Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84681786 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add AppOpsController to the DumpController"

parents 2e82e39c fc7ce79a
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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
+5 −1
Original line number Diff line number Diff line
@@ -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