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

Commit 0cc40af3 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 am: 1e674d7f

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

Change-Id: I03359b3a6051ad5af65bced357b9c3f3729b6e9c
parents 9bd9c156 1e674d7f
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -961,11 +961,13 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo


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