summaryrefslogtreecommitdiffstats
path: root/services/backup
diff options
context:
space:
mode:
Diffstat (limited to 'services/backup')
-rw-r--r--services/backup/java/com/android/server/backup/Trampoline.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/services/backup/java/com/android/server/backup/Trampoline.java b/services/backup/java/com/android/server/backup/Trampoline.java
index 5d2187f..8bd7132 100644
--- a/services/backup/java/com/android/server/backup/Trampoline.java
+++ b/services/backup/java/com/android/server/backup/Trampoline.java
@@ -94,7 +94,7 @@ public class Trampoline extends IBackupManager.Stub {
if (userHandle == UserHandle.USER_OWNER) {
synchronized (this) {
- if (makeActive != (mService != null)) {
+ if (makeActive != isBackupServiceActive(userHandle)) {
Slog.i(TAG, "Making backup "
+ (makeActive ? "" : "in") + "active in user " + userHandle);
if (makeActive) {
@@ -113,6 +113,21 @@ public class Trampoline extends IBackupManager.Stub {
}
}
+ /**
+ * Querying activity state of backup service. Calling this method before initialize yields
+ * undefined result.
+ * @param userHandle The user in which the activity state of backup service is queried.
+ * @return true if the service is active.
+ */
+ public boolean isBackupServiceActive(final int userHandle) {
+ if (userHandle == UserHandle.USER_OWNER) {
+ synchronized (this) {
+ return mService != null;
+ }
+ }
+ return false;
+ }
+
// IBackupManager binder API
@Override
public void dataChanged(String packageName) throws RemoteException {