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);
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;
}
public void notifyLockedProfile(@UserIdInt int userId) throws RemoteException;
+ public void startConfirmDeviceCredentialIntent(Intent intent) throws RemoteException;
+
/*
* Private non-Binder interfaces
*/
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;
}
);
}
} 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);
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;
}
}
@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)
!= PackageManager.PERMISSION_GRANTED) {
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;
.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(
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,