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

Commit 39424f4a authored by Ryan Mitchell's avatar Ryan Mitchell Committed by Automerger Merge Worker
Browse files

Merge changes I6d84d3d1,Idd304f56 into sc-dev am: 97d5ea4b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13562411

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0d7da48cabde6b96546ffad4fa08b2e98409014d
parents 443e8297 97d5ea4b
Loading
Loading
Loading
Loading
+9 −25
Original line number Diff line number Diff line
@@ -115,10 +115,10 @@ final class OverlayManagerShellCommand extends ShellCommand {
        out.println("    Enable overlay within or owned by PACKAGE with optional unique NAME.");
        out.println("  disable [--user USER_ID] PACKAGE[:NAME]");
        out.println("    Disable overlay within or owned by PACKAGE with optional unique NAME.");
        out.println("  enable-exclusive [--user USER_ID] [--category] PACKAGE[:NAME]");
        out.println("    Enable overlay within or owned by PACKAGE with optional unique NAME and");
        out.println("    disable all other overlays for its target package. If the --category");
        out.println("    option is given, only disables other overlays in the same category.");
        out.println("  enable-exclusive [--user USER_ID] [--category] PACKAGE");
        out.println("    Enable overlay within or owned by PACKAGE and disable all other overlays");
        out.println("    for its target package. If the --category option is given, only disables");
        out.println("    other overlays in the same category.");
        out.println("  set-priority [--user USER_ID] PACKAGE PARENT|lowest|highest");
        out.println("    Change the priority of the overlay to be just higher than");
        out.println("    the priority of PARENT If PARENT is the special keyword");
@@ -325,28 +325,12 @@ final class OverlayManagerShellCommand extends ShellCommand {
                    return 1;
            }
        }

        final OverlayIdentifier overlay = OverlayIdentifier.fromString(getNextArgRequired());
        final OverlayInfo overlayInfo = mInterface.getOverlayInfoByIdentifier(overlay, userId);
        if (overlayInfo == null) {
            err.println("Error: Unable to get overlay info of: " + overlay);
            return 1;
        }

        final List<OverlayInfo> overlaysForTarget =
                mInterface.getOverlayInfosForTarget(overlayInfo.targetPackageName, userId);
        overlaysForTarget.remove(overlayInfo);
        final OverlayManagerTransaction.Builder builder = new OverlayManagerTransaction.Builder();
        for (final OverlayInfo disableOverlay : overlaysForTarget) {
            if ((inCategory && !Objects.equals(disableOverlay.category,overlayInfo.category))
                    || !disableOverlay.isMutable) {
                continue;
            }
            builder.setEnabled(disableOverlay.getOverlayIdentifier(), false, userId);
        final String overlay = getNextArgRequired();
        if (inCategory) {
            return mInterface.setEnabledExclusiveInCategory(overlay, userId) ? 0 : 1;
        } else {
            return mInterface.setEnabledExclusive(overlay, true, userId) ? 0 : 1;
        }
        builder.setEnabled(overlayInfo.getOverlayIdentifier(), true, userId);
        mInterface.commit(builder.build());
        return 0;
    }

    private int runSetPriority() throws RemoteException {