Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65f9717b authored by Richard Uhler's avatar Richard Uhler
Browse files

Remove unused RollbackManager APIs.

RollbackManager.getAvailableRollback and
getPackagesWithAvailableRollback are no longer needed given the
getAvailableRollbacks API. Remove them.

Bug: 112431924
Test: atest RollbackTest
Change-Id: I88a50a0efd97dd5b45c68e0a3e3253f11d0284f6
parent beb7e38f
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1704,9 +1704,7 @@ package android.content.rollback {
  public final class RollbackManager {
    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public void executeRollback(@NonNull android.content.rollback.RollbackInfo, @NonNull android.content.IntentSender);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public void expireRollbackForPackage(@NonNull String);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) @Nullable public android.content.rollback.RollbackInfo getAvailableRollback(@NonNull String);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) @NonNull public java.util.List<java.lang.String> getPackagesWithAvailableRollbacks();
    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getRecentlyExecutedRollbacks();
    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public void reloadPersistedData();
  }
+1 −54
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.content.rollback;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
@@ -25,7 +24,6 @@ import android.content.Context;
import android.content.IntentSender;
import android.os.RemoteException;

import java.util.ArrayList;
import java.util.List;

/**
@@ -65,57 +63,6 @@ public final class RollbackManager {
        }
    }

    /**
     * Returns the rollback currently available to be executed for the given
     * package.
     * <p>
     * The returned RollbackInfo describes what packages would be rolled back,
     * including package version codes before and after rollback. The rollback
     * can be initiated using {@link #executeRollback(RollbackInfo,IntentSender)}.
     * <p>
     * TODO: remove this API in favor of getAvailableRollbacks.
     *
     * @param packageName name of the package to get the availble RollbackInfo for.
     * @return the rollback available for the package, or null if no rollback
     *         is available for the package.
     * @throws SecurityException if the caller does not have the
     *            MANAGE_ROLLBACKS permission.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS)
    public @Nullable RollbackInfo getAvailableRollback(@NonNull String packageName) {
        for (RollbackInfo rollback : getAvailableRollbacks()) {
            for (PackageRollbackInfo info : rollback.getPackages()) {
                if (packageName.equals(info.getPackageName())) {
                    return rollback;
                }
            }
        }
        return null;
    }

    /**
     * Gets the names of packages that are available for rollback.
     * Call {@link #getAvailableRollback(String)} to get more information
     * about the rollback available for a particular package.
     * <p>
     * TODO: remove this API in favor of getAvailableRollbacks.
     *
     * @return the names of packages that are available for rollback.
     * @throws SecurityException if the caller does not have the
     *            MANAGE_ROLLBACKS permission.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS)
    public @NonNull List<String> getPackagesWithAvailableRollbacks() {
        List<String> packages = new ArrayList<>();
        for (RollbackInfo rollbacks : getAvailableRollbacks()) {
            for (PackageRollbackInfo info : rollbacks.getPackages()) {
                packages.add(info.getPackageName());
            }
        }
        return packages;
    }


    /**
     * Gets the list of all recently executed rollbacks.
     * This is for the purposes of preventing re-install of a bad version of a
@@ -150,7 +97,7 @@ public final class RollbackManager {
     * of the installed packages or available rollbacks are inconsistent with
     * the versions specified in the given rollback object, which can happen
     * if a package has been updated or a rollback expired since the rollback
     * object was retrieved from {@link #getAvailableRollback(String)}.
     * object was retrieved from {@link #getAvailableRollbacks()}.
     * <p>
     * TODO: Specify the returns status codes.
     * TODO: What happens in case reboot is required for the rollback to take