diff options
author | Zoltan Szatmary-Ban <szatmz@google.com> | 2014-11-21 15:20:44 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-11-21 15:20:47 +0000 |
commit | 07334334aab3863408325653ceccee47f9e1788d (patch) | |
tree | 532883bdd6b1071dc79ae8440015daeebf631e5e /services | |
parent | 0653f508b58eab994089ae2da783852a5c1b4a8a (diff) | |
parent | 201caf57f9a9699e04620eac9b1fcdaf4338d2f0 (diff) | |
download | frameworks_base-07334334aab3863408325653ceccee47f9e1788d.zip frameworks_base-07334334aab3863408325653ceccee47f9e1788d.tar.gz frameworks_base-07334334aab3863408325653ceccee47f9e1788d.tar.bz2 |
Merge "Adding method to query backup manager service activity status" into lmp-mr1-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/backup/java/com/android/server/backup/Trampoline.java | 17 |
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 { |