Merge "OverlayManager: Add categories"
This commit is contained in:
@@ -83,16 +83,35 @@ interface IOverlayManager {
|
||||
* @param packageName The name of the overlay package.
|
||||
* @param enable true to enable the overlay, false to disable it.
|
||||
* @param userId The user for which to change the overlay.
|
||||
* @return true if the system successfully registered the request, false
|
||||
* otherwise.
|
||||
* @return true if the system successfully registered the request, false otherwise.
|
||||
*/
|
||||
boolean setEnabled(in String packageName, in boolean enable, in int userId);
|
||||
|
||||
/**
|
||||
* Version of setEnabled that will also disable any other overlays for the target package.
|
||||
* Request that an overlay package is enabled and any other overlay packages with the same
|
||||
* target package are disabled.
|
||||
*
|
||||
* See {@link #setEnabled} for the details on overlay packages.
|
||||
*
|
||||
* @param packageName the name of the overlay package to enable.
|
||||
* @param enabled must be true, otherwise the operation fails.
|
||||
* @param userId The user for which to change the overlay.
|
||||
* @return true if the system successfully registered the request, false otherwise.
|
||||
*/
|
||||
boolean setEnabledExclusive(in String packageName, in boolean enable, in int userId);
|
||||
|
||||
/**
|
||||
* Request that an overlay package is enabled and any other overlay packages with the same
|
||||
* target package and category are disabled.
|
||||
*
|
||||
* See {@link #setEnabled} for the details on overlay packages.
|
||||
*
|
||||
* @param packageName the name of the overlay package to enable.
|
||||
* @param userId The user for which to change the overlay.
|
||||
* @return true if the system successfully registered the request, false otherwise.
|
||||
*/
|
||||
boolean setEnabledExclusiveInCategory(in String packageName, in int userId);
|
||||
|
||||
/**
|
||||
* Change the priority of the given overlay to be just higher than the
|
||||
* overlay with package name newParentPackageName. Both overlay packages
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.content.om;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -66,14 +67,14 @@ public final class OverlayInfo implements Parcelable {
|
||||
/**
|
||||
* The overlay is currently disabled. It can be enabled.
|
||||
*
|
||||
* @see IOverlayManager.setEnabled
|
||||
* @see IOverlayManager#setEnabled
|
||||
*/
|
||||
public static final int STATE_DISABLED = 2;
|
||||
|
||||
/**
|
||||
* The overlay is currently enabled. It can be disabled.
|
||||
*
|
||||
* @see IOverlayManager.setEnabled
|
||||
* @see IOverlayManager#setEnabled
|
||||
*/
|
||||
public static final int STATE_ENABLED = 3;
|
||||
|
||||
@@ -89,6 +90,11 @@ public final class OverlayInfo implements Parcelable {
|
||||
*/
|
||||
public static final int STATE_OVERLAY_UPGRADING = 5;
|
||||
|
||||
/**
|
||||
* Category for theme overlays.
|
||||
*/
|
||||
public static final String CATEGORY_THEME = "android.theme";
|
||||
|
||||
/**
|
||||
* Package name of the overlay package
|
||||
*/
|
||||
@@ -99,6 +105,11 @@ public final class OverlayInfo implements Parcelable {
|
||||
*/
|
||||
public final String targetPackageName;
|
||||
|
||||
/**
|
||||
* Category of the overlay package
|
||||
*/
|
||||
public final String category;
|
||||
|
||||
/**
|
||||
* Full path to the base APK for this overlay package
|
||||
*/
|
||||
@@ -121,14 +132,15 @@ public final class OverlayInfo implements Parcelable {
|
||||
* @param state the new state for the source OverlayInfo
|
||||
*/
|
||||
public OverlayInfo(@NonNull OverlayInfo source, @State int state) {
|
||||
this(source.packageName, source.targetPackageName, source.baseCodePath, state,
|
||||
source.userId);
|
||||
this(source.packageName, source.targetPackageName, source.category, source.baseCodePath,
|
||||
state, source.userId);
|
||||
}
|
||||
|
||||
public OverlayInfo(@NonNull String packageName, @NonNull String targetPackageName,
|
||||
@NonNull String baseCodePath, @State int state, int userId) {
|
||||
@Nullable String category, @NonNull String baseCodePath, int state, int userId) {
|
||||
this.packageName = packageName;
|
||||
this.targetPackageName = targetPackageName;
|
||||
this.category = category;
|
||||
this.baseCodePath = baseCodePath;
|
||||
this.state = state;
|
||||
this.userId = userId;
|
||||
@@ -138,6 +150,7 @@ public final class OverlayInfo implements Parcelable {
|
||||
public OverlayInfo(Parcel source) {
|
||||
packageName = source.readString();
|
||||
targetPackageName = source.readString();
|
||||
category = source.readString();
|
||||
baseCodePath = source.readString();
|
||||
state = source.readInt();
|
||||
userId = source.readInt();
|
||||
@@ -177,6 +190,7 @@ public final class OverlayInfo implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(packageName);
|
||||
dest.writeString(targetPackageName);
|
||||
dest.writeString(category);
|
||||
dest.writeString(baseCodePath);
|
||||
dest.writeInt(state);
|
||||
dest.writeInt(userId);
|
||||
@@ -275,6 +289,9 @@ public final class OverlayInfo implements Parcelable {
|
||||
if (!targetPackageName.equals(other.targetPackageName)) {
|
||||
return false;
|
||||
}
|
||||
if (!category.equals(other.category)) {
|
||||
return false;
|
||||
}
|
||||
if (!baseCodePath.equals(other.baseCodePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -362,6 +362,13 @@ public class PackageInfo implements Parcelable {
|
||||
*/
|
||||
public String overlayTarget;
|
||||
|
||||
/**
|
||||
* The overlay category, if any, of this package
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public String overlayCategory;
|
||||
|
||||
/** @hide */
|
||||
public int overlayPriority;
|
||||
|
||||
@@ -464,6 +471,7 @@ public class PackageInfo implements Parcelable {
|
||||
dest.writeString(restrictedAccountType);
|
||||
dest.writeString(requiredAccountType);
|
||||
dest.writeString(overlayTarget);
|
||||
dest.writeString(overlayCategory);
|
||||
dest.writeInt(overlayPriority);
|
||||
dest.writeBoolean(mOverlayIsStatic);
|
||||
dest.writeInt(compileSdkVersion);
|
||||
@@ -531,6 +539,7 @@ public class PackageInfo implements Parcelable {
|
||||
restrictedAccountType = source.readString();
|
||||
requiredAccountType = source.readString();
|
||||
overlayTarget = source.readString();
|
||||
overlayCategory = source.readString();
|
||||
overlayPriority = source.readInt();
|
||||
mOverlayIsStatic = source.readBoolean();
|
||||
compileSdkVersion = source.readInt();
|
||||
|
||||
@@ -676,6 +676,7 @@ public class PackageParser {
|
||||
pi.restrictedAccountType = p.mRestrictedAccountType;
|
||||
pi.requiredAccountType = p.mRequiredAccountType;
|
||||
pi.overlayTarget = p.mOverlayTarget;
|
||||
pi.overlayCategory = p.mOverlayCategory;
|
||||
pi.overlayPriority = p.mOverlayPriority;
|
||||
pi.mOverlayIsStatic = p.mOverlayIsStatic;
|
||||
pi.compileSdkVersion = p.mCompileSdkVersion;
|
||||
@@ -2073,6 +2074,8 @@ public class PackageParser {
|
||||
com.android.internal.R.styleable.AndroidManifestResourceOverlay);
|
||||
pkg.mOverlayTarget = sa.getString(
|
||||
com.android.internal.R.styleable.AndroidManifestResourceOverlay_targetPackage);
|
||||
pkg.mOverlayCategory = sa.getString(
|
||||
com.android.internal.R.styleable.AndroidManifestResourceOverlay_category);
|
||||
pkg.mOverlayPriority = sa.getInt(
|
||||
com.android.internal.R.styleable.AndroidManifestResourceOverlay_priority,
|
||||
0);
|
||||
@@ -6324,6 +6327,7 @@ public class PackageParser {
|
||||
public String mRequiredAccountType;
|
||||
|
||||
public String mOverlayTarget;
|
||||
public String mOverlayCategory;
|
||||
public int mOverlayPriority;
|
||||
public boolean mOverlayIsStatic;
|
||||
|
||||
@@ -6834,6 +6838,7 @@ public class PackageParser {
|
||||
mRestrictedAccountType = dest.readString();
|
||||
mRequiredAccountType = dest.readString();
|
||||
mOverlayTarget = dest.readString();
|
||||
mOverlayCategory = dest.readString();
|
||||
mOverlayPriority = dest.readInt();
|
||||
mOverlayIsStatic = (dest.readInt() == 1);
|
||||
mCompileSdkVersion = dest.readInt();
|
||||
@@ -6957,6 +6962,7 @@ public class PackageParser {
|
||||
dest.writeString(mRestrictedAccountType);
|
||||
dest.writeString(mRequiredAccountType);
|
||||
dest.writeString(mOverlayTarget);
|
||||
dest.writeString(mOverlayCategory);
|
||||
dest.writeInt(mOverlayPriority);
|
||||
dest.writeInt(mOverlayIsStatic ? 1 : 0);
|
||||
dest.writeInt(mCompileSdkVersion);
|
||||
|
||||
@@ -52,6 +52,16 @@ public final class DisplayCutout {
|
||||
private static final String TAG = "DisplayCutout";
|
||||
private static final String DP_MARKER = "@dp";
|
||||
|
||||
/**
|
||||
* Category for overlays that allow emulating a display cutout on devices that don't have
|
||||
* one.
|
||||
*
|
||||
* @see android.content.om.IOverlayManager
|
||||
* @hide
|
||||
*/
|
||||
public static final String EMULATION_OVERLAY_CATEGORY =
|
||||
"com.android.internal.display_cutout_emulation";
|
||||
|
||||
private static final Rect ZERO_RECT = new Rect();
|
||||
private static final Region EMPTY_REGION = new Region();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user