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

Commit a525e223 authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Todd Kennedy
Browse files

OMS: teach the OMS about static RROs

Teach the OMS about static RROs (those with <overlay isStatic="true">)
and add a new OVERLAY_ENABLED_STATIC state to OverlayInfo. This makes
isStatic less of an edge case and something that can be reasoned about
together with the other states.

Bug: 78809704
Test: atest OverlayHostTests OverlayDeviceTests
Change-Id: Ia785554ed2bcf7679888c3ccdaeaedca1430a477
parent 2f1944bf
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public final class OverlayInfo implements Parcelable {
            STATE_NO_IDMAP,
            STATE_DISABLED,
            STATE_ENABLED,
            STATE_ENABLED_STATIC,
            STATE_TARGET_UPGRADING,
            STATE_OVERLAY_UPGRADING,
    })
@@ -90,7 +91,16 @@ public final class OverlayInfo implements Parcelable {
    public static final int STATE_OVERLAY_UPGRADING = 5;

    /**
     * Category for theme overlays.
     * The overlay package is currently enabled because it is marked as
     * 'static'. It cannot be disabled but will change state if for instance
     * its target is uninstalled.
     */
    public static final int STATE_ENABLED_STATIC = 6;

    /**
     * Overlay category: theme.
     * <p>
     * Change how Android (including the status bar, dialogs, ...) looks.
     */
    public static final String CATEGORY_THEME = "android.theme";

@@ -194,6 +204,7 @@ public final class OverlayInfo implements Parcelable {
            case STATE_NO_IDMAP:
            case STATE_DISABLED:
            case STATE_ENABLED:
            case STATE_ENABLED_STATIC:
            case STATE_TARGET_UPGRADING:
            case STATE_OVERLAY_UPGRADING:
                break;
@@ -243,6 +254,7 @@ public final class OverlayInfo implements Parcelable {
    public boolean isEnabled() {
        switch (state) {
            case STATE_ENABLED:
            case STATE_ENABLED_STATIC:
                return true;
            default:
                return false;
@@ -267,6 +279,8 @@ public final class OverlayInfo implements Parcelable {
                return "STATE_DISABLED";
            case STATE_ENABLED:
                return "STATE_ENABLED";
            case STATE_ENABLED_STATIC:
                return "STATE_ENABLED_STATIC";
            case STATE_TARGET_UPGRADING:
                return "STATE_TARGET_UPGRADING";
            case STATE_OVERLAY_UPGRADING:
+5 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.om;

import static android.content.om.OverlayInfo.STATE_DISABLED;
import static android.content.om.OverlayInfo.STATE_ENABLED;
import static android.content.om.OverlayInfo.STATE_ENABLED_STATIC;
import static android.content.om.OverlayInfo.STATE_MISSING_TARGET;
import static android.content.om.OverlayInfo.STATE_NO_IDMAP;
import static android.content.om.OverlayInfo.STATE_OVERLAY_UPGRADING;
@@ -681,6 +682,10 @@ final class OverlayManagerServiceImpl {
            return STATE_NO_IDMAP;
        }

        if (overlayPackage.isStaticOverlayPackage()) {
            return STATE_ENABLED_STATIC;
        }

        final boolean enabled = mSettings.getEnabled(overlayPackage.packageName, userId);
        return enabled ? STATE_ENABLED : STATE_DISABLED;
    }
+1 −0
Original line number Diff line number Diff line
@@ -309,6 +309,7 @@ final class OverlayManagerSettings {
            pw.print("mState.............: "); pw.println(OverlayInfo.stateToString(item.getState()));
            pw.print("mIsEnabled.........: "); pw.println(item.isEnabled());
            pw.print("mIsStatic..........: "); pw.println(item.isStatic());
            pw.print("mPriority..........: "); pw.println(item.mPriority);
            pw.print("mCategory..........: "); pw.println(item.mCategory);

            pw.decreaseIndent();
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ final class OverlayManagerShellCommand extends ShellCommand {
                final OverlayInfo oi = overlaysForTarget.get(i);
                String status;
                switch (oi.state) {
                    case OverlayInfo.STATE_ENABLED_STATIC:
                    case OverlayInfo.STATE_ENABLED:
                        status = "[x]";
                        break;