Remove the test aconfig lib.

zhidou@ from ACE team is working on AConfigFakelib which will be useful
to set fake flag values in both unit tests and UI automator tests.
Meanwhile, we will mock the flag values for unit tests and UI automator
tests will have all flags values defaulted to false.

testAConfigLib with "test:true" doesn't generate fake flags values and
forces us to set the flag values using "SetFlagsRule". "SetFlagsRule"
doesn't work with Out Of Proc tests and hence doesn't serve the purpose
for us. AConfigFakelib and FakeFlagTargetPreparer should use for Out Of
Proc tests.

testAConfigLib with "test:true" is suitable for java host tests where
there is no device involved. Launcher tests are instrumentation tests and tests run on actual
devices. So we can use the production version of the AConfig lib and device
config flag values will be fetched for UI Automator tests.

Also migrating "enable_twoline_allapps" to trunk stable. Unit tests is
using mockito to mock the flag value as false. The owner of
"enable_twoline_allapps" can mock the value to true in unit tests as
next step.

Bug: 294913042
Test: Local studio build and soong build
Flag: enable_twoline_allapps

Change-Id: Iea42bf18197832a9ecbddc1c3aaa8c9e36169131
diff --git a/Android.bp b/Android.bp
index af0e3be..28eee94 100644
--- a/Android.bp
+++ b/Android.bp
@@ -167,13 +167,14 @@
 //
 // Build rule for Launcher3 dependencies lib.
 //
-java_defaults {
-    name: "Launcher3CommonDepsDefault",
+android_library {
+    name: "Launcher3CommonDepsLib",
     srcs: ["src_build_config/**/*.java"],
     static_libs: [
         "Launcher3ResLib",
         "launcher-testing-shared",
-        "animationlib"
+        "animationlib",
+        "com_android_launcher3_flags_lib",
     ],
     sdk_version: "current",
     min_sdk_version: min_launcher3_sdk_version,
@@ -184,35 +185,13 @@
 }
 
 //
-// Build rule for Launcher3 dependencies lib.
-//
-android_library {
-    name: "Launcher3CommonDepsLib",
-    defaults: ["Launcher3CommonDepsDefault"],
-    static_libs: [
-        "com_android_launcher3_flags_lib",
-    ],
-}
-
-//
-// Build rule for Launcher3 dependencies lib for test and debug.
-//
-android_library {
-    name: "Launcher3CommonDepsLibDebug",
-    defaults: ["Launcher3CommonDepsDefault"],
-    static_libs: [
-        "com_android_launcher3_flags_lib_debug",
-    ],
-}
-
-//
 // Build rule for Launcher3 app.
 //
 android_app {
     name: "Launcher3",
 
     static_libs: [
-        "Launcher3CommonDepsLibDebug",
+        "Launcher3CommonDepsLib",
     ],
     srcs: [
         ":launcher-src",
diff --git a/aconfig/Android.bp b/aconfig/Android.bp
index 9ada485..dc30a35 100644
--- a/aconfig/Android.bp
+++ b/aconfig/Android.bp
@@ -27,9 +27,3 @@
     name: "com_android_launcher3_flags_lib",
     aconfig_declarations: "com_android_launcher3_flags",
 }
-
-java_aconfig_library {
-    name: "com_android_launcher3_flags_lib_debug",
-    aconfig_declarations: "com_android_launcher3_flags",
-    test: true
-}
diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig
index dd39249..aca1b3b 100644
--- a/aconfig/launcher.aconfig
+++ b/aconfig/launcher.aconfig
@@ -6,3 +6,10 @@
     description: "Expand and collapse pause work button while scrolling."
     bug: "270390779"
 }
+
+flag {
+    name: "enable_twoline_allapps"
+    namespace: "launcher"
+    description: "Enables two line label inside all apps."
+    bug: "270390937"
+}
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index abf84dd..347c7af 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -272,7 +272,7 @@
         mDotParams.scale = 0f;
         mForceHideDot = false;
         setBackground(null);
-        if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()
+        if (Flags.enableTwolineAllapps() || FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()
                 || FeatureFlags.ENABLE_TWOLINE_DEVICESEARCH.get()) {
             setMaxLines(1);
         }
@@ -405,7 +405,8 @@
      *  Only if actual text can be displayed in two line, the {@code true} value will be effective.
      */
     protected boolean shouldUseTwoLine() {
-        return  (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() && mDisplay == DISPLAY_ALL_APPS)
+        return ((Flags.enableTwolineAllapps() || FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get())
+                && mDisplay == DISPLAY_ALL_APPS)
                 || (FeatureFlags.ENABLE_TWOLINE_DEVICESEARCH.get()
                 && mDisplay == DISPLAY_SEARCH_RESULT);
     }
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java b/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java
index be0a898..769c787 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsAdapter.java
@@ -27,6 +27,7 @@
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.launcher3.BubbleTextView;
+import com.android.launcher3.Flags;
 import com.android.launcher3.R;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.allapps.search.SearchAdapterProvider;
@@ -176,8 +177,10 @@
     public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
         switch (viewType) {
             case VIEW_TYPE_ICON:
-                int layout = !FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() ? R.layout.all_apps_icon
-                        : R.layout.all_apps_icon_twoline;
+                int layout =
+                        !(Flags.enableTwolineAllapps() || FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get())
+                                ? R.layout.all_apps_icon
+                                : R.layout.all_apps_icon_twoline;
                 BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
                         layout, parent, false);
                 icon.setLongPressTimeoutFactor(1f);
@@ -187,7 +190,7 @@
                 // Ensure the all apps icon height matches the workspace icons in portrait mode.
                 icon.getLayoutParams().height =
                         mActivityContext.getDeviceProfile().allAppsCellHeightPx;
-                if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) {
+                if (Flags.enableTwolineAllapps() || FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) {
                     icon.getLayoutParams().height += mExtraTextHeight;
                 }
                 return new ViewHolder(icon);
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 21520bf..0ace552 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -238,6 +238,7 @@
     public static final BooleanFlag COLLECT_SEARCH_HISTORY = getReleaseFlag(270391455,
             "COLLECT_SEARCH_HISTORY", DISABLED, "Allow launcher to collect search history for log");
 
+    // Aconfig migration complete for ENABLE_TWOLINE_ALLAPPS.
     public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(270390937,
             "ENABLE_TWOLINE_ALLAPPS", DISABLED, "Enables two line label inside all apps.");
 
diff --git a/tests/Android.bp b/tests/Android.bp
index 5effa5c..d40efce 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -88,7 +88,7 @@
         "truth-prebuilt",
         "platform-test-rules",
         "testables",
-        "com_android_launcher3_flags_lib_debug",
+        "com_android_launcher3_flags_lib",
     ],
     manifest: "AndroidManifest-common.xml",
     platform_apis: true,
