Skip to content

Commit 18632fa

Browse files
Abbondanzofacebook-github-bot
authored andcommitted
Roll out enableAndroidLinearText entirely
Summary: The `enableAndroidLinearText` flag enables `Paint.LINEAR_TEXT_FLAG` wherever `SUBPIXEL_TEXT_FLAG` is already set. The flag defaults to `true` and has been fully rolled out internally, so this removes the flag and makes the behavior unconditional. Two call sites: - `CustomStyleSpan.kt`: always sets `isLinearText = true` alongside `isSubpixelText = true` - `ReactEditText.kt`: always toggles `LINEAR_TEXT_FLAG` in sync with `SUBPIXEL_TEXT_FLAG` The flag definition is removed from `ReactNativeFeatureFlags.config.js` and all generated accessor files are regenerated. Changelog: [Internal] Differential Revision: D100213385
1 parent 5f861ce commit 18632fa

22 files changed

+104
-226
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<eacf6769e8598f88fe1790149e437f3f>>
7+
* @generated SignedSource<<99a7d3e814f4b037ed4496b6eee4f264>>
88
*/
99

1010
/**
@@ -102,12 +102,6 @@ public object ReactNativeFeatureFlags {
102102
@JvmStatic
103103
public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = accessor.enableAccumulatedUpdatesInRawPropsAndroid()
104104

105-
/**
106-
* Enables linear text rendering on Android wherever subpixel text rendering is enabled
107-
*/
108-
@JvmStatic
109-
public fun enableAndroidLinearText(): Boolean = accessor.enableAndroidLinearText()
110-
111105
/**
112106
* Enables various optimizations throughout the path of measuring text on Android.
113107
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<668885665a149d50bdff92bd96a297f0>>
7+
* @generated SignedSource<<c2f867597d97dc97c8ded5fbd258c13c>>
88
*/
99

1010
/**
@@ -32,7 +32,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
3232
private var disableViewPreallocationAndroidCache: Boolean? = null
3333
private var enableAccessibilityOrderCache: Boolean? = null
3434
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
35-
private var enableAndroidLinearTextCache: Boolean? = null
3635
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
3736
private var enableBridgelessArchitectureCache: Boolean? = null
3837
private var enableCppPropsIteratorSetterCache: Boolean? = null
@@ -219,15 +218,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
219218
return cached
220219
}
221220

222-
override fun enableAndroidLinearText(): Boolean {
223-
var cached = enableAndroidLinearTextCache
224-
if (cached == null) {
225-
cached = ReactNativeFeatureFlagsCxxInterop.enableAndroidLinearText()
226-
enableAndroidLinearTextCache = cached
227-
}
228-
return cached
229-
}
230-
231221
override fun enableAndroidTextMeasurementOptimizations(): Boolean {
232222
var cached = enableAndroidTextMeasurementOptimizationsCache
233223
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<aa4a2ab7af66d857da4318ac2e75899b>>
7+
* @generated SignedSource<<8667d7237cea82bb5978cb19582d59c0>>
88
*/
99

1010
/**
@@ -52,8 +52,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
5252

5353
@DoNotStrip @JvmStatic public external fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
5454

55-
@DoNotStrip @JvmStatic public external fun enableAndroidLinearText(): Boolean
56-
5755
@DoNotStrip @JvmStatic public external fun enableAndroidTextMeasurementOptimizations(): Boolean
5856

5957
@DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<6348c0cc9285f2bac6df9986155b584f>>
7+
* @generated SignedSource<<17abc72a4045c5695818f254be1783b5>>
88
*/
99

1010
/**
@@ -47,8 +47,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
4747

4848
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = false
4949

50-
override fun enableAndroidLinearText(): Boolean = true
51-
5250
override fun enableAndroidTextMeasurementOptimizations(): Boolean = false
5351

5452
override fun enableBridgelessArchitecture(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<f545945b19339923fcafab4eeb1da134>>
7+
* @generated SignedSource<<77ba6c5db120016e6e1f8af195ab3690>>
88
*/
99

1010
/**
@@ -36,7 +36,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
3636
private var disableViewPreallocationAndroidCache: Boolean? = null
3737
private var enableAccessibilityOrderCache: Boolean? = null
3838
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
39-
private var enableAndroidLinearTextCache: Boolean? = null
4039
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
4140
private var enableBridgelessArchitectureCache: Boolean? = null
4241
private var enableCppPropsIteratorSetterCache: Boolean? = null
@@ -235,16 +234,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
235234
return cached
236235
}
237236

238-
override fun enableAndroidLinearText(): Boolean {
239-
var cached = enableAndroidLinearTextCache
240-
if (cached == null) {
241-
cached = currentProvider.enableAndroidLinearText()
242-
accessedFeatureFlags.add("enableAndroidLinearText")
243-
enableAndroidLinearTextCache = cached
244-
}
245-
return cached
246-
}
247-
248237
override fun enableAndroidTextMeasurementOptimizations(): Boolean {
249238
var cached = enableAndroidTextMeasurementOptimizationsCache
250239
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<e340fe9805381dcf818f51e333f7c120>>
7+
* @generated SignedSource<<8496c138ce5493df84149940df0de944>>
88
*/
99

