Loading core/java/android/app/Activity.java +7 −0 Original line number Diff line number Diff line Loading @@ -5090,6 +5090,13 @@ public class Activity extends ContextThemeWrapper mTaskDescription.setBackgroundColor(colorBackground); } int colorBackgroundFloating = a.getColor( com.android.internal.R.styleable.ActivityTaskDescription_colorBackgroundFloating, 0); if (colorBackgroundFloating != 0 && Color.alpha(colorBackgroundFloating) == 0xFF) { mTaskDescription.setBackgroundColorFloating(colorBackgroundFloating); } final int statusBarColor = a.getColor( com.android.internal.R.styleable.ActivityTaskDescription_statusBarColor, 0); if (statusBarColor != 0) { Loading core/java/android/app/ActivityManager.java +54 −10 Original line number Diff line number Diff line Loading @@ -1072,13 +1072,15 @@ public class ActivityManager { private static final String ATTR_TASKDESCRIPTIONCOLOR_PRIMARY = ATTR_TASKDESCRIPTION_PREFIX + "color"; private static final String ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND = ATTR_TASKDESCRIPTION_PREFIX + "colorBackground"; ATTR_TASKDESCRIPTION_PREFIX + "color_background"; private static final String ATTR_TASKDESCRIPTIONICON_FILENAME = ATTR_TASKDESCRIPTION_PREFIX + "icon_filename"; private static final String ATTR_TASKDESCRIPTIONICON_RESOURCE = ATTR_TASKDESCRIPTION_PREFIX + "icon_resource"; private static final String ATTR_TASKDESCRIPTIONICON_RESOURCE_PACKAGE = ATTR_TASKDESCRIPTION_PREFIX + "icon_package"; private static final String ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND_FLOATING = ATTR_TASKDESCRIPTION_PREFIX + "color_background_floating"; private String mLabel; @Nullable Loading @@ -1086,6 +1088,7 @@ public class ActivityManager { private String mIconFilename; private int mColorPrimary; private int mColorBackground; private int mColorBackgroundFloating; private int mStatusBarColor; private int mNavigationBarColor; private boolean mEnsureStatusBarContrastWhenTransparent; Loading @@ -1106,7 +1109,7 @@ public class ActivityManager { */ public TaskDescription(String label, @DrawableRes int iconRes, int colorPrimary) { this(label, Icon.createWithResource(ActivityThread.currentPackageName(), iconRes), colorPrimary, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); colorPrimary, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); if ((colorPrimary != 0) && (Color.alpha(colorPrimary) != 255)) { throw new RuntimeException("A TaskDescription's primary color should be opaque"); } Loading @@ -1121,7 +1124,7 @@ public class ActivityManager { */ public TaskDescription(String label, @DrawableRes int iconRes) { this(label, Icon.createWithResource(ActivityThread.currentPackageName(), iconRes), 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** Loading @@ -1130,14 +1133,14 @@ public class ActivityManager { * @param label A label and description of the current state of this activity. */ public TaskDescription(String label) { this(label, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); this(label, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** * Creates an empty TaskDescription. */ public TaskDescription() { this(null, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); this(null, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** Loading @@ -1152,7 +1155,7 @@ public class ActivityManager { @Deprecated public TaskDescription(String label, Bitmap icon, int colorPrimary) { this(label, icon != null ? Icon.createWithBitmap(icon) : null, colorPrimary, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); if ((colorPrimary != 0) && (Color.alpha(colorPrimary) != 255)) { throw new RuntimeException("A TaskDescription's primary color should be opaque"); } Loading @@ -1168,7 +1171,7 @@ public class ActivityManager { @Deprecated public TaskDescription(String label, Bitmap icon) { this(label, icon != null ? Icon.createWithBitmap(icon) : null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** @hide */ Loading @@ -1177,7 +1180,7 @@ public class ActivityManager { int statusBarColor, int navigationBarColor, boolean ensureStatusBarContrastWhenTransparent, boolean ensureNavigationBarContrastWhenTransparent, int resizeMode, int minWidth, int minHeight) { int minHeight, int colorBackgroundFloating) { mLabel = label; mIcon = icon; mColorPrimary = colorPrimary; Loading @@ -1190,6 +1193,7 @@ public class ActivityManager { mResizeMode = resizeMode; mMinWidth = minWidth; mMinHeight = minHeight; mColorBackgroundFloating = colorBackgroundFloating; } /** Loading Loading @@ -1217,6 +1221,7 @@ public class ActivityManager { mResizeMode = other.mResizeMode; mMinWidth = other.mMinWidth; mMinHeight = other.mMinHeight; mColorBackgroundFloating = other.mColorBackgroundFloating; } /** Loading Loading @@ -1253,6 +1258,9 @@ public class ActivityManager { if (other.mMinHeight != -1) { mMinHeight = other.mMinHeight; } if (other.mColorBackgroundFloating != 0) { mColorBackgroundFloating = other.mColorBackgroundFloating; } } private TaskDescription(Parcel source) { Loading Loading @@ -1291,6 +1299,19 @@ public class ActivityManager { mColorBackground = backgroundColor; } /** * Sets the background color floating for this task description. * @hide */ public void setBackgroundColorFloating(int backgroundColor) { // Ensure that the given color is valid if ((backgroundColor != 0) && (Color.alpha(backgroundColor) != 255)) { throw new RuntimeException( "A TaskDescription's background color floating should be opaque"); } mColorBackgroundFloating = backgroundColor; } /** * @hide */ Loading Loading @@ -1460,6 +1481,14 @@ public class ActivityManager { return mColorBackground; } /** * @return The background color floating. * @hide */ public int getBackgroundColorFloating() { return mColorBackgroundFloating; } /** * @hide */ Loading Loading @@ -1537,6 +1566,10 @@ public class ActivityManager { if (mColorBackground != 0) { out.attributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND, mColorBackground); } if (mColorBackgroundFloating != 0) { out.attributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND_FLOATING, mColorBackgroundFloating); } if (mIconFilename != null) { out.attribute(null, ATTR_TASKDESCRIPTIONICON_FILENAME, mIconFilename); } Loading @@ -1563,6 +1596,11 @@ public class ActivityManager { if (colorBackground != 0) { setBackgroundColor(colorBackground); } final int colorBackgroundFloating = in.getAttributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND_FLOATING, 0); if (colorBackgroundFloating != 0) { setBackgroundColorFloating(colorBackgroundFloating); } final String iconFilename = in.getAttributeValue(null, ATTR_TASKDESCRIPTIONICON_FILENAME); if (iconFilename != null) { Loading Loading @@ -1615,6 +1653,7 @@ public class ActivityManager { dest.writeInt(1); dest.writeString(mIconFilename); } dest.writeInt(mColorBackgroundFloating); } public void readFromParcel(Parcel source) { Loading @@ -1632,6 +1671,7 @@ public class ActivityManager { mMinWidth = source.readInt(); mMinHeight = source.readInt(); mIconFilename = source.readInt() > 0 ? source.readString() : null; mColorBackgroundFloating = source.readInt(); } public static final @android.annotation.NonNull Creator<TaskDescription> CREATOR Loading @@ -1655,7 +1695,8 @@ public class ActivityManager { + (mEnsureNavigationBarContrastWhenTransparent ? " (contrast when transparent)" : "") + " resizeMode: " + ActivityInfo.resizeModeToString(mResizeMode) + " minWidth: " + mMinWidth + " minHeight: " + mMinHeight; + " minWidth: " + mMinWidth + " minHeight: " + mMinHeight + " colorBackgrounFloating: " + mColorBackgroundFloating; } @Override Loading @@ -1678,7 +1719,8 @@ public class ActivityManager { == other.mEnsureNavigationBarContrastWhenTransparent && mResizeMode == other.mResizeMode && mMinWidth == other.mMinWidth && mMinHeight == other.mMinHeight; && mMinHeight == other.mMinHeight && mColorBackgroundFloating == other.mColorBackgroundFloating; } /** @hide */ Loading Loading @@ -1826,6 +1868,8 @@ public class ActivityManager { pw.print(ActivityInfo.resizeModeToString(td.getResizeMode())); pw.print(" minWidth="); pw.print(td.getMinWidth()); pw.print(" minHeight="); pw.print(td.getMinHeight()); pw.print(" colorBackgroundFloating=#"); pw.print(Integer.toHexString(td.getBackgroundColorFloating())); pw.println(" }"); } } Loading core/res/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -9186,6 +9186,9 @@ <!-- @hide From Theme.colorBackground, used for the TaskDescription background color. --> <attr name="colorBackground" /> <!-- @hide From Theme.colorBackgroundFloating, used for the TaskDescription background color floating. --> <attr name="colorBackgroundFloating" /> <!-- @hide From Theme.statusBarColor, used for the TaskDescription status bar color. --> <attr name="statusBarColor"/> <!-- @hide From Theme.navigationBarColor, used for the TaskDescription navigation bar Loading core/res/res/values/config.xml +17 −0 Original line number Diff line number Diff line Loading @@ -4657,6 +4657,23 @@ corners of the activity won't be rounded. --> <integer name="config_letterboxActivityCornersRadius">0</integer> <!-- Corners appearance of the letterbox background. 0 - Solid background using color specified in R.color.config_letterboxBackgroundColor. 1 - Color specified in R.attr.colorBackground for the letterboxed application. 2 - Color specified in R.attr.colorBackgroundFloating for the letterboxed application. If given value is outside of this range, the option 0 will be assummed. --> <integer name="config_letterboxBackgroundType">0</integer> <!-- Color of the letterbox background if one following conditions is true - Option 0 is selected for R.integer.config_letterboxBackgroundType. - Option 1 is selected for R.integer.config_letterboxBackgroundType and R.attr.colorBackground isn't specified for the app. - Option 2 is selected for R.integer.config_letterboxBackgroundType and R.attr.colorBackgroundFloating isn't specified for the app. Defaults to black if not specified. --> <color name="config_letterboxBackgroundColor">#000</color> <!-- If true, hide the display cutout with display area --> <bool name="config_hideDisplayCutoutWithDisplayArea">false</bool> Loading core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4136,6 +4136,8 @@ <java-symbol type="dimen" name="config_taskLetterboxAspectRatio" /> <java-symbol type="integer" name="config_letterboxActivityCornersRadius" /> <java-symbol type="integer" name="config_letterboxBackgroundType" /> <java-symbol type="color" name="config_letterboxBackgroundColor" /> <java-symbol type="bool" name="config_hideDisplayCutoutWithDisplayArea" /> Loading Loading
core/java/android/app/Activity.java +7 −0 Original line number Diff line number Diff line Loading @@ -5090,6 +5090,13 @@ public class Activity extends ContextThemeWrapper mTaskDescription.setBackgroundColor(colorBackground); } int colorBackgroundFloating = a.getColor( com.android.internal.R.styleable.ActivityTaskDescription_colorBackgroundFloating, 0); if (colorBackgroundFloating != 0 && Color.alpha(colorBackgroundFloating) == 0xFF) { mTaskDescription.setBackgroundColorFloating(colorBackgroundFloating); } final int statusBarColor = a.getColor( com.android.internal.R.styleable.ActivityTaskDescription_statusBarColor, 0); if (statusBarColor != 0) { Loading
core/java/android/app/ActivityManager.java +54 −10 Original line number Diff line number Diff line Loading @@ -1072,13 +1072,15 @@ public class ActivityManager { private static final String ATTR_TASKDESCRIPTIONCOLOR_PRIMARY = ATTR_TASKDESCRIPTION_PREFIX + "color"; private static final String ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND = ATTR_TASKDESCRIPTION_PREFIX + "colorBackground"; ATTR_TASKDESCRIPTION_PREFIX + "color_background"; private static final String ATTR_TASKDESCRIPTIONICON_FILENAME = ATTR_TASKDESCRIPTION_PREFIX + "icon_filename"; private static final String ATTR_TASKDESCRIPTIONICON_RESOURCE = ATTR_TASKDESCRIPTION_PREFIX + "icon_resource"; private static final String ATTR_TASKDESCRIPTIONICON_RESOURCE_PACKAGE = ATTR_TASKDESCRIPTION_PREFIX + "icon_package"; private static final String ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND_FLOATING = ATTR_TASKDESCRIPTION_PREFIX + "color_background_floating"; private String mLabel; @Nullable Loading @@ -1086,6 +1088,7 @@ public class ActivityManager { private String mIconFilename; private int mColorPrimary; private int mColorBackground; private int mColorBackgroundFloating; private int mStatusBarColor; private int mNavigationBarColor; private boolean mEnsureStatusBarContrastWhenTransparent; Loading @@ -1106,7 +1109,7 @@ public class ActivityManager { */ public TaskDescription(String label, @DrawableRes int iconRes, int colorPrimary) { this(label, Icon.createWithResource(ActivityThread.currentPackageName(), iconRes), colorPrimary, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); colorPrimary, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); if ((colorPrimary != 0) && (Color.alpha(colorPrimary) != 255)) { throw new RuntimeException("A TaskDescription's primary color should be opaque"); } Loading @@ -1121,7 +1124,7 @@ public class ActivityManager { */ public TaskDescription(String label, @DrawableRes int iconRes) { this(label, Icon.createWithResource(ActivityThread.currentPackageName(), iconRes), 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** Loading @@ -1130,14 +1133,14 @@ public class ActivityManager { * @param label A label and description of the current state of this activity. */ public TaskDescription(String label) { this(label, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); this(label, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** * Creates an empty TaskDescription. */ public TaskDescription() { this(null, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); this(null, null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** Loading @@ -1152,7 +1155,7 @@ public class ActivityManager { @Deprecated public TaskDescription(String label, Bitmap icon, int colorPrimary) { this(label, icon != null ? Icon.createWithBitmap(icon) : null, colorPrimary, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); false, false, RESIZE_MODE_RESIZEABLE, -1, -1, 0); if ((colorPrimary != 0) && (Color.alpha(colorPrimary) != 255)) { throw new RuntimeException("A TaskDescription's primary color should be opaque"); } Loading @@ -1168,7 +1171,7 @@ public class ActivityManager { @Deprecated public TaskDescription(String label, Bitmap icon) { this(label, icon != null ? Icon.createWithBitmap(icon) : null, 0, 0, 0, 0, false, false, RESIZE_MODE_RESIZEABLE, -1, -1); RESIZE_MODE_RESIZEABLE, -1, -1, 0); } /** @hide */ Loading @@ -1177,7 +1180,7 @@ public class ActivityManager { int statusBarColor, int navigationBarColor, boolean ensureStatusBarContrastWhenTransparent, boolean ensureNavigationBarContrastWhenTransparent, int resizeMode, int minWidth, int minHeight) { int minHeight, int colorBackgroundFloating) { mLabel = label; mIcon = icon; mColorPrimary = colorPrimary; Loading @@ -1190,6 +1193,7 @@ public class ActivityManager { mResizeMode = resizeMode; mMinWidth = minWidth; mMinHeight = minHeight; mColorBackgroundFloating = colorBackgroundFloating; } /** Loading Loading @@ -1217,6 +1221,7 @@ public class ActivityManager { mResizeMode = other.mResizeMode; mMinWidth = other.mMinWidth; mMinHeight = other.mMinHeight; mColorBackgroundFloating = other.mColorBackgroundFloating; } /** Loading Loading @@ -1253,6 +1258,9 @@ public class ActivityManager { if (other.mMinHeight != -1) { mMinHeight = other.mMinHeight; } if (other.mColorBackgroundFloating != 0) { mColorBackgroundFloating = other.mColorBackgroundFloating; } } private TaskDescription(Parcel source) { Loading Loading @@ -1291,6 +1299,19 @@ public class ActivityManager { mColorBackground = backgroundColor; } /** * Sets the background color floating for this task description. * @hide */ public void setBackgroundColorFloating(int backgroundColor) { // Ensure that the given color is valid if ((backgroundColor != 0) && (Color.alpha(backgroundColor) != 255)) { throw new RuntimeException( "A TaskDescription's background color floating should be opaque"); } mColorBackgroundFloating = backgroundColor; } /** * @hide */ Loading Loading @@ -1460,6 +1481,14 @@ public class ActivityManager { return mColorBackground; } /** * @return The background color floating. * @hide */ public int getBackgroundColorFloating() { return mColorBackgroundFloating; } /** * @hide */ Loading Loading @@ -1537,6 +1566,10 @@ public class ActivityManager { if (mColorBackground != 0) { out.attributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND, mColorBackground); } if (mColorBackgroundFloating != 0) { out.attributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND_FLOATING, mColorBackgroundFloating); } if (mIconFilename != null) { out.attribute(null, ATTR_TASKDESCRIPTIONICON_FILENAME, mIconFilename); } Loading @@ -1563,6 +1596,11 @@ public class ActivityManager { if (colorBackground != 0) { setBackgroundColor(colorBackground); } final int colorBackgroundFloating = in.getAttributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND_FLOATING, 0); if (colorBackgroundFloating != 0) { setBackgroundColorFloating(colorBackgroundFloating); } final String iconFilename = in.getAttributeValue(null, ATTR_TASKDESCRIPTIONICON_FILENAME); if (iconFilename != null) { Loading Loading @@ -1615,6 +1653,7 @@ public class ActivityManager { dest.writeInt(1); dest.writeString(mIconFilename); } dest.writeInt(mColorBackgroundFloating); } public void readFromParcel(Parcel source) { Loading @@ -1632,6 +1671,7 @@ public class ActivityManager { mMinWidth = source.readInt(); mMinHeight = source.readInt(); mIconFilename = source.readInt() > 0 ? source.readString() : null; mColorBackgroundFloating = source.readInt(); } public static final @android.annotation.NonNull Creator<TaskDescription> CREATOR Loading @@ -1655,7 +1695,8 @@ public class ActivityManager { + (mEnsureNavigationBarContrastWhenTransparent ? " (contrast when transparent)" : "") + " resizeMode: " + ActivityInfo.resizeModeToString(mResizeMode) + " minWidth: " + mMinWidth + " minHeight: " + mMinHeight; + " minWidth: " + mMinWidth + " minHeight: " + mMinHeight + " colorBackgrounFloating: " + mColorBackgroundFloating; } @Override Loading @@ -1678,7 +1719,8 @@ public class ActivityManager { == other.mEnsureNavigationBarContrastWhenTransparent && mResizeMode == other.mResizeMode && mMinWidth == other.mMinWidth && mMinHeight == other.mMinHeight; && mMinHeight == other.mMinHeight && mColorBackgroundFloating == other.mColorBackgroundFloating; } /** @hide */ Loading Loading @@ -1826,6 +1868,8 @@ public class ActivityManager { pw.print(ActivityInfo.resizeModeToString(td.getResizeMode())); pw.print(" minWidth="); pw.print(td.getMinWidth()); pw.print(" minHeight="); pw.print(td.getMinHeight()); pw.print(" colorBackgroundFloating=#"); pw.print(Integer.toHexString(td.getBackgroundColorFloating())); pw.println(" }"); } } Loading
core/res/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -9186,6 +9186,9 @@ <!-- @hide From Theme.colorBackground, used for the TaskDescription background color. --> <attr name="colorBackground" /> <!-- @hide From Theme.colorBackgroundFloating, used for the TaskDescription background color floating. --> <attr name="colorBackgroundFloating" /> <!-- @hide From Theme.statusBarColor, used for the TaskDescription status bar color. --> <attr name="statusBarColor"/> <!-- @hide From Theme.navigationBarColor, used for the TaskDescription navigation bar Loading
core/res/res/values/config.xml +17 −0 Original line number Diff line number Diff line Loading @@ -4657,6 +4657,23 @@ corners of the activity won't be rounded. --> <integer name="config_letterboxActivityCornersRadius">0</integer> <!-- Corners appearance of the letterbox background. 0 - Solid background using color specified in R.color.config_letterboxBackgroundColor. 1 - Color specified in R.attr.colorBackground for the letterboxed application. 2 - Color specified in R.attr.colorBackgroundFloating for the letterboxed application. If given value is outside of this range, the option 0 will be assummed. --> <integer name="config_letterboxBackgroundType">0</integer> <!-- Color of the letterbox background if one following conditions is true - Option 0 is selected for R.integer.config_letterboxBackgroundType. - Option 1 is selected for R.integer.config_letterboxBackgroundType and R.attr.colorBackground isn't specified for the app. - Option 2 is selected for R.integer.config_letterboxBackgroundType and R.attr.colorBackgroundFloating isn't specified for the app. Defaults to black if not specified. --> <color name="config_letterboxBackgroundColor">#000</color> <!-- If true, hide the display cutout with display area --> <bool name="config_hideDisplayCutoutWithDisplayArea">false</bool> Loading
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4136,6 +4136,8 @@ <java-symbol type="dimen" name="config_taskLetterboxAspectRatio" /> <java-symbol type="integer" name="config_letterboxActivityCornersRadius" /> <java-symbol type="integer" name="config_letterboxBackgroundType" /> <java-symbol type="color" name="config_letterboxBackgroundColor" /> <java-symbol type="bool" name="config_hideDisplayCutoutWithDisplayArea" /> Loading