diff options
65 files changed, 516 insertions, 789 deletions
diff --git a/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java b/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java index c458d1190e51..661f32f35cb2 100644 --- a/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java +++ b/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java @@ -670,7 +670,7 @@ public class UserLifecycleTests { private void startApp(int userId, String packageName) throws RemoteException { final Context context = InstrumentationRegistry.getContext(); final WaitResult result = ActivityTaskManager.getService().startActivityAndWait(null, - context.getPackageName(), context.getFeatureId(), + context.getPackageName(), context.getPackageManager().getLaunchIntentForPackage(packageName), null, null, null, 0, 0, null, null, userId); attestTrue("User " + userId + " failed to start " + packageName, diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 2319dd2c168f..642f51b6bb63 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(), - getFeatureId(), intent, - intent.resolveTypeIfNeeded(getContentResolver()), mToken, mEmbeddedID, - requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED, null, options); + 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().getIntentSenderWithFeature( - ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName, getFeatureId(), + ActivityManager.getService().getIntentSender( + ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName, 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 dba3020d0dcd..db9aa18dbd5a 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -4315,8 +4315,8 @@ public class ActivityManager { */ public static void broadcastStickyIntent(Intent intent, int appOp, int userId) { try { - getService().broadcastIntentWithFeature( - null, null, intent, null, null, Activity.RESULT_OK, null, null, + getService().broadcastIntent( + 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 ec110435d95c..c60f7bd29ce8 100644 --- a/core/java/android/app/ActivityManagerInternal.java +++ b/core/java/android/app/ActivityManagerInternal.java @@ -269,16 +269,13 @@ public abstract class ActivityManagerInternal { public abstract void tempWhitelistForPendingIntent(int callerPid, int callerUid, int targetUid, long duration, String tag); - - 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 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 ComponentName startServiceInPackage(int uid, Intent service, - String resolvedType, boolean fgRequired, String callingPackage, - @Nullable String callingFeatureId, @UserIdInt int userId, + String resolvedType, boolean fgRequired, String callingPackage, @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 6b5bfda92cd0..57cd8941a398 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(), getFeatureId(), intent, + mMainThread.getApplicationThread(), getBasePackageName(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), 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().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermissions, appOp, options, true, false, getUserId()); } catch (RemoteException e) { @@ -1277,10 +1277,9 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, false, - user.getIdentifier()); + ActivityManager.getService().broadcastIntent(mMainThread.getApplicationThread(), + intent, resolvedType, null, Activity.RESULT_OK, null, null, null, + AppOpsManager.OP_NONE, null, false, false, user.getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1300,8 +1299,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, options, false, false, user.getIdentifier()); } catch (RemoteException e) { @@ -1317,8 +1316,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermissions, appOp, null, false, false, user.getIdentifier()); } catch (RemoteException e) { @@ -1368,8 +1367,8 @@ class ContextImpl extends Context { : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermissions, appOp, options, true, false, user.getIdentifier()); } catch (RemoteException e) { @@ -1409,8 +1408,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, true, getUserId()); } catch (RemoteException e) { @@ -1445,8 +1444,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, null, true, true, getUserId()); } catch (RemoteException e) { @@ -1477,8 +1476,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, null, false, true, user.getIdentifier()); } catch (RemoteException e) { @@ -1492,8 +1491,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, null, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, options, false, true, user.getIdentifier()); } catch (RemoteException e) { @@ -1527,8 +1526,8 @@ class ContextImpl extends Context { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(this); - ActivityManager.getService().broadcastIntentWithFeature( - mMainThread.getApplicationThread(), getFeatureId(), intent, resolvedType, rd, + ActivityManager.getService().broadcastIntent( + mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, null, true, true, user.getIdentifier()); } catch (RemoteException e) { @@ -1613,9 +1612,9 @@ class ContextImpl extends Context { } } try { - final Intent intent = ActivityManager.getService().registerReceiverWithFeature( - mMainThread.getApplicationThread(), mBasePackageName, getFeatureId(), rd, - filter, broadcastPermission, userId, flags); + final Intent intent = ActivityManager.getService().registerReceiver( + mMainThread.getApplicationThread(), mBasePackageName, rd, filter, + broadcastPermission, userId, flags); if (intent != null) { intent.setExtrasClassLoader(getClassLoader()); intent.prepareToEnterProcess(); @@ -1688,9 +1687,9 @@ class ContextImpl extends Context { validateServiceIntent(service); service.prepareToLeaveProcess(this); ComponentName cn = ActivityManager.getService().startService( - mMainThread.getApplicationThread(), service, - service.resolveTypeIfNeeded(getContentResolver()), requireForeground, - getOpPackageName(), getFeatureId(), user.getIdentifier()); + mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded( + getContentResolver()), requireForeground, + getOpPackageName(), 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 83fa9d7ea796..cb6a476fb617 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -104,38 +104,25 @@ interface IActivityManager { // Special low-level communication with activity manager. void handleApplicationCrash(in IBinder app, in ApplicationErrorReport.ParcelableCrashInfo crashInfo); - /** @deprecated Use {@link #startActivityWithFeature} instead */ - @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#startActivity(android.content.Intent)} instead") + @UnsupportedAppUsage 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(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)} instead") + @UnsupportedAppUsage 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); - /** @deprecated Use {@link #broadcastIntentWithFeature} instead */ - @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#sendBroadcast(android.content.Intent)} instead") + @UnsupportedAppUsage 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, @@ -158,8 +145,7 @@ 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, - in String callingFeatureId, int userId); + in String resolvedType, boolean requireForeground, in String callingPackage, int userId); @UnsupportedAppUsage int stopService(in IApplicationThread caller, in Intent service, in String resolvedType, int userId); @@ -240,14 +226,10 @@ interface IActivityManager { ParceledListSlice getRecentTasks(int maxNum, int flags, int userId); @UnsupportedAppUsage oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res); - /** @deprecated Use {@link #getIntentSenderWithFeature} instead */ - @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link PendingIntent#getIntentSender()} instead") + @UnsupportedAppUsage 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); @@ -373,16 +355,11 @@ interface IActivityManager { boolean isIntentSenderAnActivity(in IIntentSender sender); boolean isIntentSenderAForegroundService(in IIntentSender sender); boolean isIntentSenderABroadcast(in IIntentSender sender); - /** @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") + @UnsupportedAppUsage 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 180507cd7e9c..be2f144c2fe8 100644 --- a/core/java/android/app/IActivityTaskManager.aidl +++ b/core/java/android/app/IActivityTaskManager.aidl @@ -85,17 +85,16 @@ import java.util.List; * {@hide} */ interface IActivityTaskManager { - 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 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 startActivities(in IApplicationThread caller, in String callingPackage, - in String callingFeatureId, in Intent[] intents, in String[] resolvedTypes, - in IBinder resultTo, in Bundle options, int userId); + in Intent[] intents, in String[] resolvedTypes, in IBinder resultTo, + in Bundle options, int userId); int startActivityAsUser(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); + 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, @@ -103,19 +102,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 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); + 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 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); + 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); 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 f41d705e2ba7..3ce71908bbfd 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, String callingFeatureId, + int startActivity(IBinder whoThread, String callingPackage, 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 18932c6b0784..62c905d8c2c6 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(), who.getFeatureId(), intent, + .startActivity(whoThread, who.getBasePackageName(), 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(), who.getFeatureId(), intents, - resolvedTypes, token, options, userId); + .startActivities(whoThread, who.getBasePackageName(), 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(), who.getFeatureId(), intent, + .startActivity(whoThread, who.getBasePackageName(), 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(), who.getFeatureId(), - intent, intent.resolveTypeIfNeeded(who.getContentResolver()), + .startActivityAsUser(whoThread, who.getBasePackageName(), intent, + intent.resolveTypeIfNeeded(who.getContentResolver()), token, resultWho, requestCode, 0, null, options, user.getIdentifier()); checkStartActivityResult(result, intent); @@ -2022,8 +2022,7 @@ public class Instrumentation { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(who); int result = appTask.startActivity(whoThread.asBinder(), who.getBasePackageName(), - who.getFeatureId(), intent, - intent.resolveTypeIfNeeded(who.getContentResolver()), options); + 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 f68c929144c8..b8348c7d4f22 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().getIntentSenderWithFeature( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), + ActivityManager.getService().getIntentSender( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, 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().getIntentSenderWithFeature( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), + ActivityManager.getService().getIntentSender( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, 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().getIntentSenderWithFeature( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), + ActivityManager.getService().getIntentSender( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, 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().getIntentSenderWithFeature( - ActivityManager.INTENT_SENDER_ACTIVITY, packageName, context.getFeatureId(), + ActivityManager.getService().getIntentSender( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, 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().getIntentSenderWithFeature( - ActivityManager.INTENT_SENDER_BROADCAST, packageName, context.getFeatureId(), + ActivityManager.getService().getIntentSender( + ActivityManager.INTENT_SENDER_BROADCAST, packageName, 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().getIntentSenderWithFeature( - serviceKind, packageName, context.getFeatureId(), + ActivityManager.getService().getIntentSender( + serviceKind, packageName, 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 b7afe3f71fec..de153d00b48b 100644 --- a/core/java/android/content/pm/CrossProfileApps.java +++ b/core/java/android/content/pm/CrossProfileApps.java @@ -87,7 +87,6 @@ public class CrossProfileApps { mService.startActivityAsUser( mContext.getIApplicationThread(), mContext.getPackageName(), - mContext.getFeatureId(), component, targetUser.getIdentifier(), true); @@ -115,7 +114,6 @@ public class CrossProfileApps { mService.startActivityAsUserByIntent( mContext.getIApplicationThread(), mContext.getPackageName(), - mContext.getFeatureId(), intent, targetUser.getIdentifier()); } catch (RemoteException ex) { @@ -141,8 +139,7 @@ public class CrossProfileApps { public void startActivity(@NonNull ComponentName component, @NonNull UserHandle targetUser) { try { mService.startActivityAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), mContext.getFeatureId(), component, - targetUser.getIdentifier(), false); + mContext.getPackageName(), 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 98bf2ddd0e1b..a69b9881aa01 100644 --- a/core/java/android/content/pm/ICrossProfileApps.aidl +++ b/core/java/android/content/pm/ICrossProfileApps.aidl @@ -28,14 +28,13 @@ import android.os.UserHandle; */ interface ICrossProfileApps { void startActivityAsUser(in IApplicationThread caller, in String callingPackage, - in String callingFeatureId, in ComponentName component, int userId, - boolean launchMainActivity); + in ComponentName component, int userId, boolean launchMainActivity); void startActivityAsUserByIntent(in IApplicationThread caller, in String callingPackage, - in String callingFeatureId, in Intent intent, int userId); + 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 660ed9413e37..04923590b413 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, - String callingFeatureId, in PackageInstaller.SessionInfo sessionInfo, - in Rect sourceBounds, in Bundle opts, in UserHandle user); + in PackageInstaller.SessionInfo sessionInfo, in Rect sourceBounds, in Bundle opts, + in UserHandle user); void startActivityAsUser(in IApplicationThread caller, String callingPackage, - String callingFeatureId, in ComponentName component, in Rect sourceBounds, + in ComponentName component, in Rect sourceBounds, in Bundle opts, in UserHandle user); - void showAppDetailsAsUser(in IApplicationThread caller, String callingPackage, - String callingFeatureId, in ComponentName component, in Rect sourceBounds, + void showAppDetailsAsUser(in IApplicationThread caller, + String callingPackage, 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 featureId, String id, + boolean startShortcut(String callingPackage, String packageName, 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 84f5021f0538..f692db1f0443 100644 --- a/core/java/android/content/pm/InstantAppRequest.java +++ b/core/java/android/content/pm/InstantAppRequest.java @@ -35,8 +35,6 @@ 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 */ @@ -59,15 +57,13 @@ public final class InstantAppRequest { public final String token; public InstantAppRequest(AuxiliaryResolveInfo responseObj, Intent origIntent, - String resolvedType, String callingPackage, @Nullable String callingFeatureId, - boolean isRequesterInstantApp, int userId, Bundle verificationBundle, - boolean resolveForStart, @Nullable int[] hostDigestPrefixSecure, - @NonNull String token) { + String resolvedType, String callingPackage, 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 7fda9aadff6a..73c9e4d843b7 100644 --- a/core/java/android/content/pm/LauncherApps.java +++ b/core/java/android/content/pm/LauncherApps.java @@ -714,7 +714,7 @@ public class LauncherApps { } try { mService.startActivityAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), mContext.getFeatureId(), + mContext.getPackageName(), component, sourceBounds, opts, user); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); @@ -732,8 +732,8 @@ public class LauncherApps { @Nullable Rect sourceBounds, @Nullable Bundle opts) { try { mService.startSessionDetailsActivityAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), mContext.getFeatureId(), sessionInfo, sourceBounds, - opts, sessionInfo.getUser()); + mContext.getPackageName(), sessionInfo, sourceBounds, opts, + sessionInfo.getUser()); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -753,7 +753,7 @@ public class LauncherApps { logErrorForInvalidProfileAccess(user); try { mService.showAppDetailsAsUser(mContext.getIApplicationThread(), - mContext.getPackageName(), mContext.getFeatureId(), + mContext.getPackageName(), component, sourceBounds, opts, user); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); @@ -1290,9 +1290,9 @@ public class LauncherApps { @Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions, int userId) { try { - final boolean success = mService.startShortcut(mContext.getPackageName(), packageName, - null /* default featureId */, shortcutId, sourceBounds, startActivityOptions, - userId); + final boolean success = + mService.startShortcut(mContext.getPackageName(), packageName, 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 8e6f77b2fd0c..36f2c6267622 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()), mContext.getFeatureId()); + intent.resolveType(mContext.getContentResolver())); 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()), mContext.getFeatureId()); + intent.resolveType(mContext.getContentResolver())); Instrumentation.checkStartActivityResult(res, intent); } catch (RemoteException e) { } diff --git a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl index 417e23f56448..f3b6d292623d 100644 --- a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +++ b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl @@ -38,10 +38,8 @@ interface IVoiceInteractionManagerService { IVoiceInteractor interactor); boolean showSessionFromSession(IBinder token, in Bundle sessionArgs, int flags); boolean hideSessionFromSession(IBinder token); - int startVoiceActivity(IBinder token, in Intent intent, String resolvedType, - String callingFeatureId); - int startAssistantActivity(IBinder token, in Intent intent, String resolvedType, - String callingFeatureId); + int startVoiceActivity(IBinder token, in Intent intent, String resolvedType); + int startAssistantActivity(IBinder token, in Intent intent, String resolvedType); void setKeepAwake(IBinder token, boolean keepAwake); void closeSystemDialogs(IBinder token); void finish(IBinder token); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java index ae380b72f5e0..6498b9161be7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivityController.java @@ -93,7 +93,6 @@ public class WorkLockActivityController { return mIatm.startActivityAsUser( mContext.getIApplicationThread() /*caller*/, mContext.getBasePackageName() /*callingPackage*/, - mContext.getFeatureId() /*callingFeatureId*/, intent /*intent*/, intent.resolveTypeIfNeeded(mContext.getContentResolver()) /*resolvedType*/, null /*resultTo*/, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 72dfa18ca991..d3e44eaf17b1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -492,7 +492,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL try { result = ActivityTaskManager.getService().startActivityAsUser( null, getContext().getBasePackageName(), - getContext().getFeatureId(), intent, + intent, intent.resolveTypeIfNeeded(getContext().getContentResolver()), null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, o.toBundle(), UserHandle.CURRENT.getIdentifier()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index a6498d50ed68..11f70796748c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -2571,7 +2571,7 @@ public class StatusBar extends SystemUI implements DemoMode, } try { result = ActivityTaskManager.getService().startActivityAsUser( - null, mContext.getBasePackageName(), mContext.getFeatureId(), + null, mContext.getBasePackageName(), intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java index 3439fe53c48f..d26ae6aaad79 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java @@ -119,7 +119,6 @@ public class WorkLockActivityControllerTest extends SysuiTestCase { doReturn(code).when(mIActivityTaskManager).startActivityAsUser( eq((IApplicationThread) null), eq((String) null), - eq((String) null), any(Intent.class), eq((String) null), eq((IBinder) null), @@ -135,7 +134,6 @@ public class WorkLockActivityControllerTest extends SysuiTestCase { verify(mIActivityTaskManager).startActivityAsUser( eq((IApplicationThread) null), eq((String) null), - eq((String) null), any(Intent.class), eq((String) null), eq((IBinder) null), diff --git a/services/core/java/android/content/pm/PackageManagerInternal.java b/services/core/java/android/content/pm/PackageManagerInternal.java index 63d092456a26..bdcd832e4f4a 100644 --- a/services/core/java/android/content/pm/PackageManagerInternal.java +++ b/services/core/java/android/content/pm/PackageManagerInternal.java @@ -396,7 +396,6 @@ public abstract class PackageManagerInternal { * @param origIntent The original intent that triggered ephemeral resolution * @param resolvedType The resolved type of the intent * @param callingPkg The app requesting the ephemeral application - * @param callingFeatureId The feature in the package * @param isRequesterInstantApp Whether or not the app requesting the ephemeral application * is an instant app * @param verificationBundle Optional bundle to pass to the installer for additional @@ -405,8 +404,7 @@ public abstract class PackageManagerInternal { */ public abstract void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj, Intent origIntent, String resolvedType, String callingPkg, - @Nullable String callingFeatureId, boolean isRequesterInstantApp, - Bundle verificationBundle, int userId); + boolean isRequesterInstantApp, Bundle verificationBundle, int userId); /** * Grants implicit access based on an interaction between two apps. This grants the target app diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java index 0eedf8a1f468..b994e6c58e64 100644 --- a/services/core/java/com/android/server/UiModeManagerService.java +++ b/services/core/java/com/android/server/UiModeManagerService.java @@ -1261,9 +1261,8 @@ final class UiModeManagerService extends SystemService { if (Sandman.shouldStartDockApp(getContext(), homeIntent)) { try { int result = ActivityTaskManager.getService().startActivityWithConfig( - null, getContext().getBasePackageName(), getContext().getFeatureId(), - homeIntent, null, null, null, 0, 0, mConfiguration, null, - UserHandle.USER_CURRENT); + null, getContext().getBasePackageName(), homeIntent, null, null, null, + 0, 0, mConfiguration, null, UserHandle.USER_CURRENT); if (ActivityManager.isStartResultSuccessful(result)) { dockAppStarted = true; } else if (result != ActivityManager.START_INTENT_NOT_RESOLVED) { diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 97b5eaaca756..982466d82d38 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -417,23 +417,22 @@ public final class ActiveServices { } private boolean appRestrictedAnyInBackground(final int uid, final String packageName) { - final int mode = mAm.getAppOpsManager().checkOpNoThrow( + final int mode = mAm.mAppOpsService.checkOperation( AppOpsManager.OP_RUN_ANY_IN_BACKGROUND, uid, packageName); return (mode != AppOpsManager.MODE_ALLOWED); } ComponentName startServiceLocked(IApplicationThread caller, Intent service, String resolvedType, - int callingPid, int callingUid, boolean fgRequired, String callingPackage, - @Nullable String callingFeatureId, final int userId) + int callingPid, int callingUid, boolean fgRequired, String callingPackage, final int userId) throws TransactionTooLargeException { return startServiceLocked(caller, service, resolvedType, callingPid, callingUid, fgRequired, - callingPackage, callingFeatureId, userId, false); + callingPackage, userId, false); } ComponentName startServiceLocked(IApplicationThread caller, Intent service, String resolvedType, int callingPid, int callingUid, boolean fgRequired, String callingPackage, - @Nullable String callingFeatureId, final int userId, - boolean allowBackgroundActivityStarts) throws TransactionTooLargeException { + final int userId, boolean allowBackgroundActivityStarts) + throws TransactionTooLargeException { if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE, "startService: " + service + " type=" + resolvedType + " args=" + service.getExtras()); @@ -489,7 +488,7 @@ public final class ActiveServices { // If this is a direct-to-foreground start, make sure it is allowed as per the app op. boolean forceSilentAbort = false; if (fgRequired) { - final int mode = mAm.getAppOpsManager().checkOpNoThrow( + final int mode = mAm.mAppOpsService.checkOperation( AppOpsManager.OP_START_FOREGROUND, r.appInfo.uid, r.packageName); switch (mode) { case AppOpsManager.MODE_ALLOWED: @@ -567,7 +566,7 @@ public final class ActiveServices { // review is completed. // XXX This is not dealing with fgRequired! - if (!requestStartTargetPermissionsReviewIfNeededLocked(r, callingPackage, callingFeatureId, + if (!requestStartTargetPermissionsReviewIfNeededLocked(r, callingPackage, callingUid, service, callerFg, userId)) { return null; } @@ -674,8 +673,8 @@ public final class ActiveServices { } private boolean requestStartTargetPermissionsReviewIfNeededLocked(ServiceRecord r, - String callingPackage, @Nullable String callingFeatureId, int callingUid, - Intent service, boolean callerFg, final int userId) { + String callingPackage, int callingUid, Intent service, boolean callerFg, + final int userId) { if (mAm.getPackageManagerInternalLocked().isPermissionsReviewRequired( r.packageName, r.userId)) { @@ -687,7 +686,7 @@ public final class ActiveServices { } IIntentSender target = mAm.mPendingIntentController.getIntentSender( - ActivityManager.INTENT_SENDER_SERVICE, callingPackage, callingFeatureId, + ActivityManager.INTENT_SENDER_SERVICE, callingPackage, callingUid, userId, null, null, 0, new Intent[]{service}, new String[]{service.resolveType(mAm.mContext.getContentResolver())}, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT @@ -1288,7 +1287,7 @@ public final class ActiveServices { } // Instant apps need permission to create foreground services. if (r.appInfo.isInstantApp()) { - final int mode = mAm.getAppOpsManager().checkOpNoThrow( + final int mode = mAm.mAppOpsService.checkOperation( AppOpsManager.OP_INSTANT_APP_START_FOREGROUND, r.appInfo.uid, r.appInfo.packageName); @@ -1355,7 +1354,7 @@ public final class ActiveServices { try { boolean ignoreForeground = false; - final int mode = mAm.getAppOpsManager().checkOpNoThrow( + final int mode = mAm.mAppOpsService.checkOperation( AppOpsManager.OP_START_FOREGROUND, r.appInfo.uid, r.packageName); switch (mode) { case AppOpsManager.MODE_ALLOWED: @@ -2290,7 +2289,7 @@ public final class ActiveServices { return new ServiceLookupResult(null, r.permission); } else if (r.permission != null && callingPackage != null) { final int opCode = AppOpsManager.permissionToOpCode(r.permission); - if (opCode != AppOpsManager.OP_NONE && mAm.getAppOpsManager().checkOpNoThrow( + if (opCode != AppOpsManager.OP_NONE && mAm.mAppOpsService.checkOperation( opCode, callingUid, callingPackage) != AppOpsManager.MODE_ALLOWED) { Slog.w(TAG, "Appop Denial: Accessing service " + r.shortInstanceName + " from pid=" + callingPid diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index a6a569c92b7a..3ad96ea193bf 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -1240,7 +1240,6 @@ public class ActivityManagerService extends IActivityManager.Stub * Information about and control over application operations */ final AppOpsService mAppOpsService; - private AppOpsManager mAppOpsManager; /** * List of initialization arguments to pass to all processes when binding applications to them. @@ -2110,7 +2109,7 @@ public class ActivityManagerService extends IActivityManager.Stub new IAppOpsCallback.Stub() { @Override public void opChanged(int op, int uid, String packageName) { if (op == AppOpsManager.OP_RUN_IN_BACKGROUND && packageName != null) { - if (getAppOpsManager().checkOpNoThrow(op, uid, packageName) + if (mAppOpsService.checkOperation(op, uid, packageName) != AppOpsManager.MODE_ALLOWED) { runInBackgroundDisabled(uid); } @@ -2401,13 +2400,6 @@ public class ActivityManagerService extends IActivityManager.Stub } } - AppOpsManager getAppOpsManager() { - if (mAppOpsManager == null) { - mAppOpsManager = mContext.getSystemService(AppOpsManager.class); - } - return mAppOpsManager; - } - /** * Provides the basic functionality for activity task related tests when a handler thread is * given to initialize the dependency members. @@ -2916,7 +2908,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void batterySendBroadcast(Intent intent) { synchronized (this) { - broadcastIntentLocked(null, null, null, intent, null, null, 0, null, null, null, + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, OP_NONE, null, false, false, -1, SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), UserHandle.USER_ALL); } @@ -3520,56 +3512,30 @@ public class ActivityManagerService extends IActivityManager.Stub } - /** - * @deprecated use {@link #startActivityWithFeature} instead - */ - @Deprecated @Override public int startActivity(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions) { - return mActivityTaskManager.startActivity(caller, callingPackage, null, intent, - resolvedType, resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions); + return mActivityTaskManager.startActivity(caller, callingPackage, intent, resolvedType, + resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions); } @Override - public int startActivityWithFeature(IApplicationThread caller, String callingPackage, - String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, - Bundle bOptions) { - return mActivityTaskManager.startActivity(caller, callingPackage, callingFeatureId, intent, - resolvedType, resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions); - } - - /** - * @deprecated use {@link #startActivityAsUserWithFeature} instead - */ - @Deprecated - @Override public final int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId) { - return startActivityAsUserWithFeature(caller, callingPackage, null, intent, resolvedType, - resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions, userId); - } - @Override - public final int startActivityAsUserWithFeature(IApplicationThread caller, - String callingPackage, String callingFeatureId, Intent intent, String resolvedType, - IBinder resultTo, String resultWho, int requestCode, int startFlags, - ProfilerInfo profilerInfo, Bundle bOptions, int userId) { - return mActivityTaskManager.startActivityAsUser(caller, callingPackage, - callingFeatureId, intent, resolvedType, resultTo, resultWho, requestCode, - startFlags, profilerInfo, bOptions, userId); + return mActivityTaskManager.startActivityAsUser(caller, callingPackage, intent, + resolvedType, resultTo, resultWho, requestCode, startFlags, profilerInfo, + bOptions, userId); } WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage, - @Nullable String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, - Bundle bOptions, int userId) { - return mActivityTaskManager.startActivityAndWait(caller, callingPackage, - callingFeatureId, intent, resolvedType, resultTo, resultWho, requestCode, - startFlags, profilerInfo, bOptions, userId); + Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, + int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId) { + return mActivityTaskManager.startActivityAndWait(caller, callingPackage, intent, + resolvedType, resultTo, resultWho, requestCode, startFlags, profilerInfo, + bOptions, userId); } @Override @@ -4140,12 +4106,12 @@ public class ActivityManagerService extends IActivityManager.Stub intent.putExtra(Intent.EXTRA_USER_HANDLE, resolvedUserId); if (isInstantApp) { intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName); - broadcastIntentInPackage("android", null, SYSTEM_UID, uid, pid, intent, - null, null, 0, null, null, permission.ACCESS_INSTANT_APPS, null, - false, false, resolvedUserId, false); + broadcastIntentInPackage("android", SYSTEM_UID, uid, pid, intent, null, + null, 0, null, null, permission.ACCESS_INSTANT_APPS, null, false, + false, resolvedUserId, false); } else { - broadcastIntentInPackage("android", null, SYSTEM_UID, uid, pid, intent, - null, null, 0, null, null, null, null, false, false, resolvedUserId, + broadcastIntentInPackage("android", SYSTEM_UID, uid, pid, intent, null, + null, 0, null, null, null, null, false, false, resolvedUserId, false); } @@ -4593,7 +4559,7 @@ public class ActivityManagerService extends IActivityManager.Stub } intent.putExtra(Intent.EXTRA_UID, uid); intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(uid)); - broadcastIntentLocked(null, null, null, intent, + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, OP_NONE, null, false, false, MY_PID, SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), UserHandle.getUserId(uid)); @@ -5450,23 +5416,12 @@ public class ActivityManagerService extends IActivityManager.Stub } } - /** - * @deprecated Use {@link #getIntentSenderWithFeature} instead - */ - @Deprecated @Override public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle bOptions, int userId) { - return getIntentSenderWithFeature(type, packageName, null, token, resultWho, requestCode, - intents, resolvedTypes, flags, bOptions, userId); - } - @Override - public IIntentSender getIntentSenderWithFeature(int type, String packageName, String featureId, - IBinder token, String resultWho, int requestCode, Intent[] intents, - String[] resolvedTypes, int flags, Bundle bOptions, int userId) { // NOTE: The service lock isn't held in this method because nothing in the method requires // the service lock to be held. @@ -5528,13 +5483,12 @@ public class ActivityManagerService extends IActivityManager.Stub } if (type == ActivityManager.INTENT_SENDER_ACTIVITY_RESULT) { - return mAtmInternal.getIntentSender(type, packageName, featureId, callingUid, - userId, token, resultWho, requestCode, intents, resolvedTypes, flags, - bOptions); + return mAtmInternal.getIntentSender(type, packageName, callingUid, userId, + token, resultWho, requestCode, intents, resolvedTypes, flags, bOptions); } - return mPendingIntentController.getIntentSender(type, packageName, featureId, - callingUid, userId, token, resultWho, requestCode, intents, resolvedTypes, - flags, bOptions); + return mPendingIntentController.getIntentSender(type, packageName, callingUid, + userId, token, resultWho, requestCode, intents, resolvedTypes, flags, + bOptions); } catch (RemoteException e) { throw new SecurityException(e); } @@ -6100,8 +6054,8 @@ public class ActivityManagerService extends IActivityManager.Stub return ActivityManager.APP_START_MODE_DELAYED; } // Not in the RESTRICTED bucket so policy is based on AppOp check. - int appop = getAppOpsManager().noteOpNoThrow(AppOpsManager.OP_RUN_IN_BACKGROUND, - uid, packageName, null, ""); + int appop = mAppOpsService.noteOperation(AppOpsManager.OP_RUN_IN_BACKGROUND, + uid, packageName, null, false, ""); if (DEBUG_BACKGROUND_CHECK) { Slog.i(TAG, "Legacy app " + uid + "/" + packageName + " bg appop " + appop); } @@ -8007,7 +7961,7 @@ public class ActivityManagerService extends IActivityManager.Stub } boolean isBackgroundRestrictedNoCheck(final int uid, final String packageName) { - final int mode = getAppOpsManager().checkOpNoThrow(AppOpsManager.OP_RUN_ANY_IN_BACKGROUND, + final int mode = mAppOpsService.checkOperation(AppOpsManager.OP_RUN_ANY_IN_BACKGROUND, uid, packageName); return mode != AppOpsManager.MODE_ALLOWED; } @@ -9485,14 +9439,14 @@ public class ActivityManagerService extends IActivityManager.Stub intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId); - broadcastIntentLocked(null, null, null, intent, + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, OP_NONE, null, false, false, MY_PID, SYSTEM_UID, callingUid, callingPid, currentUserId); intent = new Intent(Intent.ACTION_USER_STARTING); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId); - broadcastIntentLocked(null, null, null, intent, null, + broadcastIntentLocked(null, null, intent, null, new IIntentReceiver.Stub() { @Override public void performReceive(Intent intent, int resultCode, @@ -14631,8 +14585,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public ComponentName startService(IApplicationThread caller, Intent service, - String resolvedType, boolean requireForeground, String callingPackage, - String callingFeatureId, int userId) + String resolvedType, boolean requireForeground, String callingPackage, int userId) throws TransactionTooLargeException { enforceNotIsolatedCaller("startService"); // Refuse possible leaked file descriptors @@ -14654,7 +14607,7 @@ public class ActivityManagerService extends IActivityManager.Stub try { res = mServices.startServiceLocked(caller, service, resolvedType, callingPid, callingUid, - requireForeground, callingPackage, callingFeatureId, userId); + requireForeground, callingPackage, userId); } finally { Binder.restoreCallingIdentity(origId); } @@ -15132,20 +15085,9 @@ public class ActivityManagerService extends IActivityManager.Stub return didSomething; } - /** - * @deprecated Use {@link #registerReceiverWithFeature} - */ - @Deprecated public Intent registerReceiver(IApplicationThread caller, String callerPackage, IIntentReceiver receiver, IntentFilter filter, String permission, int userId, int flags) { - return registerReceiverWithFeature(caller, callerPackage, null, receiver, filter, - permission, userId, flags); - } - - public Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage, - String callerFeatureId, IIntentReceiver receiver, IntentFilter filter, - String permission, int userId, int flags) { enforceNotIsolatedCaller("registerReceiver"); ArrayList<Intent> stickyIntents = null; ProcessRecord callerApp = null; @@ -15281,7 +15223,7 @@ public class ActivityManagerService extends IActivityManager.Stub + " was previously registered for user " + rl.userId + " callerPackage is " + callerPackage); } - BroadcastFilter bf = new BroadcastFilter(filter, rl, callerPackage, callerFeatureId, + BroadcastFilter bf = new BroadcastFilter(filter, rl, callerPackage, permission, callingUid, userId, instantApp, visibleToInstantApps); if (rl.containsFilter(filter)) { Slog.w(TAG, "Receiver with filter " + filter @@ -15306,7 +15248,7 @@ public class ActivityManagerService extends IActivityManager.Stub Intent intent = allSticky.get(i); BroadcastQueue queue = broadcastQueueForIntent(intent); BroadcastRecord r = new BroadcastRecord(queue, intent, null, - null, null, -1, -1, false, null, null, OP_NONE, null, receivers, + null, -1, -1, false, null, null, OP_NONE, null, receivers, null, 0, null, null, false, true, true, -1, false, false /* only PRE_BOOT_COMPLETED should be exempt, no stickies */); queue.enqueueParallelBroadcastLocked(r); @@ -15536,20 +15478,20 @@ public class ActivityManagerService extends IActivityManager.Stub @GuardedBy("this") final int broadcastIntentLocked(ProcessRecord callerApp, - String callerPackage, String callerFeatureId, Intent intent, String resolvedType, + String callerPackage, Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode, String resultData, Bundle resultExtras, String[] requiredPermissions, int appOp, Bundle bOptions, boolean ordered, boolean sticky, int callingPid, int callingUid, int realCallingUid, int realCallingPid, int userId) { - return broadcastIntentLocked(callerApp, callerPackage, callerFeatureId, intent, - resolvedType, resultTo, resultCode, resultData, resultExtras, requiredPermissions, - appOp, bOptions, ordered, sticky, callingPid, callingUid, realCallingUid, - realCallingPid, userId, false /* allowBackgroundActivityStarts */); + return broadcastIntentLocked(callerApp, callerPackage, intent, resolvedType, resultTo, + resultCode, resultData, resultExtras, requiredPermissions, appOp, bOptions, ordered, + sticky, callingPid, callingUid, realCallingUid, realCallingPid, userId, + false /* allowBackgroundActivityStarts */); } @GuardedBy("this") - final int broadcastIntentLocked(ProcessRecord callerApp, String callerPackage, - @Nullable String callerFeatureId, Intent intent, String resolvedType, + final int broadcastIntentLocked(ProcessRecord callerApp, + String callerPackage, Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode, String resultData, Bundle resultExtras, String[] requiredPermissions, int appOp, Bundle bOptions, boolean ordered, boolean sticky, int callingPid, int callingUid, int realCallingUid, @@ -16086,8 +16028,8 @@ public class ActivityManagerService extends IActivityManager.Stub isProtectedBroadcast, registeredReceivers); } final BroadcastQueue queue = broadcastQueueForIntent(intent); - BroadcastRecord r = new BroadcastRecord(queue, intent, callerApp, callerPackage, - callerFeatureId, callingPid, callingUid, callerInstantApp, resolvedType, + BroadcastRecord r = new BroadcastRecord(queue, intent, callerApp, + callerPackage, callingPid, callingUid, callerInstantApp, resolvedType, requiredPermissions, appOp, brOptions, registeredReceivers, resultTo, resultCode, resultData, resultExtras, ordered, sticky, false, userId, allowBackgroundActivityStarts, timeoutExempt); @@ -16183,8 +16125,8 @@ public class ActivityManagerService extends IActivityManager.Stub if ((receivers != null && receivers.size() > 0) || resultTo != null) { BroadcastQueue queue = broadcastQueueForIntent(intent); - BroadcastRecord r = new BroadcastRecord(queue, intent, callerApp, callerPackage, - callerFeatureId, callingPid, callingUid, callerInstantApp, resolvedType, + BroadcastRecord r = new BroadcastRecord(queue, intent, callerApp, + callerPackage, callingPid, callingUid, callerInstantApp, resolvedType, requiredPermissions, appOp, brOptions, receivers, resultTo, resultCode, resultData, resultExtras, ordered, sticky, false, userId, allowBackgroundActivityStarts, timeoutExempt); @@ -16303,25 +16245,11 @@ public class ActivityManagerService extends IActivityManager.Stub return intent; } - /** - * @deprecated Use {@link #broadcastIntentWithFeature} - */ - @Deprecated public final int broadcastIntent(IApplicationThread caller, Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode, String resultData, Bundle resultExtras, String[] requiredPermissions, int appOp, Bundle bOptions, boolean serialized, boolean sticky, int userId) { - return broadcastIntentWithFeature(caller, null, intent, resolvedType, resultTo, resultCode, - resultData, resultExtras, requiredPermissions, appOp, bOptions, serialized, sticky, - userId); - } - - public final int broadcastIntentWithFeature(IApplicationThread caller, String callingFeatureId, - Intent intent, String resolvedType, IIntentReceiver resultTo, - int resultCode, String resultData, Bundle resultExtras, - String[] requiredPermissions, int appOp, Bundle bOptions, - boolean serialized, boolean sticky, int userId) { enforceNotIsolatedCaller("broadcastIntent"); synchronized(this) { intent = verifyBroadcastLocked(intent); @@ -16333,7 +16261,7 @@ public class ActivityManagerService extends IActivityManager.Stub final long origId = Binder.clearCallingIdentity(); try { return broadcastIntentLocked(callerApp, - callerApp != null ? callerApp.info.packageName : null, callingFeatureId, + callerApp != null ? callerApp.info.packageName : null, intent, resolvedType, resultTo, resultCode, resultData, resultExtras, requiredPermissions, appOp, bOptions, serialized, sticky, callingPid, callingUid, callingUid, callingPid, userId); @@ -16343,9 +16271,9 @@ public class ActivityManagerService extends IActivityManager.Stub } } - 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, + 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, int userId, boolean allowBackgroundActivityStarts) { synchronized(this) { @@ -16355,10 +16283,11 @@ public class ActivityManagerService extends IActivityManager.Stub String[] requiredPermissions = requiredPermission == null ? null : new String[] {requiredPermission}; try { - return broadcastIntentLocked(null, packageName, featureId, intent, resolvedType, - resultTo, resultCode, resultData, resultExtras, requiredPermissions, - OP_NONE, bOptions, serialized, sticky, -1, uid, realCallingUid, - realCallingPid, userId, allowBackgroundActivityStarts); + return broadcastIntentLocked(null, packageName, intent, resolvedType, + resultTo, resultCode, resultData, resultExtras, + requiredPermissions, OP_NONE, bOptions, serialized, + sticky, -1, uid, realCallingUid, realCallingPid, userId, + allowBackgroundActivityStarts); } finally { Binder.restoreCallingIdentity(origId); } @@ -18962,24 +18891,23 @@ public class ActivityManagerService extends IActivityManager.Stub } @Override - public 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, - int userId, boolean allowBackgroundActivityStarts) { + public 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, int userId, + boolean allowBackgroundActivityStarts) { synchronized (ActivityManagerService.this) { - return ActivityManagerService.this.broadcastIntentInPackage(packageName, featureId, - uid, realCallingUid, realCallingPid, intent, resolvedType, resultTo, - resultCode, resultData, resultExtras, requiredPermission, bOptions, - serialized, sticky, userId, allowBackgroundActivityStarts); + return ActivityManagerService.this.broadcastIntentInPackage(packageName, uid, + realCallingUid, realCallingPid, intent, resolvedType, resultTo, resultCode, + resultData, resultExtras, requiredPermission, bOptions, serialized, sticky, + userId, allowBackgroundActivityStarts); } } @Override public ComponentName startServiceInPackage(int uid, Intent service, String resolvedType, - boolean fgRequired, String callingPackage, @Nullable String callingFeatureId, - int userId, boolean allowBackgroundActivityStarts) - throws TransactionTooLargeException { + boolean fgRequired, String callingPackage, int userId, + boolean allowBackgroundActivityStarts) throws TransactionTooLargeException { synchronized(ActivityManagerService.this) { if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "startServiceInPackage: " + service + " type=" + resolvedType); @@ -18987,8 +18915,8 @@ public class ActivityManagerService extends IActivityManager.Stub ComponentName res; try { res = mServices.startServiceLocked(null, service, - resolvedType, -1, uid, fgRequired, callingPackage, - callingFeatureId, userId, allowBackgroundActivityStarts); + resolvedType, -1, uid, fgRequired, callingPackage, userId, + allowBackgroundActivityStarts); } finally { Binder.restoreCallingIdentity(origId); } @@ -19081,7 +19009,7 @@ public class ActivityManagerService extends IActivityManager.Stub | Intent.FLAG_RECEIVER_REPLACE_PENDING | Intent.FLAG_RECEIVER_FOREGROUND | Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS); - broadcastIntentLocked(null, null, null, intent, null, null, 0, null, null, null, + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, OP_NONE, null, false, false, MY_PID, SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), UserHandle.USER_ALL); if ((changes & ActivityInfo.CONFIG_LOCALE) != 0) { @@ -19092,7 +19020,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (initLocale || !mProcessesReady) { intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); } - broadcastIntentLocked(null, null, null, intent, null, null, 0, null, null, null, + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, OP_NONE, null, false, false, MY_PID, SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), UserHandle.USER_ALL); } @@ -19107,7 +19035,7 @@ public class ActivityManagerService extends IActivityManager.Stub // Typically only app stores will have this permission. String[] permissions = new String[] { android.Manifest.permission.INSTALL_PACKAGES }; - broadcastIntentLocked(null, null, null, intent, null, null, 0, null, null, + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, permissions, OP_NONE, null, false, false, MY_PID, SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), UserHandle.USER_ALL); } @@ -19132,7 +19060,7 @@ public class ActivityManagerService extends IActivityManager.Stub intent.putExtra("reason", reason); } - broadcastIntentLocked(null, null, null, intent, null, null, 0, null, null, null, + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, OP_NONE, null, false, false, -1, SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), UserHandle.USER_ALL); } diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java index c0e98cd9b30a..53a967b0ce50 100644 --- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java +++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java @@ -534,13 +534,13 @@ final class ActivityManagerShellCommand extends ShellCommand { options.setLockTaskEnabled(true); } if (mWaitOption) { - result = mInternal.startActivityAndWait(null, SHELL_PACKAGE_NAME, null, intent, - mimeType, null, null, 0, mStartFlags, profilerInfo, + result = mInternal.startActivityAndWait(null, SHELL_PACKAGE_NAME, intent, mimeType, + null, null, 0, mStartFlags, profilerInfo, options != null ? options.toBundle() : null, mUserId); res = result.result; } else { - res = mInternal.startActivityAsUserWithFeature(null, SHELL_PACKAGE_NAME, null, - intent, mimeType, null, null, 0, mStartFlags, profilerInfo, + res = mInternal.startActivityAsUser(null, SHELL_PACKAGE_NAME, intent, mimeType, + null, null, 0, mStartFlags, profilerInfo, options != null ? options.toBundle() : null, mUserId); } final long endTime = SystemClock.uptimeMillis(); @@ -652,7 +652,7 @@ final class ActivityManagerShellCommand extends ShellCommand { pw.println("Starting service: " + intent); pw.flush(); ComponentName cn = mInterface.startService(null, intent, intent.getType(), - asForeground, SHELL_PACKAGE_NAME, null, mUserId); + asForeground, SHELL_PACKAGE_NAME, mUserId); if (cn == null) { err.println("Error: Not found; no service started."); return -1; @@ -742,9 +742,8 @@ final class ActivityManagerShellCommand extends ShellCommand { pw.println("Broadcasting: " + intent); pw.flush(); Bundle bundle = mBroadcastOptions == null ? null : mBroadcastOptions.toBundle(); - mInterface.broadcastIntentWithFeature(null, null, intent, null, receiver, 0, null, null, - requiredPermissions, android.app.AppOpsManager.OP_NONE, bundle, true, false, - mUserId); + mInterface.broadcastIntent(null, intent, null, receiver, 0, null, null, requiredPermissions, + android.app.AppOpsManager.OP_NONE, bundle, true, false, mUserId); receiver.waitForFinish(); return 0; } diff --git a/services/core/java/com/android/server/am/BroadcastFilter.java b/services/core/java/com/android/server/am/BroadcastFilter.java index 578db6f9dba1..1ec8db0aeec9 100644 --- a/services/core/java/com/android/server/am/BroadcastFilter.java +++ b/services/core/java/com/android/server/am/BroadcastFilter.java @@ -27,7 +27,6 @@ final class BroadcastFilter extends IntentFilter { // Back-pointer to the list this filter is in. final ReceiverList receiverList; final String packageName; - final String featureId; final String requiredPermission; final int owningUid; final int owningUserId; @@ -35,12 +34,11 @@ final class BroadcastFilter extends IntentFilter { final boolean visibleToInstantApp; BroadcastFilter(IntentFilter _filter, ReceiverList _receiverList, - String _packageName, String _featureId, String _requiredPermission, int _owningUid, int _userId, + String _packageName, String _requiredPermission, int _owningUid, int _userId, boolean _instantApp, boolean _visibleToInstantApp) { super(_filter); receiverList = _receiverList; packageName = _packageName; - featureId = _featureId; requiredPermission = _requiredPermission; owningUid = _owningUid; owningUserId = _userId; diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java index 26ef7073487d..6697b5ab7c85 100644 --- a/services/core/java/com/android/server/am/BroadcastQueue.java +++ b/services/core/java/com/android/server/am/BroadcastQueue.java @@ -648,10 +648,10 @@ public final class BroadcastQueue { skip = true; } else { final int opCode = AppOpsManager.permissionToOpCode(filter.requiredPermission); + // TODO moltmann: Set featureId from caller if (opCode != AppOpsManager.OP_NONE - && mService.getAppOpsManager().noteOpNoThrow(opCode, r.callingUid, - r.callerPackage, r.callerFeatureId, "") - != AppOpsManager.MODE_ALLOWED) { + && mService.mAppOpsService.noteOperation(opCode, r.callingUid, + r.callerPackage, null, false, "") != AppOpsManager.MODE_ALLOWED) { Slog.w(TAG, "Appop Denial: broadcasting " + r.intent.toString() + " from " + r.callerPackage + " (pid=" @@ -681,9 +681,10 @@ public final class BroadcastQueue { break; } int appOp = AppOpsManager.permissionToOpCode(requiredPermission); + // TODO moltmann: Set featureId from caller if (appOp != AppOpsManager.OP_NONE && appOp != r.appOp - && mService.getAppOpsManager().noteOpNoThrow(appOp, - filter.receiverList.uid, filter.packageName, filter.featureId, "") + && mService.mAppOpsService.noteOperation(appOp, + filter.receiverList.uid, filter.packageName, null, false, "") != AppOpsManager.MODE_ALLOWED) { Slog.w(TAG, "Appop Denial: receiving " + r.intent.toString() @@ -713,9 +714,10 @@ public final class BroadcastQueue { skip = true; } } + // TODO moltmann: Set featureId from caller if (!skip && r.appOp != AppOpsManager.OP_NONE - && mService.getAppOpsManager().noteOpNoThrow(r.appOp, - filter.receiverList.uid, filter.packageName, filter.featureId, "") + && mService.mAppOpsService.noteOperation(r.appOp, + filter.receiverList.uid, filter.packageName, null, false, "") != AppOpsManager.MODE_ALLOWED) { Slog.w(TAG, "Appop Denial: receiving " + r.intent.toString() @@ -861,8 +863,7 @@ public final class BroadcastQueue { if (callerForeground && receiverRecord.intent.getComponent() != null) { IIntentSender target = mService.mPendingIntentController.getIntentSender( ActivityManager.INTENT_SENDER_BROADCAST, receiverRecord.callerPackage, - receiverRecord.callerFeatureId, receiverRecord.callingUid, - receiverRecord.userId, null, null, 0, + receiverRecord.callingUid, receiverRecord.userId, null, null, 0, new Intent[]{receiverRecord.intent}, new String[]{receiverRecord.intent.resolveType(mService.mContext .getContentResolver())}, @@ -1370,9 +1371,10 @@ public final class BroadcastQueue { skip = true; } else if (!skip && info.activityInfo.permission != null) { final int opCode = AppOpsManager.permissionToOpCode(info.activityInfo.permission); + // TODO moltmann: Set featureId from caller if (opCode != AppOpsManager.OP_NONE - && mService.getAppOpsManager().noteOpNoThrow(opCode, r.callingUid, r.callerPackage, - r.callerFeatureId, "") != AppOpsManager.MODE_ALLOWED) { + && mService.mAppOpsService.noteOperation(opCode, r.callingUid, r.callerPackage, + null, false, "") != AppOpsManager.MODE_ALLOWED) { Slog.w(TAG, "Appop Denial: broadcasting " + r.intent.toString() + " from " + r.callerPackage + " (pid=" @@ -1408,10 +1410,11 @@ public final class BroadcastQueue { break; } int appOp = AppOpsManager.permissionToOpCode(requiredPermission); + // TODO moltmann: Set featureId from caller if (appOp != AppOpsManager.OP_NONE && appOp != r.appOp - && mService.getAppOpsManager().noteOpNoThrow(appOp, - info.activityInfo.applicationInfo.uid, info.activityInfo.packageName, - null /* default featureId */, "") + && mService.mAppOpsService.noteOperation(appOp, + info.activityInfo.applicationInfo.uid, info.activityInfo.packageName, null, + false, "") != AppOpsManager.MODE_ALLOWED) { Slog.w(TAG, "Appop Denial: receiving " + r.intent + " to " @@ -1425,10 +1428,11 @@ public final class BroadcastQueue { } } } + // TODO moltmann: Set featureId from caller if (!skip && r.appOp != AppOpsManager.OP_NONE - && mService.getAppOpsManager().noteOpNoThrow(r.appOp, - info.activityInfo.applicationInfo.uid, info.activityInfo.packageName, - null /* default featureId */, "") + && mService.mAppOpsService.noteOperation(r.appOp, + info.activityInfo.applicationInfo.uid, info.activityInfo.packageName, null, false, + "") != AppOpsManager.MODE_ALLOWED) { Slog.w(TAG, "Appop Denial: receiving " + r.intent + " to " diff --git a/services/core/java/com/android/server/am/BroadcastRecord.java b/services/core/java/com/android/server/am/BroadcastRecord.java index 8ef67f97e8d4..f2638861d39b 100644 --- a/services/core/java/com/android/server/am/BroadcastRecord.java +++ b/services/core/java/com/android/server/am/BroadcastRecord.java @@ -16,7 +16,6 @@ package com.android.server.am; -import android.annotation.Nullable; import android.app.AppOpsManager; import android.app.BroadcastOptions; import android.content.ComponentName; @@ -52,7 +51,6 @@ final class BroadcastRecord extends Binder { final ComponentName targetComp; // original component name set on the intent final ProcessRecord callerApp; // process that sent this final String callerPackage; // who sent this - final @Nullable String callerFeatureId; // which feature in the package sent this final int callingPid; // the pid of who sent this final int callingUid; // the uid of who sent this final boolean callerInstantApp; // caller is an Instant App? @@ -235,8 +233,7 @@ final class BroadcastRecord extends Binder { BroadcastRecord(BroadcastQueue _queue, Intent _intent, ProcessRecord _callerApp, String _callerPackage, - @Nullable String _callerFeatureId, int _callingPid, int _callingUid, - boolean _callerInstantApp, String _resolvedType, + int _callingPid, int _callingUid, boolean _callerInstantApp, String _resolvedType, String[] _requiredPermissions, int _appOp, BroadcastOptions _options, List _receivers, IIntentReceiver _resultTo, int _resultCode, String _resultData, Bundle _resultExtras, boolean _serialized, boolean _sticky, boolean _initialSticky, int _userId, @@ -249,7 +246,6 @@ final class BroadcastRecord extends Binder { targetComp = _intent.getComponent(); callerApp = _callerApp; callerPackage = _callerPackage; - callerFeatureId = _callerFeatureId; callingPid = _callingPid; callingUid = _callingUid; callerInstantApp = _callerInstantApp; @@ -284,7 +280,6 @@ final class BroadcastRecord extends Binder { callerApp = from.callerApp; callerPackage = from.callerPackage; - callerFeatureId = from.callerFeatureId; callingPid = from.callingPid; callingUid = from.callingUid; callerInstantApp = from.callerInstantApp; @@ -348,8 +343,8 @@ final class BroadcastRecord extends Binder { } // build a new BroadcastRecord around that single-target list - BroadcastRecord split = new BroadcastRecord(queue, intent, callerApp, callerPackage, - callerFeatureId, callingPid, callingUid, callerInstantApp, resolvedType, + BroadcastRecord split = new BroadcastRecord(queue, intent, callerApp, + callerPackage, callingPid, callingUid, callerInstantApp, resolvedType, requiredPermissions, appOp, options, splitReceivers, resultTo, resultCode, resultData, resultExtras, ordered, sticky, initialSticky, userId, allowBackgroundActivityStarts, timeoutExempt); diff --git a/services/core/java/com/android/server/am/PendingIntentController.java b/services/core/java/com/android/server/am/PendingIntentController.java index eacf08889b1d..df76713d58a6 100644 --- a/services/core/java/com/android/server/am/PendingIntentController.java +++ b/services/core/java/com/android/server/am/PendingIntentController.java @@ -23,7 +23,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_MU; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; -import android.annotation.Nullable; import android.app.Activity; import android.app.ActivityManagerInternal; import android.app.AppGlobals; @@ -89,9 +88,9 @@ public class PendingIntentController { } } - public PendingIntentRecord getIntentSender(int type, String packageName, - @Nullable String featureId, int callingUid, int userId, IBinder token, String resultWho, - int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle bOptions) { + public PendingIntentRecord getIntentSender(int type, String packageName, int callingUid, + int userId, IBinder token, String resultWho, int requestCode, Intent[] intents, + String[] resolvedTypes, int flags, Bundle bOptions) { synchronized (mLock) { if (DEBUG_MU) Slog.v(TAG_MU, "getIntentSender(): uid=" + callingUid); @@ -110,8 +109,8 @@ public class PendingIntentController { flags &= ~(PendingIntent.FLAG_NO_CREATE | PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_UPDATE_CURRENT); - PendingIntentRecord.Key key = new PendingIntentRecord.Key(type, packageName, featureId, - token, resultWho, requestCode, intents, resolvedTypes, flags, + PendingIntentRecord.Key key = new PendingIntentRecord.Key(type, packageName, token, + resultWho, requestCode, intents, resolvedTypes, flags, SafeActivityOptions.fromBundle(bOptions), userId); WeakReference<PendingIntentRecord> ref; ref = mIntentSenderRecords.get(key); diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java index d54d2d7d2056..3ba2210504d6 100644 --- a/services/core/java/com/android/server/am/PendingIntentRecord.java +++ b/services/core/java/com/android/server/am/PendingIntentRecord.java @@ -17,16 +17,14 @@ package com.android.server.am; import static android.app.ActivityManager.START_SUCCESS; - import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; -import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityOptions; -import android.app.PendingIntent; -import android.content.IIntentReceiver; import android.content.IIntentSender; +import android.content.IIntentReceiver; +import android.app.PendingIntent; import android.content.Intent; import android.os.Binder; import android.os.Bundle; @@ -74,7 +72,6 @@ public final class PendingIntentRecord extends IIntentSender.Stub { final static class Key { final int type; final String packageName; - final String featureId; final IBinder activity; final String who; final int requestCode; @@ -89,11 +86,10 @@ public final class PendingIntentRecord extends IIntentSender.Stub { private static final int ODD_PRIME_NUMBER = 37; - Key(int _t, String _p, @Nullable String _featureId, IBinder _a, String _w, + Key(int _t, String _p, IBinder _a, String _w, int _r, Intent[] _i, String[] _it, int _f, SafeActivityOptions _o, int _userId) { type = _t; packageName = _p; - featureId = _featureId; activity = _a; who = _w; requestCode = _r; @@ -144,9 +140,6 @@ public final class PendingIntentRecord extends IIntentSender.Stub { if (!Objects.equals(packageName, other.packageName)) { return false; } - if (!Objects.equals(featureId, other.featureId)) { - return false; - } if (activity != other.activity) { return false; } @@ -182,8 +175,7 @@ public final class PendingIntentRecord extends IIntentSender.Stub { } public String toString() { - return "Key{" + typeName() - + " pkg=" + packageName + (featureId != null ? "/" + featureId : "") + return "Key{" + typeName() + " pkg=" + packageName + " intent=" + (requestIntent != null ? requestIntent.toShortString(false, true, false, false) : "<null>") @@ -411,20 +403,19 @@ public final class PendingIntentRecord extends IIntentSender.Stub { if (key.allIntents != null && key.allIntents.length > 1) { res = controller.mAtmInternal.startActivitiesInPackage( - uid, callingPid, callingUid, key.packageName, key.featureId, - allIntents, allResolvedTypes, resultTo, mergedOptions, userId, + uid, callingPid, callingUid, key.packageName, allIntents, + allResolvedTypes, resultTo, mergedOptions, userId, false /* validateIncomingUser */, this /* originatingPendingIntent */, mAllowBgActivityStartsForActivitySender.contains(whitelistToken)); } else { - res = controller.mAtmInternal.startActivityInPackage(uid, callingPid, - callingUid, key.packageName, key.featureId, finalIntent, + res = controller.mAtmInternal.startActivityInPackage( + uid, callingPid, callingUid, key.packageName, finalIntent, resolvedType, resultTo, resultWho, requestCode, 0, mergedOptions, userId, null, "PendingIntentRecord", false /* validateIncomingUser */, this /* originatingPendingIntent */, - mAllowBgActivityStartsForActivitySender.contains( - whitelistToken)); + mAllowBgActivityStartsForActivitySender.contains(whitelistToken)); } } catch (RuntimeException e) { Slog.w(TAG, "Unable to send startActivity intent", e); @@ -439,12 +430,11 @@ public final class PendingIntentRecord extends IIntentSender.Stub { // If a completion callback has been requested, require // that the broadcast be delivered synchronously int sent = controller.mAmInternal.broadcastIntentInPackage(key.packageName, - key.featureId, uid, callingUid, callingPid, finalIntent, - resolvedType, finishedReceiver, code, null, null, - requiredPermission, options, (finishedReceiver != null), false, - userId, + uid, callingUid, callingPid, finalIntent, resolvedType, + finishedReceiver, code, null, null, requiredPermission, options, + (finishedReceiver != null), false, userId, mAllowBgActivityStartsForBroadcastSender.contains(whitelistToken) - || allowTrampoline); + || allowTrampoline); if (sent == ActivityManager.BROADCAST_SUCCESS) { sendFinish = false; } @@ -457,7 +447,7 @@ public final class PendingIntentRecord extends IIntentSender.Stub { try { controller.mAmInternal.startServiceInPackage(uid, finalIntent, resolvedType, key.type == ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE, - key.packageName, key.featureId, userId, + key.packageName, userId, mAllowBgActivityStartsForServiceSender.contains(whitelistToken) || allowTrampoline); } catch (RuntimeException e) { @@ -506,7 +496,6 @@ public final class PendingIntentRecord extends IIntentSender.Stub { public void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("uid="); pw.print(uid); pw.print(" packageName="); pw.print(key.packageName); - pw.print(" featureId="); pw.print(key.featureId); pw.print(" type="); pw.print(key.typeName()); pw.print(" flags=0x"); pw.println(Integer.toHexString(key.flags)); if (key.activity != null || key.who != null) { @@ -556,10 +545,6 @@ public final class PendingIntentRecord extends IIntentSender.Stub { sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(' '); sb.append(key.packageName); - if (key.featureId != null) { - sb.append('/'); - sb.append(key.featureId); - } sb.append(' '); sb.append(key.typeName()); if (whitelistDuration != null) { diff --git a/services/core/java/com/android/server/am/PreBootBroadcaster.java b/services/core/java/com/android/server/am/PreBootBroadcaster.java index 747e8a89f8e7..beb0e4741c36 100644 --- a/services/core/java/com/android/server/am/PreBootBroadcaster.java +++ b/services/core/java/com/android/server/am/PreBootBroadcaster.java @@ -108,8 +108,8 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub { mIntent.setComponent(componentName); synchronized (mService) { - mService.broadcastIntentLocked(null, null, null, mIntent, null, this, 0, null, null, - null, AppOpsManager.OP_NONE, null, true, false, ActivityManagerService.MY_PID, + mService.broadcastIntentLocked(null, null, mIntent, null, this, 0, null, null, null, + AppOpsManager.OP_NONE, null, true, false, ActivityManagerService.MY_PID, Process.SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), mUserId); } } diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index e575e10807bc..c75ee04543e3 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -2447,10 +2447,10 @@ class UserController implements Handler.Callback { int realCallingPid, @UserIdInt int userId) { // TODO b/64165549 Verify that mLock is not held before calling AMS methods synchronized (mService) { - return mService.broadcastIntentLocked(null, null, null, intent, resolvedType, - resultTo, resultCode, resultData, resultExtras, requiredPermissions, appOp, - bOptions, ordered, sticky, callingPid, callingUid, realCallingUid, - realCallingPid, userId); + return mService.broadcastIntentLocked(null, null, intent, resolvedType, resultTo, + resultCode, resultData, resultExtras, requiredPermissions, appOp, bOptions, + ordered, sticky, callingPid, callingUid, realCallingUid, realCallingPid, + userId); } } diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java index d75eb6d65b03..3c31f6a7f0d7 100644 --- a/services/core/java/com/android/server/om/OverlayManagerService.java +++ b/services/core/java/com/android/server/om/OverlayManagerService.java @@ -913,9 +913,9 @@ public final class OverlayManagerService extends SystemService { } try { - ActivityManager.getService().broadcastIntentWithFeature(null, null, intent, - null, null, 0, null, null, null, android.app.AppOpsManager.OP_NONE, - null, false, false, userId); + ActivityManager.getService().broadcastIntent(null, intent, null, null, 0, + null, null, null, android.app.AppOpsManager.OP_NONE, null, false, false, + userId); } catch (RemoteException e) { // Intentionally left empty. } diff --git a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java index cd4485e67064..74d2efeceb63 100644 --- a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java +++ b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java @@ -44,7 +44,9 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.ResolveInfo; import android.os.Binder; +import android.os.IBinder; import android.os.RemoteException; +import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.stats.devicepolicy.DevicePolicyEnums; @@ -52,8 +54,10 @@ import android.text.TextUtils; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.app.IAppOpsService; import com.android.internal.util.ArrayUtils; import com.android.server.LocalServices; +import com.android.server.appop.AppOpsService; import com.android.server.wm.ActivityTaskManagerInternal; import java.util.ArrayList; @@ -65,7 +69,7 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { private Context mContext; private Injector mInjector; - private AppOpsManager mAppOpsManager; + private AppOpsService mAppOpsService; public CrossProfileAppsServiceImpl(Context context) { this(context, new InjectorImpl(context)); @@ -96,7 +100,6 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { public void startActivityAsUser( IApplicationThread caller, String callingPackage, - String callingFeatureId, ComponentName component, @UserIdInt int userId, boolean launchMainActivity) throws RemoteException { @@ -162,7 +165,7 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { launchIntent.setPackage(null); launchIntent.setComponent(component); mInjector.getActivityTaskManagerInternal().startActivityAsUser( - caller, callingPackage, callingFeatureId, launchIntent, + caller, callingPackage, launchIntent, launchMainActivity ? ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle() : null, @@ -173,7 +176,6 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { public void startActivityAsUserByIntent( IApplicationThread caller, String callingPackage, - String callingFeatureId, Intent intent, @UserIdInt int userId) throws RemoteException { Objects.requireNonNull(callingPackage); @@ -210,8 +212,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { verifyActivityCanHandleIntent(launchIntent, callingUid, userId); - mInjector.getActivityTaskManagerInternal().startActivityAsUser(caller, callingPackage, - callingFeatureId, launchIntent, /* options= */ null, userId); + mInjector.getActivityTaskManagerInternal().startActivityAsUser( + caller, callingPackage, launchIntent, /* options= */ null, userId); } @Override @@ -543,11 +545,12 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { permission, uid, /* owningUid= */-1, /* exported= */ true); } - private AppOpsManager getAppOpsManager() { - if (mAppOpsManager == null) { - mAppOpsManager = mContext.getSystemService(AppOpsManager.class); + private AppOpsService getAppOpsService() { + if (mAppOpsService == null) { + IBinder b = ServiceManager.getService(Context.APP_OPS_SERVICE); + mAppOpsService = (AppOpsService) IAppOpsService.Stub.asInterface(b); } - return mAppOpsManager; + return mAppOpsService; } private static class InjectorImpl implements Injector { diff --git a/services/core/java/com/android/server/pm/InstantAppResolver.java b/services/core/java/com/android/server/pm/InstantAppResolver.java index 0b0f13929b2a..8333ae5cbbad 100644 --- a/services/core/java/com/android/server/pm/InstantAppResolver.java +++ b/services/core/java/com/android/server/pm/InstantAppResolver.java @@ -222,7 +222,6 @@ public abstract class InstantAppResolver { sanitizedIntent, failureIntent, requestObj.callingPackage, - requestObj.callingFeatureId, requestObj.verificationBundle, requestObj.resolvedType, requestObj.userId, @@ -267,7 +266,6 @@ public abstract class InstantAppResolver { @NonNull Intent sanitizedIntent, @Nullable Intent failureIntent, @NonNull String callingPackage, - @Nullable String callingFeatureId, @Nullable Bundle verificationBundle, @NonNull String resolvedType, int userId, @@ -310,10 +308,9 @@ public abstract class InstantAppResolver { onFailureIntent = failureIntent; } final IIntentSender failureIntentTarget = ActivityManager.getService() - .getIntentSenderWithFeature( + .getIntentSender( ActivityManager.INTENT_SENDER_ACTIVITY, callingPackage, - callingFeatureId, null /*token*/, null /*resultWho*/, - 1 /*requestCode*/, + null /*token*/, null /*resultWho*/, 1 /*requestCode*/, new Intent[] { onFailureIntent }, new String[] { resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT @@ -331,10 +328,9 @@ public abstract class InstantAppResolver { successIntent.setLaunchToken(token); try { final IIntentSender successIntentTarget = ActivityManager.getService() - .getIntentSenderWithFeature( + .getIntentSender( ActivityManager.INTENT_SENDER_ACTIVITY, callingPackage, - callingFeatureId, null /*token*/, null /*resultWho*/, - 0 /*requestCode*/, + null /*token*/, null /*resultWho*/, 0 /*requestCode*/, new Intent[] { successIntent }, new String[] { resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java index 12b9743f94a3..3e64e9828c3e 100644 --- a/services/core/java/com/android/server/pm/LauncherAppsService.java +++ b/services/core/java/com/android/server/pm/LauncherAppsService.java @@ -17,7 +17,6 @@ package com.android.server.pm; import android.annotation.NonNull; -import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.ActivityManagerInternal; @@ -742,9 +741,8 @@ public class LauncherAppsService extends SystemService { } @Override - public boolean startShortcut(String callingPackage, String packageName, String featureId, - String shortcutId, Rect sourceBounds, Bundle startActivityOptions, - int targetUserId) { + public boolean startShortcut(String callingPackage, String packageName, String shortcutId, + Rect sourceBounds, Bundle startActivityOptions, int targetUserId) { verifyCallingPackage(callingPackage); if (!canAccessProfile(targetUserId, "Cannot start activity")) { return false; @@ -768,16 +766,15 @@ public class LauncherAppsService extends SystemService { intents[0].setSourceBounds(sourceBounds); return startShortcutIntentsAsPublisher( - intents, packageName, featureId, startActivityOptions, targetUserId); + intents, packageName, startActivityOptions, targetUserId); } private boolean startShortcutIntentsAsPublisher(@NonNull Intent[] intents, - @NonNull String publisherPackage, @Nullable String publishedFeatureId, - Bundle startActivityOptions, int userId) { + @NonNull String publisherPackage, Bundle startActivityOptions, int userId) { final int code; try { code = mActivityTaskManagerInternal.startActivitiesAsPackage(publisherPackage, - publishedFeatureId, userId, intents, startActivityOptions); + userId, intents, startActivityOptions); if (ActivityManager.isStartResultSuccessful(code)) { return true; // Success } else { @@ -832,8 +829,8 @@ public class LauncherAppsService extends SystemService { @Override public void startSessionDetailsActivityAsUser(IApplicationThread caller, - String callingPackage, String callingFeatureId, SessionInfo sessionInfo, - Rect sourceBounds, Bundle opts, UserHandle userHandle) throws RemoteException { + String callingPackage, SessionInfo sessionInfo, Rect sourceBounds, + Bundle opts, UserHandle userHandle) throws RemoteException { int userId = userHandle.getIdentifier(); if (!canAccessProfile(userId, "Cannot start details activity")) { return; @@ -849,13 +846,13 @@ public class LauncherAppsService extends SystemService { .authority(callingPackage).build()); i.setSourceBounds(sourceBounds); - mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, - callingFeatureId, i, opts, userId); + mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, i, opts, + userId); } @Override public void startActivityAsUser(IApplicationThread caller, String callingPackage, - String callingFeatureId, ComponentName component, Rect sourceBounds, + ComponentName component, Rect sourceBounds, Bundle opts, UserHandle user) throws RemoteException { if (!canAccessProfile(user.getIdentifier(), "Cannot start activity")) { return; @@ -909,12 +906,12 @@ public class LauncherAppsService extends SystemService { Binder.restoreCallingIdentity(ident); } mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, - callingFeatureId, launchIntent, opts, user.getIdentifier()); + launchIntent, opts, user.getIdentifier()); } @Override public void showAppDetailsAsUser(IApplicationThread caller, - String callingPackage, String callingFeatureId, ComponentName component, + String callingPackage, ComponentName component, Rect sourceBounds, Bundle opts, UserHandle user) throws RemoteException { if (!canAccessProfile(user.getIdentifier(), "Cannot show app details")) { return; @@ -932,7 +929,7 @@ public class LauncherAppsService extends SystemService { Binder.restoreCallingIdentity(ident); } mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, - callingFeatureId, intent, opts, user.getIdentifier()); + intent, opts, user.getIdentifier()); } /** Checks if user is a profile of or same as listeningUser. diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 6dd5ea26dd14..c85859072d89 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -6298,11 +6298,10 @@ public class PackageManagerService extends IPackageManager.Stub private void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj, Intent origIntent, String resolvedType, String callingPackage, - @Nullable String callingFeatureId, boolean isRequesterInstantApp, - Bundle verificationBundle, int userId) { + boolean isRequesterInstantApp, Bundle verificationBundle, int userId) { final Message msg = mHandler.obtainMessage(INSTANT_APP_RESOLUTION_PHASE_TWO, new InstantAppRequest(responseObj, origIntent, resolvedType, - callingPackage, callingFeatureId, isRequesterInstantApp, userId, verificationBundle, + callingPackage, isRequesterInstantApp, userId, verificationBundle, false /*resolveForStart*/, responseObj.hostDigestPrefixSecure, responseObj.token)); mHandler.sendMessage(msg); @@ -6988,10 +6987,10 @@ public class PackageManagerService extends IPackageManager.Stub Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "resolveEphemeral"); String token = UUID.randomUUID().toString(); InstantAppDigest digest = InstantAppResolver.parseDigest(intent); - final InstantAppRequest requestObject = new InstantAppRequest(null /*responseObj*/, - intent /*origIntent*/, resolvedType, null /*callingPackage*/, - null /*callingFeatureId*/, isRequesterInstantApp, userId, - null /*verificationBundle*/, resolveForStart, + final InstantAppRequest requestObject = new InstantAppRequest( + null /*responseObj*/, intent /*origIntent*/, resolvedType, + null /*callingPackage*/, isRequesterInstantApp, + userId, null /*verificationBundle*/, resolveForStart, digest.getDigestPrefixSecure(), token); auxiliaryResponse = InstantAppResolver.doInstantAppResolutionPhaseOne( mInstantAppResolverConnection, requestObject); @@ -12207,7 +12206,7 @@ public class PackageManagerService extends IPackageManager.Stub + intent.toShortString(false, true, false, false) + " " + intent.getExtras(), here); } - am.broadcastIntentWithFeature(null, null, intent, null, finishedReceiver, + am.broadcastIntent(null, intent, null, finishedReceiver, 0, null, null, requiredPermissions, android.app.AppOpsManager.OP_NONE, null, finishedReceiver != null, false, id); } @@ -12369,9 +12368,8 @@ public class PackageManagerService extends IPackageManager.Stub lockedBcIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); } final String[] requiredPermissions = {Manifest.permission.RECEIVE_BOOT_COMPLETED}; - am.broadcastIntentWithFeature(null, null, lockedBcIntent, null, null, 0, null, null, - requiredPermissions, android.app.AppOpsManager.OP_NONE, null, false, false, - userId); + am.broadcastIntent(null, lockedBcIntent, null, null, 0, null, null, requiredPermissions, + android.app.AppOpsManager.OP_NONE, null, false, false, userId); // Deliver BOOT_COMPLETED only if user is unlocked if (mUserManager.isUserUnlockingOrUnlocked(userId)) { @@ -12379,9 +12377,8 @@ public class PackageManagerService extends IPackageManager.Stub if (includeStopped) { bcIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); } - am.broadcastIntentWithFeature(null, null, bcIntent, null, null, 0, null, null, - requiredPermissions, android.app.AppOpsManager.OP_NONE, null, false, false, - userId); + am.broadcastIntent(null, bcIntent, null, null, 0, null, null, requiredPermissions, + android.app.AppOpsManager.OP_NONE, null, false, false, userId); } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -18772,7 +18769,7 @@ public class PackageManagerService extends IPackageManager.Stub intent.putExtra(Intent.EXTRA_USER_HANDLE, userId); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); try { - am.broadcastIntentWithFeature(null, null, intent, null, null, + am.broadcastIntent(null, intent, null, null, 0, null, null, null, android.app.AppOpsManager.OP_NONE, null, false, false, userId); } catch (RemoteException e) { @@ -23416,10 +23413,9 @@ public class PackageManagerService extends IPackageManager.Stub @Override public void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj, Intent origIntent, String resolvedType, String callingPackage, - @Nullable String callingFeatureId, boolean isRequesterInstantApp, - Bundle verificationBundle, int userId) { - PackageManagerService.this.requestInstantAppResolutionPhaseTwo(responseObj, origIntent, - resolvedType, callingPackage, callingFeatureId, isRequesterInstantApp, + boolean isRequesterInstantApp, Bundle verificationBundle, int userId) { + PackageManagerService.this.requestInstantAppResolutionPhaseTwo( + responseObj, origIntent, resolvedType, callingPackage, isRequesterInstantApp, verificationBundle, userId); } @@ -24329,9 +24325,8 @@ public class PackageManagerService extends IPackageManager.Stub Manifest.permission.RECEIVE_DEVICE_CUSTOMIZATION_READY, }; try { - am.broadcastIntentWithFeature(null, null, intent, null, null, 0, null, null, - requiredPermissions, android.app.AppOpsManager.OP_NONE, null, false, false, - UserHandle.USER_ALL); + am.broadcastIntent(null, intent, null, null, 0, null, null, requiredPermissions, + android.app.AppOpsManager.OP_NONE, null, false, false, UserHandle.USER_ALL); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 4b2dc85c6667..ede04f3bbb14 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -5195,8 +5195,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final Intent dock = createHomeDockIntent(); if (dock != null) { int result = ActivityTaskManager.getService() - .startActivityAsUser(null, mContext.getBasePackageName(), - mContext.getFeatureId(), dock, + .startActivityAsUser(null, mContext.getBasePackageName(), dock, dock.resolveTypeIfNeeded(mContext.getContentResolver()), null, null, 0, ActivityManager.START_FLAG_ONLY_IF_NEEDED, @@ -5207,8 +5206,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } int result = ActivityTaskManager.getService() - .startActivityAsUser(null, mContext.getBasePackageName(), - mContext.getFeatureId(), mHomeIntent, + .startActivityAsUser(null, mContext.getBasePackageName(), mHomeIntent, mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()), null, null, 0, ActivityManager.START_FLAG_ONLY_IF_NEEDED, diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index ad57e1f675d5..a54f5d43751c 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -362,7 +362,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private static final String TAG_PERSISTABLEBUNDLE = "persistable_bundle"; private static final String ATTR_LAUNCHEDFROMUID = "launched_from_uid"; private static final String ATTR_LAUNCHEDFROMPACKAGE = "launched_from_package"; - private static final String ATTR_LAUNCHEDFROMFEATURE = "launched_from_feature"; private static final String ATTR_RESOLVEDTYPE = "resolved_type"; private static final String ATTR_COMPONENTSPECIFIED = "component_specified"; static final String ACTIVITY_ICON_SUFFIX = "_activity_icon_"; @@ -423,7 +422,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final int launchedFromPid; // always the pid who started the activity. final int launchedFromUid; // always the uid who started the activity. final String launchedFromPackage; // always the package who started the activity. - final @Nullable String launchedFromFeatureId; // always the feature in launchedFromPackage final Intent intent; // the original intent that generated us final String shortComponentName; // the short component name of the intent final String resolvedType; // as per original caller; @@ -775,7 +773,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.print(" processName="); pw.println(processName); pw.print(prefix); pw.print("launchedFromUid="); pw.print(launchedFromUid); pw.print(" launchedFromPackage="); pw.print(launchedFromPackage); - pw.print(" launchedFromFeature="); pw.print(launchedFromFeatureId); pw.print(" userId="); pw.println(mUserId); pw.print(prefix); pw.print("app="); pw.println(app); pw.print(prefix); pw.println(intent.toInsecureString()); @@ -1486,10 +1483,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } ActivityRecord(ActivityTaskManagerService _service, WindowProcessController _caller, - int _launchedFromPid, int _launchedFromUid, String _launchedFromPackage, - @Nullable String _launchedFromFeature, Intent _intent, String _resolvedType, - ActivityInfo aInfo, Configuration _configuration, ActivityRecord _resultTo, - String _resultWho, int _reqCode, boolean _componentSpecified, + int _launchedFromPid, int _launchedFromUid, String _launchedFromPackage, Intent _intent, + String _resolvedType, ActivityInfo aInfo, Configuration _configuration, + ActivityRecord _resultTo, String _resultWho, int _reqCode, boolean _componentSpecified, boolean _rootVoiceInteraction, ActivityStackSupervisor supervisor, ActivityOptions options, ActivityRecord sourceRecord) { super(_service.mWindowManager, new Token(_intent).asBinder(), TYPE_APPLICATION, true, @@ -1568,7 +1564,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A launchedFromPid = _launchedFromPid; launchedFromUid = _launchedFromUid; launchedFromPackage = _launchedFromPackage; - launchedFromFeatureId = _launchedFromFeature; shortComponentName = _intent.getComponent().flattenToShortString(); resolvedType = _resolvedType; componentSpecified = _componentSpecified; @@ -2289,7 +2284,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * @return Whether AppOps allows this package to enter picture-in-picture. */ private boolean checkEnterPictureInPictureAppOpsState() { - return mAtmService.getAppOpsManager().checkOpNoThrow( + return mAtmService.getAppOpsService().checkOperation( OP_PICTURE_IN_PICTURE, info.applicationInfo.uid, packageName) == MODE_ALLOWED; } @@ -7287,9 +7282,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (launchedFromPackage != null) { out.attribute(null, ATTR_LAUNCHEDFROMPACKAGE, launchedFromPackage); } - if (launchedFromFeatureId != null) { - out.attribute(null, ATTR_LAUNCHEDFROMFEATURE, launchedFromFeatureId); - } if (resolvedType != null) { out.attribute(null, ATTR_RESOLVEDTYPE, resolvedType); } @@ -7317,7 +7309,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A PersistableBundle persistentState = null; int launchedFromUid = 0; String launchedFromPackage = null; - String launchedFromFeature = null; String resolvedType = null; boolean componentSpecified = false; int userId = 0; @@ -7336,8 +7327,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A launchedFromUid = Integer.parseInt(attrValue); } else if (ATTR_LAUNCHEDFROMPACKAGE.equals(attrName)) { launchedFromPackage = attrValue; - } else if (ATTR_LAUNCHEDFROMFEATURE.equals(attrName)) { - launchedFromFeature = attrValue; } else if (ATTR_RESOLVEDTYPE.equals(attrName)) { resolvedType = attrValue; } else if (ATTR_COMPONENTSPECIFIED.equals(attrName)) { @@ -7385,11 +7374,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A " resolvedType=" + resolvedType); } final ActivityRecord r = new ActivityRecord(service, null /* caller */, - 0 /* launchedFromPid */, launchedFromUid, launchedFromPackage, launchedFromFeature, - intent, resolvedType, aInfo, service.getConfiguration(), null /* resultTo */, - null /* resultWho */, 0 /* reqCode */, componentSpecified, - false /* rootVoiceInteraction */, stackSupervisor, null /* options */, - null /* sourceRecord */); + 0 /* launchedFromPid */, launchedFromUid, launchedFromPackage, intent, resolvedType, + aInfo, service.getConfiguration(), null /* resultTo */, null /* resultWho */, + 0 /* reqCode */, componentSpecified, false /* rootVoiceInteraction */, + stackSupervisor, null /* options */, null /* sourceRecord */); r.mPersistentState = persistentState; r.taskDescription = taskDescription; diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 9030fce7cfcc..d380f8cd7337 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -135,7 +135,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static java.lang.Integer.MAX_VALUE; import android.annotation.IntDef; -import android.annotation.Nullable; import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManagerInternal; @@ -623,7 +622,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget { true /*neverRelinquishIdentity*/, _taskDescription != null ? _taskDescription : new ActivityManager.TaskDescription(), id, INVALID_TASK_ID, INVALID_TASK_ID, 0 /*taskAffiliationColor*/, - info.applicationInfo.uid, info.packageName, null, info.resizeMode, + info.applicationInfo.uid, info.packageName, info.resizeMode, info.supportsPictureInPicture(), false /*_realActivitySuspended*/, false /*userSetupComplete*/, INVALID_MIN_SIZE, INVALID_MIN_SIZE, info, _voiceSession, _voiceInteractor, stack); @@ -636,16 +635,15 @@ class ActivityStack extends Task implements BoundsAnimationTarget { String _lastDescription, long lastTimeMoved, boolean neverRelinquishIdentity, ActivityManager.TaskDescription _lastTaskDescription, int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor, int callingUid, - String callingPackage, @Nullable String callingFeatureId, int resizeMode, - boolean supportsPictureInPicture, boolean _realActivitySuspended, - boolean userSetupComplete, int minWidth, int minHeight, + String callingPackage, int resizeMode, boolean supportsPictureInPicture, + boolean _realActivitySuspended, boolean userSetupComplete, int minWidth, int minHeight, ActivityInfo info, IVoiceInteractionSession _voiceSession, IVoiceInteractor _voiceInteractor, ActivityStack stack) { super(atmService, id, _intent, _affinityIntent, _affinity, _rootAffinity, _realActivity, _origActivity, _rootWasReset, _autoRemoveRecents, _askedCompatMode, _userId, _effectiveUid, _lastDescription, lastTimeMoved, neverRelinquishIdentity, _lastTaskDescription, taskAffiliation, prevTaskId, nextTaskId, taskAffiliationColor, - callingUid, callingPackage, callingFeatureId, resizeMode, supportsPictureInPicture, + callingUid, callingPackage, resizeMode, supportsPictureInPicture, _realActivitySuspended, userSetupComplete, minWidth, minHeight, info, _voiceSession, _voiceInteractor, stack); @@ -2926,7 +2924,6 @@ class ActivityStack extends Task implements BoundsAnimationTarget { .setCallingPid(-1) .setCallingUid(parent.launchedFromUid) .setCallingPackage(parent.launchedFromPackage) - .setCallingFeatureId(parent.launchedFromFeatureId) .setRealCallingPid(-1) .setRealCallingUid(parent.launchedFromUid) .setComponentSpecified(true) diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java index a582f2159dfc..a513ef8f3190 100644 --- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java @@ -88,7 +88,6 @@ import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION; import static com.android.server.wm.WindowContainer.POSITION_TOP; import android.Manifest; -import android.annotation.Nullable; import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManagerInternal; @@ -261,9 +260,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { /** Short cut */ private WindowManagerService mWindowManager; - private AppOpsManager mAppOpsManager; - - /** Common synchronization logic used to save things to disks. */ + /** Common synchronization logic used to save things to disks. */ PersisterQueue mPersisterQueue; LaunchParamsPersister mLaunchParamsPersister; private LaunchParamsController mLaunchParamsController; @@ -1050,8 +1047,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { boolean checkStartAnyActivityPermission(Intent intent, ActivityInfo aInfo, String resultWho, int requestCode, int callingPid, int callingUid, String callingPackage, - @Nullable String callingFeatureId, boolean ignoreTargetSecurity, - boolean launchingInTask, WindowProcessController callerApp, ActivityRecord resultRecord, + boolean ignoreTargetSecurity, boolean launchingInTask, + WindowProcessController callerApp, ActivityRecord resultRecord, ActivityStack resultStack) { final boolean isCallerRecents = mService.getRecentTasks() != null && mService.getRecentTasks().isCallerRecents(callingUid); @@ -1063,10 +1060,10 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // existing task, then also allow the activity to be fully relaunched. return true; } - final int componentRestriction = getComponentRestrictionForCallingPackage(aInfo, - callingPackage, callingFeatureId, callingPid, callingUid, ignoreTargetSecurity); + final int componentRestriction = getComponentRestrictionForCallingPackage( + aInfo, callingPackage, callingPid, callingUid, ignoreTargetSecurity); final int actionRestriction = getActionRestrictionForCallingPackage( - intent.getAction(), callingPackage, callingFeatureId, callingPid, callingUid); + intent.getAction(), callingPackage, callingPid, callingUid); if (componentRestriction == ACTIVITY_RESTRICTION_PERMISSION || actionRestriction == ACTIVITY_RESTRICTION_PERMISSION) { if (resultRecord != null) { @@ -1197,16 +1194,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } } - private AppOpsManager getAppOpsManager() { - if (mAppOpsManager == null) { - mAppOpsManager = mService.mContext.getSystemService(AppOpsManager.class); - } - return mAppOpsManager; - } - private int getComponentRestrictionForCallingPackage(ActivityInfo activityInfo, - String callingPackage, @Nullable String callingFeatureId, int callingPid, - int callingUid, boolean ignoreTargetSecurity) { + String callingPackage, int callingPid, int callingUid, boolean ignoreTargetSecurity) { if (!ignoreTargetSecurity && mService.checkComponentPermission(activityInfo.permission, callingPid, callingUid, activityInfo.applicationInfo.uid, activityInfo.exported) == PERMISSION_DENIED) { @@ -1222,8 +1211,9 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { return ACTIVITY_RESTRICTION_NONE; } - if (getAppOpsManager().noteOpNoThrow(opCode, callingUid, - callingPackage, callingFeatureId, "") != AppOpsManager.MODE_ALLOWED) { + // TODO moltmann b/136595429: Set featureId from caller + if (mService.getAppOpsService().noteOperation(opCode, callingUid, + callingPackage, /* featureId */ null, false, "") != AppOpsManager.MODE_ALLOWED) { if (!ignoreTargetSecurity) { return ACTIVITY_RESTRICTION_APPOP; } @@ -1232,8 +1222,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { return ACTIVITY_RESTRICTION_NONE; } - private int getActionRestrictionForCallingPackage(String action, String callingPackage, - @Nullable String callingFeatureId, int callingPid, int callingUid) { + private int getActionRestrictionForCallingPackage(String action, + String callingPackage, int callingPid, int callingUid) { if (action == null) { return ACTIVITY_RESTRICTION_NONE; } @@ -1266,8 +1256,9 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { return ACTIVITY_RESTRICTION_NONE; } - if (getAppOpsManager().noteOpNoThrow(opCode, callingUid, - callingPackage, callingFeatureId, "") != AppOpsManager.MODE_ALLOWED) { + // TODO moltmann b/136595429: Set featureId from caller + if (mService.getAppOpsService().noteOperation(opCode, callingUid, + callingPackage, /* featureId */ null, false, "") != AppOpsManager.MODE_ALLOWED) { return ACTIVITY_RESTRICTION_APPOP; } @@ -2710,7 +2701,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { SafeActivityOptions options) { Task task = null; final String callingPackage; - final String callingFeatureId; final Intent intent; final int userId; int activityType = ACTIVITY_TYPE_UNDEFINED; @@ -2790,12 +2780,11 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { return ActivityManager.START_TASK_TO_FRONT; } callingPackage = task.mCallingPackage; - callingFeatureId = task.mCallingFeatureId; intent = task.intent; intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); userId = task.mUserId; - return mService.getActivityStartController().startActivityInPackage(task.mCallingUid, - callingPid, callingUid, callingPackage, callingFeatureId, intent, null, null, + return mService.getActivityStartController().startActivityInPackage( + task.mCallingUid, callingPid, callingUid, callingPackage, intent, null, null, null, 0, 0, options, userId, task, "startActivityFromRecents", false /* validateIncomingUser */, null /* originatingPendingIntent */, false /* allowBackgroundActivityStart */); diff --git a/services/core/java/com/android/server/wm/ActivityStartController.java b/services/core/java/com/android/server/wm/ActivityStartController.java index 881dc81807f5..f35ba9e69ed7 100644 --- a/services/core/java/com/android/server/wm/ActivityStartController.java +++ b/services/core/java/com/android/server/wm/ActivityStartController.java @@ -26,7 +26,6 @@ import static com.android.server.wm.ActivityStackSupervisor.ON_TOP; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME; -import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.IApplicationThread; import android.content.ComponentName; @@ -279,11 +278,10 @@ public class ActivityStartController { } final int startActivityInPackage(int uid, int realCallingPid, int realCallingUid, - String callingPackage, @Nullable String callingFeatureId, Intent intent, - String resolvedType, IBinder resultTo, String resultWho, int requestCode, - int startFlags, SafeActivityOptions options, int userId, Task inTask, String reason, - boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, - boolean allowBackgroundActivityStart) { + String callingPackage, Intent intent, String resolvedType, IBinder resultTo, + String resultWho, int requestCode, int startFlags, SafeActivityOptions options, + int userId, Task inTask, String reason, boolean validateIncomingUser, + PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { userId = checkTargetUser(userId, validateIncomingUser, realCallingPid, realCallingUid, reason); @@ -294,7 +292,6 @@ public class ActivityStartController { .setRealCallingPid(realCallingPid) .setRealCallingUid(realCallingUid) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setResolvedType(resolvedType) .setResultTo(resultTo) .setResultWho(resultWho) @@ -313,20 +310,19 @@ public class ActivityStartController { * * @param uid Make a call as if this UID did. * @param callingPackage Make a call as if this package did. - * @param callingFeatureId Make a call as if this feature in the package did. * @param intents Intents to start. * @param userId Start the intents on this user. * @param validateIncomingUser Set true to skip checking {@code userId} with the calling UID. * @param originatingPendingIntent PendingIntentRecord that originated this activity start or * null if not originated by PendingIntent */ - final int startActivitiesInPackage(int uid, String callingPackage, - @Nullable String callingFeatureId, Intent[] intents, String[] resolvedTypes, - IBinder resultTo, SafeActivityOptions options, int userId, boolean validateIncomingUser, - PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { + final int startActivitiesInPackage(int uid, String callingPackage, Intent[] intents, + String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId, + boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, + boolean allowBackgroundActivityStart) { return startActivitiesInPackage(uid, 0 /* realCallingPid */, -1 /* realCallingUid */, - callingPackage, callingFeatureId, intents, resolvedTypes, resultTo, options, userId, - validateIncomingUser, originatingPendingIntent, allowBackgroundActivityStart); + callingPackage, intents, resolvedTypes, resultTo, options, userId, validateIncomingUser, + originatingPendingIntent, allowBackgroundActivityStart); } /** @@ -343,9 +339,9 @@ public class ActivityStartController { * null if not originated by PendingIntent */ final int startActivitiesInPackage(int uid, int realCallingPid, int realCallingUid, - String callingPackage, @Nullable String callingFeatureId, Intent[] intents, - String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId, - boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, + String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, + SafeActivityOptions options, int userId, boolean validateIncomingUser, + PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { final String reason = "startActivityInPackage"; @@ -354,14 +350,14 @@ public class ActivityStartController { Binder.getCallingUid(), reason); // TODO: Switch to user app stacks here. - return startActivities(null, uid, realCallingPid, realCallingUid, callingPackage, - callingFeatureId, intents, resolvedTypes, resultTo, options, userId, reason, - originatingPendingIntent, allowBackgroundActivityStart); + return startActivities(null, uid, realCallingPid, realCallingUid, callingPackage, intents, + resolvedTypes, resultTo, options, userId, reason, originatingPendingIntent, + allowBackgroundActivityStart); } int startActivities(IApplicationThread caller, int callingUid, int incomingRealCallingPid, - int incomingRealCallingUid, String callingPackage, @Nullable String callingFeatureId, - Intent[] intents, String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, + int incomingRealCallingUid, String callingPackage, Intent[] intents, + String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId, String reason, PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { if (intents == null) { @@ -439,7 +435,6 @@ public class ActivityStartController { .setCallingPid(callingPid) .setCallingUid(callingUid) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setRealCallingPid(realCallingPid) .setRealCallingUid(realCallingUid) .setActivityOptions(checkedOptions) diff --git a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java index 100977187239..76aa1d115ef6 100644 --- a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java +++ b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java @@ -34,7 +34,6 @@ import static android.content.pm.ApplicationInfo.FLAG_SUSPENDED; import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; -import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.KeyguardManager; import android.app.admin.DevicePolicyManagerInternal; @@ -86,7 +85,6 @@ class ActivityStartInterceptor { private int mUserId; private int mStartFlags; private String mCallingPackage; - private @Nullable String mCallingFeatureId; /* * Per-intent states that were load from ActivityStarter and are subject to modifications @@ -122,20 +120,19 @@ class ActivityStartInterceptor { * method should not be changed during intercept. */ void setStates(int userId, int realCallingPid, int realCallingUid, int startFlags, - String callingPackage, @Nullable String callingFeatureId) { + String callingPackage) { mRealCallingPid = realCallingPid; mRealCallingUid = realCallingUid; mUserId = userId; mStartFlags = startFlags; mCallingPackage = callingPackage; - mCallingFeatureId = callingFeatureId; } private IntentSender createIntentSenderForOriginalIntent(int callingUid, int flags) { Bundle activityOptions = deferCrossProfileAppsAnimationIfNecessary(); final IIntentSender target = mService.getIntentSenderLocked( - INTENT_SENDER_ACTIVITY, mCallingPackage, mCallingFeatureId, callingUid, mUserId, - null /*token*/, null /*resultCode*/, 0 /*requestCode*/, + INTENT_SENDER_ACTIVITY, mCallingPackage, callingUid, mUserId, null /*token*/, + null /*resultCode*/, 0 /*requestCode*/, new Intent[] { mIntent }, new String[] { mResolvedType }, flags, activityOptions); return new IntentSender(target); diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index 8ed798c766d2..c7270f257923 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -318,7 +318,6 @@ class ActivityStarter { int callingPid = DEFAULT_CALLING_PID; int callingUid = DEFAULT_CALLING_UID; String callingPackage; - @Nullable String callingFeatureId; int realCallingPid = DEFAULT_REAL_CALLING_PID; int realCallingUid = DEFAULT_REAL_CALLING_UID; int startFlags; @@ -368,7 +367,6 @@ class ActivityStarter { callingPid = DEFAULT_CALLING_PID; callingUid = DEFAULT_CALLING_UID; callingPackage = null; - callingFeatureId = null; realCallingPid = DEFAULT_REAL_CALLING_PID; realCallingUid = DEFAULT_REAL_CALLING_UID; startFlags = 0; @@ -407,7 +405,6 @@ class ActivityStarter { callingPid = request.callingPid; callingUid = request.callingUid; callingPackage = request.callingPackage; - callingFeatureId = request.callingFeatureId; realCallingPid = request.realCallingPid; realCallingUid = request.realCallingUid; startFlags = request.startFlags; @@ -696,10 +693,9 @@ class ActivityStarter { } final IIntentSender target = mService.getIntentSenderLocked( - ActivityManager.INTENT_SENDER_ACTIVITY, "android" /* packageName */, - null /* featureId */, appCallingUid, mRequest.userId, null /* token */, - null /* resultWho*/, 0 /* requestCode*/, new Intent[]{mRequest.intent}, - new String[]{mRequest.resolvedType}, + ActivityManager.INTENT_SENDER_ACTIVITY, "android" /* packageName */, appCallingUid, + mRequest.userId, null /* token */, null /* resultWho*/, 0 /* requestCode*/, + new Intent[] { mRequest.intent }, new String[] { mRequest.resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT, null /* bOptions */); @@ -811,7 +807,6 @@ class ActivityStarter { int callingPid = request.callingPid; int callingUid = request.callingUid; String callingPackage = request.callingPackage; - String callingFeatureId = request.callingFeatureId; final int realCallingPid = request.realCallingPid; final int realCallingUid = request.realCallingUid; final int startFlags = request.startFlags; @@ -887,7 +882,6 @@ class ActivityStarter { // we want the final activity to consider it to have been launched by the // previous app activity. callingPackage = sourceRecord.launchedFromPackage; - callingFeatureId = sourceRecord.launchedFromFeatureId; } } @@ -955,8 +949,8 @@ class ActivityStarter { } boolean abort = !mSupervisor.checkStartAnyActivityPermission(intent, aInfo, resultWho, - requestCode, callingPid, callingUid, callingPackage, callingFeatureId, - request.ignoreTargetSecurity, inTask != null, callerApp, resultRecord, resultStack); + requestCode, callingPid, callingUid, callingPackage, request.ignoreTargetSecurity, + inTask != null, callerApp, resultRecord, resultStack); abort |= !mService.mIntentFirewall.checkStartActivity(intent, callingUid, callingPid, resolvedType, aInfo.applicationInfo); abort |= !mService.getPermissionPolicyInternal().checkStartActivity(intent, callingUid, @@ -996,8 +990,7 @@ class ActivityStarter { } } - mInterceptor.setStates(userId, realCallingPid, realCallingUid, startFlags, callingPackage, - callingFeatureId); + mInterceptor.setStates(userId, realCallingPid, realCallingUid, startFlags, callingPackage); if (mInterceptor.intercept(intent, rInfo, aInfo, resolvedType, inTask, callingPid, callingUid, checkedOptions)) { // activity start was intercepted, e.g. because the target user is currently in quiet @@ -1030,7 +1023,7 @@ class ActivityStarter { if (mService.getPackageManagerInternalLocked().isPermissionsReviewRequired( aInfo.packageName, userId)) { final IIntentSender target = mService.getIntentSenderLocked( - ActivityManager.INTENT_SENDER_ACTIVITY, callingPackage, callingFeatureId, + ActivityManager.INTENT_SENDER_ACTIVITY, callingPackage, callingUid, userId, null, null, 0, new Intent[]{intent}, new String[]{resolvedType}, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT, null); @@ -1088,7 +1081,7 @@ class ActivityStarter { // app [on install success]. if (rInfo != null && rInfo.auxiliaryInfo != null) { intent = createLaunchIntent(rInfo.auxiliaryInfo, request.ephemeralIntent, - callingPackage, callingFeatureId, verificationBundle, resolvedType, userId); + callingPackage, verificationBundle, resolvedType, userId); resolvedType = null; callingUid = realCallingUid; callingPid = realCallingPid; @@ -1097,10 +1090,9 @@ class ActivityStarter { } final ActivityRecord r = new ActivityRecord(mService, callerApp, callingPid, callingUid, - callingPackage, callingFeatureId, intent, resolvedType, aInfo, - mService.getGlobalConfiguration(), resultRecord, resultWho, requestCode, - request.componentSpecified, voiceSession != null, mSupervisor, checkedOptions, - sourceRecord); + callingPackage, intent, resolvedType, aInfo, mService.getGlobalConfiguration(), + resultRecord, resultWho, requestCode, request.componentSpecified, + voiceSession != null, mSupervisor, checkedOptions, sourceRecord); mLastStartActivityRecord = r; if (r.appTimeTracker == null && sourceRecord != null) { @@ -1310,22 +1302,21 @@ class ActivityStarter { * Creates a launch intent for the given auxiliary resolution data. */ private @NonNull Intent createLaunchIntent(@Nullable AuxiliaryResolveInfo auxiliaryResponse, - Intent originalIntent, String callingPackage, @Nullable String callingFeatureId, - Bundle verificationBundle, String resolvedType, int userId) { + Intent originalIntent, String callingPackage, Bundle verificationBundle, + String resolvedType, int userId) { if (auxiliaryResponse != null && auxiliaryResponse.needsPhaseTwo) { // request phase two resolution PackageManagerInternal packageManager = mService.getPackageManagerInternalLocked(); boolean isRequesterInstantApp = packageManager.isInstantApp(callingPackage, userId); packageManager.requestInstantAppResolutionPhaseTwo( auxiliaryResponse, originalIntent, resolvedType, callingPackage, - callingFeatureId, isRequesterInstantApp, verificationBundle, userId); + isRequesterInstantApp, verificationBundle, userId); } return InstantAppResolver.buildEphemeralInstallerIntent( originalIntent, InstantAppResolver.sanitizeIntent(originalIntent), auxiliaryResponse == null ? null : auxiliaryResponse.failureIntent, callingPackage, - callingFeatureId, verificationBundle, resolvedType, userId, @@ -2584,11 +2575,6 @@ class ActivityStarter { return this; } - ActivityStarter setCallingFeatureId(String callingFeatureId) { - mRequest.callingFeatureId = callingFeatureId; - return this; - } - /** * Sets the pid of the caller who requested to launch the activity. * diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java index 7302e529c1eb..25f6d6fd5ca6 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java @@ -182,15 +182,14 @@ public abstract class ActivityTaskManagerInternal { public abstract void notifySingleTaskDisplayDrawn(int displayId); /** - * Start activity {@code intents} as if {@code packageName/featureId} on user {@code userId} did - * it. + * Start activity {@code intents} as if {@code packageName} on user {@code userId} did it. * * - DO NOT call it with the calling UID cleared. * - All the necessary caller permission checks must be done at callsites. * * @return error codes used by {@link IActivityManager#startActivity} and its siblings. */ - public abstract int startActivitiesAsPackage(String packageName, String featureId, + public abstract int startActivitiesAsPackage(String packageName, int userId, Intent[] intents, Bundle bOptions); /** @@ -200,7 +199,6 @@ public abstract class ActivityTaskManagerInternal { * @param realCallingPid PID of the real caller. * @param realCallingUid UID of the real caller. * @param callingPackage Make a call as if this package did. - * @param callingFeatureId Make a call as if this feature in the package did. * @param intents Intents to start. * @param userId Start the intents on this user. * @param validateIncomingUser Set true to skip checking {@code userId} with the calling UID. @@ -210,17 +208,16 @@ public abstract class ActivityTaskManagerInternal { * from originatingPendingIntent */ public abstract int startActivitiesInPackage(int uid, int realCallingPid, int realCallingUid, - String callingPackage, @Nullable String callingFeatureId, Intent[] intents, - String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId, - boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, + String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, + SafeActivityOptions options, int userId, boolean validateIncomingUser, + PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart); public abstract int startActivityInPackage(int uid, int realCallingPid, int realCallingUid, - String callingPackage, @Nullable String callingFeaturId, Intent intent, - String resolvedType, IBinder resultTo, String resultWho, int requestCode, - int startFlags, SafeActivityOptions options, int userId, Task inTask, String reason, - boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, - boolean allowBackgroundActivityStart); + String callingPackage, Intent intent, String resolvedType, IBinder resultTo, + String resultWho, int requestCode, int startFlags, SafeActivityOptions options, + int userId, Task inTask, String reason, boolean validateIncomingUser, + PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart); /** * Start activity {@code intent} without calling user-id check. @@ -231,7 +228,7 @@ public abstract class ActivityTaskManagerInternal { * @return error codes used by {@link IActivityManager#startActivity} and its siblings. */ public abstract int startActivityAsUser(IApplicationThread caller, String callingPackage, - @Nullable String callingFeatureId, Intent intent, @Nullable Bundle options, int userId); + Intent intent, @Nullable Bundle options, int userId); /** * Called when Keyguard flags might have changed. @@ -391,7 +388,7 @@ public abstract class ActivityTaskManagerInternal { public abstract ActivityTokens getTopActivityForTask(int taskId); public abstract IIntentSender getIntentSender(int type, String packageName, - @Nullable String featureId, int callingUid, int userId, IBinder token, String resultWho, + int callingUid, int userId, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle bOptions); diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index ea5a71a7200e..5f3e3a39490c 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -234,6 +234,7 @@ import android.view.WindowManager; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.AssistUtils; +import com.android.internal.app.IAppOpsService; import com.android.internal.app.IVoiceInteractor; import com.android.internal.app.ProcessMap; import com.android.internal.logging.MetricsLogger; @@ -263,6 +264,7 @@ import com.android.server.am.BaseErrorDialog; import com.android.server.am.PendingIntentController; import com.android.server.am.PendingIntentRecord; import com.android.server.am.UserState; +import com.android.server.appop.AppOpsService; import com.android.server.firewall.IntentFirewall; import com.android.server.inputmethod.InputMethodSystemProperty; import com.android.server.pm.UserManagerService; @@ -376,7 +378,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { RootWindowContainer mRootWindowContainer; WindowManagerService mWindowManager; private UserManagerService mUserManager; - private AppOpsManager mAppOpsManager; + private AppOpsService mAppOpsService; /** All active uids in the system. */ private final MirrorActiveUids mActiveUids = new MirrorActiveUids(); private final SparseArray<String> mPendingTempWhitelist = new SparseArray<>(); @@ -889,11 +891,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { return mUserManager; } - AppOpsManager getAppOpsManager() { - if (mAppOpsManager == null) { - mAppOpsManager = mContext.getSystemService(AppOpsManager.class); + AppOpsService getAppOpsService() { + if (mAppOpsService == null) { + IBinder b = ServiceManager.getService(Context.APP_OPS_SERVICE); + mAppOpsService = (AppOpsService) IAppOpsService.Stub.asInterface(b); } - return mAppOpsManager; + return mAppOpsService; } boolean hasUserRestriction(String restriction, int userId) { @@ -901,8 +904,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } boolean hasSystemAlertWindowPermission(int callingUid, int callingPid, String callingPackage) { - final int mode = getAppOpsManager().noteOpNoThrow(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, - callingUid, callingPackage, /* featureId */ null, ""); + final int mode = getAppOpsService().noteOperation(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, + callingUid, callingPackage, /* featureId */ null, false, ""); if (mode == AppOpsManager.MODE_DEFAULT) { return checkPermission(Manifest.permission.SYSTEM_ALERT_WINDOW, callingPid, callingUid) == PERMISSION_GRANTED; @@ -1022,43 +1025,41 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public final int startActivity(IApplicationThread caller, String callingPackage, - String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, - Bundle bOptions) { - return startActivityAsUser(caller, callingPackage, callingFeatureId, intent, resolvedType, - resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions, + Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, + int startFlags, ProfilerInfo profilerInfo, Bundle bOptions) { + return startActivityAsUser(caller, callingPackage, intent, resolvedType, resultTo, + resultWho, requestCode, startFlags, profilerInfo, bOptions, UserHandle.getCallingUserId()); } @Override public final int startActivities(IApplicationThread caller, String callingPackage, - String callingFeatureId, Intent[] intents, String[] resolvedTypes, IBinder resultTo, - Bundle bOptions, int userId) { + Intent[] intents, String[] resolvedTypes, IBinder resultTo, Bundle bOptions, + int userId) { assertPackageMatchesCallingUid(callingPackage); final String reason = "startActivities"; enforceNotIsolatedCaller(reason); userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, reason); // TODO: Switch to user app stacks here. return getActivityStartController().startActivities(caller, -1, 0, -1, callingPackage, - callingFeatureId, intents, resolvedTypes, resultTo, - SafeActivityOptions.fromBundle(bOptions), userId, reason, - null /* originatingPendingIntent */, false /* allowBackgroundActivityStart */); + intents, resolvedTypes, resultTo, SafeActivityOptions.fromBundle(bOptions), userId, + reason, null /* originatingPendingIntent */, + false /* allowBackgroundActivityStart */); } @Override public int startActivityAsUser(IApplicationThread caller, String callingPackage, - String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, - Bundle bOptions, int userId) { - return startActivityAsUser(caller, callingPackage, callingFeatureId, intent, resolvedType, - resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions, userId, + Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, + int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId) { + return startActivityAsUser(caller, callingPackage, intent, resolvedType, resultTo, + resultWho, requestCode, startFlags, profilerInfo, bOptions, userId, true /*validateIncomingUser*/); } private int startActivityAsUser(IApplicationThread caller, String callingPackage, - @Nullable String callingFeatureId, Intent intent, String resolvedType, - IBinder resultTo, String resultWho, int requestCode, int startFlags, - ProfilerInfo profilerInfo, Bundle bOptions, int userId, boolean validateIncomingUser) { + Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, + int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId, + boolean validateIncomingUser) { assertPackageMatchesCallingUid(callingPackage); enforceNotIsolatedCaller("startActivityAsUser"); @@ -1069,7 +1070,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { return getActivityStartController().obtainStarter(intent, "startActivityAsUser") .setCaller(caller) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setResolvedType(resolvedType) .setResultTo(resultTo) .setResultWho(resultWho) @@ -1215,7 +1215,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { .setCallingPid(-1) .setCallingUid(r.launchedFromUid) .setCallingPackage(r.launchedFromPackage) - .setCallingFeatureId(r.launchedFromFeatureId) .setRealCallingPid(-1) .setRealCallingUid(r.launchedFromUid) .setActivityOptions(options) @@ -1232,9 +1231,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public final WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage, - String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, - Bundle bOptions, int userId) { + Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, + int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId) { assertPackageMatchesCallingUid(callingPackage); final WaitResult res = new WaitResult(); enforceNotIsolatedCaller("startActivityAndWait"); @@ -1244,7 +1242,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { getActivityStartController().obtainStarter(intent, "startActivityAndWait") .setCaller(caller) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setResolvedType(resolvedType) .setResultTo(resultTo) .setResultWho(resultWho) @@ -1260,9 +1257,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public final int startActivityWithConfig(IApplicationThread caller, String callingPackage, - String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo, - String resultWho, int requestCode, int startFlags, Configuration config, - Bundle bOptions, int userId) { + Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, + int startFlags, Configuration config, Bundle bOptions, int userId) { assertPackageMatchesCallingUid(callingPackage); enforceNotIsolatedCaller("startActivityWithConfig"); userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, @@ -1271,7 +1267,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { return getActivityStartController().obtainStarter(intent, "startActivityWithConfig") .setCaller(caller) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setResolvedType(resolvedType) .setResultTo(resultTo) .setResultWho(resultWho) @@ -1322,7 +1317,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { final ActivityRecord sourceRecord; final int targetUid; final String targetPackage; - final String targetFeatureId; final boolean isResolver; synchronized (mGlobalLock) { if (resultTo == null) { @@ -1390,7 +1384,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } targetUid = sourceRecord.launchedFromUid; targetPackage = sourceRecord.launchedFromPackage; - targetFeatureId = sourceRecord.launchedFromFeatureId; isResolver = sourceRecord.isResolverOrChildActivity(); } @@ -1403,7 +1396,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { return getActivityStartController().obtainStarter(intent, "startActivityAsCaller") .setCallingUid(targetUid) .setCallingPackage(targetPackage) - .setCallingFeatureId(targetFeatureId) .setResolvedType(resolvedType) .setResultTo(resultTo) .setResultWho(resultWho) @@ -1439,8 +1431,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override - public int startVoiceActivity(String callingPackage, String callingFeatureId, int callingPid, - int callingUid, Intent intent, String resolvedType, IVoiceInteractionSession session, + public int startVoiceActivity(String callingPackage, int callingPid, int callingUid, + Intent intent, String resolvedType, IVoiceInteractionSession session, IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId) { assertPackageMatchesCallingUid(callingPackage); @@ -1453,7 +1445,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { return getActivityStartController().obtainStarter(intent, "startVoiceActivity") .setCallingUid(callingUid) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setResolvedType(resolvedType) .setVoiceSession(session) .setVoiceInteractor(interactor) @@ -1466,9 +1457,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override - public int startAssistantActivity(String callingPackage, @NonNull String callingFeatureId, - int callingPid, int callingUid, Intent intent, String resolvedType, Bundle bOptions, - int userId) { + public int startAssistantActivity(String callingPackage, int callingPid, int callingUid, + Intent intent, String resolvedType, Bundle bOptions, int userId) { assertPackageMatchesCallingUid(callingPackage); mAmInternal.enforceCallingPermission(BIND_VOICE_INTERACTION, "startAssistantActivity()"); userId = handleIncomingUser(callingPid, callingUid, userId, "startAssistantActivity"); @@ -1476,7 +1466,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { return getActivityStartController().obtainStarter(intent, "startAssistantActivity") .setCallingUid(callingUid) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setResolvedType(resolvedType) .setActivityOptions(bOptions) .setUserId(userId) @@ -1500,14 +1489,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { try { synchronized (mGlobalLock) { final ComponentName recentsComponent = mRecentTasks.getRecentsComponent(); - final String recentsFeatureId = mRecentTasks.getRecentsComponentFeatureId(); final int recentsUid = mRecentTasks.getRecentsComponentUid(); final WindowProcessController caller = getProcessController(callingPid, callingUid); // Start a new recents animation final RecentsAnimation anim = new RecentsAnimation(this, mStackSupervisor, getActivityStartController(), mWindowManager, intent, recentsComponent, - recentsFeatureId, recentsUid, caller); + recentsUid, caller); if (recentsAnimationRunner == null) { anim.preloadRecentsActivity(); } else { @@ -5785,9 +5773,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } - IIntentSender getIntentSenderLocked(int type, String packageName, String featureId, - int callingUid, int userId, IBinder token, String resultWho, int requestCode, - Intent[] intents, String[] resolvedTypes, int flags, Bundle bOptions) { + IIntentSender getIntentSenderLocked(int type, String packageName, int callingUid, int userId, + IBinder token, String resultWho, int requestCode, Intent[] intents, + String[] resolvedTypes, int flags, Bundle bOptions) { ActivityRecord activity = null; if (type == ActivityManager.INTENT_SENDER_ACTIVITY_RESULT) { @@ -5803,8 +5791,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } final PendingIntentRecord rec = mPendingIntentController.getIntentSender(type, packageName, - featureId, callingUid, userId, token, resultWho, requestCode, intents, - resolvedTypes, flags, bOptions); + callingUid, userId, token, resultWho, requestCode, intents, resolvedTypes, flags, + bOptions); final boolean noCreate = (flags & PendingIntent.FLAG_NO_CREATE) != 0; if (noCreate) { return rec; @@ -6192,8 +6180,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override - public int startActivitiesAsPackage(String packageName, @Nullable String featureId, - int userId, Intent[] intents, Bundle bOptions) { + public int startActivitiesAsPackage(String packageName, int userId, Intent[] intents, + Bundle bOptions) { Objects.requireNonNull(intents, "intents"); final String[] resolvedTypes = new String[intents.length]; @@ -6218,7 +6206,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } return getActivityStartController().startActivitiesInPackage( - packageUid, packageName, featureId, + packageUid, packageName, intents, resolvedTypes, null /* resultTo */, SafeActivityOptions.fromBundle(bOptions), userId, false /* validateIncomingUser */, null /* originatingPendingIntent */, @@ -6227,41 +6215,41 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public int startActivitiesInPackage(int uid, int realCallingPid, int realCallingUid, - String callingPackage, @Nullable String callingFeatureId, Intent[] intents, - String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId, - boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, + String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, + SafeActivityOptions options, int userId, boolean validateIncomingUser, + PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { assertPackageMatchesCallingUid(callingPackage); synchronized (mGlobalLock) { return getActivityStartController().startActivitiesInPackage(uid, realCallingPid, - realCallingUid, callingPackage, callingFeatureId, intents, resolvedTypes, - resultTo, options, userId, validateIncomingUser, originatingPendingIntent, + realCallingUid, callingPackage, intents, resolvedTypes, resultTo, options, + userId, validateIncomingUser, originatingPendingIntent, allowBackgroundActivityStart); } } @Override public int startActivityInPackage(int uid, int realCallingPid, int realCallingUid, - String callingPackage, @Nullable String callingFeatureId, Intent intent, - String resolvedType, IBinder resultTo, String resultWho, int requestCode, - int startFlags, SafeActivityOptions options, int userId, Task inTask, String reason, - boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, + String callingPackage, Intent intent, String resolvedType, IBinder resultTo, + String resultWho, int requestCode, int startFlags, SafeActivityOptions options, + int userId, Task inTask, String reason, boolean validateIncomingUser, + PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { assertPackageMatchesCallingUid(callingPackage); synchronized (mGlobalLock) { return getActivityStartController().startActivityInPackage(uid, realCallingPid, - realCallingUid, callingPackage, callingFeatureId, intent, resolvedType, - resultTo, resultWho, requestCode, startFlags, options, userId, inTask, - reason, validateIncomingUser, originatingPendingIntent, + realCallingUid, callingPackage, intent, resolvedType, resultTo, resultWho, + requestCode, startFlags, options, userId, inTask, reason, + validateIncomingUser, originatingPendingIntent, allowBackgroundActivityStart); } } @Override - public int startActivityAsUser(IApplicationThread caller, String callerPackage, - @Nullable String callerFeatureId, Intent intent, Bundle options, int userId) { + public int startActivityAsUser(IApplicationThread caller, String callerPacakge, + Intent intent, Bundle options, int userId) { return ActivityTaskManagerService.this.startActivityAsUser( - caller, callerPackage, callerFeatureId, intent, + caller, callerPacakge, intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options, userId, false /*validateIncomingUser*/); @@ -6697,12 +6685,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public IIntentSender getIntentSender(int type, String packageName, - @Nullable String featureId, int callingUid, int userId, IBinder token, - String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, - int flags, Bundle bOptions) { + int callingUid, int userId, IBinder token, String resultWho, + int requestCode, Intent[] intents, String[] resolvedTypes, int flags, + Bundle bOptions) { synchronized (mGlobalLock) { - return getIntentSenderLocked(type, packageName, featureId, callingUid, userId, - token, resultWho, requestCode, intents, resolvedTypes, flags, bOptions); + return getIntentSenderLocked(type, packageName, callingUid, userId, token, + resultWho, requestCode, intents, resolvedTypes, flags, bOptions); } } diff --git a/services/core/java/com/android/server/wm/AppTaskImpl.java b/services/core/java/com/android/server/wm/AppTaskImpl.java index 8fa811915fc2..16a75645f9ae 100644 --- a/services/core/java/com/android/server/wm/AppTaskImpl.java +++ b/services/core/java/com/android/server/wm/AppTaskImpl.java @@ -125,7 +125,7 @@ class AppTaskImpl extends IAppTask.Stub { } @Override - public int startActivity(IBinder whoThread, String callingPackage, String callingFeatureId, + public int startActivity(IBinder whoThread, String callingPackage, Intent intent, String resolvedType, Bundle bOptions) { checkCaller(); mService.assertPackageMatchesCallingUid(callingPackage); @@ -148,7 +148,6 @@ class AppTaskImpl extends IAppTask.Stub { return mService.getActivityStartController().obtainStarter(intent, "AppTaskImpl") .setCaller(appThread) .setCallingPackage(callingPackage) - .setCallingFeatureId(callingFeatureId) .setResolvedType(resolvedType) .setActivityOptions(bOptions) .setUserId(callingUser) diff --git a/services/core/java/com/android/server/wm/RecentTasks.java b/services/core/java/com/android/server/wm/RecentTasks.java index 3771b3ee9dc9..a9dc36d91a3f 100644 --- a/services/core/java/com/android/server/wm/RecentTasks.java +++ b/services/core/java/com/android/server/wm/RecentTasks.java @@ -42,7 +42,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_TASKS import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME; -import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.AppGlobals; @@ -156,7 +155,6 @@ class RecentTasks { */ private int mRecentsUid = -1; private ComponentName mRecentsComponent = null; - private @Nullable String mFeatureId; /** * Mapping of user id -> whether recent tasks have been loaded for that user. @@ -420,13 +418,6 @@ class RecentTasks { } /** - * @return the featureId for the recents component. - */ - @Nullable String getRecentsComponentFeatureId() { - return mFeatureId; - } - - /** * @return the uid for the recents component. */ int getRecentsComponentUid() { diff --git a/services/core/java/com/android/server/wm/RecentsAnimation.java b/services/core/java/com/android/server/wm/RecentsAnimation.java index b0492be5f542..9770947ff2c3 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimation.java +++ b/services/core/java/com/android/server/wm/RecentsAnimation.java @@ -63,7 +63,6 @@ class RecentsAnimation implements RecentsAnimationCallbacks, private final DisplayContent mDefaultDisplay; private final Intent mTargetIntent; private final ComponentName mRecentsComponent; - private final @Nullable String mRecentsFeatureId; private final int mRecentsUid; private final @Nullable WindowProcessController mCaller; private final int mUserId; @@ -81,8 +80,8 @@ class RecentsAnimation implements RecentsAnimationCallbacks, RecentsAnimation(ActivityTaskManagerService atm, ActivityStackSupervisor stackSupervisor, ActivityStartController activityStartController, WindowManagerService wm, - Intent targetIntent, ComponentName recentsComponent, @Nullable String recentsFeatureId, - int recentsUid, @Nullable WindowProcessController caller) { + Intent targetIntent, ComponentName recentsComponent, int recentsUid, + @Nullable WindowProcessController caller) { mService = atm; mStackSupervisor = stackSupervisor; mDefaultDisplay = mService.mRootWindowContainer.getDefaultDisplay(); @@ -90,7 +89,6 @@ class RecentsAnimation implements RecentsAnimationCallbacks, mWindowManager = wm; mTargetIntent = targetIntent; mRecentsComponent = recentsComponent; - mRecentsFeatureId = recentsFeatureId; mRecentsUid = recentsUid; mCaller = caller; mUserId = atm.getCurrentUserId(); @@ -458,7 +456,6 @@ class RecentsAnimation implements RecentsAnimationCallbacks, .obtainStarter(mTargetIntent, reason) .setCallingUid(mRecentsUid) .setCallingPackage(mRecentsComponent.getPackageName()) - .setCallingFeatureId(mRecentsFeatureId) .setActivityOptions(new SafeActivityOptions(options)) .setUserId(mUserId) .execute(); diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index eca6da3256a6..87c91ef6b96c 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -189,7 +189,6 @@ class Task extends WindowContainer<WindowContainer> { private static final String ATTR_TASK_AFFILIATION_COLOR = "task_affiliation_color"; private static final String ATTR_CALLING_UID = "calling_uid"; private static final String ATTR_CALLING_PACKAGE = "calling_package"; - private static final String ATTR_CALLING_FEATURE_ID = "calling_feature_id"; private static final String ATTR_SUPPORTS_PICTURE_IN_PICTURE = "supports_picture_in_picture"; private static final String ATTR_RESIZE_MODE = "resize_mode"; private static final String ATTR_NON_FULLSCREEN_BOUNDS = "non_fullscreen_bounds"; @@ -303,7 +302,6 @@ class Task extends WindowContainer<WindowContainer> { // For relaunching the task from recents as though it was launched by the original launcher. int mCallingUid; String mCallingPackage; - String mCallingFeatureId; private final Rect mTmpStableBounds = new Rect(); private final Rect mTmpNonDecorBounds = new Rect(); @@ -485,8 +483,8 @@ class Task extends WindowContainer<WindowContainer> { true /*neverRelinquishIdentity*/, _taskDescription != null ? _taskDescription : new TaskDescription(), _taskId, INVALID_TASK_ID, INVALID_TASK_ID, 0 /*taskAffiliationColor*/, - info.applicationInfo.uid, info.packageName, null /* default featureId */, - info.resizeMode, info.supportsPictureInPicture(), false /*_realActivitySuspended*/, + info.applicationInfo.uid, info.packageName, info.resizeMode, + info.supportsPictureInPicture(), false /*_realActivitySuspended*/, false /*userSetupComplete*/, INVALID_MIN_SIZE, INVALID_MIN_SIZE, info, _voiceSession, _voiceInteractor, stack); } @@ -508,17 +506,18 @@ class Task extends WindowContainer<WindowContainer> { } /** Don't use constructor directly. This is only used by XML parser. */ - Task(ActivityTaskManagerService atmService, int _taskId, Intent _intent, Intent _affinityIntent, - String _affinity, String _rootAffinity, ComponentName _realActivity, - ComponentName _origActivity, boolean _rootWasReset, boolean _autoRemoveRecents, - boolean _askedCompatMode, int _userId, int _effectiveUid, String _lastDescription, + Task(ActivityTaskManagerService atmService, int _taskId, Intent _intent, + Intent _affinityIntent, String _affinity, String _rootAffinity, + ComponentName _realActivity, ComponentName _origActivity, boolean _rootWasReset, + boolean _autoRemoveRecents, boolean _askedCompatMode, int _userId, + int _effectiveUid, String _lastDescription, long lastTimeMoved, boolean neverRelinquishIdentity, TaskDescription _lastTaskDescription, int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor, int callingUid, String callingPackage, - @Nullable String callingFeatureId, int resizeMode, boolean supportsPictureInPicture, - boolean _realActivitySuspended, boolean userSetupComplete, int minWidth, int minHeight, - ActivityInfo info, IVoiceInteractionSession _voiceSession, - IVoiceInteractor _voiceInteractor, ActivityStack stack) { + int resizeMode, boolean supportsPictureInPicture, boolean _realActivitySuspended, + boolean userSetupComplete, int minWidth, int minHeight, ActivityInfo info, + IVoiceInteractionSession _voiceSession, IVoiceInteractor _voiceInteractor, + ActivityStack stack) { super(atmService.mWindowManager); EventLogTags.writeWmTaskCreated(_taskId, stack != null ? getRootTaskId() : INVALID_TASK_ID); @@ -557,7 +556,6 @@ class Task extends WindowContainer<WindowContainer> { mNextAffiliateTaskId = nextTaskId; mCallingUid = callingUid; mCallingPackage = callingPackage; - mCallingFeatureId = callingFeatureId; mResizeMode = resizeMode; if (info != null) { setIntent(_intent, info); @@ -904,7 +902,6 @@ class Task extends WindowContainer<WindowContainer> { void setIntent(ActivityRecord r) { mCallingUid = r.launchedFromUid; mCallingPackage = r.launchedFromPackage; - mCallingFeatureId = r.launchedFromFeatureId; setIntent(r.intent, r.info); setLockTaskAuth(r); @@ -1360,7 +1357,6 @@ class Task extends WindowContainer<WindowContainer> { isPersistable = r.isPersistable(); mCallingUid = r.launchedFromUid; mCallingPackage = r.launchedFromPackage; - mCallingFeatureId = r.launchedFromFeatureId; // Clamp to [1, max]. maxRecents = Math.min(Math.max(r.info.maxRecents, 1), ActivityTaskManager.getMaxAppRecentsLimitStatic()); @@ -3237,7 +3233,6 @@ class Task extends WindowContainer<WindowContainer> { pw.print(" mCallingUid="); UserHandle.formatUid(pw, mCallingUid); pw.print(" mUserSetupComplete="); pw.print(mUserSetupComplete); pw.print(" mCallingPackage="); pw.println(mCallingPackage); - pw.print(" mCallingFeatureId="); pw.println(mCallingFeatureId); if (affinity != null || rootAffinity != null) { pw.print(prefix); pw.print("affinity="); pw.print(affinity); if (affinity == null || !affinity.equals(rootAffinity)) { @@ -3447,8 +3442,6 @@ class Task extends WindowContainer<WindowContainer> { out.attribute(null, ATTR_NEXT_AFFILIATION, String.valueOf(mNextAffiliateTaskId)); out.attribute(null, ATTR_CALLING_UID, String.valueOf(mCallingUid)); out.attribute(null, ATTR_CALLING_PACKAGE, mCallingPackage == null ? "" : mCallingPackage); - out.attribute(null, ATTR_CALLING_FEATURE_ID, - mCallingFeatureId == null ? "" : mCallingFeatureId); out.attribute(null, ATTR_RESIZE_MODE, String.valueOf(mResizeMode)); out.attribute(null, ATTR_SUPPORTS_PICTURE_IN_PICTURE, String.valueOf(mSupportsPictureInPicture)); @@ -3562,17 +3555,16 @@ class Task extends WindowContainer<WindowContainer> { long lastTimeMoved, boolean neverRelinquishIdentity, TaskDescription lastTaskDescription, int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor, int callingUid, String callingPackage, - @Nullable String callingFeatureId, int resizeMode, - boolean supportsPictureInPicture, boolean realActivitySuspended, + int resizeMode, boolean supportsPictureInPicture, boolean realActivitySuspended, boolean userSetupComplete, int minWidth, int minHeight, ActivityStack stack) { return new ActivityStack(service, taskId, intent, affinityIntent, affinity, rootAffinity, realActivity, origActivity, rootWasReset, autoRemoveRecents, askedCompatMode, userId, effectiveUid, lastDescription, lastTimeMoved, neverRelinquishIdentity, lastTaskDescription, taskAffiliation, prevTaskId, nextTaskId, taskAffiliationColor, callingUid, callingPackage, - callingFeatureId, resizeMode, supportsPictureInPicture, realActivitySuspended, - userSetupComplete, minWidth, minHeight, null /*ActivityInfo*/, - null /*_voiceSession*/, null /*_voiceInteractor*/, stack); + resizeMode, supportsPictureInPicture, realActivitySuspended, userSetupComplete, + minWidth, minHeight, null /*ActivityInfo*/, null /*_voiceSession*/, + null /*_voiceInteractor*/, stack); } Task restoreFromXml(XmlPullParser in, ActivityStackSupervisor stackSupervisor) @@ -3605,7 +3597,6 @@ class Task extends WindowContainer<WindowContainer> { int nextTaskId = INVALID_TASK_ID; int callingUid = -1; String callingPackage = ""; - String callingFeatureId = null; int resizeMode = RESIZE_MODE_FORCE_RESIZEABLE; boolean supportsPictureInPicture = false; Rect lastNonFullscreenBounds = null; @@ -3686,9 +3677,6 @@ class Task extends WindowContainer<WindowContainer> { case ATTR_CALLING_PACKAGE: callingPackage = attrValue; break; - case ATTR_CALLING_FEATURE_ID: - callingFeatureId = attrValue; - break; case ATTR_RESIZE_MODE: resizeMode = Integer.parseInt(attrValue); break; @@ -3790,8 +3778,8 @@ class Task extends WindowContainer<WindowContainer> { autoRemoveRecents, askedCompatMode, userId, effectiveUid, lastDescription, lastTimeOnTop, neverRelinquishIdentity, taskDescription, taskAffiliation, prevTaskId, nextTaskId, taskAffiliationColor, callingUid, - callingPackage, callingFeatureId, resizeMode, supportsPictureInPicture, - realActivitySuspended, userSetupComplete, minWidth, minHeight, null /*stack*/); + callingPackage, resizeMode, supportsPictureInPicture, realActivitySuspended, + userSetupComplete, minWidth, minHeight, null /*stack*/); task.mLastNonFullscreenBounds = lastNonFullscreenBounds; task.setBounds(lastNonFullscreenBounds); diff --git a/services/core/java/com/android/server/wm/TaskTile.java b/services/core/java/com/android/server/wm/TaskTile.java index 369db05452f7..add11d69cbaa 100644 --- a/services/core/java/com/android/server/wm/TaskTile.java +++ b/services/core/java/com/android/server/wm/TaskTile.java @@ -60,11 +60,10 @@ public class TaskTile extends ActivityStack { System.currentTimeMillis(), true /*neverRelinquishIdentity*/, new ActivityManager.TaskDescription(), id, INVALID_TASK_ID, INVALID_TASK_ID, 0 /*taskAffiliationColor*/, 0 /*callingUid*/, "" /*callingPackage*/, - null /*callingFeatureId*/, RESIZE_MODE_RESIZEABLE, - false /*supportsPictureInPicture*/, false /*_realActivitySuspended*/, - false /*userSetupComplete*/, INVALID_MIN_SIZE, INVALID_MIN_SIZE, - createEmptyActivityInfo(), null /*voiceSession*/, null /*voiceInteractor*/, - null /*stack*/); + RESIZE_MODE_RESIZEABLE, false /*supportsPictureInPicture*/, + false /*_realActivitySuspended*/, false /*userSetupComplete*/, INVALID_MIN_SIZE, + INVALID_MIN_SIZE, createEmptyActivityInfo(), null /*voiceSession*/, + null /*voiceInteractor*/, null /*stack*/); getRequestedOverrideConfiguration().windowConfiguration.setWindowingMode(windowingMode); } diff --git a/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java b/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java index e3453a06990f..3975f0baa22a 100644 --- a/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java @@ -50,7 +50,6 @@ import org.mockito.quality.Strictness; @RunWith(AndroidJUnit4.class) public class PendingIntentControllerTest { private static final String TEST_PACKAGE_NAME = "test-package-1"; - private static final String TEST_FEATURE_ID = "test-feature-1"; private static final int TEST_CALLING_UID = android.os.Process.myUid(); private static final Intent[] TEST_INTENTS = new Intent[]{new Intent("com.test.intent")}; @@ -88,8 +87,8 @@ public class PendingIntentControllerTest { private PendingIntentRecord createPendingIntentRecord(int flags) { return mPendingIntentController.getIntentSender(ActivityManager.INTENT_SENDER_BROADCAST, - TEST_PACKAGE_NAME, TEST_FEATURE_ID, TEST_CALLING_UID, 0, null, null, 0, - TEST_INTENTS, null, flags, null); + TEST_PACKAGE_NAME, TEST_CALLING_UID, 0, null, null, 0, TEST_INTENTS, null, flags, + null); } @Test diff --git a/services/tests/servicestests/src/com/android/server/am/BroadcastRecordTest.java b/services/tests/servicestests/src/com/android/server/am/BroadcastRecordTest.java index a871ec64af3b..089a79b018a8 100644 --- a/services/tests/servicestests/src/com/android/server/am/BroadcastRecordTest.java +++ b/services/tests/servicestests/src/com/android/server/am/BroadcastRecordTest.java @@ -178,7 +178,6 @@ public class BroadcastRecordTest { new Intent(), null /* callerApp */, null /* callerPackage */, - null /* callerFeatureId */, 0 /* callingPid */, 0 /* callingUid */, false /* callerInstantApp */, diff --git a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java index 8961b539c610..3d190be8888b 100644 --- a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java @@ -24,7 +24,6 @@ import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils.set; import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; @@ -1708,7 +1707,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { final ArgumentCaptor<Intent[]> intentsCaptor = ArgumentCaptor.forClass(Intent[].class); verify(mMockActivityTaskManagerInternal).startActivitiesAsPackage( eq(packageName), - isNull(), eq(userId), intentsCaptor.capture(), anyOrNull(Bundle.class)); @@ -1767,7 +1765,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { // This shouldn't have been called. verify(mMockActivityTaskManagerInternal, times(0)).startActivitiesAsPackage( anyString(), - isNull(), anyInt(), any(Intent[].class), anyOrNull(Bundle.class)); diff --git a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java index fea1b825228c..91cc9f35da1e 100644 --- a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java @@ -55,7 +55,6 @@ import java.util.List; @RunWith(MockitoJUnitRunner.class) public class CrossProfileAppsServiceImplTest { private static final String PACKAGE_ONE = "com.one"; - private static final String FEATURE_ID = "feature.one"; private static final int PACKAGE_ONE_UID = 1111; private static final ComponentName ACTIVITY_COMPONENT = new ComponentName("com.one", "test"); @@ -221,7 +220,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PRIMARY_USER).getIdentifier(), true)); @@ -230,7 +228,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -244,7 +241,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PRIMARY_USER).getIdentifier(), false)); @@ -253,7 +249,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -269,7 +264,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), true)); @@ -278,7 +272,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -294,7 +287,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), false)); @@ -303,7 +295,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -317,7 +308,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_TWO, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), true)); @@ -326,7 +316,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -340,7 +329,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_TWO, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), false)); @@ -349,7 +337,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -365,7 +352,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), true)); @@ -374,7 +360,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -395,7 +380,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), false)); @@ -404,7 +388,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -418,7 +401,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, new ComponentName(PACKAGE_TWO, "test"), UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), true)); @@ -427,7 +409,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -441,7 +422,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, new ComponentName(PACKAGE_TWO, "test"), UserHandle.of(PROFILE_OF_PRIMARY_USER).getIdentifier(), false)); @@ -450,7 +430,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -464,7 +443,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(SECONDARY_USER).getIdentifier(), true)); @@ -473,7 +451,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -487,7 +464,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(SECONDARY_USER).getIdentifier(), false)); @@ -496,7 +472,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), anyString(), - nullable(String.class), any(Intent.class), nullable(Bundle.class), anyInt()); @@ -509,7 +484,6 @@ public class CrossProfileAppsServiceImplTest { mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, - FEATURE_ID, ACTIVITY_COMPONENT, UserHandle.of(PRIMARY_USER).getIdentifier(), true); @@ -518,7 +492,6 @@ public class CrossProfileAppsServiceImplTest { .startActivityAsUser( nullable(IApplicationThread.class), eq(PACKAGE_ONE), - eq(FEATURE_ID), any(Intent.class), nullable(Bundle.class), eq(PRIMARY_USER)); diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java index 63f667f49b0b..63da5fbab122 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java @@ -3132,7 +3132,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // Not launchable. doReturn(ActivityManager.START_CLASS_NOT_FOUND) .when(mMockActivityTaskManagerInternal).startActivitiesAsPackage( - anyStringOrNull(), anyStringOrNull(), anyInt(), + anyStringOrNull(), anyInt(), anyOrNull(Intent[].class), anyOrNull(Bundle.class)); assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_0, ActivityNotFoundException.class); @@ -3141,7 +3141,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { doReturn(ActivityManager.START_CLASS_NOT_FOUND) .when(mMockActivityTaskManagerInternal) .startActivitiesAsPackage( - anyStringOrNull(), anyStringOrNull(), anyInt(), + anyStringOrNull(), anyInt(), anyOrNull(Intent[].class), anyOrNull(Bundle.class)); assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_0, ActivityNotFoundException.class); diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java index af04f7641250..135d00586329 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java @@ -120,7 +120,7 @@ public class ActivityStartInterceptorTest { mInterceptor = new ActivityStartInterceptor( mService, mSupervisor, mRootWindowContainer, mContext); mInterceptor.setStates(TEST_USER_ID, TEST_REAL_CALLING_PID, TEST_REAL_CALLING_UID, - TEST_START_FLAGS, TEST_CALLING_PACKAGE, null); + TEST_START_FLAGS, TEST_CALLING_PACKAGE); // Mock ActivityManagerInternal LocalServices.removeServiceForTest(ActivityManagerInternal.class); diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java index fa182d68d917..bab877e6c26f 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java @@ -275,7 +275,7 @@ public class ActivityStarterTests extends ActivityTestsBase { if (containsConditions(preconditions, PRECONDITION_CANNOT_START_ANY_ACTIVITY)) { doReturn(false).when(service.mStackSupervisor).checkStartAnyActivityPermission( - any(), any(), any(), anyInt(), anyInt(), anyInt(), any(), any(), + any(), any(), any(), anyInt(), anyInt(), anyInt(), any(), anyBoolean(), anyBoolean(), any(), any(), any()); } @@ -349,7 +349,7 @@ public class ActivityStarterTests extends ActivityTestsBase { boolean mockGetLaunchStack) { // always allow test to start activity. doReturn(true).when(mSupervisor).checkStartAnyActivityPermission( - any(), any(), any(), anyInt(), anyInt(), anyInt(), any(), any(), + any(), any(), any(), anyInt(), anyInt(), anyInt(), any(), anyBoolean(), anyBoolean(), any(), any(), any()); if (mockGetLaunchStack) { diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java index c93dc9757853..eb84d0af35c7 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java @@ -255,10 +255,10 @@ class ActivityTestsBase extends SystemServiceTestsBase { final ActivityRecord activity = new ActivityRecord(mService, null /* caller */, mLaunchedFromPid /* launchedFromPid */, mLaunchedFromUid /* launchedFromUid */, - null, null, intent, null, aInfo /*aInfo*/, new Configuration(), - null /* resultTo */, null /* resultWho */, 0 /* reqCode */, - false /*componentSpecified*/, false /* rootVoiceInteraction */, - mService.mStackSupervisor, options, null /* sourceRecord */); + null, intent, null, aInfo /*aInfo*/, new Configuration(), null /* resultTo */, + null /* resultWho */, 0 /* reqCode */, false /*componentSpecified*/, + false /* rootVoiceInteraction */, mService.mStackSupervisor, options, + null /* sourceRecord */); spyOn(activity); if (mTask != null) { // fullscreen value is normally read from resources in ctor, so for testing we need diff --git a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java index f517881d835b..e50750841e20 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java +++ b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java @@ -439,11 +439,11 @@ public class SystemServicesTestRule implements TestRule { doNothing().when(this).updateCpuStats(); // AppOpsService - final AppOpsManager aos = mock(AppOpsManager.class); - doReturn(aos).when(this).getAppOpsManager(); + final AppOpsService aos = mock(AppOpsService.class); + doReturn(aos).when(this).getAppOpsService(); // Make sure permission checks aren't overridden. - doReturn(AppOpsManager.MODE_DEFAULT).when(aos).noteOpNoThrow(anyInt(), anyInt(), - anyString(), nullable(String.class), nullable(String.class)); + doReturn(AppOpsManager.MODE_DEFAULT).when(aos).noteOperation(anyInt(), anyInt(), + anyString(), nullable(String.class), anyBoolean(), nullable(String.class)); // UserManagerService final UserManagerService ums = mock(UserManagerService.class); diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java index feadd0a496bb..ebf14d2c6a19 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java @@ -988,7 +988,7 @@ public class TaskRecordTests extends ActivityTestsBase { private Task createTask(int taskId) { return new ActivityStack(mService, taskId, new Intent(), null, null, null, ActivityBuilder.getDefaultComponent(), null, false, false, false, 0, 10050, null, - 0, false, null, 0, 0, 0, 0, 0, null, null, 0, false, false, false, 0, + 0, false, null, 0, 0, 0, 0, 0, null, 0, false, false, false, 0, 0, null /*ActivityInfo*/, null /*_voiceSession*/, null /*_voiceInteractor*/, null /*stack*/); } @@ -1022,7 +1022,7 @@ public class TaskRecordTests extends ActivityTestsBase { boolean neverRelinquishIdentity, ActivityManager.TaskDescription lastTaskDescription, int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor, - int callingUid, String callingPackage, String callingFeatureId, int resizeMode, + int callingUid, String callingPackage, int resizeMode, boolean supportsPictureInPicture, boolean realActivitySuspended, boolean userSetupComplete, int minWidth, int minHeight, ActivityStack stack) { diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java index 8378d8ed9f68..d5eec332cda0 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java @@ -747,8 +747,7 @@ public class VoiceInteractionManagerService extends SystemService { } @Override - public int startVoiceActivity(IBinder token, Intent intent, String resolvedType, - String callingFeatureId) { + public int startVoiceActivity(IBinder token, Intent intent, String resolvedType) { synchronized (this) { if (mImpl == null) { Slog.w(TAG, "startVoiceActivity without running voice interaction service"); @@ -758,8 +757,8 @@ public class VoiceInteractionManagerService extends SystemService { final int callingUid = Binder.getCallingUid(); final long caller = Binder.clearCallingIdentity(); try { - return mImpl.startVoiceActivityLocked(callingFeatureId, callingPid, callingUid, - token, intent, resolvedType); + return mImpl.startVoiceActivityLocked(callingPid, callingUid, token, + intent, resolvedType); } finally { Binder.restoreCallingIdentity(caller); } @@ -767,8 +766,7 @@ public class VoiceInteractionManagerService extends SystemService { } @Override - public int startAssistantActivity(IBinder token, Intent intent, String resolvedType, - String callingFeatureId) { + public int startAssistantActivity(IBinder token, Intent intent, String resolvedType) { synchronized (this) { if (mImpl == null) { Slog.w(TAG, "startAssistantActivity without running voice interaction service"); @@ -778,8 +776,8 @@ public class VoiceInteractionManagerService extends SystemService { final int callingUid = Binder.getCallingUid(); final long caller = Binder.clearCallingIdentity(); try { - return mImpl.startAssistantActivityLocked(callingFeatureId, callingPid, - callingUid, token, intent, resolvedType); + return mImpl.startAssistantActivityLocked(callingPid, callingUid, token, + intent, resolvedType); } finally { Binder.restoreCallingIdentity(caller); } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index a62b03ca82e4..a1210cfce26d 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -216,8 +216,8 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne return true; } - public int startVoiceActivityLocked(@Nullable String callingFeatureId, int callingPid, - int callingUid, IBinder token, Intent intent, String resolvedType) { + public int startVoiceActivityLocked(int callingPid, int callingUid, IBinder token, + Intent intent, String resolvedType) { try { if (mActiveSession == null || token != mActiveSession.mToken) { Slog.w(TAG, "startVoiceActivity does not match active session"); @@ -230,16 +230,16 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne intent = new Intent(intent); intent.addCategory(Intent.CATEGORY_VOICE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); - return mAtm.startVoiceActivity(mComponent.getPackageName(), callingFeatureId, - callingPid, callingUid, intent, resolvedType, mActiveSession.mSession, - mActiveSession.mInteractor, 0, null, null, mUser); + return mAtm.startVoiceActivity(mComponent.getPackageName(), callingPid, callingUid, + intent, resolvedType, mActiveSession.mSession, mActiveSession.mInteractor, + 0, null, null, mUser); } catch (RemoteException e) { throw new IllegalStateException("Unexpected remote error", e); } } - public int startAssistantActivityLocked(@Nullable String callingFeatureId, int callingPid, - int callingUid, IBinder token, Intent intent, String resolvedType) { + public int startAssistantActivityLocked(int callingPid, int callingUid, IBinder token, + Intent intent, String resolvedType) { try { if (mActiveSession == null || token != mActiveSession.mToken) { Slog.w(TAG, "startAssistantActivity does not match active session"); @@ -253,8 +253,8 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); final ActivityOptions options = ActivityOptions.makeBasic(); options.setLaunchActivityType(ACTIVITY_TYPE_ASSISTANT); - return mAtm.startAssistantActivity(mComponent.getPackageName(), callingFeatureId, - callingPid, callingUid, intent, resolvedType, options.toBundle(), mUser); + return mAtm.startAssistantActivity(mComponent.getPackageName(), callingPid, callingUid, + intent, resolvedType, options.toBundle(), mUser); } catch (RemoteException e) { throw new IllegalStateException("Unexpected remote error", e); } diff --git a/tests/MemoryUsage/src/com/android/tests/memoryusage/MemoryUsageTest.java b/tests/MemoryUsage/src/com/android/tests/memoryusage/MemoryUsageTest.java index 59049160e885..1361df30e9d7 100644 --- a/tests/MemoryUsage/src/com/android/tests/memoryusage/MemoryUsageTest.java +++ b/tests/MemoryUsage/src/com/android/tests/memoryusage/MemoryUsageTest.java @@ -321,8 +321,7 @@ public class MemoryUsageTest extends InstrumentationTestCase { } mAtm.startActivityAndWait(null, - getInstrumentation().getContext().getBasePackageName(), - getInstrumentation().getContext().getFeatureId(), mLaunchIntent, + getInstrumentation().getContext().getBasePackageName(), mLaunchIntent, mimeType, null, null, 0, mLaunchIntent.getFlags(), null, null, UserHandle.USER_CURRENT_OR_SELF); } catch (RemoteException e) { |