1010
/**
@@ -47,8 +47,6 @@ public interface ReactNativeFeatureFlagsProvider {
4747

4848
@DoNotStrip public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
4949

50-
@DoNotStrip public fun enableAndroidLinearText(): Boolean
51-
5250
@DoNotStrip public fun enableAndroidTextMeasurementOptimizations(): Boolean
5351

5452
@DoNotStrip public fun enableBridgelessArchitecture(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import android.text.TextPaint
1414
import android.text.style.MetricAffectingSpan
1515
import com.facebook.react.common.ReactConstants
1616
import com.facebook.react.common.assets.ReactFontManager
17-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
1817
import com.facebook.react.views.text.ReactTypefaceUtils
1918

2019
/**
@@ -74,9 +73,7 @@ internal class CustomStyleSpan(
7473
fontFeatureSettings = fontFeatureSettingsParam
7574
setTypeface(typeface)
7675
isSubpixelText = true
77-
if (ReactNativeFeatureFlags.enableAndroidLinearText()) {
78-
isLinearText = true
79-
}
76+
isLinearText = true
8077
}
8178
}
8279
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,12 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
621621
paintFlags and Paint.SUBPIXEL_TEXT_FLAG.inv()
622622
}
623623

624-
if (ReactNativeFeatureFlags.enableAndroidLinearText()) {
625-
paintFlags =
626-
if (enableSubpixelText) {
627-
paintFlags or Paint.LINEAR_TEXT_FLAG
628-
} else {
629-
paintFlags and Paint.LINEAR_TEXT_FLAG.inv()
630-
}
631-
}
624+
paintFlags =
625+
if (enableSubpixelText) {
626+
paintFlags or Paint.LINEAR_TEXT_FLAG
627+
} else {
628+
paintFlags and Paint.LINEAR_TEXT_FLAG.inv()
629+
}
632630
}
633631

634632
public fun requestFocusFromJS() {

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<367bb35175543888c27d2e26a049289c>>
7+
* @generated SignedSource<<5bac13bb6faeffdd3c5eca800f25b96a>>
88
*/
99

1010
/**
@@ -111,12 +111,6 @@ class ReactNativeFeatureFlagsJavaProvider
111111
return method(javaProvider_);
112112
}
113113

114-
bool enableAndroidLinearText() override {
115-
static const auto method =
116-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAndroidLinearText");
117-
return method(javaProvider_);
118-
}
119-
120114
bool enableAndroidTextMeasurementOptimizations() override {
121115
static const auto method =
122116
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAndroidTextMeasurementOptimizations");
@@ -643,11 +637,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndro
643637
return ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid();
644638
}
645639

646-
bool JReactNativeFeatureFlagsCxxInterop::enableAndroidLinearText(
647-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
648-
return ReactNativeFeatureFlags::enableAndroidLinearText();
649-
}
650-
651640
bool JReactNativeFeatureFlagsCxxInterop::enableAndroidTextMeasurementOptimizations(
652641
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
653642
return ReactNativeFeatureFlags::enableAndroidTextMeasurementOptimizations();
@@ -1100,9 +1089,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11001089
makeNativeMethod(
11011090
"enableAccumulatedUpdatesInRawPropsAndroid",
11021091
JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndroid),
1103-
makeNativeMethod(
1104-
"enableAndroidLinearText",
1105-
JReactNativeFeatureFlagsCxxInterop::enableAndroidLinearText),
11061092
makeNativeMethod(
11071093
"enableAndroidTextMeasurementOptimizations",
11081094
JReactNativeFeatureFlagsCxxInterop::enableAndroidTextMeasurementOptimizations),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<e3364d03414c159bf8ad8afbd4d3fafe>>
7+
* @generated SignedSource<<ad45dce1fafd3bd29078bd54e4206d9f>>
88
*/
99

1010
/**
@@ -66,9 +66,6 @@ class JReactNativeFeatureFlagsCxxInterop
6666
static bool enableAccumulatedUpdatesInRawPropsAndroid(
6767
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
6868

69-
static bool enableAndroidLinearText(
70-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
71-
7269
static bool enableAndroidTextMeasurementOptimizations(
7370
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
7471

0 commit comments

Comments
 (0)