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

Commit ab8b39c5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add caller check to com.android.credentials.RESET" into qt-dev am:...

Merge "Add caller check to com.android.credentials.RESET" into qt-dev am: 50b65a16 am: 1ef5f42b am: f43f129d am: d902f8c7 am: ea3d0361 am: 3a4ebbfc

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16577205

Change-Id: I9def541c37fcc068c201abd75394cd3623b8db16
parents 34203ad7 3a4ebbfc
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ public final class CredentialStorage extends FragmentActivity {
        final String action = intent.getAction();
        final UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
        if (!userManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) {
            if (ACTION_RESET.equals(action)) {
            if (ACTION_RESET.equals(action) && checkCallerIsSelf()) {
                new ResetDialog();
            } else {
                if (ACTION_INSTALL.equals(action) && checkCallerIsCertInstallerOrSelfInProfile()) {
@@ -318,6 +318,19 @@ public final class CredentialStorage extends FragmentActivity {
        finish();
    }

    /**
     * Check that the caller is Settings.
     */
    private boolean checkCallerIsSelf() {
        try {
            return Process.myUid() == android.app.ActivityManager.getService()
                    .getLaunchedFromUid(getActivityToken());
        } catch (RemoteException re) {
            // Error talking to ActivityManager, just give up
            return false;
        }
    }

    /**
     * Check that the caller is either certinstaller or Settings running in a profile of this user.
     */