Add AppOpsController to the DumpController
There are no more calls to Dependency.get(AppOpsController.class), so we must register this controller to DumpController if we want to see AppOps in a dumpsys Fixes: 144160975 Test: atest AppOpsControllerTest Test: manual - adb shell dumpsys activity service com.android.systemui/.SystemUIService - see AppOpsController state Change-Id: I0c2246540a5340cc0cf8246424afcd2ee482bc70
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user