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

Commit 3b6be64e authored by Michal Karpinski's avatar Michal Karpinski Committed by Android (Google) Code Review
Browse files

Merge "Deprecate BackupManager#requestRestore()"

parents 5baf96a0 0df62ac2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6938,7 +6938,7 @@ package android.app.backup {
    ctor public BackupManager(android.content.Context);
    method public void dataChanged();
    method public static void dataChanged(java.lang.String);
    method public int requestRestore(android.app.backup.RestoreObserver);
    method public deprecated int requestRestore(android.app.backup.RestoreObserver);
  }
  public class FileBackupHelper implements android.app.backup.BackupHelper {
+1 −1
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ package android.app.backup {
    method public java.lang.String[] listAllTransports();
    method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver);
    method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver, android.app.backup.BackupManagerMonitor, int);
    method public int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
    method public deprecated int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
    method public deprecated java.lang.String selectBackupTransport(java.lang.String);
    method public void selectBackupTransport(android.content.ComponentName, android.app.backup.SelectBackupTransportCallback);
    method public void setAutoRestore(boolean);
+9 −20
Original line number Diff line number Diff line
@@ -252,6 +252,8 @@ public class BackupManager {
    }

    /**
     * @deprecated Since Android P app can no longer request restoring of its backup.
     *
     * Restore the calling application from backup.  The data will be restored from the
     * current backup dataset if the application has stored data there, or from
     * the dataset used during the last full device setup operation if the current
@@ -269,6 +271,7 @@ public class BackupManager {
     *
     * @return Zero on success; nonzero on error.
     */
    @Deprecated
    public int requestRestore(RestoreObserver observer) {
        return requestRestore(observer, null);
    }
@@ -276,6 +279,8 @@ public class BackupManager {
    // system APIs start here

    /**
     * @deprecated Since Android P app can no longer request restoring of its backup.
     *
     * Restore the calling application from backup.  The data will be restored from the
     * current backup dataset if the application has stored data there, or from
     * the dataset used during the last full device setup operation if the current
@@ -298,28 +303,12 @@ public class BackupManager {
     *
     * @hide
     */
    @Deprecated
    @SystemApi
    public int requestRestore(RestoreObserver observer, BackupManagerMonitor monitor) {
        int result = -1;
        checkServiceBinder();
        if (sService != null) {
            RestoreSession session = null;
            try {
                IRestoreSession binder = sService.beginRestoreSession(mContext.getPackageName(),
                    null);
                if (binder != null) {
                    session = new RestoreSession(mContext, binder);
                    result = session.restorePackage(mContext.getPackageName(), observer, monitor);
                }
            } catch (RemoteException e) {
                Log.e(TAG, "restoreSelf() unable to contact service");
            } finally {
                if (session != null) {
                    session.endRestoreSession();
                }
            }
        }
        return result;
        Log.w(TAG, "requestRestore(): Since Android P app can no longer request restoring"
                + " of its backup.");
        return -1;
    }

    /**