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

Commit 310fe847 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

am 8582f9f7: am 21b0b3ac: am 2c5aeeaa: Merge "Require permission for internal...

am 8582f9f7: am 21b0b3ac: am 2c5aeeaa: Merge "Require permission for internal broadcast" into mnc-dev

* commit '8582f9f7':
  Require permission for internal broadcast
parents b02f646c 8582f9f7
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -126,6 +126,11 @@
    <!-- Assist -->
    <!-- Assist -->
    <uses-permission android:name="android.permission.ACCESS_VOICE_INTERACTION_SERVICE" />
    <uses-permission android:name="android.permission.ACCESS_VOICE_INTERACTION_SERVICE" />


    <!-- Self permission for internal broadcasts. -->
    <permission android:name="com.android.systemui.permission.SELF"
            android:protectionLevel="signature" />
    <uses-permission android:name="com.android.systemui.permission.SELF" />

    <application
    <application
        android:name=".SystemUIApplication"
        android:name=".SystemUIApplication"
        android:persistent="true"
        android:persistent="true"
+10 −3
Original line number Original line Diff line number Diff line
@@ -69,6 +69,10 @@ public class UserSwitcherController {
            "lockscreenSimpleUserSwitcher";
            "lockscreenSimpleUserSwitcher";
    private static final String ACTION_REMOVE_GUEST = "com.android.systemui.REMOVE_GUEST";
    private static final String ACTION_REMOVE_GUEST = "com.android.systemui.REMOVE_GUEST";


    private static final int ID_REMOVE_GUEST = 1010;
    private static final String TAG_REMOVE_GUEST = "remove_guest";
    private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF";

    private final Context mContext;
    private final Context mContext;
    private final UserManager mUserManager;
    private final UserManager mUserManager;
    private final ArrayList<WeakReference<BaseUserAdapter>> mAdapters = new ArrayList<>();
    private final ArrayList<WeakReference<BaseUserAdapter>> mAdapters = new ArrayList<>();
@@ -94,10 +98,13 @@ public class UserSwitcherController {
        filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
        filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
        filter.addAction(Intent.ACTION_USER_SWITCHED);
        filter.addAction(Intent.ACTION_USER_SWITCHED);
        filter.addAction(Intent.ACTION_USER_STOPPING);
        filter.addAction(Intent.ACTION_USER_STOPPING);
        filter.addAction(ACTION_REMOVE_GUEST);
        mContext.registerReceiverAsUser(mReceiver, UserHandle.OWNER, filter,
        mContext.registerReceiverAsUser(mReceiver, UserHandle.OWNER, filter,
                null /* permission */, null /* scheduler */);
                null /* permission */, null /* scheduler */);


        filter = new IntentFilter();
        filter.addAction(ACTION_REMOVE_GUEST);
        mContext.registerReceiverAsUser(mReceiver, UserHandle.OWNER, filter,
                PERMISSION_SELF, null /* scheduler */);


        mContext.getContentResolver().registerContentObserver(
        mContext.getContentResolver().registerContentObserver(
                Settings.Global.getUriFor(SIMPLE_USER_SWITCHER_GLOBAL_SETTING), true,
                Settings.Global.getUriFor(SIMPLE_USER_SWITCHER_GLOBAL_SETTING), true,
@@ -366,8 +373,8 @@ public class UserSwitcherController {
                            mContext.getString(R.string.guest_notification_remove_action),
                            mContext.getString(R.string.guest_notification_remove_action),
                            removeGuestPI)
                            removeGuestPI)
                    .build();
                    .build();
            NotificationManager.from(mContext).notifyAsUser(null, 0, notification,
            NotificationManager.from(mContext).notifyAsUser(TAG_REMOVE_GUEST, ID_REMOVE_GUEST,
                    new UserHandle(guestUserId));
                    notification, new UserHandle(guestUserId));
        }
        }
    };
    };