From 192924459ba3bef4324ebe8f9565b522c94b007a Mon Sep 17 00:00:00 2001 From: Santhosh Thangaraj Date: Tue, 8 Jun 2021 20:28:24 +0000 Subject: [PATCH 01/18] Fix the page number based Seen impression. Test: On device. Bug: 183117427 Change-Id: Ic1b11fb7630f60f11387951749420653aa3f0c8a --- src/com/android/launcher3/Launcher.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 578379b70d..30fe6ca021 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1080,7 +1080,13 @@ public class Launcher extends StatefulActivity implements Launche // Making sure mAllAppsSessionLogId is not null to avoid double logging. && mAllAppsSessionLogId != null) { getAppsView().getSearchUiManager().resetSearch(); - getStatsLogManager().logger().log(LAUNCHER_ALLAPPS_EXIT); + getStatsLogManager().logger() + .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() + .setWorkspace( + LauncherAtom.WorkspaceContainer.newBuilder() + .setPageIndex(getWorkspace().getCurrentPage())) + .build()) + .log(LAUNCHER_ALLAPPS_EXIT); mAllAppsSessionLogId = null; } } From cb5c35e5d1ff5f3e3b99cde590040dc76d98653f Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Thu, 10 Jun 2021 17:59:00 -0700 Subject: [PATCH 02/18] Calculate the position from start bounds for auto-enter PiP Video: http://recall/-/aaaaaabFQoRHlzixHdtY/eUpkH2il1vYBVBPt1Vks2u Bug: 190748719 Test: manual, see video Change-Id: I053bd5607200ad6341d04c9bcfec5222f101cf65 --- .../quickstep/util/SwipePipToHomeAnimator.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java index 36311302bf..61bd82cd39 100644 --- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java +++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java @@ -289,16 +289,16 @@ public class SwipePipToHomeAnimator extends ValueAnimator { final float degree, positionX, positionY; if (mFromRotation == Surface.ROTATION_90) { degree = -90 * fraction; - positionX = fraction * (mDestinationBoundsTransformed.left - mAppBounds.left) - + mAppBounds.left; - positionY = fraction * (mDestinationBoundsTransformed.bottom - mAppBounds.top) - + mAppBounds.top; + positionX = fraction * (mDestinationBoundsTransformed.left - mStartBounds.left) + + mStartBounds.left; + positionY = fraction * (mDestinationBoundsTransformed.bottom - mStartBounds.top) + + mStartBounds.top; } else { degree = 90 * fraction; - positionX = fraction * (mDestinationBoundsTransformed.right - mAppBounds.left) - + mAppBounds.left; - positionY = fraction * (mDestinationBoundsTransformed.top - mAppBounds.top) - + mAppBounds.top; + positionX = fraction * (mDestinationBoundsTransformed.right - mStartBounds.left) + + mStartBounds.left; + positionY = fraction * (mDestinationBoundsTransformed.top - mStartBounds.top) + + mStartBounds.top; } return new RotatedPosition(degree, positionX, positionY); } From 6c2e3b303123fa7d5862c4a25e3a10741e40fc3e Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 11 Jun 2021 13:34:57 -0700 Subject: [PATCH 03/18] Removing UB flavor of TAPL library Test: presubmit Bug: 187761685 Change-Id: Ide5060886f1b9856c1046bc2028f55418e8c1e0e --- tests/Android.mk | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/tests/Android.mk b/tests/Android.mk index 19b9656e37..6adc685981 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -15,34 +15,6 @@ LOCAL_PATH := $(call my-dir) -# -# Build rule for Tapl library. -# -include $(CLEAR_VARS) -LOCAL_STATIC_JAVA_LIBRARIES := \ - androidx.annotation_annotation \ - androidx.test.runner \ - androidx.test.rules \ - androidx.preference_preference \ - androidx.test.uiautomator_uiautomator - -ifneq (,$(wildcard frameworks/base)) -else - LOCAL_STATIC_JAVA_LIBRARIES += SystemUISharedLib - - LOCAL_SRC_FILES := $(call all-java-files-under, tapl) \ - ../src/com/android/launcher3/ResourceUtils.java \ - ../src/com/android/launcher3/testing/TestProtocol.java -endif - -LOCAL_MODULE := ub-launcher-aosp-tapl -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE -LOCAL_SDK_VERSION := system_current - -include $(BUILD_STATIC_JAVA_LIBRARY) - # # Build rule for Launcher3Tests # @@ -56,14 +28,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ mockito-target-minus-junit4 \ launcher_log_protos_lite -ifneq (,$(wildcard frameworks/base)) - LOCAL_PRIVATE_PLATFORM_APIS := true - LOCAL_STATIC_JAVA_LIBRARIES += launcher-aosp-tapl -else - LOCAL_SDK_VERSION := system_28 - LOCAL_MIN_SDK_VERSION := 21 - LOCAL_STATIC_JAVA_LIBRARIES += ub-launcher-aosp-tapl -endif +LOCAL_PRIVATE_PLATFORM_APIS := true +LOCAL_STATIC_JAVA_LIBRARIES += launcher-aosp-tapl LOCAL_SRC_FILES := \ $(call all-java-files-under, src) \ From 1e1ad449a8b813a1ca359d69ba5c20751eb3c249 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 11 Jun 2021 14:10:45 -0700 Subject: [PATCH 04/18] Logging UPs and DOWNs that TAPL injects Test: presubmit Bug: 190748682 Change-Id: I82e792724bab178a9c3ca190609af913fbaf4a87 --- .../android/launcher3/tapl/LauncherInstrumentation.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index c99a81f0f6..0f9761d8a3 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -1248,6 +1248,13 @@ public final class LauncherInstrumentation { } final MotionEvent event = getMotionEvent(downTime, currentTime, action, point.x, point.y); + // b/190748682 + switch (action) { + case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_UP: + log("b/190748682: injecting " + event); + break; + } assertTrue("injectInputEvent failed", mInstrumentation.getUiAutomation().injectInputEvent(event, true, false)); event.recycle(); From 5fcc3a90b0fc302dc89c740e5d177bb0a89a7dfb Mon Sep 17 00:00:00 2001 From: Cyrus Boadway Date: Fri, 11 Jun 2021 17:27:49 +0000 Subject: [PATCH 05/18] Fix foreground position during widget home animation The home return animation applies a position animation to all views in the workspace. Since the widget uses a GhostView of the original widget to represent the foreground of the animation, that animation was reflected in the foreground's positioning. The CL creates an ignore list of workspace views to which an animator should not be applied. Bug: 190488979 Test: manual Change-Id: I5a86165e945336693eedd253a02bda1e1eb6662d --- .../quickstep/LauncherSwipeHandlerV2.java | 19 ++++++++++++++++++- .../util/StaggeredWorkspaceAnim.java | 12 +++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java index 1bae1c5f6b..819e484025 100644 --- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java @@ -181,6 +181,12 @@ public class LauncherSwipeHandlerV2 extends return new FloatingViewHomeAnimationFactory(floatingWidgetView) { + @Override + @Nullable + protected View getViewIgnoredInWorkspaceRevealAnimation() { + return hostView; + } + @Override public RectF getWindowTargetRect() { super.getWindowTargetRect(); @@ -370,6 +376,16 @@ public class LauncherSwipeHandlerV2 extends } private class LauncherHomeAnimationFactory extends HomeAnimationFactory { + + /** + * Returns a view which should be excluded from the Workspace animation, or null if there + * is no view to exclude. + */ + @Nullable + protected View getViewIgnoredInWorkspaceRevealAnimation() { + return null; + } + @NonNull @Override public AnimatorPlaybackController createActivityAnimationToHome() { @@ -383,7 +399,8 @@ public class LauncherSwipeHandlerV2 extends @Override public void playAtomicAnimation(float velocity) { if (!PROTOTYPE_APP_CLOSE.get()) { - new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */) + new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */, + getViewIgnoredInWorkspaceRevealAnimation()) .start(); } else if (shouldPlayAtomicWorkspaceReveal()) { new WorkspaceRevealAnim(mActivity, true).start(); diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 49aec933b7..ccc587cd87 100644 --- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -32,6 +32,8 @@ import android.animation.ValueAnimator; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.Nullable; + import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; @@ -68,15 +70,18 @@ public class StaggeredWorkspaceAnim { private final float mSpringTransY; private final AnimatorSet mAnimators = new AnimatorSet(); + private final @Nullable View mIgnoredView; - public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim) { - this(launcher, velocity, animateOverviewScrim, true); + public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim, + @Nullable View ignoredView) { + this(launcher, velocity, animateOverviewScrim, ignoredView, true); } public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim, - boolean staggerWorkspace) { + @Nullable View ignoredView, boolean staggerWorkspace) { prepareToAnimate(launcher, animateOverviewScrim); + mIgnoredView = ignoredView; mVelocity = velocity; // Scale the translationY based on the initial velocity to better sync the workspace items @@ -224,6 +229,7 @@ public class StaggeredWorkspaceAnim { * @param totalRows Total number of rows. */ private void addStaggeredAnimationForView(View v, int row, int totalRows) { + if (mIgnoredView != null && mIgnoredView == v) return; // Invert the rows, because we stagger starting from the bottom of the screen. int invertedRow = totalRows - row; // Add 1 to the inverted row so that the bottom most row has a start delay. From 154ad76f40b54d7264df7f076ef45703b1a2bfb6 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Mon, 14 Jun 2021 00:31:00 -0500 Subject: [PATCH 06/18] Introduce inline education for work profile Bug: 186857875 Test: local Change-Id: I796b04fbb3ffc714a01104107774819d35034f93 --- res/drawable/work_apps_toggle_background.xml | 2 +- res/drawable/work_card.xml | 27 +++++ res/drawable/work_card_btn.xml | 27 +++++ res/layout/work_apps_edu.xml | 45 ++++++++ res/layout/work_mode_fab.xml | 10 +- res/layout/work_mode_switch.xml | 36 ------ res/values/dimens.xml | 4 +- res/values/strings.xml | 2 +- .../allapps/AllAppsContainerView.java | 53 ++++----- .../launcher3/allapps/AllAppsGridAdapter.java | 42 ++++--- .../allapps/AlphabeticalAppsList.java | 19 +++- .../allapps/BaseAdapterProvider.java | 56 +++++++++ .../allapps/WorkAdapterProvider.java | 106 ++++++++++++++++++ .../launcher3/allapps/WorkEduCard.java | 98 ++++++++++++++++ .../search/DefaultSearchAdapterProvider.java | 2 +- .../allapps/search/SearchAdapterProvider.java | 36 +----- 16 files changed, 433 insertions(+), 132 deletions(-) create mode 100644 res/drawable/work_card.xml create mode 100644 res/drawable/work_card_btn.xml create mode 100644 res/layout/work_apps_edu.xml delete mode 100644 res/layout/work_mode_switch.xml create mode 100644 src/com/android/launcher3/allapps/BaseAdapterProvider.java create mode 100644 src/com/android/launcher3/allapps/WorkAdapterProvider.java create mode 100644 src/com/android/launcher3/allapps/WorkEduCard.java diff --git a/res/drawable/work_apps_toggle_background.xml b/res/drawable/work_apps_toggle_background.xml index a04d269875..cb8b8e2a42 100644 --- a/res/drawable/work_apps_toggle_background.xml +++ b/res/drawable/work_apps_toggle_background.xml @@ -24,7 +24,7 @@ - + diff --git a/res/drawable/work_card.xml b/res/drawable/work_card.xml new file mode 100644 index 0000000000..0e4b05407e --- /dev/null +++ b/res/drawable/work_card.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/res/drawable/work_card_btn.xml b/res/drawable/work_card_btn.xml new file mode 100644 index 0000000000..3c9391912a --- /dev/null +++ b/res/drawable/work_card_btn.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml new file mode 100644 index 0000000000..2c58907e4b --- /dev/null +++ b/res/layout/work_apps_edu.xml @@ -0,0 +1,45 @@ + + + + + + +