diff --git a/api/system-current.txt b/api/system-current.txt index e0c447a1f5069..1c2dbec3a2b8d 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -469,7 +469,11 @@ package android.app.backup { method public android.app.backup.RestoreSession beginRestoreSession(); method public void cancelBackups(); method public long getAvailableRestoreToken(java.lang.String); + method public android.content.Intent getConfigurationIntent(java.lang.String); method public java.lang.String getCurrentTransport(); + method public android.content.Intent getDataManagementIntent(java.lang.String); + method public java.lang.String getDataManagementLabel(java.lang.String); + method public java.lang.String getDestinationString(java.lang.String); method public boolean isAppEligibleForBackup(java.lang.String); method public boolean isBackupEnabled(); method public boolean isBackupServiceActive(android.os.UserHandle); diff --git a/api/test-current.txt b/api/test-current.txt index 121ca6e58a627..55e7926de1585 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -167,6 +167,17 @@ package android.app.admin { } +package android.app.backup { + + public class BackupManager { + method public android.content.Intent getConfigurationIntent(java.lang.String); + method public android.content.Intent getDataManagementIntent(java.lang.String); + method public java.lang.String getDataManagementLabel(java.lang.String); + method public java.lang.String getDestinationString(java.lang.String); + } + +} + package android.app.usage { public class StorageStatsManager { diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java index 6ec0969771c67..debc32bd83eb1 100644 --- a/core/java/android/app/backup/BackupManager.java +++ b/core/java/android/app/backup/BackupManager.java @@ -19,6 +19,7 @@ package android.app.backup; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -715,6 +716,92 @@ public class BackupManager { } } + /** + * Returns an {@link Intent} for the specified transport's configuration UI. + * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String, + * Intent, String)}. + * @param transportName The name of the registered transport. + * @hide + */ + @SystemApi + @TestApi + @RequiresPermission(android.Manifest.permission.BACKUP) + public Intent getConfigurationIntent(String transportName) { + if (sService != null) { + try { + return sService.getConfigurationIntent(transportName); + } catch (RemoteException e) { + Log.e(TAG, "getConfigurationIntent() couldn't connect"); + } + } + return null; + } + + /** + * Returns a {@link String} describing where the specified transport is sending data. + * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String, + * Intent, String)}. + * @param transportName The name of the registered transport. + * @hide + */ + @SystemApi + @TestApi + @RequiresPermission(android.Manifest.permission.BACKUP) + public String getDestinationString(String transportName) { + if (sService != null) { + try { + return sService.getDestinationString(transportName); + } catch (RemoteException e) { + Log.e(TAG, "getDestinationString() couldn't connect"); + } + } + return null; + } + + /** + * Returns an {@link Intent} for the specified transport's data management UI. + * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String, + * Intent, String)}. + * @param transportName The name of the registered transport. + * @hide + */ + @SystemApi + @TestApi + @RequiresPermission(android.Manifest.permission.BACKUP) + public Intent getDataManagementIntent(String transportName) { + if (sService != null) { + try { + return sService.getDataManagementIntent(transportName); + } catch (RemoteException e) { + Log.e(TAG, "getDataManagementIntent() couldn't connect"); + } + } + return null; + } + + /** + * Returns a {@link String} describing what the specified transport's data management intent is + * used for. + * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String, + * Intent, String)}. + * + * @param transportName The name of the registered transport. + * @hide + */ + @SystemApi + @TestApi + @RequiresPermission(android.Manifest.permission.BACKUP) + public String getDataManagementLabel(String transportName) { + if (sService != null) { + try { + return sService.getDataManagementLabel(transportName); + } catch (RemoteException e) { + Log.e(TAG, "getDataManagementLabel() couldn't connect"); + } + } + return null; + } + /* * We wrap incoming binder calls with a private class implementation that * redirects them into main-thread actions. This serializes the backup