Before requesting wakelock ensure that we have a valid suspend service.
Use waitForService instead of checkService.
Test: libpower_test
Test: block_suspend
Test: atest NexusLauncherOutOfProcTests:MemoryTests#testAppLaunchFromWorkspace --rerun-until-failure 10
Bug: 195319784
Change-Id: If13e233360a7b5f372dd2991c1891ee0bee8544b
Use the system susepnd AIDL hal for requesting wakelocks from libpower
or libhardware_legacy.
Bug: 170260236
Test: boot test on cf (suspend blocker works).
Test: libpower_test
Test: block_suspend
Change-Id: I8fc345c33fb893ca11603826b0e993ca908d5b20
Wakelock acquisition can fail if suspend service is not available.
Make this clear by returning an optional value that client must
check before entering wakelock critical sections.
Bug: b/179229598
Test: Boot test on Pixel 4 device
Change-Id: Ied00fa919c20d8a30f1c40ee34a91a2a7e240689
Main motivation is to prevent wake lock leaks, e.g. b/133175847.
Changing power.h header breaks downstream vendor code that does C
linkage to that header b/135730848. Introduce new wakelock.h header.
Bug: 133175847
Test: boot blueline
Test: device suspends if left alone
Change-Id: I477123938ab20e954ce4d55b8588c0a116ed3882
On device shutdown, it's possible for SystemSuspend to have exited
before its clients. We change libpower to handle this case by checking
DEAD_OBJECT transaction error, so that client can shutdown cleanly.
Fixes: 120292523
Test: libpower_test
Change-Id: Ie43b72f2c326a9dcdc48371c03b4d97d7fd4e12a
We use "-Wexit-time-destructors" and "-fno-c++-static-destructors" flags
to make sure that no static variables are destroyed at exit time.
We do this to avoid the race condition between process exit and use of
static vars when calling acquire/release_wake_lock().
Bug: 117575503
Test: libpower_test
Change-Id: I16acfeb2412685e376d8bd1069c86f60f56d215a
With this change:
1. We avoid constructing a strong pointer on every call to
getSystemSuspendServiceOnce().
2. In case the function static pointer is corrupted, the error
propagates to the API call where we're able to handle the errors instead
of the compiler-generated code in the return statement of
getSystemSuspendServiceOnce().
Bug: 117575503
Test: device builds/boots
Change-Id: I85b5616efca25063c876b242529e2bf561f5b834
Changed:
- simplified getting system suspend service
- added isOk() check when releasing a wake lock
Bug: 117575503
Test: presubmit
Change-Id: I78f1f50a7670e7df88e59999c35f99a6df06e8ef
This change routes libpower and libhardware_legacy to SystemSuspend service for
wake locks instead of /sys/power/wake_[un]lock.
Bug: 78888165
Bug: 115946999
Test: /sys/kernel/debug/suspend_stats shows that device suspends if left alone
Change-Id: Id4d392e13d06be6d86e3112dedeb6a57bb24c06f