diff options
| author | Philip P. Moltmann <moltmann@google.com> | 2020-02-08 22:54:50 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-02-08 22:54:50 +0000 |
| commit | 6e406c8ae79fd2d300ea983e6f6867328b43350f (patch) | |
| tree | 823e0bd3ebff87690cbf41fbe2d4d176c7db1680 /core/java/android | |
| parent | c1532be57ccbf0a1599b637dd8838f5c65781fda (diff) | |
| parent | 9c5226fe363245e454d715cc4009ac9a80de5b6a (diff) | |
Merge "Activity start: Send featureId from context->AppOpsManager"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/Activity.java | 10 | ||||
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 4 | ||||
| -rw-r--r-- | core/java/android/app/ActivityManagerInternal.java | 15 | ||||
| -rw-r--r-- | core/java/android/app/ContextImpl.java | 85 | ||||
| -rw-r--r-- | core/java/android/app/IActivityManager.aidl | 35 | ||||
| -rw-r--r-- | core/java/android/app/IActivityTaskManager.aidl | 39 | ||||
| -rw-r--r-- | core/java/android/app/IAppTask.aidl | 2 | ||||
| -rw-r--r-- | core/java/android/app/Instrumentation.java | 15 | ||||
| -rw-r--r-- | core/java/android/app/PendingIntent.java | 24 | ||||
| -rw-r--r-- | core/java/android/content/pm/CrossProfileApps.java | 5 | ||||
| -rw-r--r-- | core/java/android/content/pm/ICrossProfileApps.aidl | 7 | ||||
| -rw-r--r-- | core/java/android/content/pm/ILauncherApps.aidl | 12 | ||||
| -rw-r--r-- | core/java/android/content/pm/InstantAppRequest.java | 10 | ||||
| -rw-r--r-- | core/java/android/content/pm/LauncherApps.java | 14 | ||||
| -rw-r--r-- | core/java/android/service/voice/VoiceInteractionSession.java | 4 |
15 files changed, 159 insertions, 122 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 642f51b6bb63..2319dd2c168f 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -5810,9 +5810,9 @@ public class Activity extends ContextThemeWrapper intent.prepareToLeaveProcess(this); result = ActivityTaskManager.getService() .startActivity(mMainThread.getApplicationThread(), getBasePackageName(), - intent, intent.resolveTypeIfNeeded(getContentResolver()), mToken, - mEmbeddedID, requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED, - null, options); + getFeatureId(), intent, + intent.resolveTypeIfNeeded(getContentResolver()), mToken, mEmbeddedID, + requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED, null, options); } catch (RemoteException e) { // Empty } @@ -6606,8 +6606,8 @@ public class Activity extends ContextThemeWrapper try { data.prepareToLeaveProcess(this); IIntentSender target = - ActivityManager.getService().getIntentSender( - ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName, + ActivityManager.getService().getIntentSenderWithFeature( + ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName, getFeatureId(), mParent == null ? mToken : mParent.mToken, mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null, getUserId()); diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 7ee44053d4d5..2838ad829f6b 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -4316,8 +4316,8 @@ public class ActivityManager { */ public static void broadcastStickyIntent(Intent intent, int appOp, int userId) { try { - getService().broadcastIntent( - null, intent, null, null, Activity.RESULT_OK, null, null, + getService().broadcastIntentWithFeature( + null, null, intent, null, null, Activity.RESULT_OK, null, null, null /*permission*/, appOp, null, false, true, userId); } catch (RemoteException ex) { } diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java index c60f7bd29ce8..ec110435d95c 100644 --- a/core/java/android/app/ActivityManagerInternal.java +++ b/core/java/android/app/ActivityManagerInternal.java @@ -269,13 +269,16 @@ public abstract class ActivityManagerInternal { public abstract void tempWhitelistForPendingIntent(int callerPid, int callerUid, int targetUid, long duration, String tag); - public abstract int broadcastIntentInPackage(String packageName, int uid, int realCallingUid, - int realCallingPid, Intent intent, String resolvedType, IIntentReceiver resultTo, - int resultCode, String resultData, Bundle resultExtras, String requiredPermission, - Bundle bOptions, boolean serialized, boolean sticky, @UserIdInt int userId, - boolean allowBackgroundActivityStarts); + + public abstract int broadcastIntentInPackage(String packageName, @Nullable String featureId, + int uid, int realCallingUid, int realCallingPid, Intent intent, String resolvedType, + IIntentReceiver resultTo, int resultCode, String resultData, Bundle resultExtras, + String requiredPermission, Bundle bOptions, boolean serialized, boolean sticky, + @UserIdInt int userId, boolean allowBackgroundActivityStarts); + public abstract ComponentName startServiceInPackage(int uid, Intent service, - String resolvedType, boolean fgRequired, String callingPackage, @UserIdInt int userId, + String resolvedType, boolean fgRequired, String callingPackage, + @Nullable String callingFeatureId, @UserIdInt int userId, boolean allowBackgroundActivityStarts) throws TransactionTooLargeException; public abstract void disconnectActivityFromServices(Object connectionHolder); diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 57cd8941a398..6b5bfda92cd0 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1020,7 +1020,7 @@ class ContextImpl extends Context { public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) { try { ActivityTaskManager.getService().startActivityAsUser( - mMainThread.getApplicationThread(), getBasePackageName(), intent, + mMainThread.getApplicationThread(), getBasePackageName(), getFeatureId(), intent, intent.resolveTypeIfNeeded(getContentResolver()), null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options, user.getIdentifier()); @@ -1102,8 +1102,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, false, getUserId()); } catch (RemoteException e) { @@ -1119,8 +1119,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, null, false, false, getUserId()); } catch (RemoteException e) { @@ -1134,8 +1134,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, null, false, false, getUserId()); } catch (RemoteException e) { @@ -1149,8 +1149,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, null, false, false, user.getIdentifier()); } catch (RemoteException e) { @@ -1166,8 +1166,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, options, false, false, getUserId()); } catch (RemoteException e) { @@ -1183,8 +1183,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, appOp, null, false, false, getUserId()); } catch (RemoteException e) { @@ -1200,8 +1200,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, null, true, false, getUserId()); } catch (RemoteException e) { @@ -1263,8 +1263,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermissions, appOp, options, true, false, getUserId()); } catch (RemoteException e) { @@ -1277,9 +1277,10 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent(mMainThread.getApplicationThread(), - intent, resolvedType, null, Activity.RESULT_OK, null, null, null, - AppOpsManager.OP_NONE, null, false, false, user.getIdentifier()); + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, false, + user.getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1299,8 +1300,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, options, false, false, user.getIdentifier()); } catch (RemoteException e) { @@ -1316,8 +1317,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, appOp, null, false, false, user.getIdentifier()); } catch (RemoteException e) { @@ -1367,8 +1368,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermissions, appOp, options, true, false, user.getIdentifier()); } catch (RemoteException e) { @@ -1408,8 +1409,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, true, getUserId()); } catch (RemoteException e) { @@ -1444,8 +1445,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, null, true, true, getUserId()); } catch (RemoteException e) { @@ -1476,8 +1477,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, true, user.getIdentifier()); } catch (RemoteException e) { @@ -1491,8 +1492,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, options, false, true, user.getIdentifier()); } catch (RemoteException e) { @@ -1526,8 +1527,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntentWithFeature( + mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, null, true, true, user.getIdentifier()); } catch (RemoteException e) { @@ -1612,9 +1613,9 @@ class ContextImpl extends Context { } } try { - final Intent intent = ActivityManager.getService().registerReceiver( - mMainThread.getApplicationThread(), mBasePackageName, rd, filter, - broadcastPermission, userId, flags); + final Intent intent = ActivityManager.getService().registerReceiverWithFeature( + mMainThread.getApplicationThread(), mBasePackageName, getFeatureId(), rd, + filter, broadcastPermission, userId, flags); if (intent != null) { intent.setExtrasClassLoader(getClassLoader()); intent.prepareToEnterProcess(); @@ -1687,9 +1688,9 @@ class ContextImpl extends Context { validateServiceIntent(service); service.prepareToLeaveProcess(this); ComponentName cn = ActivityManager.getService().startService( - mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded( - getContentResolver()), requireForeground, - getOpPackageName(), user.getIdentifier()); + mMainThread.getApplicationThread(), service, + service.resolveTypeIfNeeded(getContentResolver()), requireForeground, + getOpPackageName(), getFeatureId(), user.getIdentifier()); if (cn != null) { if (cn.getPackageName().equals("!")) { throw new SecurityException( diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index cb6a476fb617..83fa9d7ea796 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -104,25 +104,38 @@ interface IActivityManager { // Special low-level communication with activity manager. void handleApplicationCrash(in IBinder app, in ApplicationErrorReport.ParcelableCrashInfo crashInfo); - @UnsupportedAppUsage + /** @deprecated Use {@link #startActivityWithFeature} instead */ + @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#startActivity(android.content.Intent)} instead") int startActivity(in IApplicationThread caller, in String callingPackage, in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options); + int startActivityWithFeature(in IApplicationThread caller, in String callingPackage, + in String callingFeatureId, in Intent intent, in String resolvedType, + in IBinder resultTo, in String resultWho, int requestCode, int flags, + in ProfilerInfo profilerInfo, in Bundle options); @UnsupportedAppUsage void unhandledBack(); @UnsupportedAppUsage boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask); - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)} instead") Intent registerReceiver(in IApplicationThread caller, in String callerPackage, in IIntentReceiver receiver, in IntentFilter filter, in String requiredPermission, int userId, int flags); + Intent registerReceiverWithFeature(in IApplicationThread caller, in String callerPackage, + in String callingFeatureId, in IIntentReceiver receiver, in IntentFilter filter, + in String requiredPermission, int userId, int flags); @UnsupportedAppUsage void unregisterReceiver(in IIntentReceiver receiver); - @UnsupportedAppUsage + /** @deprecated Use {@link #broadcastIntentWithFeature} instead */ + @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#sendBroadcast(android.content.Intent)} instead") int broadcastIntent(in IApplicationThread caller, in Intent intent, in String resolvedType, in IIntentReceiver resultTo, int resultCode, in String resultData, in Bundle map, in String[] requiredPermissions, int appOp, in Bundle options, boolean serialized, boolean sticky, int userId); + int broadcastIntentWithFeature(in IApplicationThread caller, in String callingFeatureId, + in Intent intent, in String resolvedType, in IIntentReceiver resultTo, int resultCode, + in String resultData, in Bundle map, in String[] requiredPermissions, + int appOp, in Bundle options, boolean serialized, boolean sticky, int userId); void unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId); @UnsupportedAppUsage oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map, @@ -145,7 +158,8 @@ interface IActivityManager { boolean refContentProvider(in IBinder connection, int stableDelta, int unstableDelta); PendingIntent getRunningServiceControlPanel(in ComponentName service); ComponentName startService(in IApplicationThread caller, in Intent service, - in String resolvedType, boolean requireForeground, in String callingPackage, int userId); + in String resolvedType, boolean requireForeground, in String callingPackage, + in String callingFeatureId, int userId); @UnsupportedAppUsage int stopService(in IApplicationThread caller, in Intent service, in String resolvedType, int userId); @@ -226,10 +240,14 @@ interface IActivityManager { ParceledListSlice getRecentTasks(int maxNum, int flags, int userId); @UnsupportedAppUsage oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res); - @UnsupportedAppUsage + /** @deprecated Use {@link #getIntentSenderWithFeature} instead */ + @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link PendingIntent#getIntentSender()} instead") IIntentSender getIntentSender(int type, in String packageName, in IBinder token, in String resultWho, int requestCode, in Intent[] intents, in String[] resolvedTypes, int flags, in Bundle options, int userId); + IIntentSender getIntentSenderWithFeature(int type, in String packageName, in String featureId, + in IBinder token, in String resultWho, int requestCode, in Intent[] intents, + in String[] resolvedTypes, int flags, in Bundle options, int userId); void cancelIntentSender(in IIntentSender sender); String getPackageForIntentSender(in IIntentSender sender); void registerIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver); @@ -355,11 +373,16 @@ interface IActivityManager { boolean isIntentSenderAnActivity(in IIntentSender sender); boolean isIntentSenderAForegroundService(in IIntentSender sender); boolean isIntentSenderABroadcast(in IIntentSender sender); - @UnsupportedAppUsage + /** @deprecated Use {@link startActivityAsUserWithFeature} instead */ + @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@code android.content.Context#createContextAsUser(android.os.UserHandle, int)} and {@link android.content.Context#startActivity(android.content.Intent)} instead") int startActivityAsUser(in IApplicationThread caller, in String callingPackage, in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options, int userId); + int startActivityAsUserWithFeature(in IApplicationThread caller, in String callingPackage, + in String callingFeatureId, in Intent intent, in String resolvedType, + in IBinder resultTo, in String resultWho, int requestCode, int flags, + in ProfilerInfo profilerInfo, in Bundle options, int userId); @UnsupportedAppUsage int stopUser(int userid, boolean force, in IStopUserCallback callback); /** diff --git a/core/java/android/app/IActivityTaskManager.aidl b/core/java/android/app/IActivityTaskManager.aidl index be2f144c2fe8..180507cd7e9c 100644 --- a/core/java/android/app/IActivityTaskManager.aidl +++ b/core/java/android/app/IActivityTaskManager.aidl @@ -85,16 +85,17 @@ import java.util.List; * {@hide} */ interface IActivityTaskManager { - int startActivity(in IApplicationThread caller, in String callingPackage, in Intent intent, - in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, + int startActivity(in IApplicationThread caller, in String callingPackage, + in String callingFeatureId, in Intent intent, in String resolvedType, + in IBinder resultTo, in String resultWho, int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options); int startActivities(in IApplicationThread caller, in String callingPackage, - in Intent[] intents, in String[] resolvedTypes, in IBinder resultTo, - in Bundle options, int userId); + in String callingFeatureId, in Intent[] intents, in String[] resolvedTypes, + in IBinder resultTo, in Bundle options, int userId); int startActivityAsUser(in IApplicationThread caller, in String callingPackage, - in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, - int requestCode, int flags, in ProfilerInfo profilerInfo, - in Bundle options, int userId); + in String callingFeatureId, in Intent intent, in String resolvedType, + in IBinder resultTo, in String resultWho, int requestCode, int flags, + in ProfilerInfo profilerInfo, in Bundle options, int userId); boolean startNextMatchingActivity(in IBinder callingActivity, in Intent intent, in Bundle options); int startActivityIntentSender(in IApplicationThread caller, @@ -102,19 +103,19 @@ interface IActivityTaskManager { in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flagsMask, int flagsValues, in Bundle options); WaitResult startActivityAndWait(in IApplicationThread caller, in String callingPackage, - in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, - int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options, - int userId); + in String callingFeatureId, in Intent intent, in String resolvedType, + in IBinder resultTo, in String resultWho, int requestCode, int flags, + in ProfilerInfo profilerInfo, in Bundle options, int userId); int startActivityWithConfig(in IApplicationThread caller, in String callingPackage, - in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, - int requestCode, int startFlags, in Configuration newConfig, - in Bundle options, int userId); - int startVoiceActivity(in String callingPackage, int callingPid, int callingUid, - in Intent intent, in String resolvedType, in IVoiceInteractionSession session, - in IVoiceInteractor interactor, int flags, in ProfilerInfo profilerInfo, - in Bundle options, int userId); - int startAssistantActivity(in String callingPackage, int callingPid, int callingUid, - in Intent intent, in String resolvedType, in Bundle options, int userId); + in String callingFeatureId, in Intent intent, in String resolvedType, + in IBinder resultTo, in String resultWho, int requestCode, int startFlags, + in Configuration newConfig, in Bundle options, int userId); + int startVoiceActivity(in String callingPackage, in String callingFeatureId, int callingPid, + int callingUid, in Intent intent, in String resolvedType, + in IVoiceInteractionSession session, in IVoiceInteractor interactor, int flags, + in ProfilerInfo profilerInfo, in Bundle options, int userId); + int startAssistantActivity(in String callingPackage, in String callingFeatureId, int callingPid, + int callingUid, in Intent intent, in String resolvedType, in Bundle options, int userId); void startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver, in IRecentsAnimationRunner recentsAnimationRunner); int startActivityFromRecents(int taskId, in Bundle options); diff --git a/core/java/android/app/IAppTask.aidl b/core/java/android/app/IAppTask.aidl index 3ce71908bbfd..f41d705e2ba7 100644 --- a/core/java/android/app/IAppTask.aidl +++ b/core/java/android/app/IAppTask.aidl @@ -27,7 +27,7 @@ interface IAppTask { @UnsupportedAppUsage ActivityManager.RecentTaskInfo getTaskInfo(); void moveToFront(in IApplicationThread appThread, in String callingPackage); - int startActivity(IBinder whoThread, String callingPackage, + int startActivity(IBinder whoThread, String callingPackage, String callingFeatureId, in Intent intent, String resolvedType, in Bundle options); void setExcludeFromRecents(boolean exclude); } diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 62c905d8c2c6..18932c6b0784 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -1721,7 +1721,7 @@ public class Instrumentation { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(who); int result = ActivityTaskManager.getService() - .startActivity(whoThread, who.getBasePackageName(), intent, + .startActivity(whoThread, who.getBasePackageName(), who.getFeatureId(), intent, intent.resolveTypeIfNeeded(who.getContentResolver()), token, target != null ? target.mEmbeddedID : null, requestCode, 0, null, options); @@ -1794,8 +1794,8 @@ public class Instrumentation { resolvedTypes[i] = intents[i].resolveTypeIfNeeded(who.getContentResolver()); } int result = ActivityTaskManager.getService() - .startActivities(whoThread, who.getBasePackageName(), intents, resolvedTypes, - token, options, userId); + .startActivities(whoThread, who.getBasePackageName(), who.getFeatureId(), intents, + resolvedTypes, token, options, userId); checkStartActivityResult(result, intents[0]); return result; } catch (RemoteException e) { @@ -1861,7 +1861,7 @@ public class Instrumentation { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(who); int result = ActivityTaskManager.getService() - .startActivity(whoThread, who.getBasePackageName(), intent, + .startActivity(whoThread, who.getBasePackageName(), who.getFeatureId(), intent, intent.resolveTypeIfNeeded(who.getContentResolver()), token, target, requestCode, 0, null, options); checkStartActivityResult(result, intent); @@ -1928,8 +1928,8 @@ public class Instrumentation { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(who); int result = ActivityTaskManager.getService() - .startActivityAsUser(whoThread, who.getBasePackageName(), intent, - intent.resolveTypeIfNeeded(who.getContentResolver()), + .startActivityAsUser(whoThread, who.getBasePackageName(), who.getFeatureId(), + intent, intent.resolveTypeIfNeeded(who.getContentResolver()), token, resultWho, requestCode, 0, null, options, user.getIdentifier()); checkStartActivityResult(result, intent); @@ -2022,7 +2022,8 @@ public class Instrumentation { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(who); int result = appTask.startActivity(whoThread.asBinder(), who.getBasePackageName(), - intent, intent.resolveTypeIfNeeded(who.getContentResolver()), options); + who.getFeatureId(), intent, + intent.resolveTypeIfNeeded(who.getContentResolver()), options); checkStartActivityResult(result, intent); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index b8348c7d4f22..f68c929144c8 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -354,8 +354,8 @@ public final class PendingIntent implements Parcelable { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(context); IIntentSender target = - ActivityManager.getService().getIntentSender( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, + ActivityManager.getService().getIntentSenderWithFeature( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, options, context.getUserId()); @@ -380,8 +380,8 @@ public final class PendingIntent implements Parcelable { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(context); IIntentSender target = - ActivityManager.getService().getIntentSender( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, + ActivityManager.getService().getIntentSenderWithFeature( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, options, user.getIdentifier()); @@ -497,8 +497,8 @@ public final class PendingIntent implements Parcelable { } try { IIntentSender target = - ActivityManager.getService().getIntentSender( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, + ActivityManager.getService().getIntentSenderWithFeature( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), null, null, requestCode, intents, resolvedTypes, flags, options, context.getUserId()); return target != null ? new PendingIntent(target) : null; @@ -523,8 +523,8 @@ public final class PendingIntent implements Parcelable { } try { IIntentSender target = - ActivityManager.getService().getIntentSender( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, + ActivityManager.getService().getIntentSenderWithFeature( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), null, null, requestCode, intents, resolvedTypes, flags, options, user.getIdentifier()); return target != null ? new PendingIntent(target) : null; @@ -575,8 +575,8 @@ public final class PendingIntent implements Parcelable { try { intent.prepareToLeaveProcess(context); IIntentSender target = - ActivityManager.getService().getIntentSender( - ActivityManager.INTENT_SENDER_BROADCAST, packageName, + ActivityManager.getService().getIntentSenderWithFeature( + ActivityManager.INTENT_SENDER_BROADCAST, packageName, context.getFeatureId(), null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, null, userHandle.getIdentifier()); @@ -654,8 +654,8 @@ public final class PendingIntent implements Parcelable { try { intent.prepareToLeaveProcess(context); IIntentSender target = - ActivityManager.getService().getIntentSender( - serviceKind, packageName, + ActivityManager.getService().getIntentSenderWithFeature( + serviceKind, packageName, context.getFeatureId(), null, null, requestCode, new Intent[] { intent }, resolvedType != null ? new String[] { resolvedType } : null, flags, null, context.getUserId()); diff --git a/core/java/android/content/pm/CrossProfileApps.java b/core/java/android/content/pm/CrossProfileApps.java index edc20d9f65ad..2ba2840d8c70 100644 --- a/core/java/android/content/pm/CrossProfileApps.java +++ b/core/java/android/content/pm/CrossProfileApps.java @@ -87,6 +87,7 @@ public class CrossProfileApps { mService.startActivityAsUser( mContext.getIApplicationThread(), mContext.getPackageName(), + mContext.getFeatureId(), component, targetUser.getIdentifier(), true); @@ -114,6 +115,7 @@ public class CrossProfileApps { mService.startActivityAsUserByIntent( mContext.getIApplicationThread(), mContext.getPackageName(), + mContext.getFeatureId(), intent, targetUser.getIdentifier()); } catch (RemoteException ex) { @@ -139,7 +141,8 @@ public class CrossProfileApps { public void startActivity(@NonNull ComponentName component, @NonNull UserHandle targetUser) { try { mService.startActivityAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), component, targetUser.getIdentifier(), false); + mContext.getPackageName(), mContext.getFeatureId(), component, + targetUser.getIdentifier(), false); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } diff --git a/core/java/android/content/pm/ICrossProfileApps.aidl b/core/java/android/content/pm/ICrossProfileApps.aidl index a69b9881aa01..98bf2ddd0e1b 100644 --- a/core/java/android/content/pm/ICrossProfileApps.aidl +++ b/core/java/android/content/pm/ICrossProfileApps.aidl @@ -28,13 +28,14 @@ import android.os.UserHandle; */ interface ICrossProfileApps { void startActivityAsUser(in IApplicationThread caller, in String callingPackage, - in ComponentName component, int userId, boolean launchMainActivity); + in String callingFeatureId, in ComponentName component, int userId, + boolean launchMainActivity); void startActivityAsUserByIntent(in IApplicationThread caller, in String callingPackage, - in Intent intent, int userId); + in String callingFeatureId, in Intent intent, int userId); List<UserHandle> getTargetUserProfiles(in String callingPackage); boolean canInteractAcrossProfiles(in String callingPackage); boolean canRequestInteractAcrossProfiles(in String callingPackage); void setInteractAcrossProfilesAppOp(in String packageName, int newMode); boolean canConfigureInteractAcrossProfiles(in String packageName); void resetInteractAcrossProfilesAppOps(in List<String> packageNames); -}
\ No newline at end of file +} diff --git a/core/java/android/content/pm/ILauncherApps.aidl b/core/java/android/content/pm/ILauncherApps.aidl index 38a9ac4a0d05..b5f4f806d244 100644 --- a/core/java/android/content/pm/ILauncherApps.aidl +++ b/core/java/android/content/pm/ILauncherApps.aidl @@ -49,13 +49,13 @@ interface ILauncherApps { ActivityInfo resolveActivity( String callingPackage, in ComponentName component, in UserHandle user); void startSessionDetailsActivityAsUser(in IApplicationThread caller, String callingPackage, - in PackageInstaller.SessionInfo sessionInfo, in Rect sourceBounds, in Bundle opts, - in UserHandle user); + String callingFeatureId, in PackageInstaller.SessionInfo sessionInfo, + in Rect sourceBounds, in Bundle opts, in UserHandle user); void startActivityAsUser(in IApplicationThread caller, String callingPackage, - in ComponentName component, in Rect sourceBounds, + String callingFeatureId, in ComponentName component, in Rect sourceBounds, in Bundle opts, in UserHandle user); - void showAppDetailsAsUser(in IApplicationThread caller, - String callingPackage, in ComponentName component, in Rect sourceBounds, + void showAppDetailsAsUser(in IApplicationThread caller, String callingPackage, + String callingFeatureId, in ComponentName component, in Rect sourceBounds, in Bundle opts, in UserHandle user); boolean isPackageEnabled(String callingPackage, String packageName, in UserHandle user); Bundle getSuspendedPackageLauncherExtras(String packageName, in UserHandle user); @@ -72,7 +72,7 @@ interface ILauncherApps { int flags, in UserHandle user); void pinShortcuts(String callingPackage, String packageName, in List<String> shortcutIds, in UserHandle user); - boolean startShortcut(String callingPackage, String packageName, String id, + boolean startShortcut(String callingPackage, String packageName, String featureId, String id, in Rect sourceBounds, in Bundle startActivityOptions, int userId); int getShortcutIconResId(String callingPackage, String packageName, String id, diff --git a/core/java/android/content/pm/InstantAppRequest.java b/core/java/android/content/pm/InstantAppRequest.java index f692db1f0443..84f5021f0538 100644 --- a/core/java/android/content/pm/InstantAppRequest.java +++ b/core/java/android/content/pm/InstantAppRequest.java @@ -35,6 +35,8 @@ public final class InstantAppRequest { public final String resolvedType; /** The name of the package requesting the instant application */ public final String callingPackage; + /** The feature in the package requesting the instant application */ + public final String callingFeatureId; /** Whether or not the requesting package was an instant app */ public final boolean isRequesterInstantApp; /** ID of the user requesting the instant application */ @@ -57,13 +59,15 @@ public final class InstantAppRequest { public final String token; public InstantAppRequest(AuxiliaryResolveInfo responseObj, Intent origIntent, - String resolvedType, String callingPackage, boolean isRequesterInstantApp, - int userId, Bundle verificationBundle, boolean resolveForStart, - @Nullable int[] hostDigestPrefixSecure, @NonNull String token) { + String resolvedType, String callingPackage, @Nullable String callingFeatureId, + boolean isRequesterInstantApp, int userId, Bundle verificationBundle, + boolean resolveForStart, @Nullable int[] hostDigestPrefixSecure, + @NonNull String token) { this.responseObj = responseObj; this.origIntent = origIntent; this.resolvedType = resolvedType; this.callingPackage = callingPackage; + this.callingFeatureId = callingFeatureId; this.isRequesterInstantApp = isRequesterInstantApp; this.userId = userId; this.verificationBundle = verificationBundle; diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java index d2532783f47c..271d5e44d5db 100644 --- a/core/java/android/content/pm/LauncherApps.java +++ b/core/java/android/content/pm/LauncherApps.java @@ -715,7 +715,7 @@ public class LauncherApps { } try { mService.startActivityAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), + mContext.getPackageName(), mContext.getFeatureId(), component, sourceBounds, opts, user); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); @@ -733,8 +733,8 @@ public class LauncherApps { @Nullable Rect sourceBounds, @Nullable Bundle opts) { try { mService.startSessionDetailsActivityAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), sessionInfo, sourceBounds, opts, - sessionInfo.getUser()); + mContext.getPackageName(), mContext.getFeatureId(), sessionInfo, sourceBounds, + opts, sessionInfo.getUser()); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -754,7 +754,7 @@ public class LauncherApps { logErrorForInvalidProfileAccess(user); try { mService.showAppDetailsAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), + mContext.getPackageName(), mContext.getFeatureId(), component, sourceBounds, opts, user); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); @@ -1346,9 +1346,9 @@ public class LauncherApps { @Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions, int userId) { try { - final boolean success = - mService.startShortcut(mContext.getPackageName(), packageName, shortcutId, - sourceBounds, startActivityOptions, userId); + final boolean success = mService.startShortcut(mContext.getPackageName(), packageName, + null /* default featureId */, shortcutId, sourceBounds, startActivityOptions, + userId); if (!success) { throw new ActivityNotFoundException("Shortcut could not be started"); } diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java index 36f2c6267622..8e6f77b2fd0c 100644 --- a/core/java/android/service/voice/VoiceInteractionSession.java +++ b/core/java/android/service/voice/VoiceInteractionSession.java @@ -1314,7 +1314,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(mContext); int res = mSystemService.startVoiceActivity(mToken, intent, - intent.resolveType(mContext.getContentResolver())); + intent.resolveType(mContext.getContentResolver()), mContext.getFeatureId()); Instrumentation.checkStartActivityResult(res, intent); } catch (RemoteException e) { } @@ -1342,7 +1342,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(mContext); int res = mSystemService.startAssistantActivity(mToken, intent, - intent.resolveType(mContext.getContentResolver())); + intent.resolveType(mContext.getContentResolver()), mContext.getFeatureId()); Instrumentation.checkStartActivityResult(res, intent); } catch (RemoteException e) { } |
