Add Launcher aconfig.
Use `enable_expanding_pause_work_button` as an example.
See go/trunk-stable-launcher for implementation details
Bug: 294913042
Test: adb shell device_config put launcher com.google.android.platform.launcher.aconfig.flags.enable_expanding_pause_work_button true
Flag: enable_expanding_pause_work_button
Change-Id: I732722c8b219c023adf5bf31f132ce9da72fc4d5
diff --git a/Android.bp b/Android.bp
index b68e1e5..4dddbf6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -136,6 +136,24 @@
min_sdk_version: min_launcher3_sdk_version,
}
+aconfig_declarations {
+ name: "launcher_flags",
+ package: "com.google.android.platform.launcher.aconfig.flags",
+ srcs: ["launcher.aconfig"],
+}
+
+java_aconfig_library {
+ name: "launcher_flags_lib",
+ aconfig_declarations: "launcher_flags",
+}
+
+java_aconfig_library {
+ name: "launcher_flags_lib_test",
+ aconfig_declarations: "launcher_flags",
+ test: true
+}
+
+
// Library with all the dependencies for building Launcher3
android_library {
name: "Launcher3ResLib",
@@ -167,8 +185,8 @@
//
// Build rule for Launcher3 dependencies lib.
//
-android_library {
- name: "Launcher3CommonDepsLib",
+java_defaults {
+ name: "Launcher3CommonDepsDefault",
srcs: ["src_build_config/**/*.java"],
static_libs: [
"Launcher3ResLib",
@@ -184,13 +202,35 @@
}
//
+// Build rule for Launcher3 dependencies lib.
+//
+android_library {
+ name: "Launcher3CommonDepsLib",
+ defaults: ["Launcher3CommonDepsDefault"],
+ static_libs: [
+ "launcher_flags_lib",
+ ],
+}
+
+//
+// Build rule for Launcher3 dependencies lib for test and debug.
+//
+android_library {
+ name: "Launcher3CommonDepsLibDebug",
+ defaults: ["Launcher3CommonDepsDefault"],
+ static_libs: [
+ "launcher_flags_lib_test",
+ ],
+}
+
+//
// Build rule for Launcher3 app.
//
android_app {
name: "Launcher3",
static_libs: [
- "Launcher3CommonDepsLib",
+ "Launcher3CommonDepsLibDebug",
],
srcs: [
":launcher-src",
diff --git a/launcher.aconfig b/launcher.aconfig
new file mode 100644
index 0000000..cab193c
--- /dev/null
+++ b/launcher.aconfig
@@ -0,0 +1,8 @@
+package: "com.google.android.platform.launcher.aconfig.flags"
+
+flag {
+ name: "enable_expanding_pause_work_button"
+ namespace: "launcher"
+ description: "Expand and collapse pause work button while scrolling."
+ bug: "270390779"
+}
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index 40382b2..542266a 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -26,6 +26,8 @@
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.ScrollableLayoutManager.PREDICTIVE_BACK_MIN_SCALE;
+import static com.google.android.platform.launcher.aconfig.flags.Flags.enableExpandingPauseWorkButton;
+
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
@@ -561,7 +563,8 @@
mAH.get(AdapterHolder.MAIN).setup(mainRecyclerView, mPersonalMatcher);
mAH.get(AdapterHolder.WORK).setup(workRecyclerView, mWorkManager.getMatcher());
workRecyclerView.setId(R.id.apps_list_view_work);
- if (FeatureFlags.ENABLE_EXPANDING_PAUSE_WORK_BUTTON.get()) {
+ if (enableExpandingPauseWorkButton()
+ || FeatureFlags.ENABLE_EXPANDING_PAUSE_WORK_BUTTON.get()) {
mAH.get(AdapterHolder.WORK).mRecyclerView.addOnScrollListener(
mWorkManager.newScrollListener());
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 38aa387..2df20df 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -230,6 +230,7 @@
public static final BooleanFlag ENABLE_HIDE_HEADER = getReleaseFlag(270390930,
"ENABLE_HIDE_HEADER", ENABLED, "Hide header on keyboard before typing in all apps");
+ // Aconfig migration complete for ENABLE_EXPANDING_PAUSE_WORK_BUTTON.
public static final BooleanFlag ENABLE_EXPANDING_PAUSE_WORK_BUTTON = getDebugFlag(270390779,
"ENABLE_EXPANDING_PAUSE_WORK_BUTTON", DISABLED,
"Expand and collapse pause work button while scrolling");
diff --git a/tests/Android.bp b/tests/Android.bp
index 5a52440..96ffa76 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -73,6 +73,7 @@
asset_dirs: ["assets"],
resource_dirs: ["res"],
static_libs: [
+ "flag-junit-base",
"launcher-aosp-tapl",
"androidx.test.core",
"androidx.test.runner",
@@ -87,6 +88,7 @@
"truth-prebuilt",
"platform-test-rules",
"testables",
+ "launcher_flags_lib_test",
],
manifest: "AndroidManifest-common.xml",
platform_apis: true,
@@ -103,7 +105,10 @@
":launcher-tests-src",
":launcher-non-quickstep-tests-src",
],
- static_libs: ["Launcher3TestLib"],
+ static_libs: [
+ "Launcher3TestLib",
+ "launcher_flags_lib_test",
+ ],
libs: [
"android.test.base",
"android.test.runner",
diff --git a/tests/src/com/android/launcher3/ui/WorkProfileTest.java b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
index 5b9adcd..61cdd17 100644
--- a/tests/src/com/android/launcher3/ui/WorkProfileTest.java
+++ b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
@@ -22,10 +22,13 @@
import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
+import static com.google.android.platform.launcher.aconfig.flags.Flags.FLAG_ENABLE_EXPANDING_PAUSE_WORK_BUTTON;
+
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;
@@ -44,6 +47,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
+import org.junit.Rule;
import org.junit.Test;
import java.util.Objects;
@@ -52,6 +56,7 @@
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;
@@ -60,6 +65,7 @@
@Before
@Override
public void setUp() throws Exception {
+ mSetFlagsRule.disableFlags(FLAG_ENABLE_EXPANDING_PAUSE_WORK_BUTTON);
super.setUp();
String output =
mDevice.executeShellCommand(