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

Unverified Commit b5e66b8d authored by dhacker29's avatar dhacker29 Committed by Michael Bestas
Browse files

fw/b: Use ro.build.version.incremental 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

Author: maxwen <max.weninger@gmail.com>
Date:   Wed Oct 28 07:07:10 2020 -0400
    One more Build.FINGERPRINT to Build.DATE change

    Change-Id: I13dbf3d7f6587d3fcd6591cc0f861b34b6d5561c

Change-Id: If0eb969ba509981f9209ffa37a949d9042ef4c2a
parent cdc40c3d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ public final class SystemUpdateInfo implements Parcelable {
        out.startTag(null, tag);
        out.attributeLong(null, ATTR_RECEIVED_TIME, mReceivedTime);
        out.attributeInt(null, ATTR_SECURITY_PATCH_STATE, mSecurityPatchState);
        out.attribute(null, ATTR_ORIGINAL_BUILD , Build.FINGERPRINT);
        out.attribute(null, ATTR_ORIGINAL_BUILD , Build.VERSION.INCREMENTAL);
        out.endTag(null, tag);
    }

@@ -141,7 +141,7 @@ public final class SystemUpdateInfo implements Parcelable {
    public static SystemUpdateInfo readFromXml(TypedXmlPullParser 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.VERSION.INCREMENTAL.equals(buildFingerprint)) {
            return null;
        }
        try {
+2 −1
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import android.content.pm.PackagePartitions;
import android.content.pm.UserInfo;
import android.os.BatteryStats;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
@@ -750,7 +751,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, PackagePartitions.FINGERPRINT)
        if (!Objects.equals(info.lastLoggedInFingerprint, Build.VERSION.INCREMENTAL)
                || SystemProperties.getBoolean("persist.pm.mock-upgrade", false)) {
            // Suppress double notifications for managed profiles that
            // were unlocked automatically as part of their parent user being
+6 −6
Original line number Diff line number Diff line
@@ -1491,7 +1491,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
        }

        PackageManagerService m = new PackageManagerService(injector, onlyCore, factoryTest,
                PackagePartitions.FINGERPRINT, Build.IS_ENG, Build.IS_USERDEBUG,
                Build.VERSION.INCREMENTAL, Build.IS_ENG, Build.IS_USERDEBUG,
                Build.VERSION.SDK_INT, Build.VERSION.INCREMENTAL);
        t.traceEnd(); // "create package manager"

@@ -1955,7 +1955,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                    !buildFingerprint.equals(ver.fingerprint);
            if (mIsUpgrade) {
                PackageManagerServiceUtils.logCriticalInfo(Log.INFO, "Upgrading from "
                        + ver.fingerprint + " to " + PackagePartitions.FINGERPRINT);
                        + ver.fingerprint + " to " + Build.VERSION.INCREMENTAL);
            }

            // when upgrading from pre-M, promote system app permissions from install to runtime
@@ -2066,8 +2066,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
            // allow...  it would be nice to have some better way to handle
            // this situation.
            if (mIsUpgrade) {
                Slog.i(TAG, "Build fingerprint changed from " + ver.fingerprint + " to "
                        + PackagePartitions.FINGERPRINT
                Slog.i(TAG, "Build incremental version changed from " + ver.fingerprint + " to "
                        + Build.VERSION.INCREMENTAL
                        + "; regranting permissions for internal storage");
            }
            mPermissionManager.onStorageVolumeMounted(
@@ -2089,7 +2089,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
            // across OTAs and are used to drive profile verification (post OTA) and
            // profile compilation (without waiting to collect a fresh set of profiles).
            if (mIsUpgrade && !mOnlyCore) {
                Slog.i(TAG, "Build fingerprint changed; clearing code caches");
                Slog.i(TAG, "Build incremental version changed; clearing code caches");
                for (int i = 0; i < packageSettings.size(); i++) {
                    final PackageSetting ps = packageSettings.valueAt(i);
                    if (Objects.equals(StorageManager.UUID_PRIVATE_INTERNAL, ps.getVolumeUuid())) {
@@ -2100,7 +2100,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                                        | Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
                    }
                }
                ver.fingerprint = PackagePartitions.FINGERPRINT;
                ver.fingerprint = Build.VERSION.INCREMENTAL;
            }

            // Defer the app data fixup until we are done with app data clearing above.
+2 −2
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ public final class Settings implements Watchable, Snappable {
        public void forceCurrent() {
            sdkVersion = Build.VERSION.SDK_INT;
            databaseVersion = CURRENT_DATABASE_VERSION;
            fingerprint = PackagePartitions.FINGERPRINT;
            fingerprint = Build.VERSION.INCREMENTAL;
        }
    }

@@ -5480,7 +5480,7 @@ public final class Settings implements Watchable, Snappable {
        }

        private String getExtendedFingerprint(long version) {
            return PackagePartitions.FINGERPRINT + "?pc_version=" + version;
            return Build.VERSION.INCREMENTAL + "?pc_version=" + version;
        }

        private static long uniformRandom(double low, double high) {
+1 −1
Original line number Diff line number Diff line
@@ -5136,7 +5136,7 @@ public class ShortcutService extends IShortcutService.Stub {

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

    final void wtf(String message) {
Loading