diff options
| -rw-r--r-- | services/core/java/com/android/server/om/OverlayManagerShellCommand.java | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java index b7b72d11a264..0b52c2e90ab9 100644 --- a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java +++ b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java @@ -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,27 +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); - 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 { |