Deprecate BackupManager#requestRestore()

Turned the method into a no-op.
The rationale behind deprecating discussed in the bug.

Bug: 62650350
Test: make update-api && make -j40
Change-Id: I216a0700e351050836a8a39d7e36539bb84ad1dc
This commit is contained in:
Michal Karpinski
2018-01-24 13:02:03 +00:00
parent a8c7794856
commit 0df62ac206
3 changed files with 11 additions and 22 deletions

View File

@@ -6917,7 +6917,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 {

View File

@@ -437,7 +437,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);

View File

@@ -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;
}
/**