From bc62b218df0bf6b83169cd82420e2701ae13a5ea Mon Sep 17 00:00:00 2001 From: longhai Date: Fri, 29 Jan 2016 14:22:22 +0800 Subject: Fixed the issue when some apps were gone and couldn't be installed successfully after updating from KK to M via OTA. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is more than one signature for some apps like Cortana. This app which is installed in KK would be gone when updating from KK to M via OTA. The reason for this is the unmatching signature, the error code is: INSTALL_FAILED_UPDATE_INCOMPATIBLE. Solution: 'databaseVersion' should not be assigned to CURRENT_DATABASE_VERSION when creating a 'VersionInfo' instance, because it would affect the process of ‘compareSignaturesCompat’ signature verification. We could set the right value of 'databaseVersion' at an appropriate timing. Signed-off-by: longhai --- services/core/java/com/android/server/pm/Settings.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 4093e20199bd..41f497248c95 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -1233,7 +1233,6 @@ final class Settings { VersionInfo ver = mVersion.get(volumeUuid); if (ver == null) { ver = new VersionInfo(); - ver.forceCurrent(); mVersion.put(volumeUuid, ver); } return ver; @@ -2529,8 +2528,8 @@ final class Settings { "No settings file; creating initial state"); // It's enough to just touch version details to create them // with default values - findOrCreateVersion(StorageManager.UUID_PRIVATE_INTERNAL); - findOrCreateVersion(StorageManager.UUID_PRIMARY_PHYSICAL); + findOrCreateVersion(StorageManager.UUID_PRIVATE_INTERNAL).forceCurrent(); + findOrCreateVersion(StorageManager.UUID_PRIMARY_PHYSICAL).forceCurrent(); return false; } str = new FileInputStream(mSettingsFilename); -- cgit v1.2.3-59-g8ed1b