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

Commit 5d59242c authored by Robin Lee's avatar Robin Lee
Browse files

Animate starting work challenge from work lock

Bug: 31001762
Test: adb shell service call trust 6 i32 10 i32 1 && adb shell am start -a com.android.systemui.recents.TOGGLE_RECENTS
Change-Id: Ic6c622c32718bd235eb71704881b853072383dba
parent f793d87b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -542,7 +542,7 @@ interface IActivityManager {
     */
    void swapDockedAndFullscreenStack();
    void notifyLockedProfile(int userId);
    void startConfirmDeviceCredentialIntent(in Intent intent);
    void startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options);
    void sendIdleJobTrigger();
    int sendIntentSender(in IIntentSender target, int code, in Intent intent,
            in String resolvedType, in IIntentReceiver finishedReceiver,
+17 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.keyguard;

import static android.app.ActivityManager.TaskDescription;
import static android.app.ActivityManager.StackId;

import android.annotation.ColorInt;
import android.annotation.UserIdInt;
@@ -31,6 +32,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -160,9 +162,23 @@ public class WorkLockActivity extends Activity {

        credential.putExtra(Intent.EXTRA_INTENT, target.getIntentSender());
        try {
            ActivityManager.getService().startConfirmDeviceCredentialIntent(credential);
            ActivityManager.getService().startConfirmDeviceCredentialIntent(credential,
                    getChallengeOptions().toBundle());
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to start confirm credential intent", e);
        }
    }

    private ActivityOptions getChallengeOptions() {
        // If we are taking up the whole screen, just use the default animation of clipping the
        // credentials activity into the entire foreground.
        if (!isInMultiWindowMode()) {
            return ActivityOptions.makeBasic();
        }

        // Otherwise, animate the transition from this part of the screen to fullscreen
        // using our own decor as the starting position.
        final View view = getWindow().getDecorView();
        return ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.getWidth(), view.getHeight());
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -1971,7 +1971,8 @@ public abstract class BaseStatusBar extends SystemUI implements
                Intent.EXTRA_INTENT,
                callBackPendingIntent.getIntentSender());
        try {
            ActivityManager.getService().startConfirmDeviceCredentialIntent(newIntent);
            ActivityManager.getService().startConfirmDeviceCredentialIntent(newIntent,
                    null /*options*/);
        } catch (RemoteException ex) {
            // ignore
        }
+2 −2
Original line number Diff line number Diff line
@@ -11945,12 +11945,12 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    @Override
    public void startConfirmDeviceCredentialIntent(Intent intent) {
    public void startConfirmDeviceCredentialIntent(Intent intent, Bundle options) {
        enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "startConfirmDeviceCredentialIntent");
        synchronized (this) {
            final long ident = Binder.clearCallingIdentity();
            try {
                mActivityStarter.startConfirmCredentialIntent(intent);
                mActivityStarter.startConfirmCredentialIntent(intent, options);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
+5 −5
Original line number Diff line number Diff line
@@ -644,18 +644,18 @@ class ActivityStarter {
                    null);
            credential.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
            // Show confirm credentials activity.
            startConfirmCredentialIntent(credential);
            startConfirmCredentialIntent(credential, null);
        }
    }

    void startConfirmCredentialIntent(Intent intent) {
    void startConfirmCredentialIntent(Intent intent, Bundle optionsBundle) {
        intent.addFlags(FLAG_ACTIVITY_NEW_TASK |
                FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |
                FLAG_ACTIVITY_TASK_ON_HOME);
        final ActivityOptions options = ActivityOptions.makeBasic();
        ActivityOptions options = (optionsBundle != null ? new ActivityOptions(optionsBundle)
                        : ActivityOptions.makeBasic());
        options.setLaunchTaskId(mSupervisor.getHomeActivity().task.taskId);
        mService.mContext.startActivityAsUser(intent, options.toBundle(),
                UserHandle.CURRENT);
        mService.mContext.startActivityAsUser(intent, options.toBundle(), UserHandle.CURRENT);
    }

    final int startActivityMayWait(IApplicationThread caller, int callingUid,