summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/notification/ConditionProviders.java12
-rw-r--r--services/core/java/com/android/server/notification/ManagedServices.java32
2 files changed, 26 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/notification/ConditionProviders.java b/services/core/java/com/android/server/notification/ConditionProviders.java
index 18f4bc768632..41f2cc5a0c83 100644
--- a/services/core/java/com/android/server/notification/ConditionProviders.java
+++ b/services/core/java/com/android/server/notification/ConditionProviders.java
@@ -279,11 +279,13 @@ public class ConditionProviders extends ManagedServices {
public void ensureRecordExists(ComponentName component, Uri conditionId,
IConditionProvider provider) {
- // constructed by convention, make sure the record exists...
- final ConditionRecord r = getRecordLocked(conditionId, component, true /*create*/);
- if (r.info == null) {
- // ... and is associated with the in-process service
- r.info = checkServiceTokenLocked(provider);
+ synchronized (mMutex) {
+ // constructed by convention, make sure the record exists...
+ final ConditionRecord r = getRecordLocked(conditionId, component, true /*create*/);
+ if (r.info == null) {
+ // ... and is associated with the in-process service
+ r.info = checkServiceTokenLocked(provider);
+ }
}
}
diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java
index efc18adc0e35..340ae0ad637a 100644
--- a/services/core/java/com/android/server/notification/ManagedServices.java
+++ b/services/core/java/com/android/server/notification/ManagedServices.java
@@ -216,12 +216,14 @@ abstract public class ManagedServices {
}
pw.println(" Live " + getCaption() + "s (" + mServices.size() + "):");
- for (ManagedServiceInfo info : mServices) {
- if (filter != null && !filter.matches(info.component)) continue;
- pw.println(" " + info.component
- + " (user " + info.userid + "): " + info.service
- + (info.isSystem?" SYSTEM":"")
- + (info.isGuest(this)?" GUEST":""));
+ synchronized (mMutex) {
+ for (ManagedServiceInfo info : mServices) {
+ if (filter != null && !filter.matches(info.component)) continue;
+ pw.println(" " + info.component
+ + " (user " + info.userid + "): " + info.service
+ + (info.isSystem ? " SYSTEM" : "")
+ + (info.isGuest(this) ? " GUEST" : ""));
+ }
}
pw.println(" Snoozed " + getCaption() + "s (" +
@@ -260,9 +262,11 @@ abstract public class ManagedServices {
cmpt.writeToProto(proto, ManagedServicesProto.ENABLED);
}
- for (ManagedServiceInfo info : mServices) {
- if (filter != null && !filter.matches(info.component)) continue;
- info.writeToProto(proto, ManagedServicesProto.LIVE_SERVICES, this);
+ synchronized (mMutex) {
+ for (ManagedServiceInfo info : mServices) {
+ if (filter != null && !filter.matches(info.component)) continue;
+ info.writeToProto(proto, ManagedServicesProto.LIVE_SERVICES, this);
+ }
}
for (ComponentName name : mSnoozingForCurrentProfiles) {
@@ -631,11 +635,13 @@ abstract public class ManagedServices {
public boolean isSameUser(IInterface service, int userId) {
checkNotNull(service);
- ManagedServiceInfo info = getServiceFromTokenLocked(service);
- if (info != null) {
- return info.isSameUser(userId);
+ synchronized (mMutex) {
+ ManagedServiceInfo info = getServiceFromTokenLocked(service);
+ if (info != null) {
+ return info.isSameUser(userId);
+ }
+ return false;
}
- return false;
}
public void unregisterService(IInterface service, int userid) {