Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 549fa5df authored by dhacker29's avatar dhacker29 Committed by Bruno Martins
Browse files

fw/b: Use ro.build.date to signal OTA upgrades

Squash of:

Author: dhacker29 <dhackerdvm@gmail.com>
Date:   Tue Nov 24 01:53:47 2015 -0500
    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: I0e3ed5c8f0351e48944432ae6a0c5194ddeff1fa

Author: Sam Mortimer <sam@mortimer.me.uk>
Date:   Fri Sep 28 13:45:00 2018 -0700
    fw/b UserManagerService: Use ro.build.date to signal upgrades
    *) We changed PackageManagerService to use Build.DATE instead of
       Build.FINGERPRINT to detect upgrade.  Do the same for
       UserManagerService.
    *) Affects generation of preboot intent and app data migration.
    Change-Id: I56887b7ca842afdcf3cf84b27b4c04667cf43307

Author: Wang Han <416810799@qq.com>
Date:   Sat Dec 29 23:33:20 2018 +0800
    ShortcutService: Use ro.build.date to signal package scanning
     * Affects system apps scanning.
    Change-Id: I5f6d6647929f5b5ae7e820b18e95bf5ed2ec8d1c

Author: maxwen <max.weninger@gmail.com>
Date:   Tue Nov 19 01:02:01 2019 +0100
    base: Use ro.build.date to clear cache dirs on update

    instead of using ro.build.fingerprint we explictly need to use ro.build.date

    Change-Id: Ib3e80e58eb8c9a21c108e9f5cd2dbdb7ada8e3a4

Change-Id: If0eb969ba509981f9209ffa37a949d9042ef4c2a
parent 299dc3ae
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public final class SystemUpdateInfo implements Parcelable {
        out.startTag(null, tag);
        out.attribute(null, ATTR_RECEIVED_TIME, String.valueOf(mReceivedTime));
        out.attribute(null, ATTR_SECURITY_PATCH_STATE, String.valueOf(mSecurityPatchState));
        out.attribute(null, ATTR_ORIGINAL_BUILD , Build.FINGERPRINT);
        out.attribute(null, ATTR_ORIGINAL_BUILD , Build.DATE);
        out.endTag(null, tag);
    }

@@ -138,7 +138,7 @@ public final class SystemUpdateInfo implements Parcelable {
    public static SystemUpdateInfo readFromXml(XmlPullParser parser) {
        // If an OTA has been applied (build fingerprint has changed), discard stale info.
        final String buildFingerprint = parser.getAttributeValue(null, ATTR_ORIGINAL_BUILD );
        if (!Build.FINGERPRINT.equals(buildFingerprint)) {
        if (!Build.DATE.equals(buildFingerprint)) {
            return null;
        }
        final long receivedTime =
+6 −0
Original line number Diff line number Diff line
@@ -62,6 +62,12 @@ public class Build {
    /** The name of the underlying board, like "goldfish". */
    public static final String BOARD = getString("ro.product.board");

    /**
     * The build date
     * @hide
     */
    public static final String DATE = getString("ro.build.date");

    /**
     * The name of the instruction set (CPU type + ABI convention) of native code.
     *
+1 −1
Original line number Diff line number Diff line
@@ -645,7 +645,7 @@ class UserController implements Handler.Callback {
        // purposefully block sending BOOT_COMPLETED until after all
        // PRE_BOOT receivers are finished to avoid ANR'ing apps
        final UserInfo info = getUserInfo(userId);
        if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
        if (!Objects.equals(info.lastLoggedInFingerprint, Build.DATE)) {
            // Suppress double notifications for managed profiles that
            // were unlocked automatically as part of their parent user
            // being unlocked.
+5 −5
Original line number Diff line number Diff line
@@ -3033,10 +3033,10 @@ public class PackageManagerService extends IPackageManager.Stub
            File frameworkDir = new File(Environment.getRootDirectory(), "framework");
            final VersionInfo ver = mSettings.getInternalVersion();
            mIsUpgrade = !Build.FINGERPRINT.equals(ver.fingerprint);
            mIsUpgrade = !Build.DATE.equals(ver.fingerprint);
            if (mIsUpgrade) {
                logCriticalInfo(Log.INFO,
                        "Upgrading from " + ver.fingerprint + " to " + Build.FINGERPRINT);
                        "Upgrading from " + ver.fingerprint + " to " + Build.DATE);
            }
            // when upgrading from pre-M, promote system app permissions from install to runtime
@@ -3503,7 +3503,7 @@ public class PackageManagerService extends IPackageManager.Stub
                                        | Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
                    }
                }
                ver.fingerprint = Build.FINGERPRINT;
                ver.fingerprint = Build.DATE;
            }
            // Grandfather existing (installed before Q) non-system apps to hide
@@ -3902,7 +3902,7 @@ public class PackageManagerService extends IPackageManager.Stub
        // feature flags should cause us to invalidate any caches.
        final String cacheName = FORCE_PACKAGE_PARSED_CACHE_ENABLED ? "debug"
                : SystemProperties.digestOf(
                        "ro.build.fingerprint",
                        "ro.build.date",
                        StorageManager.PROP_ISOLATED_STORAGE,
                        StorageManager.PROP_ISOLATED_STORAGE_SNAPSHOT
                );
@@ -22477,7 +22477,7 @@ public class PackageManagerService extends IPackageManager.Stub
                    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, FLAG_STORAGE_DE | FLAG_STORAGE_CE
                            | FLAG_STORAGE_EXTERNAL | Installer.FLAG_CLEAR_CODE_CACHE_ONLY
                            | Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
+2 −2
Original line number Diff line number Diff line
@@ -357,7 +357,7 @@ public final class Settings {
        public void forceCurrent() {
            sdkVersion = Build.VERSION.SDK_INT;
            databaseVersion = CURRENT_DATABASE_VERSION;
            fingerprint = Build.FINGERPRINT;
            fingerprint = Build.DATE;
        }
    }

@@ -3137,7 +3137,7 @@ public final class Settings {
        // 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);
                }
Loading