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

Commit 30c7e77f authored by zhibinliu's avatar zhibinliu Committed by Zhibin Liu
Browse files

Replace @hide API obtainAttributes with public API

Then Settings Search can access such drawables as settings icon, this includes all new expressive icons for top level settings

Bug: b/403977745
Flag: EXEMPT trivial refactor
Test: manual
Change-Id: Idf9bbc8618846ca60760e79473cef43a5ac624f8
parent 2b72e413
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class TintDrawable extends DrawableWrapper {
    public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser,
            @NonNull AttributeSet attrs, @Nullable Theme theme)
            throws XmlPullParserException, IOException {
        final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.TintDrawable);
        final TypedArray a = obtainAttributes(r, theme, attrs);

        super.inflate(r, parser, attrs, theme);

@@ -99,4 +99,14 @@ public class TintDrawable extends DrawableWrapper {
            getDrawable().mutate().setTintList(mTint);
        }
    }

    private static @NonNull TypedArray obtainAttributes(@NonNull Resources res,
            @Nullable Theme theme, @NonNull AttributeSet set) {
        // Don't depend on Drawable.obtainAttributes, which is @hide, thus cannot be accessed by
        // Settings search
        if (theme == null) {
            return res.obtainAttributes(set, R.styleable.TintDrawable);
        }
        return theme.obtainStyledAttributes(set, R.styleable.TintDrawable, 0, 0);
    }
}