Skip to content

Commit 00bd00f

Browse files
Brandon DayauonAndroid Build Coastguard Worker
Brandon Dayauon
authored and
Android Build Coastguard Worker
committed
Disable two line text legacy flag.
Will now repurpose the twolinetoggle flag to be the flag that will make twoline text enabled/disabled. bug: 316027081 Test: presubmit manually: https://screenshot.googleplex.com/BsZGCm7DrTZLwG4 Flag: com.android.launcher3.enable_twoline_toggle Staging (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:68c18236adb5d49d5ba3c5a19187759af63a53b4) Merged-In: Idef427bad6551ae56b13e35393e076b8e000af5a Change-Id: Idef427bad6551ae56b13e35393e076b8e000af5a
1 parent a72f546 commit 00bd00f

File tree

7 files changed

+173
-223
lines changed

7 files changed

+173
-223
lines changed

quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ public int getExpectedHeight() {
138138
int totalHeight = iconHeight + iconPadding + textHeight + mVerticalPadding * 2;
139139
// Prediction row height will be 4dp bigger than the regular apps in A-Z list when two line
140140
// is not enabled. Otherwise, the extra height will increase by just the textHeight.
141-
int extraHeight = (FeatureFlags.enableTwolineAllapps() && (!Flags.enableTwolineToggle()
142-
|| (Flags.enableTwolineToggle() && LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(
143-
getContext())))) ? textHeight : mTopRowExtraHeight;
141+
int extraHeight = (Flags.enableTwolineToggle() &&
142+
LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(getContext()))
143+
? textHeight : mTopRowExtraHeight;
144144
totalHeight += extraHeight;
145145
return getVisibility() == GONE ? 0 : totalHeight + getPaddingTop() + getPaddingBottom();
146146
}

