diff options
| author | 2023-11-28 12:26:44 -0800 | |
|---|---|---|
| committer | 2023-11-28 12:26:44 -0800 | |
| commit | 19965bc46595f5a2e740bf6b71ddf139e8929ac5 (patch) | |
| tree | ac31e3f535915aafaa057fe932206b5443b0cb61 | |
| parent | 546a73c38b414f51ebd89befbb21273e0381cd2e (diff) | |
Add deferral-until-active policy to ACTION_SHUTDOWN broadcast.
We shouldn't need to wake the frozen apps for delivering this
broadcast. This is only sent to registered receivers and apps
would have been killed and wouldn't have received this broadcast
if weren't freezing them.
Bug: 313680784
Test: boot and shutdown works
Change-Id: I06412e2a93190a45436ec85c541a128d3cb395f1
| -rw-r--r-- | services/core/java/com/android/server/power/ShutdownThread.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index 27811e9567af..871e98bf4ab3 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -19,6 +19,7 @@ package com.android.server.power; import android.app.ActivityManagerInternal; import android.app.AlertDialog; +import android.app.BroadcastOptions; import android.app.Dialog; import android.app.IActivityManager; import android.app.ProgressDialog; @@ -493,6 +494,9 @@ public final class ShutdownThread extends Thread { mActionDone = false; Intent intent = new Intent(Intent.ACTION_SHUTDOWN); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND | Intent.FLAG_RECEIVER_REGISTERED_ONLY); + final Bundle opts = BroadcastOptions.makeBasic() + .setDeferralPolicy(BroadcastOptions.DEFERRAL_POLICY_UNTIL_ACTIVE) + .toBundle(); final ActivityManagerInternal activityManagerInternal = LocalServices.getService( ActivityManagerInternal.class); activityManagerInternal.broadcastIntentWithCallback(intent, @@ -502,7 +506,7 @@ public final class ShutdownThread extends Thread { Bundle extras, boolean ordered, boolean sticky, int sendingUser) { mHandler.post(ShutdownThread.this::actionDone); } - }, null, UserHandle.USER_ALL, null, null, null); + }, null, UserHandle.USER_ALL, null, null, opts); final long endTime = SystemClock.elapsedRealtime() + MAX_BROADCAST_TIME; synchronized (mActionDoneSync) { |