Merge "Fix memory leaks in Settings" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-08-17 18:04:44 +00:00
committed by Android (Google) Code Review
3 changed files with 26 additions and 20 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.fuelgauge;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doNothing;
@@ -89,6 +90,7 @@ public class BackgroundActivityPreferenceControllerTest {
mShadowContext = RuntimeEnvironment.application;
FakeFeatureFactory.setupForTest();
when(mContext.getApplicationContext()).thenReturn(mContext);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mAppOpsManager);
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
@@ -118,7 +120,7 @@ public class BackgroundActivityPreferenceControllerTest {
@Test
public void testHandlePreferenceTreeClick_restrictApp_showDialog() {
doReturn(AppOpsManager.MODE_ALLOWED).when(mAppOpsManager)
.checkOpNoThrow(anyInt(), anyInt(), anyString());
.checkOpNoThrow(anyInt(), anyInt(), anyString());
mController.handlePreferenceTreeClick(mPreference);
@@ -128,7 +130,7 @@ public class BackgroundActivityPreferenceControllerTest {
@Test
public void testHandlePreferenceTreeClick_unRestrictApp_showDialog() {
doReturn(AppOpsManager.MODE_IGNORED).when(mAppOpsManager)
.checkOpNoThrow(anyInt(), anyInt(), anyString());
.checkOpNoThrow(anyInt(), anyInt(), anyString());
mController.handlePreferenceTreeClick(mPreference);