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

Commit 3d82b309 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Handle user current arg in OverlayManager dump

Currently the OverlayManagerService adb shell command dump only allows
numeric arguments for the user. This modifies it to also allow current
as an argument, and resolves it to the current system user.

Flag: EXEMPT refactor
Bug: 377912666
Test: atest InstallOverlayTests#testAdbShellOMSInterface
Change-Id: Ia871e168eef34a7e6064ed5e0c98ca8164465e7f
parent 80db1783
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -187,6 +187,9 @@ public class InstallOverlayTests extends BaseHostJUnit4Test {
                shell("cmd overlay list " + APP_OVERLAY_PACKAGE_NAME).trim());
        assertEquals("STATE_ENABLED",
                shell("cmd overlay dump state " + APP_OVERLAY_PACKAGE_NAME).trim());

        assertEquals("STATE_ENABLED",
                shell("cmd overlay dump --user current state " + APP_OVERLAY_PACKAGE_NAME).trim());
    }

    private void delay() {
+5 −3
Original line number Diff line number Diff line
@@ -1064,10 +1064,12 @@ public final class OverlayManagerService extends SystemService {
                        return;
                    }
                    try {
                        dumpState.setUserId(Integer.parseInt(args[opti]));
                        final int userId = UserHandle.parseUserArg(args[opti]);
                        final int realUserId = handleIncomingUser(userId, "dump");
                        dumpState.setUserId(realUserId);
                        opti++;
                    } catch (NumberFormatException e) {
                        pw.println("Error: user argument is not a number: " + args[opti]);
                    } catch (Exception e) {
                        pw.println("Error: " + e.getMessage());
                        return;
                    }
                } else if ("--verbose".equals(opt)) {