Loading services/core/java/com/android/server/wm/ActivityStarter.java +16 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ import android.app.IApplicationThread; import android.app.PendingIntent; import android.app.ProfilerInfo; import android.app.WaitResult; import android.content.ComponentName; import android.content.IIntentSender; import android.content.Intent; import android.content.IntentSender; Loading Loading @@ -1228,6 +1229,20 @@ class ActivityStarter { mController.onExecutionComplete(this); } private boolean isHomeApp(int uid, @Nullable String packageName) { if (mService.mHomeProcess != null) { // Fast check return uid == mService.mHomeProcess.mUid; } if (packageName == null) { return false; } ComponentName activity = mService.getPackageManagerInternalLocked().getDefaultHomeActivity( UserHandle.getUserId(uid)); return activity != null && packageName.equals(activity.getPackageName()); } boolean shouldAbortBackgroundActivityStart(int callingUid, int callingPid, final String callingPackage, int realCallingUid, int realCallingPid, WindowProcessController callerApp, PendingIntentRecord originatingPendingIntent, Loading @@ -1243,7 +1258,7 @@ class ActivityStarter { } // Always allow home application to start activities. if (mService.mHomeProcess != null && callingUid == mService.mHomeProcess.mUid) { if (isHomeApp(callingUid, callingPackage)) { if (DEBUG_ACTIVITY_STARTS) { Slog.d(TAG, "Activity start allowed for home app callingUid (" + callingUid + ")"); } Loading services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -348,6 +348,7 @@ public class ActivityStarterTests extends WindowTestsBase { invocation -> { throw new RuntimeException("Not stubbed"); }); doReturn(null).when(mMockPackageManager).getDefaultHomeActivity(anyInt()); doReturn(mMockPackageManager).when(mAtm).getPackageManagerInternalLocked(); doReturn(false).when(mMockPackageManager).isInstantAppInstallerComponent(any()); doReturn(null).when(mMockPackageManager).resolveIntent(any(), any(), anyInt(), anyInt(), Loading Loading
services/core/java/com/android/server/wm/ActivityStarter.java +16 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ import android.app.IApplicationThread; import android.app.PendingIntent; import android.app.ProfilerInfo; import android.app.WaitResult; import android.content.ComponentName; import android.content.IIntentSender; import android.content.Intent; import android.content.IntentSender; Loading Loading @@ -1228,6 +1229,20 @@ class ActivityStarter { mController.onExecutionComplete(this); } private boolean isHomeApp(int uid, @Nullable String packageName) { if (mService.mHomeProcess != null) { // Fast check return uid == mService.mHomeProcess.mUid; } if (packageName == null) { return false; } ComponentName activity = mService.getPackageManagerInternalLocked().getDefaultHomeActivity( UserHandle.getUserId(uid)); return activity != null && packageName.equals(activity.getPackageName()); } boolean shouldAbortBackgroundActivityStart(int callingUid, int callingPid, final String callingPackage, int realCallingUid, int realCallingPid, WindowProcessController callerApp, PendingIntentRecord originatingPendingIntent, Loading @@ -1243,7 +1258,7 @@ class ActivityStarter { } // Always allow home application to start activities. if (mService.mHomeProcess != null && callingUid == mService.mHomeProcess.mUid) { if (isHomeApp(callingUid, callingPackage)) { if (DEBUG_ACTIVITY_STARTS) { Slog.d(TAG, "Activity start allowed for home app callingUid (" + callingUid + ")"); } Loading
services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -348,6 +348,7 @@ public class ActivityStarterTests extends WindowTestsBase { invocation -> { throw new RuntimeException("Not stubbed"); }); doReturn(null).when(mMockPackageManager).getDefaultHomeActivity(anyInt()); doReturn(mMockPackageManager).when(mAtm).getPackageManagerInternalLocked(); doReturn(false).when(mMockPackageManager).isInstantAppInstallerComponent(any()); doReturn(null).when(mMockPackageManager).resolveIntent(any(), any(), anyInt(), anyInt(), Loading