am 3c4efc3e: Merge "Provide outside-facing API for data management intent+label" into lmp-dev
* commit '3c4efc3ed95aeaf30d940b6a7f1ccf69eb7f9bfa': Provide outside-facing API for data management intent+label
This commit is contained in:
@@ -249,6 +249,18 @@ interface IBackupManager {
|
||||
*/
|
||||
String getDestinationString(String transport);
|
||||
|
||||
/**
|
||||
* Get the manage-data UI intent, if any, from the given transport. Callers must
|
||||
* hold the android.permission.BACKUP permission in order to use this method.
|
||||
*/
|
||||
Intent getDataManagementIntent(String transport);
|
||||
|
||||
/**
|
||||
* Get the manage-data menu label, if any, from the given transport. Callers must
|
||||
* hold the android.permission.BACKUP permission in order to use this method.
|
||||
*/
|
||||
String getDataManagementLabel(String transport);
|
||||
|
||||
/**
|
||||
* Begin a restore session. Either or both of packageName and transportID
|
||||
* may be null. If packageName is non-null, then only the given package will be
|
||||
|
||||
@@ -8441,6 +8441,50 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
|
||||
return null;
|
||||
}
|
||||
|
||||
// Supply the manage-data intent for the given transport.
|
||||
public Intent getDataManagementIntent(String transportName) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
|
||||
"getDataManagementIntent");
|
||||
|
||||
synchronized (mTransports) {
|
||||
final IBackupTransport transport = mTransports.get(transportName);
|
||||
if (transport != null) {
|
||||
try {
|
||||
final Intent intent = transport.dataManagementIntent();
|
||||
if (MORE_DEBUG) Slog.d(TAG, "getDataManagementIntent() returning intent "
|
||||
+ intent);
|
||||
return intent;
|
||||
} catch (RemoteException e) {
|
||||
/* fall through to return null */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Supply the menu label for affordances that fire the manage-data intent
|
||||
// for the given transport.
|
||||
public String getDataManagementLabel(String transportName) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
|
||||
"getDataManagementLabel");
|
||||
|
||||
synchronized (mTransports) {
|
||||
final IBackupTransport transport = mTransports.get(transportName);
|
||||
if (transport != null) {
|
||||
try {
|
||||
final String text = transport.dataManagementLabel();
|
||||
if (MORE_DEBUG) Slog.d(TAG, "getDataManagementLabel() returning " + text);
|
||||
return text;
|
||||
} catch (RemoteException e) {
|
||||
/* fall through to return null */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Callback: a requested backup agent has been instantiated. This should only
|
||||
// be called from the Activity Manager.
|
||||
public void agentConnected(String packageName, IBinder agentBinder) {
|
||||
|
||||
Reference in New Issue
Block a user