diff options
author | Zoltan Szatmary-Ban <szatmz@google.com> | 2014-11-12 18:03:08 +0000 |
---|---|---|
committer | Zoltan Szatmary-Ban <szatmz@google.com> | 2014-11-12 23:51:31 +0000 |
commit | 201caf57f9a9699e04620eac9b1fcdaf4338d2f0 (patch) | |
tree | 0012bb1c1dc502ea15beccbdabf684a87401e1fa | |
parent | 19865ccd44958b0902b9eedd11df279a03ff74c1 (diff) | |
download | frameworks_base-201caf57f9a9699e04620eac9b1fcdaf4338d2f0.zip frameworks_base-201caf57f9a9699e04620eac9b1fcdaf4338d2f0.tar.gz frameworks_base-201caf57f9a9699e04620eac9b1fcdaf4338d2f0.tar.bz2 |
Adding method to query backup manager service activity status
Bug: 17367491
Change-Id: I9920c07d56c4c0ccb1f3dce637c0fb390902d2ff
-rw-r--r-- | core/java/android/app/backup/IBackupManager.aidl | 7 | ||||
-rw-r--r-- | services/backup/java/com/android/server/backup/Trampoline.java | 17 |
2 files changed, 23 insertions, 1 deletions
diff --git a/core/java/android/app/backup/IBackupManager.aidl b/core/java/android/app/backup/IBackupManager.aidl index 0a2d4f5..41ad936 100644 --- a/core/java/android/app/backup/IBackupManager.aidl +++ b/core/java/android/app/backup/IBackupManager.aidl @@ -303,4 +303,11 @@ interface IBackupManager { * {@code false} otherwise. */ void setBackupServiceActive(int whichUser, boolean makeActive); + + /** + * Queries the activity status of backup service as set by {@link #setBackupServiceActive}. + * @param whichUser User handle of the defined user whose backup active state + * is being queried. + */ + boolean isBackupServiceActive(int whichUser); } 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 { |