Loading services/core/java/com/android/server/am/ActivityManagerService.java +7 −2 Original line number Diff line number Diff line Loading @@ -2419,7 +2419,7 @@ public class ActivityManagerService extends IActivityManager.Stub // handlers to other threads. So take care to be explicit about the looper. public ActivityManagerService(Context systemContext, ActivityTaskManagerService atm) { LockGuard.installLock(this, LockGuard.INDEX_ACTIVITY); mInjector = new Injector(); mInjector = new Injector(systemContext); mContext = systemContext; mFactoryTest = FactoryTest.getMode(); Loading Loading @@ -18898,9 +18898,14 @@ public class ActivityManagerService extends IActivityManager.Stub @VisibleForTesting public static class Injector { private NetworkManagementInternal mNmi; private Context mContext; public Injector(Context context) { mContext = context; } public Context getContext() { return null; return mContext; } public AppOpsService getAppOpsService(File file, Handler handler) { services/tests/mockingservicestests/src/com/android/server/am/AppCompactorTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -82,7 +82,9 @@ public final class AppCompactorTest { true /* allowIo */); mThread.start(); ActivityManagerService ams = new ActivityManagerService(new TestInjector(), mThread); ActivityManagerService ams = new ActivityManagerService( new TestInjector(InstrumentationRegistry.getInstrumentation().getContext()), mThread); mCompactorUnderTest = new AppCompactor(ams, new AppCompactor.PropertyChangedCallbackForTest() { @Override Loading Loading @@ -660,6 +662,11 @@ public final class AppCompactorTest { } private class TestInjector extends Injector { TestInjector(Context context) { super(context); } @Override public AppOpsService getAppOpsService(File file, Handler handler) { return mAppOpsService; Loading @@ -669,10 +676,5 @@ public final class AppCompactorTest { public Handler getUiHandler(ActivityManagerService service) { return mHandler; } @Override public Context getContext() { return InstrumentationRegistry.getInstrumentation().getContext(); } } } services/tests/servicestests/src/com/android/server/am/ActivityManagerServiceTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class ActivityManagerServiceTest { mHandlerThread = new HandlerThread(TAG); mHandlerThread.start(); mHandler = new TestHandler(mHandlerThread.getLooper()); mInjector = new TestInjector(); mInjector = new TestInjector(mContext); mAms = new ActivityManagerService(mInjector, mServiceThreadRule.getThread()); mAms.mWaitForNetworkTimeoutMs = 2000; mAms.mActivityTaskManager = new ActivityTaskManagerService(mContext); Loading Loading @@ -920,9 +920,8 @@ public class ActivityManagerServiceTest { private class TestInjector extends Injector { private boolean mRestricted = true; @Override public Context getContext() { return mContext; TestInjector(Context context) { super(context); } @Override Loading services/tests/servicestests/src/com/android/server/am/AppErrorDialogTest.java +1 −6 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public class AppErrorDialogTest { @Before public void setUp() throws Exception { mContext = getInstrumentation().getTargetContext(); mService = new ActivityManagerService(new ActivityManagerService.Injector() { mService = new ActivityManagerService(new ActivityManagerService.Injector(mContext) { @Override public AppOpsService getAppOpsService(File file, Handler handler) { return null; Loading @@ -66,11 +66,6 @@ public class AppErrorDialogTest { public boolean isNetworkRestrictedForUid(int uid) { return false; } @Override public Context getContext() { return mContext; } }, mServiceThreadRule.getThread()); mService.mActivityTaskManager = new ActivityTaskManagerService(mContext); mService.mActivityTaskManager.initialize(null, null, mContext.getMainLooper()); Loading services/tests/servicestests/src/com/android/server/am/CoreSettingsObserverTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -93,7 +93,8 @@ public class CoreSettingsObserverTest { mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider()); when(mContext.getContentResolver()).thenReturn(mContentResolver); mAms = new ActivityManagerService(new TestInjector(), mServiceThreadRule.getThread()); mAms = new ActivityManagerService(new TestInjector(mContext), mServiceThreadRule.getThread()); mCoreSettingsObserver = new CoreSettingsObserver(mAms); } Loading Loading @@ -158,9 +159,9 @@ public class CoreSettingsObserverTest { } private class TestInjector extends Injector { @Override public Context getContext() { return getInstrumentation().getContext(); TestInjector(Context context) { super(context); } @Override Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +7 −2 Original line number Diff line number Diff line Loading @@ -2419,7 +2419,7 @@ public class ActivityManagerService extends IActivityManager.Stub // handlers to other threads. So take care to be explicit about the looper. public ActivityManagerService(Context systemContext, ActivityTaskManagerService atm) { LockGuard.installLock(this, LockGuard.INDEX_ACTIVITY); mInjector = new Injector(); mInjector = new Injector(systemContext); mContext = systemContext; mFactoryTest = FactoryTest.getMode(); Loading Loading @@ -18898,9 +18898,14 @@ public class ActivityManagerService extends IActivityManager.Stub @VisibleForTesting public static class Injector { private NetworkManagementInternal mNmi; private Context mContext; public Injector(Context context) { mContext = context; } public Context getContext() { return null; return mContext; } public AppOpsService getAppOpsService(File file, Handler handler) {
services/tests/mockingservicestests/src/com/android/server/am/AppCompactorTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -82,7 +82,9 @@ public final class AppCompactorTest { true /* allowIo */); mThread.start(); ActivityManagerService ams = new ActivityManagerService(new TestInjector(), mThread); ActivityManagerService ams = new ActivityManagerService( new TestInjector(InstrumentationRegistry.getInstrumentation().getContext()), mThread); mCompactorUnderTest = new AppCompactor(ams, new AppCompactor.PropertyChangedCallbackForTest() { @Override Loading Loading @@ -660,6 +662,11 @@ public final class AppCompactorTest { } private class TestInjector extends Injector { TestInjector(Context context) { super(context); } @Override public AppOpsService getAppOpsService(File file, Handler handler) { return mAppOpsService; Loading @@ -669,10 +676,5 @@ public final class AppCompactorTest { public Handler getUiHandler(ActivityManagerService service) { return mHandler; } @Override public Context getContext() { return InstrumentationRegistry.getInstrumentation().getContext(); } } }
services/tests/servicestests/src/com/android/server/am/ActivityManagerServiceTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class ActivityManagerServiceTest { mHandlerThread = new HandlerThread(TAG); mHandlerThread.start(); mHandler = new TestHandler(mHandlerThread.getLooper()); mInjector = new TestInjector(); mInjector = new TestInjector(mContext); mAms = new ActivityManagerService(mInjector, mServiceThreadRule.getThread()); mAms.mWaitForNetworkTimeoutMs = 2000; mAms.mActivityTaskManager = new ActivityTaskManagerService(mContext); Loading Loading @@ -920,9 +920,8 @@ public class ActivityManagerServiceTest { private class TestInjector extends Injector { private boolean mRestricted = true; @Override public Context getContext() { return mContext; TestInjector(Context context) { super(context); } @Override Loading
services/tests/servicestests/src/com/android/server/am/AppErrorDialogTest.java +1 −6 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public class AppErrorDialogTest { @Before public void setUp() throws Exception { mContext = getInstrumentation().getTargetContext(); mService = new ActivityManagerService(new ActivityManagerService.Injector() { mService = new ActivityManagerService(new ActivityManagerService.Injector(mContext) { @Override public AppOpsService getAppOpsService(File file, Handler handler) { return null; Loading @@ -66,11 +66,6 @@ public class AppErrorDialogTest { public boolean isNetworkRestrictedForUid(int uid) { return false; } @Override public Context getContext() { return mContext; } }, mServiceThreadRule.getThread()); mService.mActivityTaskManager = new ActivityTaskManagerService(mContext); mService.mActivityTaskManager.initialize(null, null, mContext.getMainLooper()); Loading
services/tests/servicestests/src/com/android/server/am/CoreSettingsObserverTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -93,7 +93,8 @@ public class CoreSettingsObserverTest { mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider()); when(mContext.getContentResolver()).thenReturn(mContentResolver); mAms = new ActivityManagerService(new TestInjector(), mServiceThreadRule.getThread()); mAms = new ActivityManagerService(new TestInjector(mContext), mServiceThreadRule.getThread()); mCoreSettingsObserver = new CoreSettingsObserver(mAms); } Loading Loading @@ -158,9 +159,9 @@ public class CoreSettingsObserverTest { } private class TestInjector extends Injector { @Override public Context getContext() { return getInstrumentation().getContext(); TestInjector(Context context) { super(context); } @Override Loading