Loading packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java +7 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.DumpController; import com.android.systemui.Dumpable; import com.android.systemui.dagger.qualifiers.BgLooper; Loading Loading @@ -77,12 +78,14 @@ public class AppOpsControllerImpl implements AppOpsController, }; @Inject public AppOpsControllerImpl(Context context, @BgLooper Looper bgLooper) { this(context, bgLooper, new PermissionFlagsCache(context)); public AppOpsControllerImpl(Context context, @BgLooper Looper bgLooper, DumpController dumpController) { this(context, bgLooper, new PermissionFlagsCache(context), dumpController); } @VisibleForTesting protected AppOpsControllerImpl(Context context, Looper bgLooper, PermissionFlagsCache cache) { protected AppOpsControllerImpl(Context context, Looper bgLooper, PermissionFlagsCache cache, DumpController dumpController) { mContext = context; mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); mFlagsCache = cache; Loading @@ -91,6 +94,7 @@ public class AppOpsControllerImpl implements AppOpsController, for (int i = 0; i < numOps; i++) { mCallbacksByCode.put(OPS[i], new ArraySet<>()); } dumpController.registerDumpable(TAG, this); } @VisibleForTesting Loading packages/SystemUI/tests/src/com/android/systemui/appops/AppOpsControllerTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.DumpController; import com.android.systemui.SysuiTestCase; import org.junit.Before; Loading Loading @@ -66,6 +67,8 @@ public class AppOpsControllerTest extends SysuiTestCase { private AppOpsControllerImpl.H mMockHandler; @Mock private PermissionFlagsCache mFlagsCache; @Mock private DumpController mDumpController; private AppOpsControllerImpl mController; private TestableLooper mTestableLooper; Loading @@ -89,7 +92,8 @@ public class AppOpsControllerTest extends SysuiTestCase { when(mFlagsCache.getPermissionFlags(anyString(), anyString(), eq(UserHandle.getUserHandleForUid(TEST_UID_NON_USER_SENSITIVE)))).thenReturn(0); mController = new AppOpsControllerImpl(mContext, mTestableLooper.getLooper(), mFlagsCache); mController = new AppOpsControllerImpl(mContext, mTestableLooper.getLooper(), mFlagsCache, mDumpController); } @Test Loading Loading
packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java +7 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.DumpController; import com.android.systemui.Dumpable; import com.android.systemui.dagger.qualifiers.BgLooper; Loading Loading @@ -77,12 +78,14 @@ public class AppOpsControllerImpl implements AppOpsController, }; @Inject public AppOpsControllerImpl(Context context, @BgLooper Looper bgLooper) { this(context, bgLooper, new PermissionFlagsCache(context)); public AppOpsControllerImpl(Context context, @BgLooper Looper bgLooper, DumpController dumpController) { this(context, bgLooper, new PermissionFlagsCache(context), dumpController); } @VisibleForTesting protected AppOpsControllerImpl(Context context, Looper bgLooper, PermissionFlagsCache cache) { protected AppOpsControllerImpl(Context context, Looper bgLooper, PermissionFlagsCache cache, DumpController dumpController) { mContext = context; mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); mFlagsCache = cache; Loading @@ -91,6 +94,7 @@ public class AppOpsControllerImpl implements AppOpsController, for (int i = 0; i < numOps; i++) { mCallbacksByCode.put(OPS[i], new ArraySet<>()); } dumpController.registerDumpable(TAG, this); } @VisibleForTesting Loading
packages/SystemUI/tests/src/com/android/systemui/appops/AppOpsControllerTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.DumpController; import com.android.systemui.SysuiTestCase; import org.junit.Before; Loading Loading @@ -66,6 +67,8 @@ public class AppOpsControllerTest extends SysuiTestCase { private AppOpsControllerImpl.H mMockHandler; @Mock private PermissionFlagsCache mFlagsCache; @Mock private DumpController mDumpController; private AppOpsControllerImpl mController; private TestableLooper mTestableLooper; Loading @@ -89,7 +92,8 @@ public class AppOpsControllerTest extends SysuiTestCase { when(mFlagsCache.getPermissionFlags(anyString(), anyString(), eq(UserHandle.getUserHandleForUid(TEST_UID_NON_USER_SENSITIVE)))).thenReturn(0); mController = new AppOpsControllerImpl(mContext, mTestableLooper.getLooper(), mFlagsCache); mController = new AppOpsControllerImpl(mContext, mTestableLooper.getLooper(), mFlagsCache, mDumpController); } @Test Loading