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

Commit 3decf24f authored by DvTonder's avatar DvTonder
Browse files

Profiles: UI/UX consistency and cleanup (Part 2 of 2)

This commit contains the frameworks support for the modified Profiles
and Application Groups settings functionality, ensuring consistency between
the two.

1) Add ability to rename Application groups
2) Add duplicate name checking for app groups

Change-Id: Ifcf2eb5f6aa26e0d4778b32c1a35bfb88fac318b
parent 843609a7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ interface IProfileManager
    Profile[] getProfiles();
    boolean profileExists(in ParcelUuid profileUuid);
    boolean profileExistsByName(String profileName);
    boolean notificationGroupExistsByName(String notificationGroupName);

    NotificationGroup[] getNotificationGroups();
    void addNotificationGroup(in NotificationGroup group);
+7 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.ParcelUuid;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;

@@ -80,6 +81,12 @@ public class NotificationGroup implements Parcelable {
        return mName;
    }

    public void setName(String name) {
        mName = name;
        mNameResId = -1;
        mDirty = true;
    }

    public UUID getUuid() {
        return mUuid;
    }
+15 −2
Original line number Diff line number Diff line
@@ -152,7 +152,8 @@ public class ProfileManager {
            return getService().profileExistsByName(profileName);
        } catch (RemoteException e) {
            Log.e(TAG, e.getLocalizedMessage(), e);
            // To be on the safe side, we'll return "true", to prevent duplicate profiles from being created.
            // To be on the safe side, we'll return "true", to prevent duplicate profiles
            // from being created.
            return true;
        }
    }
@@ -162,7 +163,19 @@ public class ProfileManager {
            return getService().profileExists(new ParcelUuid(profileUuid));
        } catch (RemoteException e) {
            Log.e(TAG, e.getLocalizedMessage(), e);
            // To be on the safe side, we'll return "true", to prevent duplicate profiles from being created.
            // To be on the safe side, we'll return "true", to prevent duplicate profiles
            // from being created.
            return true;
        }
    }

    public boolean notificationGroupExists(String notificationGroupName) {
        try {
            return getService().notificationGroupExistsByName(notificationGroupName);
        } catch (RemoteException e) {
            Log.e(TAG, e.getLocalizedMessage(), e);
            // To be on the safe side, we'll return "true", to prevent duplicate notification
            // groups from being created.
            return true;
        }
    }
+10 −0
Original line number Diff line number Diff line
@@ -341,6 +341,16 @@ public class ProfileManagerService extends IProfileManager.Stub {
        return false;
    }

    @Override
    public boolean notificationGroupExistsByName(String notificationGroupName) throws RemoteException {
        for (NotificationGroup group : mGroups.values()) {
            if (group.getName().equalsIgnoreCase(notificationGroupName)) {
                return true;
            }
        }
        return false;
    }

    @Override
    public NotificationGroup[] getNotificationGroups() throws RemoteException {
        return mGroups.values().toArray(new NotificationGroup[mGroups.size()]);