mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
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
This commit is contained in:
31
Android.bp
31
Android.bp
@@ -167,13 +167,14 @@ android_library {
|
||||
//
|
||||
// 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,
|
||||
@@ -183,28 +184,6 @@ java_defaults {
|
||||
},
|
||||
}
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
@@ -212,7 +191,7 @@ android_app {
|
||||
name: "Launcher3",
|
||||
|
||||
static_libs: [
|
||||
"Launcher3CommonDepsLibDebug",
|
||||
"Launcher3CommonDepsLib",
|
||||
],
|
||||
srcs: [
|
||||
":launcher-src",
|
||||
|
||||
@@ -27,9 +27,3 @@ java_aconfig_library {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -6,3 +6,10 @@ flag {
|
||||
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"
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
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 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
* 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);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.widget.TextView;
|
||||
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 abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
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 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
// 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);
|
||||
|
||||
@@ -238,6 +238,7 @@ public final class FeatureFlags {
|
||||
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.");
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ android_library {
|
||||
"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 @@ android_test {
|
||||
],
|
||||
static_libs: [
|
||||
"Launcher3TestLib",
|
||||
"com_android_launcher3_flags_lib_debug",
|
||||
"com_android_launcher3_flags_lib",
|
||||
],
|
||||
libs: [
|
||||
"android.test.base",
|
||||
|
||||
@@ -30,16 +30,21 @@ import android.graphics.Typeface;
|
||||
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 @@ import org.junit.Test;
|
||||
*/
|
||||
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 @@ public class BubbleTextViewTest {
|
||||
|
||||
@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);
|
||||
|
||||
@@ -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.assertEquals;
|
||||
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 com.android.launcher3.util.rule.TestStabilityRule.Stability;
|
||||
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 @@ import java.util.function.Predicate;
|
||||
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 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
|
||||
@Before
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
mSetFlagsRule.disableFlags(FLAG_ENABLE_EXPANDING_PAUSE_WORK_BUTTON);
|
||||
super.setUp();
|
||||
String output =
|
||||
mDevice.executeShellCommand(
|
||||
|
||||
Reference in New Issue
Block a user