Control revoke-on-upgrade behavior for loc perm
By default: Revoke on upgrade, but can be disabled by setting the
location_permissions_upgrade_to_Q_mode to anything but 0.
Fixes: 127285709
Test: Upgraded from P to Q with and without
location_permissions_upgrade_to_Q_mode set
atest --test-mapping frameworks/base/core/java/android/provider:presubmit
Change-Id: I4dd1772e78f46c881a5f747fcf61583beec2d6a2
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f2bb87d..33f6061 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -8559,6 +8559,19 @@
public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS =
"location_access_check_delay_millis";
+ /**
+ * What should happen to the location permissions when upgraded to Android Q.
+ *
+ * <ul>
+ * <li>0/unset == revoke permissions</li>
+ * <li>anything else == Don't do anything</li>
+ * </ul>
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE =
+ "location_permissions_upgrade_to_q_mode";
/**
* Comma separated list of enabled overlay packages for all android.theme.customization.*
diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto
index 6360a5f..08286a1 100644
--- a/core/proto/android/providers/settings/secure.proto
+++ b/core/proto/android/providers/settings/secure.proto
@@ -235,6 +235,10 @@
optional SettingProto mode = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
// The App or module that changes the location mode.
optional SettingProto changer = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+ // What should happen to the location permissions when upgraded to Android Q.
+ // 0 == revoke permissions. Anything else == do nothing.
+ optional SettingProto permissions_upgrade_to_q_mode = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
}
optional Location location = 31;
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index ad1403d..9d34b11 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -643,6 +643,7 @@
Settings.Secure.LAST_SETUP_SHOWN,
Settings.Secure.LOCATION_CHANGER,
Settings.Secure.LOCATION_MODE,
+ Settings.Secure.LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE,
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, // Candidate?
Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,