OSDN Git Service

selectBackupTransportAsync should report failure when backup is not available
authorTony Mak <tonymak@google.com>
Tue, 2 May 2017 15:31:25 +0000 (16:31 +0100)
committerTony Mak <tonymak@google.com>
Wed, 3 May 2017 20:02:57 +0000 (20:02 +0000)
Merged-in: I393308857ea6082dca167e3e417b946615a83c20
Fix: 37304539
Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/backup/TrampolineTest.java
Test: setup device owner, then set up profile.
      Ensure tapping Settings->Google->Work->Security -> Verify app
      is working

Change-Id: I88c3e3163605d62123c88377ae0843084e354212

services/backup/java/com/android/server/backup/Trampoline.java

index 2c14a7c..aafa88a 100644 (file)
@@ -304,6 +304,14 @@ public class Trampoline extends IBackupManager.Stub {
         BackupManagerService svc = mService;
         if (svc != null) {
             svc.selectBackupTransportAsync(transport, listener);
+        } else {
+            if (listener != null) {
+                try {
+                    listener.onFailure(BackupManager.ERROR_BACKUP_NOT_ALLOWED);
+                } catch (RemoteException ex) {
+                    // Ignore
+                }
+            }
         }
     }