Loading services/core/java/com/android/server/am/ActivityManagerService.java +10 −1 Original line number Diff line number Diff line Loading @@ -2793,7 +2793,7 @@ public class ActivityManagerService extends IActivityManager.Stub mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler); mTaskChangeNotificationController = new TaskChangeNotificationController(this, mStackSupervisor, mHandler); mActivityStarter = new ActivityStarter(this, AppGlobals.getPackageManager()); mActivityStarter = new ActivityStarter(this); mRecentTasks = createRecentTasks(); mStackSupervisor.setRecentTasks(mRecentTasks); mLockTaskController = new LockTaskController(mContext, mStackSupervisor, mHandler); Loading Loading @@ -11715,6 +11715,15 @@ public class ActivityManagerService extends IActivityManager.Stub return true; } /** * Returns the PackageManager. Used by classes hosted by {@link ActivityManagerService}. The * PackageManager could be unavailable at construction time and therefore needs to be accessed * on demand. */ IPackageManager getPackageManager() { return AppGlobals.getPackageManager(); } PackageManagerInternal getPackageManagerInternalLocked() { if (mPackageManagerInt == null) { mPackageManagerInt = LocalServices.getService(PackageManagerInternal.class); services/core/java/com/android/server/am/ActivityStarter.java +3 −5 Original line number Diff line number Diff line Loading @@ -134,7 +134,6 @@ class ActivityStarter { private static final int INVALID_LAUNCH_MODE = -1; private final ActivityManagerService mService; private final IPackageManager mPackageManager; private final ActivityStackSupervisor mSupervisor; private final ActivityStartInterceptor mInterceptor; Loading Loading @@ -234,9 +233,8 @@ class ActivityStarter { mIntentDelivered = false; } ActivityStarter(ActivityManagerService service, IPackageManager packageManager) { ActivityStarter(ActivityManagerService service) { mService = service; mPackageManager = packageManager; mSupervisor = mService.mStackSupervisor; mInterceptor = new ActivityStartInterceptor(mService, mSupervisor); } Loading Loading @@ -379,7 +377,7 @@ class ActivityStarter { && sourceRecord.info.applicationInfo.uid != aInfo.applicationInfo.uid) { try { intent.addCategory(Intent.CATEGORY_VOICE); if (!mPackageManager.activitySupportsIntent( if (!mService.getPackageManager().activitySupportsIntent( intent.getComponent(), intent, resolvedType)) { Slog.w(TAG, "Activity being started in current voice task does not support voice: " Loading @@ -397,7 +395,7 @@ class ActivityStarter { // If the caller is starting a new voice session, just make sure the target // is actually allowing it to run this way. try { if (!mPackageManager.activitySupportsIntent(intent.getComponent(), if (!mService.getPackageManager().activitySupportsIntent(intent.getComponent(), intent, resolvedType)) { Slog.w(TAG, "Activity being started in new voice task does not support: " Loading services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java +2 −3 Original line number Diff line number Diff line Loading @@ -95,8 +95,7 @@ public class ActivityStarterTests extends ActivityTestsBase { public void setUp() throws Exception { super.setUp(); mService = createActivityManagerService(); mPackageManager = mock(IPackageManager.class); mStarter = new ActivityStarter(mService, mPackageManager); mStarter = new ActivityStarter(mService); } @Test Loading Loading @@ -178,7 +177,7 @@ public class ActivityStarterTests extends ActivityTestsBase { int expectedResult) { final ActivityManagerService service = createActivityManagerService(); final IPackageManager packageManager = mock(IPackageManager.class); final ActivityStarter starter = new ActivityStarter(service, packageManager); final ActivityStarter starter = new ActivityStarter(service); final IApplicationThread caller = mock(IApplicationThread.class); Loading services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.res.Configuration; import android.graphics.Rect; import android.hardware.display.DisplayManager; Loading Loading @@ -90,6 +91,7 @@ public class ActivityTestsBase { protected ActivityManagerService setupActivityManagerService(ActivityManagerService service) { service = spy(service); doReturn(mock(IPackageManager.class)).when(service).getPackageManager(); service.mWindowManager = prepareMockWindowManager(); return service; } Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +10 −1 Original line number Diff line number Diff line Loading @@ -2793,7 +2793,7 @@ public class ActivityManagerService extends IActivityManager.Stub mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler); mTaskChangeNotificationController = new TaskChangeNotificationController(this, mStackSupervisor, mHandler); mActivityStarter = new ActivityStarter(this, AppGlobals.getPackageManager()); mActivityStarter = new ActivityStarter(this); mRecentTasks = createRecentTasks(); mStackSupervisor.setRecentTasks(mRecentTasks); mLockTaskController = new LockTaskController(mContext, mStackSupervisor, mHandler); Loading Loading @@ -11715,6 +11715,15 @@ public class ActivityManagerService extends IActivityManager.Stub return true; } /** * Returns the PackageManager. Used by classes hosted by {@link ActivityManagerService}. The * PackageManager could be unavailable at construction time and therefore needs to be accessed * on demand. */ IPackageManager getPackageManager() { return AppGlobals.getPackageManager(); } PackageManagerInternal getPackageManagerInternalLocked() { if (mPackageManagerInt == null) { mPackageManagerInt = LocalServices.getService(PackageManagerInternal.class);
services/core/java/com/android/server/am/ActivityStarter.java +3 −5 Original line number Diff line number Diff line Loading @@ -134,7 +134,6 @@ class ActivityStarter { private static final int INVALID_LAUNCH_MODE = -1; private final ActivityManagerService mService; private final IPackageManager mPackageManager; private final ActivityStackSupervisor mSupervisor; private final ActivityStartInterceptor mInterceptor; Loading Loading @@ -234,9 +233,8 @@ class ActivityStarter { mIntentDelivered = false; } ActivityStarter(ActivityManagerService service, IPackageManager packageManager) { ActivityStarter(ActivityManagerService service) { mService = service; mPackageManager = packageManager; mSupervisor = mService.mStackSupervisor; mInterceptor = new ActivityStartInterceptor(mService, mSupervisor); } Loading Loading @@ -379,7 +377,7 @@ class ActivityStarter { && sourceRecord.info.applicationInfo.uid != aInfo.applicationInfo.uid) { try { intent.addCategory(Intent.CATEGORY_VOICE); if (!mPackageManager.activitySupportsIntent( if (!mService.getPackageManager().activitySupportsIntent( intent.getComponent(), intent, resolvedType)) { Slog.w(TAG, "Activity being started in current voice task does not support voice: " Loading @@ -397,7 +395,7 @@ class ActivityStarter { // If the caller is starting a new voice session, just make sure the target // is actually allowing it to run this way. try { if (!mPackageManager.activitySupportsIntent(intent.getComponent(), if (!mService.getPackageManager().activitySupportsIntent(intent.getComponent(), intent, resolvedType)) { Slog.w(TAG, "Activity being started in new voice task does not support: " Loading
services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java +2 −3 Original line number Diff line number Diff line Loading @@ -95,8 +95,7 @@ public class ActivityStarterTests extends ActivityTestsBase { public void setUp() throws Exception { super.setUp(); mService = createActivityManagerService(); mPackageManager = mock(IPackageManager.class); mStarter = new ActivityStarter(mService, mPackageManager); mStarter = new ActivityStarter(mService); } @Test Loading Loading @@ -178,7 +177,7 @@ public class ActivityStarterTests extends ActivityTestsBase { int expectedResult) { final ActivityManagerService service = createActivityManagerService(); final IPackageManager packageManager = mock(IPackageManager.class); final ActivityStarter starter = new ActivityStarter(service, packageManager); final ActivityStarter starter = new ActivityStarter(service); final IApplicationThread caller = mock(IApplicationThread.class); Loading
services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.res.Configuration; import android.graphics.Rect; import android.hardware.display.DisplayManager; Loading Loading @@ -90,6 +91,7 @@ public class ActivityTestsBase { protected ActivityManagerService setupActivityManagerService(ActivityManagerService service) { service = spy(service); doReturn(mock(IPackageManager.class)).when(service).getPackageManager(); service.mWindowManager = prepareMockWindowManager(); return service; } Loading