From 1353bc5b7699febe47700bc2f091f8c0e1064278 Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Fri, 28 Jun 2019 09:24:43 -0700 Subject: [PATCH] Disable historical appops Fixes: 133419419 Test: atest CtsAppOpsTestCases Change-Id: I6debd3cbb6768b256eb558a81ba13efea375769b --- .../java/com/android/server/appop/HistoricalRegistry.java | 6 +++++- .../src/com/android/server/appop/AppOpsServiceTest.java | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/appop/HistoricalRegistry.java b/services/core/java/com/android/server/appop/HistoricalRegistry.java index 9cf342c0e4fb1..35fbfe1d40442 100644 --- a/services/core/java/com/android/server/appop/HistoricalRegistry.java +++ b/services/core/java/com/android/server/appop/HistoricalRegistry.java @@ -150,9 +150,11 @@ final class HistoricalRegistry { /** * Whether history is enabled. + * + *

The feature is permanently disabled in Android Q */ @GuardedBy("mInMemoryLock") - private int mMode = AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE; + private final int mMode = AppOpsManager.HISTORICAL_MODE_DISABLED; /** * This granularity has been chosen to allow clean delineation for intervals @@ -451,6 +453,7 @@ final class HistoricalRegistry { void setHistoryParameters(@HistoricalMode int mode, long baseSnapshotInterval, long intervalCompressionMultiplier) { + /* synchronized (mOnDiskLock) { synchronized (mInMemoryLock) { // NOTE: We allow this call if persistence is not initialized as @@ -479,6 +482,7 @@ final class HistoricalRegistry { } } } + */ } void offsetHistory(long offsetMillis) { diff --git a/services/tests/mockingservicestests/src/com/android/server/appop/AppOpsServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/appop/AppOpsServiceTest.java index 06366cf7d1433..504d981af53f7 100644 --- a/services/tests/mockingservicestests/src/com/android/server/appop/AppOpsServiceTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/appop/AppOpsServiceTest.java @@ -63,6 +63,7 @@ import com.android.server.LocalServices; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.quality.Strictness; @@ -233,6 +234,7 @@ public class AppOpsServiceTest { assertContainsOp(loggedOps, OP_READ_SMS, mTestStartMillis, -1, MODE_ALLOWED); } + @Ignore("Historical appops are disabled in Android Q") @Test public void testGetOpsForPackage() { mAppOpsService.setMode(OP_READ_SMS, mMyUid, sMyPackageName, MODE_ALLOWED); @@ -274,7 +276,7 @@ public class AppOpsServiceTest { assertThat(getLoggedOps()).isNull(); } - + @Ignore("Historical appops are disabled in Android Q") @Test public void testPackageRemovedHistoricalOps() throws InterruptedException { mAppOpsService.setMode(OP_READ_SMS, mMyUid, sMyPackageName, MODE_ALLOWED);