src/com/android/launcher3/BubbleTextView.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,6 @@ public void reset() {
285285
mDotParams.scale = 0f;
286286
mForceHideDot = false;
287287
setBackground(null);
288-
if (FeatureFlags.enableTwolineAllapps() || FeatureFlags.ENABLE_TWOLINE_DEVICESEARCH.get()) {
289-
setMaxLines(1);
290-
}
291288

292289
setTag(null);
293290
if (mIconLoadRequest != null) {
@@ -299,6 +296,7 @@ public void reset() {
299296
setAlpha(1);
300297
setScaleY(1);
301298
setTranslationY(0);
299+
setMaxLines(1);
302300
setVisibility(VISIBLE);
303301
}
304302

@@ -428,10 +426,9 @@ protected boolean shouldUseTheme() {
428426
* Only if actual text can be displayed in two line, the {@code true} value will be effective.
429427
*/
430428
protected boolean shouldUseTwoLine() {
431-
return FeatureFlags.enableTwolineAllapps() && isCurrentLanguageEnglish()
432-
&& (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW)
433-
&& (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle()
434-
&& LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(getContext())));
429+
return isCurrentLanguageEnglish() && (mDisplay == DISPLAY_ALL_APPS
430+
|| mDisplay == DISPLAY_PREDICTION_ROW) && (Flags.enableTwolineToggle()
431+
&& LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(getContext()));
435432
}
436433

437434
protected boolean isCurrentLanguageEnglish() {

src/com/android/launcher3/DeviceProfile.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1233,9 +1233,8 @@ public void updateIconSize(float scale, Context context) {
12331233
if (isVerticalLayout && !mIsResponsiveGrid) {
12341234
hideWorkspaceLabelsIfNotEnoughSpace();
12351235
}
1236-
if (FeatureFlags.enableTwolineAllapps()
1237-
&& (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle()
1238-
&& LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(context)))) {
1236+
if ((Flags.enableTwolineToggle()
1237+
&& LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(context))) {
12391238
// Add extra textHeight to the existing allAppsCellHeight.
12401239
allAppsCellHeightPx += Utilities.calculateTextHeight(allAppsIconTextSizePx);
12411240
}

src/com/android/launcher3/allapps/BaseAllAppsAdapter.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,9 @@ public void setIconFocusListener(OnFocusChangeListener focusListener) {
223223
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
224224
switch (viewType) {
225225
case VIEW_TYPE_ICON:
226-
int layout = (FeatureFlags.enableTwolineAllapps() &&
227-
(!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle()
228-
&& LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(
229-
mActivityContext.getApplicationContext()))))
226+
int layout = (Flags.enableTwolineToggle()
227+
&& LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(
228+
mActivityContext.getApplicationContext()))
230229
? R.layout.all_apps_icon_twoline : R.layout.all_apps_icon;
231230
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
232231
layout, parent, false);

src/com/android/launcher3/config/FeatureFlags.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private FeatureFlags() { }
158158

159159
// TODO(Block 5): Clean up flags
160160
public static final BooleanFlag ENABLE_TWOLINE_DEVICESEARCH = getDebugFlag(201388851,
161-
"ENABLE_TWOLINE_DEVICESEARCH", ENABLED,
161+
"ENABLE_TWOLINE_DEVICESEARCH", DISABLED,
162162
"Enable two line label for icons with labels on device search.");
163163

164164
public static final BooleanFlag ENABLE_ICON_IN_TEXT_HEADER = getDebugFlag(270395143,
@@ -274,10 +274,7 @@ public static boolean enableTaskbarNoRecreate() {
274274

275275
// Aconfig migration complete for ENABLE_TWOLINE_ALLAPPS.
276276
public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(270390937,
277-
"ENABLE_TWOLINE_ALLAPPS", ENABLED, "Enables two line label inside all apps.");
278-
public static boolean enableTwolineAllapps() {
279-
return ENABLE_TWOLINE_ALLAPPS.get() || Flags.enableTwolineAllapps();
280-
}
277+
"ENABLE_TWOLINE_ALLAPPS", DISABLED, "Enables two line label inside all apps.");
281278

282279
public static final BooleanFlag IME_STICKY_SNACKBAR_EDU = getDebugFlag(270391693,
283280
"IME_STICKY_SNACKBAR_EDU", ENABLED, "Show sticky IME edu in AllApps");

tests/src/com/android/launcher3/AbstractDeviceProfileTest.kt

+7-6
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ import com.android.launcher3.util.rule.setFlags
3838
import com.android.launcher3.util.window.CachedDisplayInfo
3939
import com.android.launcher3.util.window.WindowManagerProxy
4040
import com.google.common.truth.Truth
41+
import org.junit.Rule
42+
import org.mockito.kotlin.any
43+
import org.mockito.kotlin.mock
44+
import org.mockito.kotlin.spy
45+
import org.mockito.kotlin.whenever
4146
import java.io.BufferedReader
4247
import java.io.File
4348
import java.io.PrintWriter
4449
import java.io.StringWriter
4550
import kotlin.math.max
4651
import kotlin.math.min
47-
import org.junit.Rule
48-
import org.mockito.kotlin.any
49-
import org.mockito.kotlin.mock
50-
import org.mockito.kotlin.spy
51-
import org.mockito.kotlin.whenever
5252

5353
/**
5454
* This is an abstract class for DeviceProfile tests that create an InvariantDeviceProfile based on
@@ -274,7 +274,8 @@ abstract class AbstractDeviceProfileTest {
274274
isGestureMode: Boolean = true,
275275
densityDpi: Int
276276
) {
277-
setFlagsRule.setFlags(false, Flags.FLAG_ENABLE_TWOLINE_TOGGLE)
277+
setFlagsRule.setFlags(true, Flags.FLAG_ENABLE_TWOLINE_TOGGLE)
278+
LauncherPrefs.get(testContext).put(LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE, true)
278279
val windowsBounds = perDisplayBoundsCache[displayInfo]!!
279280
val realBounds = windowsBounds[rotation]
280281
whenever(windowManagerProxy.getDisplayInfo(any())).thenReturn(displayInfo)

0 commit comments

Comments
 (0)