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

Commit 4403f2fe authored by Robin Lee's avatar Robin Lee
Browse files

Remove setDockedStackMinimized credentials prompt

Reverts functional parts of commit 853304c0

This lives in a TaskStackListener now, so we just start the prompt for
activity stacks that need it, not for the whole device at once.

Bug: 31001762
Test: make -j20 && Boot, `adb shell service call trust 6 i32 {userid} i32 1`, resize docked stack.
Change-Id: I58be5174e10779f01149de1cd5c2a4db00b98490
parent 8e332cc5
Loading
Loading
Loading
Loading
+0 −12
Original line number Original line Diff line number Diff line
@@ -4093,18 +4093,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D


    void setDockedStackMinimized(boolean minimized) {
    void setDockedStackMinimized(boolean minimized) {
        mIsDockMinimized = minimized;
        mIsDockMinimized = minimized;
        if (minimized) {
            // Docked stack is not visible, no need to confirm credentials for its top activity.
            return;
        }
        final ActivityStack dockedStack = getStack(StackId.DOCKED_STACK_ID);
        if (dockedStack == null) {
            return;
        }
        final ActivityRecord top = dockedStack.topRunningActivityLocked();
        if (top != null && mService.mUserController.shouldConfirmCredentials(top.userId)) {
            mService.mActivityStarter.showConfirmDeviceCredential(top.userId);
        }
    }
    }


    private final class ActivityStackSupervisorHandler extends Handler {
    private final class ActivityStackSupervisorHandler extends Handler {
+0 −44
Original line number Original line Diff line number Diff line
@@ -608,50 +608,6 @@ class ActivityStarter {
        }
        }
    }
    }


    void showConfirmDeviceCredential(int userId) {
        // First, retrieve the stack that we want to resume after credential is confirmed.
        ActivityStack targetStack;
        ActivityStack fullscreenStack =
                mSupervisor.getStack(FULLSCREEN_WORKSPACE_STACK_ID);
        if (fullscreenStack != null &&
                fullscreenStack.getStackVisibilityLocked(null) != ActivityStack.STACK_INVISIBLE) {
            // Single window case and the case that the docked stack is shown with fullscreen stack.
            targetStack = fullscreenStack;
        } else {
            // The case that the docked stack is shown with recent.
            targetStack = mSupervisor.getStack(HOME_STACK_ID);
        }
        if (targetStack == null) {
            return;
        }
        final KeyguardManager km = (KeyguardManager) mService.mContext
                .getSystemService(Context.KEYGUARD_SERVICE);
        final Intent credential =
                km.createConfirmDeviceCredentialIntent(null, null, userId);
        // For safety, check null here in case users changed the setting after the checking.
        if (credential == null) {
            return;
        }
        final ActivityRecord activityRecord = targetStack.topRunningActivityLocked();
        if (activityRecord != null) {
            final IIntentSender target = mService.getIntentSenderLocked(
                    ActivityManager.INTENT_SENDER_ACTIVITY,
                    activityRecord.launchedFromPackage,
                    activityRecord.launchedFromUid,
                    activityRecord.userId,
                    null, null, 0,
                    new Intent[] { activityRecord.intent },
                    new String[] { activityRecord.resolvedType },
                    PendingIntent.FLAG_CANCEL_CURRENT |
                            PendingIntent.FLAG_ONE_SHOT |
                            PendingIntent.FLAG_IMMUTABLE,
                    null);
            credential.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
            // Show confirm credentials activity.
            startConfirmCredentialIntent(credential, null);
        }
    }

    void startConfirmCredentialIntent(Intent intent, Bundle optionsBundle) {
    void startConfirmCredentialIntent(Intent intent, Bundle optionsBundle) {
        intent.addFlags(FLAG_ACTIVITY_NEW_TASK |
        intent.addFlags(FLAG_ACTIVITY_NEW_TASK |
                FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |
                FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |