Merge "Catch security exceptions in RoR APIs" am: 27dcfb808c am: ffbcac67ab

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

Change-Id: I034655978c746b2e824ab27d68d4fb5316aa1b3b
This commit is contained in:
Tianjie Xu
2021-04-21 04:06:56 +00:00
committed by Automerger Merge Worker

View File

@@ -1423,8 +1423,8 @@ public class RecoverySystem {
private boolean requestLskf(String packageName, IntentSender sender) throws IOException { private boolean requestLskf(String packageName, IntentSender sender) throws IOException {
try { try {
return mService.requestLskf(packageName, sender); return mService.requestLskf(packageName, sender);
} catch (RemoteException e) { } catch (RemoteException | SecurityException e) {
throw new IOException("could request LSKF capture"); throw new IOException("could not request LSKF capture", e);
} }
} }
@@ -1437,8 +1437,8 @@ public class RecoverySystem {
private boolean clearLskf(String packageName) throws IOException { private boolean clearLskf(String packageName) throws IOException {
try { try {
return mService.clearLskf(packageName); return mService.clearLskf(packageName);
} catch (RemoteException e) { } catch (RemoteException | SecurityException e) {
throw new IOException("could not clear LSKF"); throw new IOException("could not clear LSKF", e);
} }
} }
@@ -1452,8 +1452,8 @@ public class RecoverySystem {
private boolean isLskfCaptured(String packageName) throws IOException { private boolean isLskfCaptured(String packageName) throws IOException {
try { try {
return mService.isLskfCaptured(packageName); return mService.isLskfCaptured(packageName);
} catch (RemoteException e) { } catch (RemoteException | SecurityException e) {
throw new IOException("could not get LSKF capture state"); throw new IOException("could not get LSKF capture state", e);
} }
} }
@@ -1465,12 +1465,11 @@ public class RecoverySystem {
boolean slotSwitch) throws IOException { boolean slotSwitch) throws IOException {
try { try {
return mService.rebootWithLskf(packageName, reason, slotSwitch); return mService.rebootWithLskf(packageName, reason, slotSwitch);
} catch (RemoteException e) { } catch (RemoteException | SecurityException e) {
throw new IOException("could not reboot for update"); throw new IOException("could not reboot for update", e);
} }
} }
/** /**
* Calls the recovery system service to reboot and apply update. This is the legacy API and * Calls the recovery system service to reboot and apply update. This is the legacy API and
* expects a slot switch for A/B devices. * expects a slot switch for A/B devices.
@@ -1480,8 +1479,8 @@ public class RecoverySystem {
String reason) throws IOException { String reason) throws IOException {
try { try {
return mService.rebootWithLskfAssumeSlotSwitch(packageName, reason); return mService.rebootWithLskfAssumeSlotSwitch(packageName, reason);
} catch (RemoteException e) { } catch (RemoteException | RuntimeException e) {
throw new IOException("could not reboot for update"); throw new IOException("could not reboot for update", e);
} }
} }