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

Commit ad66d27a authored by Sandeep Bandaru's avatar Sandeep Bandaru
Browse files

Stop throwing IllegalStateException when isolated-owner mapping is missing

In certain circumstances, an isolated uid could potentially not have an owner due to race conditions in updating the map. Rather than crash the system server, log a wtf error and continue.

Bug: 414985465
Bug: 286903116
Flag: EXEMPT bugfix
Change-Id: I565b9db5c56d5ad9abc8b0826bfc363e1a06bb7d
parent 5861e52b
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -1884,8 +1884,8 @@ public class ComputerEngine implements Computer {
    private int getIsolatedOwner(int isolatedUid) {
        final int ownerUid = mIsolatedOwners.get(isolatedUid, -1);
        if (ownerUid == -1) {
            throw new IllegalStateException(
                    "No owner UID found for isolated UID " + isolatedUid);
            Slog.wtf(TAG, "No owner UID found for isolated UID " + isolatedUid);
            return isolatedUid;
        }
        return ownerUid;
    }
@@ -4383,12 +4383,7 @@ public class ComputerEngine implements Computer {
        }
        final int callingUserId = UserHandle.getUserId(callingUid);
        if (isKnownIsolatedComputeApp(uid)) {
            try {
            uid = getIsolatedOwner(uid);
            } catch (IllegalStateException e) {
                // If the owner uid doesn't exist, just use the current uid
                Slog.wtf(TAG, "Expected isolated uid " + uid + " to have an owner", e);
            }
        }
        final int appId = UserHandle.getAppId(uid);
        final Object obj = mSettings.getSettingBase(appId);
@@ -4426,12 +4421,7 @@ public class ComputerEngine implements Computer {
                uid = getBaseSdkSandboxUid();
            }
            if (isKnownIsolatedComputeApp(uid)) {
                try {
                uid = getIsolatedOwner(uid);
                } catch (IllegalStateException e) {
                    // If the owner uid doesn't exist, just use the current uid
                    Slog.wtf(TAG, "Expected isolated uid " + uid + " to have an owner", e);
                }
            }
            final int appId = UserHandle.getAppId(uid);
            final Object obj = mSettings.getSettingBase(appId);