Merge "allocateSpaceForUpdate: clear calling identity before calling into apexd." into sc-dev
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user