Loading core/res/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2850,6 +2850,11 @@ <permission android:name="android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS" android:protectionLevel="signature|privileged" /> <!-- Allows an application to manage the companion devices. @hide --> <permission android:name="android.permission.MANAGE_COMPANION_DEVICES" android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to use SurfaceFlinger's low level features. <p>Not for use by third-party applications. @hide Loading services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -624,6 +624,11 @@ public class CompanionDeviceManagerService extends SystemService implements Bind + "associate USER_ID PACKAGE MAC_ADDRESS\n" + "disassociate USER_ID PACKAGE MAC_ADDRESS"; ShellCmd() { getContext().enforceCallingOrSelfPermission( android.Manifest.permission.MANAGE_COMPANION_DEVICES, "ShellCmd"); } @Override public int onCommand(String cmd) { switch (cmd) { Loading services/core/java/com/android/server/am/ActivityManagerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -6987,7 +6987,7 @@ public class ActivityManagerService extends IActivityManager.Stub } } private final boolean attachApplicationLocked(IApplicationThread thread, private boolean attachApplicationLocked(@NonNull IApplicationThread thread, int pid) { // Find the application record that is being attached... either via Loading Loading @@ -7292,6 +7292,9 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public final void attachApplication(IApplicationThread thread) { if (thread == null) { throw new SecurityException("Invalid application interface"); } synchronized (this) { int callingPid = Binder.getCallingPid(); final long origId = Binder.clearCallingIdentity(); services/core/java/com/android/server/am/ActivityStack.java +9 −4 Original line number Diff line number Diff line Loading @@ -3961,6 +3961,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai final boolean navigateUpToLocked(ActivityRecord srec, Intent destIntent, int resultCode, Intent resultData) { if (srec.app == null || srec.app.thread == null) { // Nothing to do if the caller is not attached, because this method should be called // from an alive activity. return false; } final TaskRecord task = srec.getTask(); final ArrayList<ActivityRecord> activities = task.mActivities; final int start = activities.indexOf(srec); Loading Loading @@ -4012,22 +4017,22 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai } if (parent != null && foundParentInTask) { final int callingUid = srec.info.applicationInfo.uid; final int parentLaunchMode = parent.info.launchMode; final int destIntentFlags = destIntent.getFlags(); if (parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE || parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK || parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP || (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) { parent.deliverNewIntentLocked(srec.info.applicationInfo.uid, destIntent, srec.packageName); parent.deliverNewIntentLocked(callingUid, destIntent, srec.packageName); } else { try { ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo( destIntent.getComponent(), 0, srec.userId); int res = mService.mActivityStarter.startActivityLocked(srec.app.thread, destIntent, null /*ephemeralIntent*/, null, aInfo, null /*rInfo*/, null, null, parent.appToken, null, 0, -1, parent.launchedFromUid, parent.launchedFromPackage, -1, parent.launchedFromUid, 0, null, null, parent.appToken, null, 0, -1, callingUid, srec.packageName, -1, callingUid, 0, null, false, true, null, null, "navigateUpTo"); foundParentInTask = res == ActivityManager.START_SUCCESS; } catch (RemoteException e) { Loading services/core/java/com/android/server/am/ActivityStarter.java +16 −1 Original line number Diff line number Diff line Loading @@ -940,6 +940,8 @@ class ActivityStarter { } else { callingPid = callingUid = -1; } boolean forceNewTask = false; final int filterCallingUid = callingUid >= 0 ? callingUid : realCallingUid; final long origId = Binder.clearCallingIdentity(); try { synchronized (mService) { Loading @@ -959,6 +961,9 @@ class ActivityStarter { // Don't modify the client's object! intent = new Intent(intent); if (forceNewTask) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } // Collect information about the target of the Intent. ActivityInfo aInfo = mSupervisor.resolveActivity(intent, resolvedTypes[i], 0, Loading @@ -984,7 +989,17 @@ class ActivityStarter { return res; } resultTo = outActivity[0] != null ? outActivity[0].appToken : null; final ActivityRecord started = outActivity[0]; if (started != null && started.getUid() == filterCallingUid) { // Only the started activity which has the same uid as the source caller can // be the caller of next activity. resultTo = started.appToken; forceNewTask = false; } else { // Different apps not adjacent to the caller are forced to be new task. resultTo = null; forceNewTask = true; } } } } finally { Loading Loading
core/res/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2850,6 +2850,11 @@ <permission android:name="android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS" android:protectionLevel="signature|privileged" /> <!-- Allows an application to manage the companion devices. @hide --> <permission android:name="android.permission.MANAGE_COMPANION_DEVICES" android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to use SurfaceFlinger's low level features. <p>Not for use by third-party applications. @hide Loading
services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -624,6 +624,11 @@ public class CompanionDeviceManagerService extends SystemService implements Bind + "associate USER_ID PACKAGE MAC_ADDRESS\n" + "disassociate USER_ID PACKAGE MAC_ADDRESS"; ShellCmd() { getContext().enforceCallingOrSelfPermission( android.Manifest.permission.MANAGE_COMPANION_DEVICES, "ShellCmd"); } @Override public int onCommand(String cmd) { switch (cmd) { Loading
services/core/java/com/android/server/am/ActivityManagerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -6987,7 +6987,7 @@ public class ActivityManagerService extends IActivityManager.Stub } } private final boolean attachApplicationLocked(IApplicationThread thread, private boolean attachApplicationLocked(@NonNull IApplicationThread thread, int pid) { // Find the application record that is being attached... either via Loading Loading @@ -7292,6 +7292,9 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public final void attachApplication(IApplicationThread thread) { if (thread == null) { throw new SecurityException("Invalid application interface"); } synchronized (this) { int callingPid = Binder.getCallingPid(); final long origId = Binder.clearCallingIdentity();
services/core/java/com/android/server/am/ActivityStack.java +9 −4 Original line number Diff line number Diff line Loading @@ -3961,6 +3961,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai final boolean navigateUpToLocked(ActivityRecord srec, Intent destIntent, int resultCode, Intent resultData) { if (srec.app == null || srec.app.thread == null) { // Nothing to do if the caller is not attached, because this method should be called // from an alive activity. return false; } final TaskRecord task = srec.getTask(); final ArrayList<ActivityRecord> activities = task.mActivities; final int start = activities.indexOf(srec); Loading Loading @@ -4012,22 +4017,22 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai } if (parent != null && foundParentInTask) { final int callingUid = srec.info.applicationInfo.uid; final int parentLaunchMode = parent.info.launchMode; final int destIntentFlags = destIntent.getFlags(); if (parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE || parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK || parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP || (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) { parent.deliverNewIntentLocked(srec.info.applicationInfo.uid, destIntent, srec.packageName); parent.deliverNewIntentLocked(callingUid, destIntent, srec.packageName); } else { try { ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo( destIntent.getComponent(), 0, srec.userId); int res = mService.mActivityStarter.startActivityLocked(srec.app.thread, destIntent, null /*ephemeralIntent*/, null, aInfo, null /*rInfo*/, null, null, parent.appToken, null, 0, -1, parent.launchedFromUid, parent.launchedFromPackage, -1, parent.launchedFromUid, 0, null, null, parent.appToken, null, 0, -1, callingUid, srec.packageName, -1, callingUid, 0, null, false, true, null, null, "navigateUpTo"); foundParentInTask = res == ActivityManager.START_SUCCESS; } catch (RemoteException e) { Loading
services/core/java/com/android/server/am/ActivityStarter.java +16 −1 Original line number Diff line number Diff line Loading @@ -940,6 +940,8 @@ class ActivityStarter { } else { callingPid = callingUid = -1; } boolean forceNewTask = false; final int filterCallingUid = callingUid >= 0 ? callingUid : realCallingUid; final long origId = Binder.clearCallingIdentity(); try { synchronized (mService) { Loading @@ -959,6 +961,9 @@ class ActivityStarter { // Don't modify the client's object! intent = new Intent(intent); if (forceNewTask) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } // Collect information about the target of the Intent. ActivityInfo aInfo = mSupervisor.resolveActivity(intent, resolvedTypes[i], 0, Loading @@ -984,7 +989,17 @@ class ActivityStarter { return res; } resultTo = outActivity[0] != null ? outActivity[0].appToken : null; final ActivityRecord started = outActivity[0]; if (started != null && started.getUid() == filterCallingUid) { // Only the started activity which has the same uid as the source caller can // be the caller of next activity. resultTo = started.appToken; forceNewTask = false; } else { // Different apps not adjacent to the caller are forced to be new task. resultTo = null; forceNewTask = true; } } } } finally { Loading