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

Commit 18bb4180 authored by John Wu's avatar John Wu
Browse files

[Ravenwood] Cleanup framework policies

Bug: 292141694
Flag: EXEMPT host side change only
Test: f/b/r/scripts/run-ravenwood-tests.sh
Change-Id: I1936438863da1ed24f230d6ad31d02ee95bc04e6
parent 901996d0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5817,6 +5817,7 @@ public abstract class PackageManager {
     * {@link Context#getPackageManager}
     */
    @Deprecated
    @android.ravenwood.annotation.RavenwoodKeep
    public PackageManager() {}

    /**
+3 −1
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@ import java.util.function.Consumer;
 *
 * @hide
 */
@android.ravenwood.annotation.RavenwoodPartiallyAllowlisted
@android.ravenwood.annotation.RavenwoodKeepPartialClass
public final class DisplayManagerGlobal {
    private static final String TAG = "DisplayManager";

@@ -231,7 +233,7 @@ public final class DisplayManagerGlobal {
     * before the display manager has been fully initialized.
     */
    @UnsupportedAppUsage
    // @RavenwoodIgnore(value = "null")
    @android.ravenwood.annotation.RavenwoodIgnore
    public static DisplayManagerGlobal getInstance() {
        synchronized (DisplayManagerGlobal.class) {
            if (sInstance == null) {
+3 −12
Original line number Diff line number Diff line
@@ -1379,7 +1379,7 @@ public final class StrictMode {
     * @hide
     */
    @UnsupportedAppUsage
    @android.ravenwood.annotation.RavenwoodReplace
    @android.ravenwood.annotation.RavenwoodIgnore
    public static @ThreadPolicyMask int getThreadPolicyMask() {
        final BlockGuard.Policy policy = BlockGuard.getThreadPolicy();
        if (policy instanceof AndroidBlockGuardPolicy) {
@@ -1389,12 +1389,6 @@ public final class StrictMode {
        }
    }

    /** @hide */
    public static @ThreadPolicyMask int getThreadPolicyMask$ravenwood() {
        // Ravenwood currently doesn't support any detection modes
        return 0;
    }

    /** Returns the current thread's policy. */
    public static ThreadPolicy getThreadPolicy() {
        // TODO: this was a last minute Gingerbread API change (to
@@ -2690,15 +2684,11 @@ public final class StrictMode {
     * (Java) thread-local policy value.
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @android.ravenwood.annotation.RavenwoodReplace
    @android.ravenwood.annotation.RavenwoodIgnore
    private static void onBinderStrictModePolicyChange(@ThreadPolicyMask int newPolicy) {
        setBlockGuardPolicy(newPolicy);
    }

    private static void onBinderStrictModePolicyChange$ravenwood(@ThreadPolicyMask int newPolicy) {
        /* no-op */
    }

    /**
     * A tracked, critical time span. (e.g. during an animation.)
     *
@@ -2864,6 +2854,7 @@ public final class StrictMode {
     *
     * @param name a short string for the exception stack trace that's built if when this fires.
     */
    @android.ravenwood.annotation.RavenwoodIgnore
    public static void noteSlowCall(String name) {
        BlockGuard.Policy policy = BlockGuard.getThreadPolicy();
        if (!(policy instanceof AndroidBlockGuardPolicy)) {
+10 −0
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ import java.io.InputStream;
 * @attr ref android.R.styleable#BitmapDrawable_mipMap
 * @attr ref android.R.styleable#BitmapDrawable_tileMode
 */
@android.ravenwood.annotation.RavenwoodPartiallyAllowlisted
@android.ravenwood.annotation.RavenwoodKeepPartialClass
public class BitmapDrawable extends Drawable {
    private static final int DEFAULT_PAINT_FLAGS =
            Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG;
@@ -149,6 +151,7 @@ public class BitmapDrawable extends Drawable {
     * Create drawable from a bitmap, setting initial target density based on
     * the display metrics of the resources.
     */
    @android.ravenwood.annotation.RavenwoodKeep
    public BitmapDrawable(Resources res, Bitmap bitmap) {
        if (bitmap == null) {
            Log.w(TAG, "BitmapDrawable created with null Bitmap");
@@ -232,10 +235,12 @@ public class BitmapDrawable extends Drawable {
    /**
     * Returns the bitmap used by this drawable to render. May be null.
     */
    @android.ravenwood.annotation.RavenwoodKeep
    public final Bitmap getBitmap() {
        return mBitmapState.mBitmap;
    }

    @android.ravenwood.annotation.RavenwoodKeep
    private void computeBitmapSize() {
        final Bitmap bitmap = mBitmapState.mBitmap;
        if (bitmap != null) {
@@ -956,11 +961,13 @@ public class BitmapDrawable extends Drawable {
    }

    @Override
    @android.ravenwood.annotation.RavenwoodKeep
    public int getIntrinsicWidth() {
        return mBitmapWidth;
    }

    @Override
    @android.ravenwood.annotation.RavenwoodKeep
    public int getIntrinsicHeight() {
        return mBitmapHeight;
    }
@@ -982,6 +989,7 @@ public class BitmapDrawable extends Drawable {
        return mBitmapState;
    }

    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    final static class BitmapState extends ConstantState {
        final Paint mPaint;

@@ -1060,6 +1068,7 @@ public class BitmapDrawable extends Drawable {
     * The one helper to rule them all. This is called by all public & private
     * constructors to set the state and initialize local properties.
     */
    @android.ravenwood.annotation.RavenwoodKeep
    private void init(BitmapState state, Resources res) {
        mBitmapState = state;
        updateLocalState(res);
@@ -1074,6 +1083,7 @@ public class BitmapDrawable extends Drawable {
     * after significant state changes, e.g. from the One True Constructor and
     * after inflating or applying a theme.
     */
    @android.ravenwood.annotation.RavenwoodKeep
    private void updateLocalState(Resources res) {
        mTargetDensity = resolveDensity(res, mBitmapState.mTargetDensity);
        mBlendModeFilter = updateBlendModeFilter(mBlendModeFilter, mBitmapState.mTint,
+5 −1
Original line number Diff line number Diff line
@@ -180,6 +180,8 @@ import java.util.Arrays;
 * <a href="{@docRoot}guide/topics/resources/drawable-resource.html">Drawable Resources</a>
 * document.</p></div>
 */
@android.ravenwood.annotation.RavenwoodPartiallyAllowlisted
@android.ravenwood.annotation.RavenwoodKeepPartialClass
public abstract class Drawable {
    private static final Rect ZERO_BOUNDS_RECT = new Rect();

@@ -1482,6 +1484,7 @@ public abstract class Drawable {
     * {@link Drawable#mutate()} on a Drawable should typically create a new ConstantState for that
     * Drawable.
     */
    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public static abstract class ConstantState {
        /**
         * Creates a new Drawable instance from its constant state.
@@ -1587,6 +1590,7 @@ public abstract class Drawable {
        return tintFilter;
    }

    @android.ravenwood.annotation.RavenwoodIgnore
    @Nullable BlendModeColorFilter updateBlendModeFilter(@Nullable BlendModeColorFilter blendFilter,
            @Nullable ColorStateList tint, @Nullable BlendMode blendMode) {
        if (tint == null || blendMode == null) {
@@ -1666,6 +1670,7 @@ public abstract class Drawable {
        }
    }

    @android.ravenwood.annotation.RavenwoodKeep
    static int resolveDensity(@Nullable Resources r, int parentDensity) {
        final int densityDpi = r == null ? parentDensity : r.getDisplayMetrics().densityDpi;
        return densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi;
@@ -1725,4 +1730,3 @@ public abstract class Drawable {
        }
    }
}
Loading