Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ff1fd94 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add some missing synchronization

Test: runtest systemui-notification
Change-Id: I34233d5134a6b42d5e565a14554f08d2ad7cda0d
Fixes: 113369253
parent 32f68e6b
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@ public class ConditionProviders extends ManagedServices {

    public void ensureRecordExists(ComponentName component, Uri conditionId,
            IConditionProvider provider) {
        synchronized (mMutex) {
            // constructed by convention, make sure the record exists...
            final ConditionRecord r = getRecordLocked(conditionId, component, true /*create*/);
            if (r.info == null) {
@@ -286,6 +287,7 @@ public class ConditionProviders extends ManagedServices {
                r.info = checkServiceTokenLocked(provider);
            }
        }
    }

    public boolean subscribeIfNecessary(ComponentName component, Uri conditionId) {
        synchronized (mMutex) {
+19 −13
Original line number Diff line number Diff line
@@ -216,6 +216,7 @@ abstract public class ManagedServices {
        }

        pw.println("    Live " + getCaption() + "s (" + mServices.size() + "):");
        synchronized (mMutex) {
            for (ManagedServiceInfo info : mServices) {
                if (filter != null && !filter.matches(info.component)) continue;
                pw.println("      " + info.component
@@ -223,6 +224,7 @@ abstract public class ManagedServices {
                        + (info.isSystem ? " SYSTEM" : "")
                        + (info.isGuest(this) ? " GUEST" : ""));
            }
        }

        pw.println("    Snoozed " + getCaption() + "s (" +
                mSnoozingForCurrentProfiles.size() + "):");
@@ -260,10 +262,12 @@ abstract public class ManagedServices {
            cmpt.writeToProto(proto, ManagedServicesProto.ENABLED);
        }

        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) {
            name.writeToProto(proto, ManagedServicesProto.SNOOZED);
@@ -631,12 +635,14 @@ abstract public class ManagedServices {

    public boolean isSameUser(IInterface service, int userId) {
        checkNotNull(service);
        synchronized (mMutex) {
            ManagedServiceInfo info = getServiceFromTokenLocked(service);
            if (info != null) {
                return info.isSameUser(userId);
            }
            return false;
        }
    }

    public void unregisterService(IInterface service, int userid) {
        checkNotNull(service);