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

Commit c3420b9b authored by dhacker29's avatar dhacker29 Committed by Michael Bestas
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

Change-Id: If0eb969ba509981f9209ffa37a949d9042ef4c2a
parent 0446ac0b
Loading
Loading
Loading
Loading
+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
@@ -501,7 +501,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.
+4 −4
Original line number Diff line number Diff line
@@ -2579,10 +2579,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
@@ -3259,7 +3259,7 @@ public class PackageManagerService extends IPackageManager.Stub
                                        | Installer.FLAG_CLEAR_CODE_CACHE_ONLY);
                    }
                }
                ver.fingerprint = Build.FINGERPRINT;
                ver.fingerprint = Build.DATE;
            }
            // Grandfather existing (installed before Q) non-system apps to hide
@@ -22636,7 +22636,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);
                }
+4 −4
Original line number Diff line number Diff line
@@ -320,7 +320,7 @@ public final class Settings {
        public void forceCurrent() {
            sdkVersion = Build.VERSION.SDK_INT;
            databaseVersion = CURRENT_DATABASE_VERSION;
            fingerprint = Build.FINGERPRINT;
            fingerprint = Build.DATE;
        }
    }

@@ -3069,7 +3069,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);
                }
@@ -5275,7 +5275,7 @@ public final class Settings {
                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.
@@ -5373,7 +5373,7 @@ public final class Settings {
                        mVersions.put(userId, version);
                        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;

+1 −1
Original line number Diff line number Diff line
@@ -4302,7 +4302,7 @@ public class ShortcutService extends IShortcutService.Stub {

    // Injection point.
    String injectBuildFingerprint() {
        return Build.FINGERPRINT;
        return Build.DATE;
    }

    final void wtf(String message) {
Loading