Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fc62600 authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Send SHUTDOWN bc to registered receivers only

Test: adb shell svc power reboot
Bug: 65174075
Change-Id: I652c7564b989736c9deabd0989abdb1e44f3b78a
parent 23a7b8d3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2508,6 +2508,9 @@ public class Intent implements Parcelable, Cloneable {
     * off, not sleeping).  Once the broadcast is complete, the final shutdown
     * will proceed and all unsaved data lost.  Apps will not normally need
     * to handle this, since the foreground activity will be paused as well.
     * <p>As of {@link Build.VERSION_CODES#P} this broadcast is only sent to receivers registered
     * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
     * Context.registerReceiver}.
     *
     * <p class="note">This is a protected intent that can only be sent
     * by the system.
+1 −1
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ public final class ShutdownThread extends Thread {
        // First send the high-level shut down broadcast.
        mActionDone = false;
        Intent intent = new Intent(Intent.ACTION_SHUTDOWN);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND | Intent.FLAG_RECEIVER_REGISTERED_ONLY);
        mContext.sendOrderedBroadcastAsUser(intent,
                UserHandle.ALL, null, br, mHandler, 0, null, null);