@@ -107,7 +107,7 @@
     ],
     static_libs: [
         "Launcher3TestLib",
-        "com_android_launcher3_flags_lib_debug",
+        "com_android_launcher3_flags_lib",
     ],
     libs: [
         "android.test.base",
diff --git a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
index ba17fdc..bba8c89 100644
--- a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
+++ b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
@@ -30,16 +30,21 @@
 import android.view.ViewGroup;
 
 import com.android.launcher3.BubbleTextView;
+import com.android.launcher3.Flags;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.model.data.ItemInfoWithIcon;
 import com.android.launcher3.search.StringMatcherUtility;
 import com.android.launcher3.util.ActivityContextWrapper;
 import com.android.launcher3.util.IntArray;
 import com.android.launcher3.util.TestUtil;
+import com.android.launcher3.util.rule.StaticMockitoRule;
 import com.android.launcher3.views.BaseDragLayer;
 
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
 
 /**
  * Unit tests for testing modifyTitleToSupportMultiLine() in BubbleTextView.java
@@ -50,6 +55,7 @@
  */
 public class BubbleTextViewTest {
 
+    @Rule public StaticMockitoRule mockitoRule = new StaticMockitoRule(Flags.class);
     private static final StringMatcherUtility.StringMatcher
             MATCHER = StringMatcherUtility.StringMatcher.getInstance();
     private static final int ONE_LINE = 1;
@@ -77,6 +83,8 @@
 
     @Before
     public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+        Mockito.when(Flags.enableTwolineAllapps()).thenReturn(false);
         Utilities.enableRunningInTestHarnessForTests();
         mContext = new ActivityContextWrapper(getApplicationContext());
         mBubbleTextView = new BubbleTextView(mContext);
diff --git a/tests/src/com/android/launcher3/ui/WorkProfileTest.java b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
index ec62058..5b9adcd 100644
--- a/tests/src/com/android/launcher3/ui/WorkProfileTest.java
+++ b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
@@ -15,7 +15,6 @@
  */
 package com.android.launcher3.ui;
 
-import static com.android.launcher3.Flags.FLAG_ENABLE_EXPANDING_PAUSE_WORK_BUTTON;
 import static com.android.launcher3.LauncherState.ALL_APPS;
 import static com.android.launcher3.LauncherState.NORMAL;
 import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
@@ -27,7 +26,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
-import android.platform.test.flag.junit.SetFlagsRule;
 import android.util.Log;
 import android.view.View;
 
@@ -46,7 +44,6 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
-import org.junit.Rule;
 import org.junit.Test;
 
 import java.util.Objects;
@@ -55,7 +52,6 @@
 public class WorkProfileTest extends AbstractLauncherUiTest {
 
     private static final int WORK_PAGE = ActivityAllAppsContainerView.AdapterHolder.WORK;
-    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
 
     private int mProfileUserId;
     private boolean mWorkProfileSetupSuccessful;
@@ -64,7 +60,6 @@
     @Before
     @Override
     public void setUp() throws Exception {
-        mSetFlagsRule.disableFlags(FLAG_ENABLE_EXPANDING_PAUSE_WORK_BUTTON);
         super.setUp();
         String output =
                 mDevice.executeShellCommand(