This repository was archived by the owner on Nov 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
services/core/java/com/android/server/recoverysystem Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -961,11 +961,13 @@ private static CompressedApexInfoList getCompressedApexInfoList(String packageFi
961
961
962
962
@ Override
963
963
public boolean allocateSpaceForUpdate (String packageFile ) {
964
+ mContext .enforceCallingOrSelfPermission (android .Manifest .permission .RECOVERY , null );
964
965
if (!isUpdatableApexSupported ()) {
965
966
Log .i (TAG , "Updatable Apex not supported, "
966
967
+ "allocateSpaceForUpdate does nothing." );
967
968
return true ;
968
969
}
970
+ final long token = Binder .clearCallingIdentity ();
969
971
try {
970
972
CompressedApexInfoList apexInfoList = getCompressedApexInfoList (packageFile );
971
973
ApexManager apexManager = ApexManager .getInstance ();
@@ -975,6 +977,8 @@ public boolean allocateSpaceForUpdate(String packageFile) {
975
977
e .rethrowAsRuntimeException ();
976
978
} catch (IOException | UnsupportedOperationException e ) {
977
979
Slog .e (TAG , "Failed to reserve space for compressed apex: " , e );
980
+ } finally {
981
+ Binder .restoreCallingIdentity (token );
978
982
}
979
983
return false ;
980
984
}
You can’t perform that action at this time.
0 commit comments