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

Commit d946a5e1 authored by Alex Stetson's avatar Alex Stetson
Browse files

Re-restrict phone ops on user addition

When a user is added, the phone ops need to be re-restricted since
otherwise the new user will not have the restrictions until the device
is rebooted.

Bug: 224603811
Test: manual, atest AppOpsTest#ensurePhoneCallOpsRestricted
Change-Id: I0af951965a7afa8aa5295b7a99415bff002da544
parent 806e0ec3
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -940,6 +940,15 @@ public class InCallController extends CallsManagerListenerBase implements
        }
    };

    private final BroadcastReceiver mUserAddedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_USER_ADDED.equals(intent.getAction())) {
                restrictPhoneCallOps();
            }
        }
    };

    private final SystemStateListener mSystemStateListener = new SystemStateListener() {
        @Override
        public void onCarModeChanged(int priority, String packageName, boolean isCarMode) {
@@ -1048,6 +1057,7 @@ public class InCallController extends CallsManagerListenerBase implements
        mSystemStateHelper.addListener(mSystemStateListener);
        mClockProxy = clockProxy;
        restrictPhoneCallOps();
        mContext.registerReceiver(mUserAddedReceiver, new IntentFilter(Intent.ACTION_USER_ADDED));
    }

    private void restrictPhoneCallOps() {