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

Commit 78f5213f authored by Yurii Zubrytskyi's avatar Yurii Zubrytskyi
Browse files

[res] Allow changing RRO state that target android

'android' resources don't have overlayable definition, so
there's no way to enable or disable them for the apps that
aren't root or system. This isn't intentional, and the CL
enables it for the apps with the proper permission.

Bug: 364035303
Flag: android.content.res.rro_control_for_android_no_overlayable
Test: atest CtsHandleConfigChangeHostTests
Change-Id: I6894f1d073f9e50eaaa70675ab9372dca1de5fdf
parent 8a61fdd0
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.om;
import android.annotation.NonNull;
import android.content.om.OverlayInfo;
import android.content.om.OverlayableInfo;
import android.content.res.Flags;
import android.net.Uri;
import android.os.Process;
import android.text.TextUtils;
@@ -162,11 +163,15 @@ public class OverlayActorEnforcer {
            return ActorState.UNABLE_TO_GET_TARGET_OVERLAYABLE;
        }

        if (targetOverlayable == null) {
        // Framework doesn't have <overlayable> declaration by design, and we still want to be able
        // to enable its overlays from the packages with the permission.
        if (targetOverlayable == null
                && !(Flags.rroControlForAndroidNoOverlayable() && targetPackageName.equals(
                "android"))) {
            return ActorState.MISSING_OVERLAYABLE;
        }

        String actor = targetOverlayable.actor;
        final String actor = targetOverlayable == null ? null : targetOverlayable.actor;
        if (TextUtils.isEmpty(actor)) {
            // If there's no actor defined, fallback to the legacy permission check
            try {