Pass Binder token to ISuspendControlServiceInternal#enableAutosuspend
The Binder token signals system_server's death to the suspend HAL,
so that autosuspend is disabled in case the framework stops or crashes
and cannot hold suspend blockers anymore.
Bug: 193776617
Test: atest SystemSuspendV1_0UnitTest SystemSuspendV1_0AidlTest
Test: Put device to sleep, observe "automatic system suspend enabled".
On `adb shell stop`, observe "automatic system suspend disabled".
Change-Id: I918e7d2180eb47f078ef57732ae0e2dcd5e1f2c3
This commit is contained in:
@@ -178,9 +178,10 @@ sp<system::suspend::internal::ISuspendControlServiceInternal> getSuspendControlI
|
|||||||
void enableAutoSuspend() {
|
void enableAutoSuspend() {
|
||||||
static bool enabled = false;
|
static bool enabled = false;
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
|
static sp<IBinder> autosuspendClientToken = new BBinder();
|
||||||
sp<system::suspend::internal::ISuspendControlServiceInternal> suspendControl =
|
sp<system::suspend::internal::ISuspendControlServiceInternal> suspendControl =
|
||||||
getSuspendControlInternal();
|
getSuspendControlInternal();
|
||||||
suspendControl->enableAutosuspend(&enabled);
|
suspendControl->enableAutosuspend(autosuspendClientToken, &enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user