Loading core/java/android/app/ActivityOptions.java +10 −0 Original line number Diff line number Diff line Loading @@ -1587,6 +1587,16 @@ public class ActivityOptions extends ComponentOptions { } } /** @hide */ public static boolean hasLaunchTargetContainer(ActivityOptions options) { return options.getLaunchDisplayId() != INVALID_DISPLAY || options.getLaunchTaskDisplayArea() != null || options.getLaunchTaskDisplayAreaFeatureId() != FEATURE_UNDEFINED || options.getLaunchRootTask() != null || options.getLaunchTaskId() != -1 || options.getLaunchTaskFragmentToken() != null; } /** * Gets whether the activity is to be launched into LockTask mode. * @return {@code true} if the activity is to be launched into LockTask mode. Loading core/java/android/app/ContextImpl.java +25 −5 Original line number Diff line number Diff line Loading @@ -1160,7 +1160,7 @@ class ContextImpl extends Context { } mMainThread.getInstrumentation().execStartActivity( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity) null, intent, -1, options); (Activity) null, intent, -1, applyLaunchDisplayIfNeeded(options)); } /** @hide */ Loading @@ -1170,8 +1170,8 @@ class ContextImpl extends Context { ActivityTaskManager.getService().startActivityAsUser( mMainThread.getApplicationThread(), getOpPackageName(), getAttributionTag(), intent, intent.resolveTypeIfNeeded(getContentResolver()), null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options, user.getIdentifier()); null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, applyLaunchDisplayIfNeeded(options), user.getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -1194,7 +1194,8 @@ class ContextImpl extends Context { } return mMainThread.getInstrumentation().execStartActivitiesAsUser( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity) null, intents, options, userHandle.getIdentifier()); (Activity) null, intents, applyLaunchDisplayIfNeeded(options), userHandle.getIdentifier()); } @Override Loading @@ -1208,7 +1209,26 @@ class ContextImpl extends Context { } mMainThread.getInstrumentation().execStartActivities( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity) null, intents, options); (Activity) null, intents, applyLaunchDisplayIfNeeded(options)); } private Bundle applyLaunchDisplayIfNeeded(@Nullable Bundle options) { if (!isAssociatedWithDisplay()) { // return if this Context has no associated display. return options; } final ActivityOptions activityOptions; if (options != null) { activityOptions = ActivityOptions.fromBundle(options); if (ActivityOptions.hasLaunchTargetContainer(activityOptions)) { // return if the options already has launching target. return options; } } else { activityOptions = ActivityOptions.makeBasic(); } return activityOptions.setLaunchDisplayId(getAssociatedDisplayId()).toBundle(); } @Override Loading Loading
core/java/android/app/ActivityOptions.java +10 −0 Original line number Diff line number Diff line Loading @@ -1587,6 +1587,16 @@ public class ActivityOptions extends ComponentOptions { } } /** @hide */ public static boolean hasLaunchTargetContainer(ActivityOptions options) { return options.getLaunchDisplayId() != INVALID_DISPLAY || options.getLaunchTaskDisplayArea() != null || options.getLaunchTaskDisplayAreaFeatureId() != FEATURE_UNDEFINED || options.getLaunchRootTask() != null || options.getLaunchTaskId() != -1 || options.getLaunchTaskFragmentToken() != null; } /** * Gets whether the activity is to be launched into LockTask mode. * @return {@code true} if the activity is to be launched into LockTask mode. Loading
core/java/android/app/ContextImpl.java +25 −5 Original line number Diff line number Diff line Loading @@ -1160,7 +1160,7 @@ class ContextImpl extends Context { } mMainThread.getInstrumentation().execStartActivity( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity) null, intent, -1, options); (Activity) null, intent, -1, applyLaunchDisplayIfNeeded(options)); } /** @hide */ Loading @@ -1170,8 +1170,8 @@ class ContextImpl extends Context { ActivityTaskManager.getService().startActivityAsUser( mMainThread.getApplicationThread(), getOpPackageName(), getAttributionTag(), intent, intent.resolveTypeIfNeeded(getContentResolver()), null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options, user.getIdentifier()); null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, applyLaunchDisplayIfNeeded(options), user.getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -1194,7 +1194,8 @@ class ContextImpl extends Context { } return mMainThread.getInstrumentation().execStartActivitiesAsUser( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity) null, intents, options, userHandle.getIdentifier()); (Activity) null, intents, applyLaunchDisplayIfNeeded(options), userHandle.getIdentifier()); } @Override Loading @@ -1208,7 +1209,26 @@ class ContextImpl extends Context { } mMainThread.getInstrumentation().execStartActivities( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity) null, intents, options); (Activity) null, intents, applyLaunchDisplayIfNeeded(options)); } private Bundle applyLaunchDisplayIfNeeded(@Nullable Bundle options) { if (!isAssociatedWithDisplay()) { // return if this Context has no associated display. return options; } final ActivityOptions activityOptions; if (options != null) { activityOptions = ActivityOptions.fromBundle(options); if (ActivityOptions.hasLaunchTargetContainer(activityOptions)) { // return if the options already has launching target. return options; } } else { activityOptions = ActivityOptions.makeBasic(); } return activityOptions.setLaunchDisplayId(getAssociatedDisplayId()).toBundle(); } @Override Loading