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

Commit fb7a52b9 authored by Nikita Ioffe's avatar Nikita Ioffe Committed by Automerger Merge Worker
Browse files

Merge "allocateSpaceForUpdate: clear calling identity before calling into...

Merge "allocateSpaceForUpdate: clear calling identity before calling into apexd." into sc-dev am: 4db95cce

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15028970

Change-Id: Id9af1c444b21a44d72fee12e8e21233b5ad6de2a
parents 17b67fad 4db95cce
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -961,11 +961,13 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo

    @Override
    public boolean allocateSpaceForUpdate(String packageFile) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.RECOVERY, null);
        if (!isUpdatableApexSupported()) {
            Log.i(TAG, "Updatable Apex not supported, "
                    + "allocateSpaceForUpdate does nothing.");
            return true;
        }
        final long token = Binder.clearCallingIdentity();
        try {
            CompressedApexInfoList apexInfoList = getCompressedApexInfoList(packageFile);
            ApexManager apexManager = ApexManager.getInstance();
@@ -975,6 +977,8 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo
            e.rethrowAsRuntimeException();
        } catch (IOException | UnsupportedOperationException e) {
            Slog.e(TAG, "Failed to reserve space for compressed apex: ", e);
        } finally {
            Binder.restoreCallingIdentity(token);
        }
        return false;
    }