Merge "Resume-on-Reboot: change SystemApi calls slightly" into rvc-dev am: f377275542

Change-Id: If9e5f819aa3a75f28ae4e5cb38aad22957159167
This commit is contained in:
Kenny Root
2020-03-27 05:27:54 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 9 deletions

View File

@@ -8394,12 +8394,12 @@ package android.os {
public class RecoverySystem { public class RecoverySystem {
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void cancelScheduledUpdate(android.content.Context) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void cancelScheduledUpdate(android.content.Context) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static boolean clearPrepareForUnattendedUpdate(@NonNull android.content.Context) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void clearPrepareForUnattendedUpdate(@NonNull android.content.Context) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void installPackage(android.content.Context, java.io.File, boolean) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void installPackage(android.content.Context, java.io.File, boolean) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void prepareForUnattendedUpdate(@NonNull android.content.Context, @NonNull String, @Nullable android.content.IntentSender) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void prepareForUnattendedUpdate(@NonNull android.content.Context, @NonNull String, @Nullable android.content.IntentSender) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener, android.os.Handler) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener, android.os.Handler) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static boolean rebootAndApply(@NonNull android.content.Context, @NonNull String, @NonNull String) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void rebootAndApply(@NonNull android.content.Context, @NonNull String, @NonNull String) throws java.io.IOException;
method @RequiresPermission(allOf={android.Manifest.permission.RECOVERY, android.Manifest.permission.REBOOT}) public static void rebootWipeAb(android.content.Context, java.io.File, String) throws java.io.IOException; method @RequiresPermission(allOf={android.Manifest.permission.RECOVERY, android.Manifest.permission.REBOOT}) public static void rebootWipeAb(android.content.Context, java.io.File, String) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void scheduleUpdateOnBoot(android.content.Context, java.io.File) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void scheduleUpdateOnBoot(android.content.Context, java.io.File) throws java.io.IOException;
method public static boolean verifyPackageCompatibility(java.io.File) throws java.io.IOException; method public static boolean verifyPackageCompatibility(java.io.File) throws java.io.IOException;

View File

@@ -665,15 +665,17 @@ public class RecoverySystem {
* the preparation for unattended update is reset. * the preparation for unattended update is reset.
* *
* @param context the Context to use. * @param context the Context to use.
* @throws IOException if there were any errors setting up unattended update * @throws IOException if there were any errors clearing the unattended update state
* @hide * @hide
*/ */
@SystemApi @SystemApi
@RequiresPermission(android.Manifest.permission.RECOVERY) @RequiresPermission(android.Manifest.permission.RECOVERY)
public static boolean clearPrepareForUnattendedUpdate(@NonNull Context context) public static void clearPrepareForUnattendedUpdate(@NonNull Context context)
throws IOException { throws IOException {
RecoverySystem rs = (RecoverySystem) context.getSystemService(Context.RECOVERY_SERVICE); RecoverySystem rs = (RecoverySystem) context.getSystemService(Context.RECOVERY_SERVICE);
return rs.clearLskf(); if (!rs.clearLskf()) {
throw new IOException("could not reset unattended update state");
}
} }
/** /**
@@ -684,21 +686,22 @@ public class RecoverySystem {
* @param context the Context to use. * @param context the Context to use.
* @param updateToken the token used to call {@link #prepareForUnattendedUpdate} before * @param updateToken the token used to call {@link #prepareForUnattendedUpdate} before
* @param reason the reboot reason to give to the {@link PowerManager} * @param reason the reboot reason to give to the {@link PowerManager}
* @throws IOException if there were any errors setting up unattended update * @throws IOException if the reboot couldn't proceed because the device wasn't ready for an
* @return false if the reboot couldn't proceed because the device wasn't ready for an
* unattended reboot or if the {@code updateToken} did not match the previously * unattended reboot or if the {@code updateToken} did not match the previously
* given token * given token
* @hide * @hide
*/ */
@SystemApi @SystemApi
@RequiresPermission(android.Manifest.permission.RECOVERY) @RequiresPermission(android.Manifest.permission.RECOVERY)
public static boolean rebootAndApply(@NonNull Context context, @NonNull String updateToken, public static void rebootAndApply(@NonNull Context context, @NonNull String updateToken,
@NonNull String reason) throws IOException { @NonNull String reason) throws IOException {
if (updateToken == null) { if (updateToken == null) {
throw new NullPointerException("updateToken == null"); throw new NullPointerException("updateToken == null");
} }
RecoverySystem rs = (RecoverySystem) context.getSystemService(Context.RECOVERY_SERVICE); RecoverySystem rs = (RecoverySystem) context.getSystemService(Context.RECOVERY_SERVICE);
return rs.rebootWithLskf(updateToken, reason); if (!rs.rebootWithLskf(updateToken, reason)) {
throw new IOException("system not prepared to apply update");
}
} }
/** /**