Merge "Clarify actor requirements in OverlayManager API" into rvc-dev
This commit is contained in:
@@ -27,14 +27,50 @@ import android.compat.annotation.ChangeId;
|
|||||||
import android.compat.annotation.EnabledAfter;
|
import android.compat.annotation.EnabledAfter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Process;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
|
||||||
|
import com.android.server.SystemConfig;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates OverlayManager state; gets information about installed overlay packages.
|
* Updates OverlayManager state; gets information about installed overlay packages.
|
||||||
|
*
|
||||||
|
* <p>Users of this API must be actors of any overlays they desire to change the state of.</p>
|
||||||
|
*
|
||||||
|
* <p>An actor is a package responsible for managing the state of overlays targeting overlayables
|
||||||
|
* that specify the actor. For example, an actor may enable or disable an overlay or otherwise
|
||||||
|
* change its state.</p>
|
||||||
|
*
|
||||||
|
* <p>Actors are specified as part of the overlayable definition.
|
||||||
|
*
|
||||||
|
* <pre>{@code
|
||||||
|
* <overlayable name="OverlayableResourcesName" actor="overlay://namespace/actorName">
|
||||||
|
* }</pre></p>
|
||||||
|
*
|
||||||
|
* <p>Actors are defined through {@link SystemConfig}. Only system packages can be used.
|
||||||
|
* The namespace "android" is reserved for use by AOSP and any "android" definitions must
|
||||||
|
* have an implementation on device that fulfill their intended functionality.</p>
|
||||||
|
*
|
||||||
|
* <pre>{@code
|
||||||
|
* <named-actor
|
||||||
|
* namespace="namespace"
|
||||||
|
* name="actorName"
|
||||||
|
* package="com.example.pkg"
|
||||||
|
* />
|
||||||
|
* }</pre></p>
|
||||||
|
*
|
||||||
|
* <p>An actor can manipulate a particular overlay if any of the following is true:
|
||||||
|
* <ul>
|
||||||
|
* <li>its UID is {@link Process#ROOT_UID}, {@link Process#SYSTEM_UID}</li>
|
||||||
|
* <li>it is the target of the overlay package</li>
|
||||||
|
* <li>it has the CHANGE_OVERLAY_PACKAGES permission and the target does not specify an actor</li>
|
||||||
|
* <li>it is the actor specified by the overlayable</li>
|
||||||
|
* </ul></p>
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
@@ -84,6 +120,8 @@ public class OverlayManager {
|
|||||||
* If a set of overlay packages share the same category, single call to this method is
|
* If a set of overlay packages share the same category, single call to this method is
|
||||||
* equivalent to multiple calls to {@link #setEnabled(String, boolean, UserHandle)}.
|
* equivalent to multiple calls to {@link #setEnabled(String, boolean, UserHandle)}.
|
||||||
*
|
*
|
||||||
|
* The caller must pass the actor requirements specified in the class comment.
|
||||||
|
*
|
||||||
* @param packageName the name of the overlay package to enable.
|
* @param packageName the name of the overlay package to enable.
|
||||||
* @param user The user for which to change the overlay.
|
* @param user The user for which to change the overlay.
|
||||||
*
|
*
|
||||||
@@ -116,6 +154,8 @@ public class OverlayManager {
|
|||||||
* While {@link #setEnabledExclusiveInCategory(String, UserHandle)} doesn't support disabling
|
* While {@link #setEnabledExclusiveInCategory(String, UserHandle)} doesn't support disabling
|
||||||
* every overlay in a category, this method allows you to disable everything.
|
* every overlay in a category, this method allows you to disable everything.
|
||||||
*
|
*
|
||||||
|
* The caller must pass the actor requirements specified in the class comment.
|
||||||
|
*
|
||||||
* @param packageName the name of the overlay package to enable.
|
* @param packageName the name of the overlay package to enable.
|
||||||
* @param enable {@code false} if the overlay should be turned off.
|
* @param enable {@code false} if the overlay should be turned off.
|
||||||
* @param user The user for which to change the overlay.
|
* @param user The user for which to change the overlay.
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import android.util.Pair;
|
|||||||
|
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.internal.util.CollectionUtils;
|
import com.android.internal.util.CollectionUtils;
|
||||||
import com.android.server.SystemConfig;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -38,6 +37,8 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Performs verification that a calling UID can act on a target package's overlayable.
|
* Performs verification that a calling UID can act on a target package's overlayable.
|
||||||
*
|
*
|
||||||
|
* Actors requirements are specified in {@link android.content.om.OverlayManager}.
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class OverlayActorEnforcer {
|
public class OverlayActorEnforcer {
|
||||||
@@ -99,13 +100,7 @@ public class OverlayActorEnforcer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An actor is valid if any of the following is true:
|
* See {@link OverlayActorEnforcer} class comment for actor requirements.
|
||||||
* - is {@link Process#ROOT_UID}, {@link Process#SYSTEM_UID}
|
|
||||||
* - is the target overlay package
|
|
||||||
* - has the CHANGE_OVERLAY_PACKAGES permission and an actor is not defined
|
|
||||||
* - is the same the as the package defined in {@link SystemConfig#getNamedActors()} for a given
|
|
||||||
* namespace and actor name
|
|
||||||
*
|
|
||||||
* @return true if the actor is allowed to act on the target overlayInfo
|
* @return true if the actor is allowed to act on the target overlayInfo
|
||||||
*/
|
*/
|
||||||
private ActorState isAllowedActor(String methodName, OverlayInfo overlayInfo,
|
private ActorState isAllowedActor(String methodName, OverlayInfo overlayInfo,
|
||||||
|
|||||||
Reference in New Issue
Block a user