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

Commit 1961db45 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Fix fallback path for default profile groups." into gingerbread

parents cccd566a 26c9d3c2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -83,10 +83,14 @@ public class Profile implements Parcelable {

    /** @hide */
    public void addProfileGroup(ProfileGroup value) {
        profileGroups.put(value.getUuid(), value);
        if (value.isDefaultGroup()) {
            /* we must not have more than one default group */
            if (mDefaultGroup != null) {
                return;
            }
            mDefaultGroup = value;
        }
        profileGroups.put(value.getUuid(), value);
        mDirty = true;
    }

+18 −7
Original line number Diff line number Diff line
@@ -80,20 +80,31 @@ public class ProfileGroup implements Parcelable {
    }

    /** @hide */
    public boolean matches(NotificationGroup group) {
    public boolean matches(NotificationGroup group, boolean defaultGroup) {
        if (mUuid.equals(group.getUuid())) {
            return true;
        }

        /* second try: match name for backwards compat */
        /* fallback matches for backwards compatibility */
        boolean matches = false;

        /* fallback attempt 1: match name */
        if (mName != null && mName.equals(group.getName())) {
            matches = true;
        /* fallback attempt 2: match for the 'defaultGroup' flag to match the wildcard group */
        } else if (mDefaultGroup && defaultGroup) {
            matches = true;
        }

        if (!matches) {
            return false;
        }

        mName = null;
        mUuid = group.getUuid();
        mDirty = true;
            return true;
        }

        return false;
        return true;
    }

    public UUID getUuid() {
+1 −1
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ public class ProfileManagerService extends IProfileManager.Stub {
        /* enforce a matchup between profile and notification group, which not only
         * works by UUID, but also by name for backwards compatibility */
        for (ProfileGroup pg : profile.getProfileGroups()) {
            if (pg.matches(group)) {
            if (pg.matches(group, defaultGroup)) {
                return;
            }
        }