Merge "Mark perm DB version as -1 when upgrading from P" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
da7156d13d
@@ -68,7 +68,8 @@ public final class PermissionManager {
|
||||
/**
|
||||
* Gets the version of the runtime permission database.
|
||||
*
|
||||
* @return The database version.
|
||||
* @return The database version, -1 when this is an upgrade from pre-Q, 0 when this is a fresh
|
||||
* install.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
|
||||
@@ -5102,6 +5102,7 @@ public final class Settings {
|
||||
private static final long WRITE_PERMISSIONS_DELAY_MILLIS = 200;
|
||||
private static final long MAX_WRITE_PERMISSIONS_DELAY_MILLIS = 2000;
|
||||
|
||||
private static final int UPGRADE_VERSION = -1;
|
||||
private static final int INITIAL_VERSION = 0;
|
||||
|
||||
private final Handler mHandler = new MyHandler();
|
||||
@@ -5133,7 +5134,7 @@ public final class Settings {
|
||||
|
||||
@GuardedBy("Settings.this.mLock")
|
||||
int getVersionLPr(int userId) {
|
||||
return mVersions.get(userId);
|
||||
return mVersions.get(userId, INITIAL_VERSION);
|
||||
}
|
||||
|
||||
@GuardedBy("Settings.this.mLock")
|
||||
@@ -5365,8 +5366,10 @@ public final class Settings {
|
||||
|
||||
switch (parser.getName()) {
|
||||
case TAG_RUNTIME_PERMISSIONS: {
|
||||
// If the permisions settings file exists but the version is not set this is
|
||||
// an upgrade from P->Q. Hence mark it with the special UPGRADE_VERSION
|
||||
int version = XmlUtils.readIntAttribute(parser, ATTR_VERSION,
|
||||
INITIAL_VERSION);
|
||||
UPGRADE_VERSION);
|
||||
mVersions.put(userId, version);
|
||||
String fingerprint = parser.getAttributeValue(null, ATTR_FINGERPRINT);
|
||||
mFingerprints.put(userId, fingerprint);
|
||||
|
||||
Reference in New Issue
Block a user