Add shell command to query if lskf is captured

This gives us accurate state on if the recovery system service gets
the lskf capture broadcast.

Bug: 191303529
Test: adb shell cmd recovery is-lskf-captured ota
Change-Id: I2e445363684568236f8a04fe34423c0a7a4ef7c4
This commit is contained in:
Tianjie
2021-06-17 12:10:36 -07:00
committed by Tianjie Xu
parent 388c76ada4
commit a94f9a8e1b

View File

@@ -44,6 +44,8 @@ public class RecoverySystemShellCommand extends ShellCommand {
return requestLskf();
case "clear-lskf":
return clearLskf();
case "is-lskf-captured":
return isLskfCaptured();
case "reboot-and-apply":
return rebootAndApply();
default:
@@ -74,6 +76,14 @@ public class RecoverySystemShellCommand extends ShellCommand {
return 0;
}
private int isLskfCaptured() throws RemoteException {
String packageName = getNextArgRequired();
boolean captured = mService.isLskfCaptured(packageName);
PrintWriter pw = getOutPrintWriter();
pw.printf("%s LSKF capture status: %s\n", packageName, captured ? "true" : "false");
return 0;
}
private int rebootAndApply() throws RemoteException {
String packageName = getNextArgRequired();
String rebootReason = getNextArgRequired();
@@ -90,8 +100,9 @@ public class RecoverySystemShellCommand extends ShellCommand {
public void onHelp() {
PrintWriter pw = getOutPrintWriter();
pw.println("Recovery system commands:");
pw.println(" request-lskf <token>");
pw.println(" request-lskf <package_name>");
pw.println(" clear-lskf");
pw.println(" reboot-and-apply <token> <reason>");
pw.println(" is-lskf-captured <package_name>");
pw.println(" reboot-and-apply <package_name> <reason>");
}
}