From 6b52305b28e0933aba06d5f7ad1d96677ac1aeac Mon Sep 17 00:00:00 2001 From: Becky Qiu Date: Thu, 8 Dec 2022 15:41:37 -0800 Subject: [PATCH 01/15] [Toast] Add a new attribute for rich answer type. Bug: 261205664 Test: local Change-Id: I2ff89c02c72d0a8ef3572b51f9429ab199231c3f --- protos/launcher_atom.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto index 151ec5a93c..677c9921a0 100644 --- a/protos/launcher_atom.proto +++ b/protos/launcher_atom.proto @@ -130,7 +130,7 @@ message TaskBarContainer { optional int32 cardinality = 2; } -// Next value 40 +// Next value 41 enum Attribute { UNKNOWN = 0; DEFAULT_LAYOUT = 1; // icon automatically placed in workspace, folder, hotseat @@ -186,6 +186,7 @@ enum Attribute { WEB_SEARCH_RESULT_PERSONAL = 36; WEB_SEARCH_RESULT_CALCULATOR = 37; WEB_SEARCH_RESULT_URL = 38; + WEB_SEARCH_RESULT_RICH_ANSWER = 40; WIDGETS_BOTTOM_TRAY = 28; WIDGETS_TRAY_PREDICTION = 29; From 8e8352e27e7bd15e491ecdae5a862b52e14ca97c Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Mon, 12 Dec 2022 18:18:20 -0800 Subject: [PATCH 02/15] Fix juttering problem with split staging animation This patch makes it so that app icons no longer jutter uncomfortably when staging and confirming a split from home. The problem occurred because I used Math.round when calculating the position at which to center the app icon within the SplitPlaceholderView. When an inexact integer is used to calculate the x and y position on every frame, it creates juttering, especially when numerical values are small. Solved by removing Math.round and using floats going forward. Fixes: 262308025 Test: Manual Change-Id: If91d1d3ee52652c155ed7e4e1d4f4620fdc41cc9 --- .../touch/LandscapePagedViewHandler.java | 8 ++++---- .../touch/PortraitPagedViewHandler.java | 20 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 820162c496..097823b078 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -432,10 +432,10 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { int drawableWidth, int drawableHeight, DeviceProfile dp, @StagePosition int stagePosition) { float insetAdjustment = getPlaceholderSizeAdjustment(dp) / 2f; - out.setX(Math.round(onScreenRectCenterX / fullscreenScaleX - - 1.0f * drawableWidth / 2)); - out.setY(Math.round((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY - - 1.0f * drawableHeight / 2)); + out.setX(onScreenRectCenterX / fullscreenScaleX + - 1.0f * drawableWidth / 2); + out.setY((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY + - 1.0f * drawableHeight / 2); } /** diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 78e17d835d..316cf0eab1 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -463,20 +463,20 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT; float insetAdjustment = getPlaceholderSizeAdjustment(dp, pinToRight) / 2f; if (!dp.isLandscape) { - out.setX(Math.round(onScreenRectCenterX / fullscreenScaleX - - 1.0f * drawableWidth / 2)); - out.setY(Math.round((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY - - 1.0f * drawableHeight / 2)); + out.setX(onScreenRectCenterX / fullscreenScaleX + - 1.0f * drawableWidth / 2); + out.setY((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY + - 1.0f * drawableHeight / 2); } else { if (pinToRight) { - out.setX(Math.round((onScreenRectCenterX - insetAdjustment) / fullscreenScaleX - - 1.0f * drawableWidth / 2)); + out.setX((onScreenRectCenterX - insetAdjustment) / fullscreenScaleX + - 1.0f * drawableWidth / 2); } else { - out.setX(Math.round((onScreenRectCenterX + insetAdjustment) / fullscreenScaleX - - 1.0f * drawableWidth / 2)); + out.setX((onScreenRectCenterX + insetAdjustment) / fullscreenScaleX + - 1.0f * drawableWidth / 2); } - out.setY(Math.round(onScreenRectCenterY / fullscreenScaleY - - 1.0f * drawableHeight / 2)); + out.setY(onScreenRectCenterY / fullscreenScaleY + - 1.0f * drawableHeight / 2); } } From e95a12c329738aee3eb0b45eddd187d534115b3e Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 13 Dec 2022 15:19:51 +0000 Subject: [PATCH 03/15] Get home rotation default value from DisplayController Info in case DeviceProfile is not updated. Bug: 260059325 Test: manual Change-Id: I7f5ea9f4607ea50ffafb7a19f0ae0e62df2dbb14 --- .../launcher3/settings/SettingsActivity.java | 10 +++++----- .../launcher3/states/RotationHelper.java | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java index 4cb4348a5e..3e2d051a0a 100644 --- a/src/com/android/launcher3/settings/SettingsActivity.java +++ b/src/com/android/launcher3/settings/SettingsActivity.java @@ -53,6 +53,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.WidgetsModel; import com.android.launcher3.states.RotationHelper; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; +import com.android.launcher3.util.DisplayController; import java.util.Collections; import java.util.List; @@ -267,15 +268,14 @@ public class SettingsActivity extends FragmentActivity return !WidgetsModel.GO_DISABLE_NOTIFICATION_DOTS; case ALLOW_ROTATION_PREFERENCE_KEY: - DeviceProfile deviceProfile = InvariantDeviceProfile.INSTANCE.get( - getContext()).getDeviceProfile(getContext()); - if (deviceProfile.isTablet) { + DisplayController.Info info = InvariantDeviceProfile.INSTANCE.get( + getContext()).getDeviceProfile(getContext()).getDisplayInfo(); + if (info.isTablet(info.realBounds)) { // Launcher supports rotation by default. No need to show this setting. return false; } // Initialize the UI once - preference.setDefaultValue( - RotationHelper.getAllowRotationDefaultValue(deviceProfile)); + preference.setDefaultValue(RotationHelper.getAllowRotationDefaultValue(info)); return true; case FLAGS_PREFERENCE_KEY: diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java index 642bdcdbb8..e5b4ebae1d 100644 --- a/src/com/android/launcher3/states/RotationHelper.java +++ b/src/com/android/launcher3/states/RotationHelper.java @@ -35,7 +35,6 @@ import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; import com.android.launcher3.BaseActivity; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.util.DisplayController; @@ -50,11 +49,11 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, /** * Returns the default value of {@link #ALLOW_ROTATION_PREFERENCE_KEY} preference. */ - public static boolean getAllowRotationDefaultValue(DeviceProfile deviceProfile) { + public static boolean getAllowRotationDefaultValue(DisplayController.Info info) { // If the device's pixel density was scaled (usually via settings for A11y), use the // original dimensions to determine if rotation is allowed of not. - float originalSmallestWidth = dpiFromPx( - Math.min(deviceProfile.widthPx, deviceProfile.heightPx), DENSITY_DEVICE_STABLE); + float originalSmallestWidth = dpiFromPx(Math.min(info.currentSize.x, info.currentSize.y), + DENSITY_DEVICE_STABLE); return originalSmallestWidth >= MIN_TABLET_WIDTH; } @@ -99,7 +98,8 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, new Handler(UI_HELPER_EXECUTOR.getLooper(), this::setOrientationAsync); } - private void setIgnoreAutoRotateSettings(boolean ignoreAutoRotateSettings) { + private void setIgnoreAutoRotateSettings(boolean ignoreAutoRotateSettings, + DisplayController.Info info) { // On large devices we do not handle auto-rotate differently. mIgnoreAutoRotateSettings = ignoreAutoRotateSettings; if (!mIgnoreAutoRotateSettings) { @@ -108,7 +108,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, mSharedPrefs.registerOnSharedPreferenceChangeListener(this); } mHomeRotationEnabled = mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY, - getAllowRotationDefaultValue(mActivity.getDeviceProfile())); + getAllowRotationDefaultValue(info)); } else { if (mSharedPrefs != null) { mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this); @@ -122,7 +122,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, if (mDestroyed || mIgnoreAutoRotateSettings) return; boolean wasRotationEnabled = mHomeRotationEnabled; mHomeRotationEnabled = mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY, - getAllowRotationDefaultValue(mActivity.getDeviceProfile())); + getAllowRotationDefaultValue(mActivity.getDeviceProfile().getDisplayInfo())); if (mHomeRotationEnabled != wasRotationEnabled) { notifyChange(); } @@ -132,7 +132,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) { boolean ignoreAutoRotateSettings = info.isTablet(info.realBounds); if (mIgnoreAutoRotateSettings != ignoreAutoRotateSettings) { - setIgnoreAutoRotateSettings(ignoreAutoRotateSettings); + setIgnoreAutoRotateSettings(ignoreAutoRotateSettings, info); notifyChange(); } } @@ -169,7 +169,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, mInitialized = true; DisplayController displayController = DisplayController.INSTANCE.get(mActivity); DisplayController.Info info = displayController.getInfo(); - setIgnoreAutoRotateSettings(info.isTablet(info.realBounds)); + setIgnoreAutoRotateSettings(info.isTablet(info.realBounds), info); displayController.addChangeListener(this); notifyChange(); } From 86a41d1a42addf8d68e8bffdb524053758232a92 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 14 Dec 2022 16:18:18 +0000 Subject: [PATCH 04/15] Avoid overlapping snackbar with nav buttons in tablets Fix: 249378243 Test: manual Change-Id: Ibbd0e917b1cbe657b2424acbad0134d6de807f62 --- src/com/android/launcher3/views/Snackbar.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/views/Snackbar.java b/src/com/android/launcher3/views/Snackbar.java index e582114fc9..86b341953f 100644 --- a/src/com/android/launcher3/views/Snackbar.java +++ b/src/com/android/launcher3/views/Snackbar.java @@ -31,6 +31,7 @@ import android.widget.TextView; import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; +import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.compat.AccessibilityManagerCompat; @@ -97,7 +98,11 @@ public class Snackbar extends AbstractFloatingView { dragLayer.getWidth() - maxMarginLeftRight * 2 - insets.left - insets.right, absoluteMaxWidth); params.width = minWidth; - params.setMargins(0, 0, 0, marginBottom + insets.bottom); + DeviceProfile deviceProfile = activity.getDeviceProfile(); + params.setMargins(0, 0, 0, marginBottom + + (deviceProfile.isTaskbarPresent + ? deviceProfile.taskbarSize + deviceProfile.getTaskbarOffsetY() + : insets.bottom)); TextView labelView = snackbar.findViewById(R.id.label); String labelText = res.getString(labelStringResId); From adb364a10419d40f157c42bb167a332d1219f244 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 9 Dec 2022 12:37:25 -0800 Subject: [PATCH 05/15] Unifying multiple all-apps implementations > Using a single layout for the all-apps content > Removing some unnecessary themes > Fixing search chashes in SecondaryDisplayLauncher Bug: 259733681 Test: Existing TAPL tests verify that Launcher/AllApps work properly Change-Id: Icd5310316499cd421bc039cdbd4d398b813cd477 --- quickstep/res/layout/taskbar_all_apps.xml | 37 +--- .../allapps/TaskbarAllAppsContainerView.java | 20 ++ .../overlay/TaskbarOverlayContext.java | 9 - res/drawable/bg_all_apps_searchbox.xml | 3 +- res/layout/all_apps.xml | 6 +- res/layout/all_apps_content.xml | 11 +- res/layout/search_container_all_apps.xml | 1 - res/layout/secondary_launcher.xml | 57 +----- res/values/config.xml | 3 - res/values/styles.xml | 23 +-- .../launcher3/BaseDraggingActivity.java | 13 -- .../allapps/ActivityAllAppsContainerView.java | 44 ++--- .../allapps/BaseAllAppsContainerView.java | 171 +++++++++++------- .../launcher3/allapps/FloatingHeaderView.java | 24 --- .../allapps/LauncherAllAppsContainerView.java | 68 +------ .../allapps/SearchTransitionController.java | 6 +- ...SecondaryLauncherAllAppsContainerView.java | 5 + .../launcher3/views/ActivityContext.java | 11 -- 18 files changed, 158 insertions(+), 354 deletions(-) diff --git a/quickstep/res/layout/taskbar_all_apps.xml b/quickstep/res/layout/taskbar_all_apps.xml index c7679beb23..976cd9e2a7 100644 --- a/quickstep/res/layout/taskbar_all_apps.xml +++ b/quickstep/res/layout/taskbar_all_apps.xml @@ -27,40 +27,5 @@ android:clipChildren="true" android:clipToPadding="false" android:focusable="false" - android:saveEnabled="false" - android:theme="?attr/allAppsTheme"> - - - - - - - - - - - - - - - - - - + android:saveEnabled="false" /> diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java index 70405d94cb..eeca329e80 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java @@ -17,6 +17,7 @@ package com.android.launcher3.taskbar.allapps; import android.content.Context; import android.util.AttributeSet; +import android.view.View; import android.view.WindowInsets; import com.android.launcher3.DeviceProfile; @@ -42,6 +43,19 @@ public class TaskbarAllAppsContainerView extends return super.onApplyWindowInsets(insets); } + @Override + protected View inflateSearchBox() { + // Remove top padding of header, since we do not have any search + mHeader.setPadding(mHeader.getPaddingLeft(), 0, + mHeader.getPaddingRight(), mHeader.getPaddingBottom()); + + TaskbarAllAppsFallbackSearchContainer searchView = + new TaskbarAllAppsFallbackSearchContainer(getContext(), null); + searchView.setId(R.id.search_container_all_apps); + searchView.setVisibility(GONE); + return searchView; + } + @Override protected boolean isSearchSupported() { return false; @@ -53,4 +67,10 @@ public class TaskbarAllAppsContainerView extends // TODO(b/240670050): Remove this and add header protection for the taskbar entrypoint. mBottomSheetBackground.setBackgroundResource(R.drawable.bg_rounded_corner_bottom_sheet); } + + @Override + public boolean isInAllApps() { + // All apps is always open + return true; + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java index ebaf60a10f..38b6dfd39b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java @@ -21,9 +21,6 @@ import android.view.View; import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; -import com.android.launcher3.allapps.ActivityAllAppsContainerView; -import com.android.launcher3.allapps.search.DefaultSearchAdapterProvider; -import com.android.launcher3.allapps.search.SearchAdapterProvider; import com.android.launcher3.dot.DotInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.PopupDataProvider; @@ -137,10 +134,4 @@ public class TaskbarOverlayContext extends BaseTaskbarContext { @Override public void onPopupVisibilityChanged(boolean isVisible) {} - - @Override - public SearchAdapterProvider createSearchAdapterProvider( - ActivityAllAppsContainerView appsView) { - return new DefaultSearchAdapterProvider(this); - } } diff --git a/res/drawable/bg_all_apps_searchbox.xml b/res/drawable/bg_all_apps_searchbox.xml index c3249279af..3c321e4c49 100644 --- a/res/drawable/bg_all_apps_searchbox.xml +++ b/res/drawable/bg_all_apps_searchbox.xml @@ -15,5 +15,6 @@ --> - + + \ No newline at end of file diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml index f8a871a502..655c75d1b5 100644 --- a/res/layout/all_apps.xml +++ b/res/layout/all_apps.xml @@ -17,13 +17,9 @@ will bake the left/right padding into that view's background itself. --> - - - \ No newline at end of file + android:saveEnabled="false" /> \ No newline at end of file diff --git a/res/layout/all_apps_content.xml b/res/layout/all_apps_content.xml index 773ab8d4d3..925f4d963b 100644 --- a/res/layout/all_apps_content.xml +++ b/res/layout/all_apps_content.xml @@ -34,6 +34,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:clipToPadding="false" + android:layout_below="@id/search_container_all_apps" android:paddingTop="@dimen/all_apps_header_top_padding" android:paddingBottom="@dimen/all_apps_header_bottom_padding" android:orientation="vertical" > @@ -44,15 +45,5 @@ - - - - - \ No newline at end of file diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml index b46298cfdb..db218c3d4b 100644 --- a/res/layout/search_container_all_apps.xml +++ b/res/layout/search_container_all_apps.xml @@ -21,7 +21,6 @@ android:layout_centerHorizontal="true" android:layout_gravity="top|center_horizontal" android:background="@drawable/bg_all_apps_searchbox" - android:elevation="1dp" android:focusableInTouchMode="true" android:gravity="center" android:hint="@string/all_apps_search_bar_hint" diff --git a/res/layout/secondary_launcher.xml b/res/layout/secondary_launcher.xml index 4be2e456ac..f48f3c0aa4 100644 --- a/res/layout/secondary_launcher.xml +++ b/res/layout/secondary_launcher.xml @@ -42,8 +42,7 @@ android:contentDescription="@string/all_apps_button_label" android:onClick="onAppsButtonClicked" /> - - - - - - - - - - - - - - - - - - + android:visibility="invisible" /> \ No newline at end of file diff --git a/res/values/config.xml b/res/values/config.xml index d9b3da5b07..4cab2dec09 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -49,9 +49,6 @@ popup_container_iterate_children - - false - diff --git a/res/values/styles.xml b/res/values/styles.xml index 9e75a31804..7582a30435 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -20,6 +20,7 @@ - + - + - - - -