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

Commit 9fe90f36 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Revert "Add warning message if developer depends on undocumented behavior"

This reverts commit a5ce5c14.

The warning message is no longer necessary since the existing behavior
is preserved.

Bug: 361260253
Test: N/A
Flag: com.android.text.flags.typeface_redesign_readonly
Change-Id: I0594d661a021b72ec398cb888a96ba4d1fbf74d7
parent 60971666
Loading
Loading
Loading
Loading
+2 −15
Original line number Diff line number Diff line
@@ -1589,18 +1589,6 @@ public class Paint {
     * @return         typeface
     */
    public Typeface setTypeface(Typeface typeface) {
        if (Flags.typefaceRedesignReadonly() && typeface != null
                && typeface.isVariationInstance()) {
            Log.w(TAG, "Attempting to set a Typeface on a Paint object that was previously "
                    + "configured with setFontVariationSettings(). This is no longer supported as "
                    + "of Target SDK " + Build.VERSION_CODES.BAKLAVA + ". To apply font"
                    + " variations, call setFontVariationSettings() directly on the Paint object"
                    + " instead.");
        }
        return setTypefaceWithoutWarning(typeface);
    }

    private Typeface setTypefaceWithoutWarning(Typeface typeface) {
        final long typefaceNative = typeface == null ? 0 : typeface.native_instance;
        nSetTypeface(mNativePaint, typefaceNative);
        mTypeface = typeface;
@@ -2159,7 +2147,7 @@ public class Paint {

        if (settings == null || settings.length() == 0) {
            mFontVariationSettings = null;
            setTypefaceWithoutWarning(Typeface.createFromTypefaceWithVariation(mTypeface,
            setTypeface(Typeface.createFromTypefaceWithVariation(mTypeface,
                      Collections.emptyList()));
            return true;
        }
@@ -2178,8 +2166,7 @@ public class Paint {
            return false;
        }
        mFontVariationSettings = settings;
        setTypefaceWithoutWarning(
                Typeface.createFromTypefaceWithVariation(targetTypeface, filteredAxes));
        setTypeface(Typeface.createFromTypefaceWithVariation(targetTypeface, filteredAxes));
        return true;
    }

+0 −11
Original line number Diff line number Diff line
@@ -242,8 +242,6 @@ public class Typeface {

    private @IntRange(from = 0, to = FontStyle.FONT_WEIGHT_MAX) final int mWeight;

    private boolean mIsVariationInstance;

    // Value for weight and italic. Indicates the value is resolved by font metadata.
    // Must be the same as the C++ constant in core/jni/android/graphics/FontFamily.cpp
    /** @hide */
@@ -286,11 +284,6 @@ public class Typeface {
        return mWeight;
    }

    /** @hide */
    public boolean isVariationInstance() {
        return mIsVariationInstance;
    }

    /** Returns the typeface's intrinsic style attributes */
    public @Style int getStyle() {
        return mStyle;
@@ -1292,7 +1285,6 @@ public class Typeface {
        mCleaner = NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, native_instance);
        mStyle = nativeGetStyle(ni);
        mWeight = nativeGetWeight(ni);
        mIsVariationInstance = nativeIsVariationInstance(ni);
        mSystemFontFamilyName = systemFontFamilyName;
        mDerivedFrom = derivedFrom;
    }
@@ -1746,9 +1738,6 @@ public class Typeface {
    @CriticalNative
    private static native int  nativeGetWeight(long nativePtr);

    @CriticalNative
    private static native boolean nativeIsVariationInstance(long nativePtr);

    @CriticalNative
    private static native long nativeGetReleaseFunc();

+0 −6
Original line number Diff line number Diff line
@@ -107,11 +107,6 @@ static jint Typeface_getWeight(CRITICAL_JNI_PARAMS_COMMA jlong faceHandle) {
    return toTypeface(faceHandle)->getFontStyle().weight();
}

// Critical Native
static jboolean Typeface_isVariationInstance(CRITICAL_JNI_PARAMS_COMMA jlong faceHandle) {
    return toTypeface(faceHandle)->isVariationInstance();
}

static jlong Typeface_createFromArray(JNIEnv *env, jobject, jlongArray familyArray,
                                      jlong fallbackPtr, int weight, int italic) {
    ScopedLongArrayRO families(env, familyArray);
@@ -404,7 +399,6 @@ static const JNINativeMethod gTypefaceMethods[] = {
        {"nativeGetReleaseFunc", "()J", (void*)Typeface_getReleaseFunc},
        {"nativeGetStyle", "(J)I", (void*)Typeface_getStyle},
        {"nativeGetWeight", "(J)I", (void*)Typeface_getWeight},
        {"nativeIsVariationInstance", "(J)Z", (void*)Typeface_isVariationInstance},
        {"nativeCreateFromArray", "([JJII)J", (void*)Typeface_createFromArray},
        {"nativeSetDefault", "(J)V", (void*)Typeface_setDefault},
        {"nativeGetSupportedAxes", "(J)[I", (void*)Typeface_getSupportedAxes},