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

Commit 32e8de05 authored by Adrian Roos's avatar Adrian Roos Committed by Android Git Automerger
Browse files

am 81c6a311: am 6857305f: am 7748ea5f: Merge "Protect demo mode commands with...

am 81c6a311: am 6857305f: am 7748ea5f: Merge "Protect demo mode commands with permission" into mnc-dev

* commit '81c6a311':
  Protect demo mode commands with permission
parents e47e3b19 81c6a311
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -198,6 +198,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,

    public static final boolean SHOW_LOCKSCREEN_MEDIA_ARTWORK = true;

    public static final String ACTION_FAKE_ARTWORK = "fake_artwork";

    private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
    private static final int MSG_CLOSE_PANELS = 1001;
    private static final int MSG_OPEN_SETTINGS_PANEL = 1002;
@@ -890,11 +892,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        filter.addAction(Intent.ACTION_SCREEN_ON);
        context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null);

        IntentFilter demoFilter = new IntentFilter();
        if (DEBUG_MEDIA_FAKE_ARTWORK) {
            filter.addAction("fake_artwork");
            demoFilter.addAction(ACTION_FAKE_ARTWORK);
        }
        filter.addAction(ACTION_DEMO);
        context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null);
        demoFilter.addAction(ACTION_DEMO);
        context.registerReceiverAsUser(mDemoReceiver, UserHandle.ALL, demoFilter,
                android.Manifest.permission.DUMP, null);

        // listen for USER_SETUP_COMPLETE setting (per-user)
        resetUserSetupObserver();
@@ -2852,7 +2858,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                mScreenOn = true;
                notifyNavigationBarScreenOn(true);
            }
            else if (ACTION_DEMO.equals(action)) {
        }
    };

    private BroadcastReceiver mDemoReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            if (DEBUG) Log.v(TAG, "onReceive: " + intent);
            String action = intent.getAction();
            if (ACTION_DEMO.equals(action)) {
                Bundle bundle = intent.getExtras();
                if (bundle != null) {
                    String command = bundle.getString("command", "").trim().toLowerCase();
@@ -2864,7 +2877,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                        }
                    }
                }
            } else if ("fake_artwork".equals(action)) {
            } else if (ACTION_FAKE_ARTWORK.equals(action)) {
                if (DEBUG_MEDIA_FAKE_ARTWORK) {
                    updateMediaMetaData(true);
                }
@@ -3188,6 +3201,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            mHandlerThread = null;
        }
        mContext.unregisterReceiver(mBroadcastReceiver);
        mContext.unregisterReceiver(mDemoReceiver);
        mAssistManager.destroy();

        final SignalClusterView signalCluster =