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

Commit 8cc21aae authored by John Wu's avatar John Wu Committed by Android (Google) Code Review
Browse files

Merge "[Ravenwood] Enable Drawable support" into main

parents 816c6637 203bc201
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1078,6 +1078,7 @@ public abstract class Context {
     *         does not exist.
     */
    @Nullable
    @RavenwoodKeep
    public final Drawable getDrawable(@DrawableRes int id) {
        return getResources().getDrawable(id, getTheme());
    }
@@ -1094,6 +1095,7 @@ public abstract class Context {
     *         does not exist.
     */
    @NonNull
    @RavenwoodKeep
    public final ColorStateList getColorStateList(@ColorRes int id) {
        return getResources().getColorStateList(id, getTheme());
    }
+2 −4
Original line number Diff line number Diff line
@@ -19,17 +19,15 @@ package android.content.res;
import android.compat.annotation.UnsupportedAppUsage;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.ravenwood.annotation.RavenwoodKeep;
import android.ravenwood.annotation.RavenwoodKeepPartialClass;
import android.ravenwood.annotation.RavenwoodKeepWholeClass;

/**
 * Class which can be used to cache Drawable resources against a theme.
 */
@RavenwoodKeepPartialClass
@RavenwoodKeepWholeClass
class DrawableCache extends ThemedResourceCache<Drawable.ConstantState> {

    @UnsupportedAppUsage
    @RavenwoodKeep
    DrawableCache() {
    }

+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import java.util.Arrays;
 * be ignored.
 * @hide
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class GradientColor extends ComplexColor {
    private static final String TAG = "GradientColor";

+0 −6
Original line number Diff line number Diff line
@@ -431,7 +431,6 @@ public class Resources {
     * @hide Pending API finalization.
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @RavenwoodThrow(blockedBy = DrawableInflater.class)
    public final DrawableInflater getDrawableInflater() {
        if (mDrawableInflater == null) {
            mDrawableInflater = new DrawableInflater(this, mClassLoader);
@@ -930,7 +929,6 @@ public class Resources {
     * @deprecated Use {@link #getDrawable(int, Theme)} instead.
     */
    @Deprecated
    @RavenwoodThrow(blockedBy = Drawable.class)
    public Drawable getDrawable(@DrawableRes int id) throws NotFoundException {
        final Drawable d = getDrawable(id, null);
        if (d != null && d.canApplyTheme()) {
@@ -955,7 +953,6 @@ public class Resources {
     * @throws NotFoundException Throws NotFoundException if the given ID does
     *         not exist.
     */
    @RavenwoodThrow(blockedBy = Drawable.class)
    public Drawable getDrawable(@DrawableRes int id, @Nullable Theme theme)
            throws NotFoundException {
        return getDrawableForDensity(id, 0, theme);
@@ -991,7 +988,6 @@ public class Resources {
     */
    @Nullable
    @Deprecated
    @RavenwoodThrow(blockedBy = Drawable.class)
    public Drawable getDrawableForDensity(@DrawableRes int id, int density)
            throws NotFoundException {
        return getDrawableForDensity(id, density, null);
@@ -1015,7 +1011,6 @@ public class Resources {
     *             not exist.
     */
    @Nullable
    @RavenwoodThrow(blockedBy = Drawable.class)
    public Drawable getDrawableForDensity(@DrawableRes int id, int density, @Nullable Theme theme) {
        final TypedValue value = obtainTempTypedValue();
        try {
@@ -1803,7 +1798,6 @@ public class Resources {
         * @throws NotFoundException Throws NotFoundException if the given ID
         *         does not exist.
         */
        @RavenwoodThrow(blockedBy = Drawable.class)
        public Drawable getDrawable(@DrawableRes int id) throws NotFoundException {
            return Resources.this.getDrawable(id, this);
        }
+0 −2
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import android.os.LocaleList;
import android.os.ParcelFileDescriptor;
import android.os.Trace;
import android.ravenwood.annotation.RavenwoodKeepWholeClass;
import android.ravenwood.annotation.RavenwoodThrow;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -782,7 +781,6 @@ public class ResourcesImpl {
    }

    @Nullable
    @RavenwoodThrow(blockedBy = Drawable.class)
    Drawable loadDrawable(@NonNull Resources wrapper, @NonNull TypedValue value, int id,
            int density, @Nullable Resources.Theme theme)
            throws NotFoundException {
Loading