diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java index 88a7c0f910d38..d2c797255b0d7 100644 --- a/core/java/android/app/backup/BackupManager.java +++ b/core/java/android/app/backup/BackupManager.java @@ -29,7 +29,6 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.Build; -import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.RemoteException; @@ -1123,18 +1122,4 @@ public class BackupManager { }); } } - - private class BackupManagerMonitorWrapper extends IBackupManagerMonitor.Stub { - final BackupManagerMonitor mMonitor; - - BackupManagerMonitorWrapper(BackupManagerMonitor monitor) { - mMonitor = monitor; - } - - @Override - public void onEvent(final Bundle event) throws RemoteException { - mMonitor.onEvent(event); - } - } - } diff --git a/core/java/android/app/backup/BackupManagerMonitorWrapper.java b/core/java/android/app/backup/BackupManagerMonitorWrapper.java new file mode 100644 index 0000000000000..0b189958ef0ad --- /dev/null +++ b/core/java/android/app/backup/BackupManagerMonitorWrapper.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.app.backup; + +import android.os.Bundle; +import android.os.RemoteException; + +/** + * Wrapper around {@link BackupManagerMonitor} that helps with IPC between the caller of backup + * APIs and the backup service. + * + * The caller implements {@link BackupManagerMonitor} and passes it into framework APIs that run on + * the caller's process. Those framework APIs will then wrap it around this class when doing the + * actual IPC. + */ +class BackupManagerMonitorWrapper extends IBackupManagerMonitor.Stub { + private final BackupManagerMonitor mMonitor; + + BackupManagerMonitorWrapper(BackupManagerMonitor monitor) { + mMonitor = monitor; + } + + @Override + public void onEvent(final Bundle event) throws RemoteException { + mMonitor.onEvent(event); + } +} diff --git a/core/java/android/app/backup/BackupTransport.java b/core/java/android/app/backup/BackupTransport.java index f6de72b43de68..90e9df47bc4b1 100644 --- a/core/java/android/app/backup/BackupTransport.java +++ b/core/java/android/app/backup/BackupTransport.java @@ -655,6 +655,20 @@ public class BackupTransport { return 0; } + /** + * Ask the transport for a {@link IBackupManagerMonitor} instance which will be used by the + * framework to report logging events back to the transport. + * + *
Backups requested from outside the framework may pass in a monitor with the request,
+ * however backups initiated by the framework will call this method to retrieve one.
+ *
+ * @hide
+ */
+ @Nullable
+ public BackupManagerMonitor getBackupManagerMonitor() {
+ return null;
+ }
+
/**
* Bridge between the actual IBackupTransport implementation and the stable API. If the
* binder interface needs to change, we use this layer to translate so that we can
@@ -952,5 +966,15 @@ public class BackupTransport {
callback.onOperationCompleteWithStatus(BackupTransport.TRANSPORT_ERROR);
}
}
+
+ @Override
+ public void getBackupManagerMonitor(AndroidFuture For supported flags see {@link android.app.backup.BackupAgent}.
*/
void getTransportFlags(in AndroidFuture