From aea4b53e14940b996af290b5e8e1c065c86ab5fb Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 12 Feb 2021 11:12:21 -0800 Subject: [PATCH 1/2] Revert "Fix enable-exclusive atomic api" This reverts commit 867aa53e7fed3b4851161de6aa6499e1fe097aad. Bug: 180016597 Change-Id: Idd304f56340369457d98b94e151a9306b7fa1e60 --- .../java/com/android/server/om/OverlayManagerShellCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java index 663fdeefae5d7..b7b72d11a2645 100644 --- a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java +++ b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java @@ -335,7 +335,6 @@ final class OverlayManagerShellCommand extends ShellCommand { final List 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)) From 19fd30e96e3d2a273c21aeda85d8d06567e64c0b Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Thu, 11 Feb 2021 17:18:49 -0800 Subject: [PATCH 2/2] Revert enable exclusive in category atomic API A test is failing after converting the enable-exclusive shell command to use the atomic API. Revert the shell command changes for now. Bug: 180016597 Test: com.android.launcher3.memory.MemoryTests#testActivityRecreation Change-Id: I6d84d3d155d8ce3a0bdd25d1afa491dbbd94d960 --- .../server/om/OverlayManagerShellCommand.java | 33 +++++-------------- 1 file 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 b7b72d11a2645..0b52c2e90ab9e 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 String overlay = getNextArgRequired(); + if (inCategory) { + return mInterface.setEnabledExclusiveInCategory(overlay, userId) ? 0 : 1; + } else { + return mInterface.setEnabledExclusive(overlay, true, userId) ? 0 : 1; } - - final List 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); - } - builder.setEnabled(overlayInfo.getOverlayIdentifier(), true, userId); - mInterface.commit(builder.build()); - return 0; } private int runSetPriority() throws RemoteException {