diff options
| author | 2018-08-29 09:57:11 -0400 | |
|---|---|---|
| committer | 2018-08-29 10:20:12 -0400 | |
| commit | 3ff1fd9441d0a9eb9133ae4e117c89f012f36bde (patch) | |
| tree | f91fd4c8fe0537cadf700087fd2066bc0902353a | |
| parent | 32f68e6b6b4a686268d75c868b9682fdd91a6e81 (diff) | |
Add some missing synchronization
Test: runtest systemui-notification
Change-Id: I34233d5134a6b42d5e565a14554f08d2ad7cda0d
Fixes: 113369253
| -rw-r--r-- | services/core/java/com/android/server/notification/ConditionProviders.java | 12 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/ManagedServices.java | 32 |
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) { |