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

Commit 9f06a92f authored by Songchun Fan's avatar Songchun Fan
Browse files

[pm] fix acquireAndRegisterNewAppId after app removal

mFirstAvailableUid becomes (the last removed app ID + 1) after an app
removal. acquireAndRegisterNewAppId should use the offset of
mFirstAvailableUid as an index, not its actual value.

Test: manual for now
BUG: 216658672
Change-Id: Ie1b9ecafeb191129320243608c7f70eb2ea5c79e
parent 9492d508
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ public final class Settings implements Watchable, Snappable {
        int[] excludedUserIds;
    }

    private static int mFirstAvailableUid = 0;
    private static int mFirstAvailableUid = Process.FIRST_APPLICATION_UID;

    /** Map from volume UUID to {@link VersionInfo} */
    @Watched
@@ -4271,7 +4271,7 @@ public final class Settings implements Watchable, Snappable {
    private int acquireAndRegisterNewAppIdLPw(SettingBase obj) {
        // Let's be stupidly inefficient for now...
        final int size = mAppIds.size();
        for (int i = mFirstAvailableUid; i < size; i++) {
        for (int i = mFirstAvailableUid - Process.FIRST_APPLICATION_UID; i < size; i++) {
            if (mAppIds.get(i) == null) {
                mAppIds.set(i, obj);
                return Process.FIRST_APPLICATION_UID + i;