Merge "Add TestApis for updateTransportAttributes GTS tests"

This commit is contained in:
Annie Meng
2018-02-22 12:22:42 +00:00
committed by Android (Google) Code Review
3 changed files with 102 additions and 0 deletions

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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