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

Commit 4ce5b80f authored by Robin Lee's avatar Robin Lee
Browse files

Revert "Add ActivityOption to remove keyguard when an activity i..."

Revert submission 17982448-ActivityOption_DismissKeyguard

Reason for revert: Exploitable, b/286371465

Bug: 286371465
Reverted changes: /q/submissionid:17982448-ActivityOption_DismissKeyguard

Change-Id: I3f76d12ef199e3bffbc47b750367742e8a137977
parent d5873fc5
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.app;

import static android.Manifest.permission.CONTROL_KEYGUARD;
import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
@@ -413,8 +412,9 @@ public class ActivityOptions extends ComponentOptions {
    private static final String KEY_LAUNCH_INTO_PIP_PARAMS =
            "android.activity.launchIntoPipParams";

    /** See {@link #setDismissKeyguard()}. */
    private static final String KEY_DISMISS_KEYGUARD = "android.activity.dismissKeyguard";
    /** See {@link #setDismissKeyguardIfInsecure()}. */
    private static final String KEY_DISMISS_KEYGUARD_IF_INSECURE =
            "android.activity.dismissKeyguardIfInsecure";

    private static final String KEY_PENDING_INTENT_CREATOR_BACKGROUND_ACTIVITY_START_MODE =
            "android.activity.pendingIntentCreatorBackgroundActivityStartMode";
@@ -519,7 +519,7 @@ public class ActivityOptions extends ComponentOptions {
    private boolean mLaunchedFromBubble;
    private boolean mTransientLaunch;
    private PictureInPictureParams mLaunchIntoPipParams;
    private boolean mDismissKeyguard;
    private boolean mDismissKeyguardIfInsecure;
    @BackgroundActivityStartMode
    private int mPendingIntentCreatorBackgroundActivityStartMode =
            MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED;
@@ -1333,7 +1333,7 @@ public class ActivityOptions extends ComponentOptions {
        mLaunchIntoPipParams = opts.getParcelable(KEY_LAUNCH_INTO_PIP_PARAMS, android.app.PictureInPictureParams.class);
        mIsEligibleForLegacyPermissionPrompt =
                opts.getBoolean(KEY_LEGACY_PERMISSION_PROMPT_ELIGIBLE);
        mDismissKeyguard = opts.getBoolean(KEY_DISMISS_KEYGUARD);
        mDismissKeyguardIfInsecure = opts.getBoolean(KEY_DISMISS_KEYGUARD_IF_INSECURE);
        mPendingIntentCreatorBackgroundActivityStartMode = opts.getInt(
                KEY_PENDING_INTENT_CREATOR_BACKGROUND_ACTIVITY_START_MODE,
                MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED);
@@ -2036,24 +2036,24 @@ public class ActivityOptions extends ComponentOptions {
    }

    /**
     * Sets whether the keyguard should go away when this activity launches.
     * Sets whether the insecure keyguard should go away when this activity launches. In case the
     * keyguard is secure, this option will be ignored.
     *
     * @see Activity#setShowWhenLocked(boolean)
     * @see android.R.attr#showWhenLocked
     * @hide
     */
    @RequiresPermission(CONTROL_KEYGUARD)
    public void setDismissKeyguard() {
        mDismissKeyguard = true;
    public void setDismissKeyguardIfInsecure() {
        mDismissKeyguardIfInsecure = true;
    }

    /**
     * @see #setDismissKeyguard()
     * @see #setDismissKeyguardIfInsecure()
     * @return whether the insecure keyguard should go away when the activity launches.
     * @hide
     */
    public boolean getDismissKeyguard() {
        return mDismissKeyguard;
    public boolean getDismissKeyguardIfInsecure() {
        return mDismissKeyguardIfInsecure;
    }

    /**
@@ -2367,8 +2367,8 @@ public class ActivityOptions extends ComponentOptions {
            b.putBoolean(KEY_LEGACY_PERMISSION_PROMPT_ELIGIBLE,
                    mIsEligibleForLegacyPermissionPrompt);
        }
        if (mDismissKeyguard) {
            b.putBoolean(KEY_DISMISS_KEYGUARD, mDismissKeyguard);
        if (mDismissKeyguardIfInsecure) {
            b.putBoolean(KEY_DISMISS_KEYGUARD_IF_INSECURE, mDismissKeyguardIfInsecure);
        }
        if (mPendingIntentCreatorBackgroundActivityStartMode
                != MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED) {
+1 −1
Original line number Diff line number Diff line
@@ -494,7 +494,7 @@ constructor(
                    // this runnable is called right after the keyguard is solved, so we tell
                    // WM that we should dismiss it to avoid flickers when opening an activity
                    // that can also be shown over the keyguard.
                    options.setDismissKeyguard()
                    options.setDismissKeyguardIfInsecure()
                    options.setDisallowEnterPictureInPictureWhileLaunching(
                        disallowEnterPictureInPictureWhileLaunching
                    )
+5 −5
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
    private boolean mAsync;
    private BroadcastOptions mBroadcastOptions;
    private boolean mShowSplashScreen;
    private boolean mDismissKeyguard;
    private boolean mDismissKeyguardIfInsecure;

    final boolean mDumping;

@@ -552,8 +552,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
                    mAsync = true;
                } else if (opt.equals("--splashscreen-show-icon")) {
                    mShowSplashScreen = true;
                } else if (opt.equals("--dismiss-keyguard")) {
                    mDismissKeyguard = true;
                } else if (opt.equals("--dismiss-keyguard-if-insecure")) {
                    mDismissKeyguardIfInsecure = true;
                } else {
                    return false;
                }
@@ -714,11 +714,11 @@ final class ActivityManagerShellCommand extends ShellCommand {
                }
                options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
            }
            if (mDismissKeyguard) {
            if (mDismissKeyguardIfInsecure) {
                if (options == null) {
                    options = ActivityOptions.makeBasic();
                }
                options.setDismissKeyguard();
                options.setDismissKeyguardIfInsecure();
            }
            if (mWaitOption) {
                result = mInternal.startActivityAndWait(null, SHELL_PACKAGE_NAME, null, intent,
+2 −2
Original line number Diff line number Diff line
@@ -913,7 +913,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    boolean mEnteringAnimation;
    boolean mOverrideTaskTransition;
    boolean mDismissKeyguard;
    boolean mDismissKeyguardIfInsecure;
    boolean mShareIdentity;

    /** True if the activity has reported stopped; False if the activity becomes visible. */
@@ -2098,7 +2098,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            }

            mOverrideTaskTransition = options.getOverrideTaskTransition();
            mDismissKeyguard = options.getDismissKeyguard();
            mDismissKeyguardIfInsecure = options.getDismissKeyguardIfInsecure();
            mShareIdentity = options.isShareIdentityEnabled();
        }

+4 −2
Original line number Diff line number Diff line
@@ -665,12 +665,14 @@ class KeyguardController {
                    mTopTurnScreenOnActivity = top;
                }

                if (top.mDismissKeyguard && mKeyguardShowing) {
                final boolean isKeyguardSecure = controller.mWindowManager.isKeyguardSecure(
                        controller.mService.getCurrentUserId());
                if (top.mDismissKeyguardIfInsecure && mKeyguardShowing && !isKeyguardSecure) {
                    mKeyguardGoingAway = true;
                } else if (top.canShowWhenLocked()) {
                    mTopOccludesActivity = top;
                }
                top.mDismissKeyguard = false;
                top.mDismissKeyguardIfInsecure = false;

                // Only the top activity may control occluded, as we can't occlude the Keyguard
                // if the top app doesn't want to occlude it.
Loading