Permalink
Browse files

Core: Use ro.build.date to signal mIsUpgrade

M: We use a static fingerprint that is only changed when a new OEM build is released, so every flash shows Android is starting instead of upgrading.  This will fix that.

N: even though we dont have the dexopt sceen on N, this is still needed to delete the correct caches, and grant/deny specific runtime permissions like a true oem update would do

Updated for Nougat By: @beanstown106

Change-Id: Id88c1f05a2d3c852d1bdc145b1af7bc201b1eb37
  • Loading branch information...
dhacker29 authored and akhilnarang committed Nov 24, 2015
1 parent fdf2b56 commit cab4c09273cb415832f7463e349ff63b497a1379
@@ -54,6 +54,9 @@
/** The name of the underlying board, like "goldfish". */
public static final String BOARD = getString("ro.product.board");
/** The build date */
public static final String DATE = getString("ro.build.date");
/**
* The name of the instruction set (CPU type + ABI convention) of native code.
*
@@ -2305,7 +2305,7 @@ public PackageManagerService(Context context, Installer installer,
File frameworkDir = new File(Environment.getRootDirectory(), "framework");
final VersionInfo ver = mSettings.getInternalVersion();
mIsUpgrade = !Build.FINGERPRINT.equals(ver.fingerprint);
mIsUpgrade = !Build.DATE.equals(ver.fingerprint);
// when upgrading from pre-M, promote system app permissions from install to runtime
mPromoteSystemApps =
@@ -2683,7 +2683,7 @@ public PackageManagerService(Context context, Installer installer,
| Installer.FLAG_CLEAR_CODE_CACHE_ONLY);
}
}
ver.fingerprint = Build.FINGERPRINT;
ver.fingerprint = Build.DATE;
}
checkDefaultBrowser();
@@ -19534,7 +19534,7 @@ private void loadPrivatePackagesInner(VolumeInfo vol) {
Slog.w(TAG, "Failed to scan " + ps.codePath + ": " + e.getMessage());
}
if (!Build.FINGERPRINT.equals(ver.fingerprint)) {
if (!Build.DATE.equals(ver.fingerprint)) {
clearAppDataLIF(ps.pkg, UserHandle.USER_ALL,
StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE
| Installer.FLAG_CLEAR_CODE_CACHE_ONLY);
@@ -320,7 +320,7 @@
public void forceCurrent() {
sdkVersion = Build.VERSION.SDK_INT;
databaseVersion = CURRENT_DATABASE_VERSION;
fingerprint = Build.FINGERPRINT;
fingerprint = Build.DATE;
}
}
@@ -2945,7 +2945,7 @@ boolean readLPw(@NonNull List<UserInfo> users) {
// on update drop the files before loading them.
if (PackageManagerService.CLEAR_RUNTIME_PERMISSIONS_ON_UPGRADE) {
final VersionInfo internal = getInternalVersion();
if (!Build.FINGERPRINT.equals(internal.fingerprint)) {
if (!Build.DATE.equals(internal.fingerprint)) {
for (UserInfo user : users) {
mRuntimePermissionsPersistence.deleteUserRuntimePermissionsFile(user.id);
}
@@ -4940,7 +4940,7 @@ public boolean areDefaultRuntimPermissionsGrantedLPr(int userId) {
}
public void onDefaultRuntimePermissionsGrantedLPr(int userId) {
mFingerprints.put(userId, Build.FINGERPRINT);
mFingerprints.put(userId, Build.DATE);
writePermissionsForUserAsyncLPr(userId);
}
@@ -5103,7 +5103,7 @@ private void writePermissionsSync(int userId) {
serializer.endDocument();
destination.finishWrite(out);
if (Build.FINGERPRINT.equals(fingerprint)) {
if (Build.DATE.equals(fingerprint)) {
mDefaultPermissionsGranted.put(userId, true);
}
// Any error while writing is fatal.
@@ -5215,7 +5215,7 @@ private void parseRuntimePermissionsLPr(XmlPullParser parser, int userId)
case TAG_RUNTIME_PERMISSIONS: {
String fingerprint = parser.getAttributeValue(null, ATTR_FINGERPRINT);
mFingerprints.put(userId, fingerprint);
final boolean defaultsGranted = Build.FINGERPRINT.equals(fingerprint);
final boolean defaultsGranted = Build.DATE.equals(fingerprint);
mDefaultPermissionsGranted.put(userId, defaultsGranted);
} break;

0 comments on commit cab4c09

Please sign in to comment.