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

Commit b9362cf6 authored by Tony Mak's avatar Tony Mak Committed by android-build-merger
Browse files

Merge "Fix wrong app is launched after solving challenge from tapping...

Merge "Fix wrong app is launched after solving challenge from tapping notification" into nyc-dev am: d3589ee7
am: f5f982f0

* commit 'f5f982f0':
  Fix wrong app is launched after solving challenge from tapping notification

Change-Id: If7fbf80682d5c7583f3cec37dd6e807a0067ac18
parents 325e71b9 f5f982f0
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -2959,6 +2959,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            reply.writeNoException();
            return true;
        }
        case START_CONFIRM_DEVICE_CREDENTIAL_INTENT: {
            data.enforceInterface(IActivityManager.descriptor);
            final Intent intent = Intent.CREATOR.createFromParcel(data);
            startConfirmDeviceCredentialIntent(intent);
            reply.writeNoException();
            return true;
        }
        }

        return super.onTransact(code, data, reply, flags);
@@ -6931,5 +6938,16 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    public void startConfirmDeviceCredentialIntent(Intent intent) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        intent.writeToParcel(data, 0);
        mRemote.transact(START_CONFIRM_DEVICE_CREDENTIAL_INTENT, data, reply, 0);
        reply.readException();
        data.recycle();
        reply.recycle();
    }

    private IBinder mRemote;
}
+3 −0
Original line number Diff line number Diff line
@@ -649,6 +649,8 @@ public interface IActivityManager extends IInterface {

    public void notifyLockedProfile(@UserIdInt int userId) throws RemoteException;

    public void startConfirmDeviceCredentialIntent(Intent intent) throws RemoteException;

    /*
     * Private non-Binder interfaces
     */
@@ -1032,4 +1034,5 @@ public interface IActivityManager extends IInterface {
    int IS_VR_PACKAGE_ENABLED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 371;
    int SWAP_DOCKED_AND_FULLSCREEN_STACK = IBinder.FIRST_CALL_TRANSACTION + 372;
    int NOTIFY_LOCKED_PROFILE = IBinder.FIRST_CALL_TRANSACTION + 373;
    int START_CONFIRM_DEVICE_CREDENTIAL_INTENT = IBinder.FIRST_CALL_TRANSACTION + 374;
}
+18 −7
Original line number Diff line number Diff line
@@ -537,8 +537,7 @@ public abstract class BaseStatusBar extends SystemUI implements
                    );
                }
            } else if (WORK_CHALLENGE_UNLOCKED_NOTIFICATION_ACTION.equals(action)) {
                final IntentSender intentSender = (IntentSender) intent
                        .getParcelableExtra(Intent.EXTRA_INTENT);
                final IntentSender intentSender = intent.getParcelableExtra(Intent.EXTRA_INTENT);
                final String notificationKey = intent.getStringExtra(Intent.EXTRA_INDEX);
                try {
                    mContext.startIntentSender(intentSender, null, 0, 0, 0);
@@ -1928,11 +1927,23 @@ public abstract class BaseStatusBar extends SystemUI implements
            callBackIntent.putExtra(Intent.EXTRA_INDEX, notificationKey);
            callBackIntent.setPackage(mContext.getPackageName());

            newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            newIntent.putExtra(Intent.EXTRA_INTENT, PendingIntent
                    .getBroadcast(mContext, 0, callBackIntent, 0).getIntentSender());
            mContext.startActivity(newIntent);
            PendingIntent callBackPendingIntent = PendingIntent.getBroadcast(
                    mContext,
                    0,
                    callBackIntent,
                    PendingIntent.FLAG_CANCEL_CURRENT |
                            PendingIntent.FLAG_ONE_SHOT |
                            PendingIntent.FLAG_IMMUTABLE
            );
            newIntent.putExtra(
                    Intent.EXTRA_INTENT,
                    callBackPendingIntent.getIntentSender()
            );
            try {
                ActivityManagerNative.getDefault().startConfirmDeviceCredentialIntent(newIntent);
            } catch (RemoteException ex) {
                // ignore
            }
            return true;
        }

+13 −0
Original line number Diff line number Diff line
@@ -11501,6 +11501,19 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
    }
    @Override
    public void startConfirmDeviceCredentialIntent(Intent intent) {
        enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "startConfirmDeviceCredentialIntent");
        synchronized (this) {
            final long ident = Binder.clearCallingIdentity();
            try {
                mActivityStarter.startConfirmCredentialIntent(intent);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }
    @Override
    public void stopAppSwitches() {
        if (checkCallingPermission(android.Manifest.permission.STOP_APP_SWITCHES)
+11 −7
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT;
import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
@@ -612,11 +613,6 @@ class ActivityStarter {
                .getSystemService(Context.KEYGUARD_SERVICE);
        final Intent credential =
                km.createConfirmDeviceCredentialIntent(null, null, userId);
        credential.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |
                Intent.FLAG_ACTIVITY_TASK_ON_HOME);
        final ActivityOptions options = ActivityOptions.makeBasic();
        options.setLaunchTaskId(mSupervisor.getHomeActivity().task.taskId);
        final ActivityRecord activityRecord = targetStack.topRunningActivityLocked();
        if (activityRecord != null) {
            final IIntentSender target = mService.getIntentSenderLocked(
@@ -633,11 +629,19 @@ class ActivityStarter {
                    null);
            credential.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
            // Show confirm credentials activity.
            mService.mContext.startActivityAsUser(credential, options.toBundle(),
                    UserHandle.CURRENT);
            startConfirmCredentialIntent(credential);
        }
    }

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

    final int startActivityMayWait(IApplicationThread caller, int callingUid,
            String callingPackage, Intent intent, String resolvedType,