summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2015-06-17 13:25:42 -0700
committerAmith Yamasani <yamasani@google.com>2015-06-19 15:04:58 -0700
commit37a40c24deb02bca3868a8085069afae112f22e4 (patch)
tree7e38587e99825bf5234c1f130bcf1972271b0795 /core/java/android/content/pm
parentb0ff3a6cb37aa45add4b0c5135bd978442fcc441 (diff)
downloadframeworks_base-37a40c24deb02bca3868a8085069afae112f22e4.zip
frameworks_base-37a40c24deb02bca3868a8085069afae112f22e4.tar.gz
frameworks_base-37a40c24deb02bca3868a8085069afae112f22e4.tar.bz2
App Standby : Association between content providers and their sync adapter
Set sync adapters to active if the associated content providers are used at foreground process state. Minimize how frequently published content providers are reported by keeping track of last reported time. Also cache sync adapters associated with an authority in SyncManager. Bug: 21785111 Change-Id: Ic2c8cb6a27f005d1a1d0aad21d36b1510160753a
Diffstat (limited to 'core/java/android/content/pm')
-rw-r--r--core/java/android/content/pm/RegisteredServicesCache.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index 0bd2a3b..b293e2a 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -84,7 +84,7 @@ public abstract class RegisteredServicesCache<V> {
private final String mAttributesName;
private final XmlSerializerAndParser<V> mSerializerAndParser;
- private final Object mServicesLock = new Object();
+ protected final Object mServicesLock = new Object();
@GuardedBy("mServicesLock")
private final SparseArray<UserServices<V>> mUserServices = new SparseArray<UserServices<V>>(2);
@@ -232,6 +232,7 @@ public abstract class RegisteredServicesCache<V> {
synchronized (mServicesLock) {
final UserServices<V> user = findOrCreateUserLocked(userId);
user.services = null;
+ onServicesChangedLocked(userId);
}
}
@@ -489,11 +490,16 @@ public abstract class RegisteredServicesCache<V> {
}
}
if (changed) {
+ onServicesChangedLocked(userId);
writePersistentServicesLocked(user, userId);
}
}
}
+ protected void onServicesChangedLocked(int userId) {
+ // Feel free to override
+ }
+
/**
* Returns true if the list of changed uids is null (wildcard) or the specified uid
* is contained in the list of changed uids.
@@ -687,7 +693,9 @@ public abstract class RegisteredServicesCache<V> {
@VisibleForTesting
protected void onUserRemoved(int userId) {
- mUserServices.remove(userId);
+ synchronized (mServicesLock) {
+ mUserServices.remove(userId);
+ }
}
@VisibleForTesting