diff --git a/go/quickstep/res/values-or/strings.xml b/go/quickstep/res/values-or/strings.xml index 36204a32ce..2e76e2d972 100644 --- a/go/quickstep/res/values-or/strings.xml +++ b/go/quickstep/res/values-or/strings.xml @@ -7,13 +7,13 @@ "Lens" "ବୁଝିଗଲି" "ବାତିଲ୍ କରନ୍ତୁ" - "ସେଟିଂସ୍" + "ସେଟିଂସ" "ସ୍କିନରେ ଥିବା ଟେକ୍ସଟକୁ ଅନୁବାଦ କରନ୍ତୁ କିମ୍ବା ଶୁଣନ୍ତୁ" - "ଆପଣଙ୍କ ସ୍କ୍ରିନରେ ଟେକ୍ସଟ୍, ୱେବ୍ ଠିକଣା ଏବଂ ସ୍କ୍ରିନସଟଗୁଡ଼ିକ ପରି ସୂଚନାକୁ Google ସହ ସେୟାର୍ କରାଯାଇପାରେ।\n\nଆପଣ କେଉଁ ସୂଚନା ସେୟାର୍ କରନ୍ତି ତାହା ପରିବର୍ତ୍ତନ କରିବାକୁ, ""ସେଟିଂସ୍ > ଆପ୍ସ > ଡିଫଲ୍ଟ ଆପ୍ସ > ଡିଜିଟାଲ୍ ଆସିଷ୍ଟାଣ୍ଟ ଆପ""କୁ ଯାଆନ୍ତୁ।" + "ଆପଣଙ୍କ ସ୍କ୍ରିନରେ ଟେକ୍ସଟ, ୱେବ ଠିକଣା ଏବଂ ସ୍କ୍ରିନସଟଗୁଡ଼ିକ ପରି ସୂଚନାକୁ Google ସହ ସେୟାର କରାଯାଇପାରେ।\n\nଆପଣ କେଉଁ ସୂଚନାକୁ ସେୟାର କରନ୍ତି ତାହା ପରିବର୍ତ୍ତନ କରିବା ପାଇଁ, ""ସେଟିଂସ > ଆପ୍ସ > ଡିଫଲ୍ଟ ଆପ୍ସ > Digital assistant ଆପ""କୁ ଯାଆନ୍ତୁ।" "ଏହି ଫିଚର୍ ବ୍ୟବହାର କରିବାକୁ ଏକ ଆସିଷ୍ଟାଣ୍ଟ ବାଛନ୍ତୁ" - "ଆପଣଙ୍କ ସ୍କ୍ରିନରେ ଥିବା ଟେକ୍ସଟକୁ ଶୁଣିବା ପାଇଁ କିମ୍ବା ଅନୁବାଦ କରିବାକୁ, ସେଟିଂସରେ ଏକ ଡିଜିଟାଲ୍ ଆସିଷ୍ଟାଣ୍ଟ ଆପ୍ ଚୟନ କରନ୍ତୁ" + "ଆପଣଙ୍କ ସ୍କ୍ରିନରେ ଥିବା ଟେକ୍ସଟକୁ ଶୁଣିବା କିମ୍ବା ଅନୁବାଦ କରିବା ପାଇଁ, ସେଟିଂସରେ ଏକ digital assistant ଆପ ବାଛନ୍ତୁ" "ଏହି ଫିଚର୍ ବ୍ୟବହାର କରିବା ପାଇଁ ଆପଣଙ୍କ ଆସିଷ୍ଟାଣ୍ଟକୁ ବଦଳାନ୍ତୁ" - "ଆପଣଙ୍କ ସ୍କ୍ରିନରେ ଥିବା ଟେକ୍ସଟକୁ ଶୁଣିବା ପାଇଁ କିମ୍ବା ଅନୁବାଦ କରିବାକୁ, ସେଟିଂସରେ ଆପଣଙ୍କ ଡିଜିଟାଲ୍ ଆସିଷ୍ଟାଣ୍ଟ ଆପକୁ ବଦଳାନ୍ତୁ" + "ଆପଣଙ୍କ ସ୍କ୍ରିନରେ ଥିବା ଟେକ୍ସଟକୁ ଶୁଣିବା କିମ୍ବା ଅନୁବାଦ କରିବା ପାଇଁ, ସେଟିଂସରେ ଆପଣଙ୍କ Digital assistant ଆପକୁ ବଦଳାନ୍ତୁ" "ଏହି ସ୍କ୍ରିନରେ ଥିବା ଟେକ୍ସଟକୁ ଶୁଣିବା ପାଇଁ ଏଠାରେ ଟାପ୍ କରନ୍ତୁ" "ଏହି ସ୍କ୍ରିନରେ ଥିବା ଟେକ୍ସଟକୁ ଅନୁବାଦ କରିବା ପାଇଁ ଏଠାରେ ଟାପ୍ କରନ୍ତୁ" "ଏହି ଆପ ସେୟାର କରାଯାଇପାରିବ ନାହିଁ" diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto index c5599887dd..84892f190a 100644 --- a/protos/launcher_atom.proto +++ b/protos/launcher_atom.proto @@ -156,6 +156,12 @@ enum Attribute { ALL_APPS_SEARCH_RESULT_LEGACY_SHORTCUT = 30; ALL_APPS_SEARCH_RESULT_ASSISTANT_MEMORY = 31; + // Suggestion Type provided by AGA + ONE_SEARCH_WEB_QUERY = 32; + ONE_SEARCH_WEB_TRENDING = 33; + ONE_SEARCH_WEB_ENTITY = 34; + ONE_SEARCH_WEB_ANSWER = 35; + WIDGETS_BOTTOM_TRAY = 28; WIDGETS_TRAY_PREDICTION = 29; } diff --git a/quickstep/res/values-or/strings.xml b/quickstep/res/values-or/strings.xml index 0d2306405c..bb810f02f8 100644 --- a/quickstep/res/values-or/strings.xml +++ b/quickstep/res/values-or/strings.xml @@ -22,7 +22,7 @@ "ପିନ୍‍" "ଫ୍ରିଫର୍ମ" "କୌଣସି ସାମ୍ପ୍ରତିକ ଆଇଟମ୍ ନାହିଁ" - "ଆପ୍‍ ବ୍ୟବହାର ସେଟିଂସ୍‍" + "ଆପ ବ୍ୟବହାର ସେଟିଂସ" "ସବୁ ଖାଲି କରନ୍ତୁ" "ବର୍ତ୍ତମାନର ଆପ୍‌" "ଟାସ୍କ ବନ୍ଦ ହୋଇଯାଇଛି" @@ -38,7 +38,7 @@ "ଆପଣଙ୍କର ସବୁଠାରୁ ଅଧିକ-ବ୍ୟବହୃତ ଆପଗୁଡ଼ିକୁ, ସିଧା ମୂଳ ସ୍କ୍ରିନରେ ସହଜରେ ଆକ୍ସେସ୍ କରନ୍ତୁ। ଆପଣଙ୍କ ରୁଟିନଗୁଡ଼ିକ ଆଧାରରେ ପରାମର୍ଶଗୁଡ଼ିକ ପରିବର୍ତ୍ତିତ ହେବ। ତଳ ଧାଡ଼ିରେ ଥିବା ଆପଗୁଡ଼ିକ ଏକ ନୂଆ ଫୋଲ୍ଡରକୁ ମୁଭ୍ କରିଯିବ।" "ଆପ୍ ପରାମର୍ଶଗୁଡ଼ିକ ପାଆନ୍ତୁ" "ନାହିଁ, ଥାଉ" - "ସେଟିଂସ୍" + "ସେଟିଂସ" "ସବୁଠାରୁ ଅଧିକ-ବ୍ୟବହୃତ ଆପଗୁଡ଼ିକ ଏଠାରେ ଦେଖାଯାଏ ଏବଂ ରୁଟିନଗୁଡ଼ିକ ଆଧାରରେ ପରିବର୍ତ୍ତିତ ହୋଇଥାଏ" "ଆପ୍ ପରାମର୍ଶଗୁଡ଼ିକ ପାଇବାକୁ ଆପଗୁଡ଼ିକୁ ତଳ ଧାଡ଼ିରୁ ଟାଣି ଆଣନ୍ତୁ" "ଆପ୍ ପରାମର୍ଶଗୁଡ଼ିକ ଖାଲି ସ୍ଥାନରେ ଯୋଗ କରାଯାଇଛି" @@ -69,14 +69,14 @@ "ଆପଗୁଡ଼ିକ ମଧ୍ୟରେ ସ୍ୱିଚ୍ କରିବାକୁ, ସ୍କ୍ରିନର ତଳୁ ଉପରକୁ ସ୍ୱାଇପ୍ କରନ୍ତୁ, ଧରି ରଖନ୍ତୁ, ତା\'ପରେ ରିଲିଜ୍ କରନ୍ତୁ।" "ସବୁ ପ୍ରସ୍ତୁତ" "ହୋଇଗଲା" - "ସେଟିଂସ୍" + "ସେଟିଂସ" "ପୁଣି ଚେଷ୍ଟା କରନ୍ତୁ" "ବଢ଼ିଆ!" "ଟ୍ୟୁଟୋରିଆଲ୍ %1$d/%2$d" "ସମ୍ପୂର୍ଣ୍ଣ ଭାବେ ପ୍ରସ୍ତୁତ!" "ମୂଳପୃଷ୍ଠାକୁ ଯିବା ପାଇଁ ଉପରକୁ ସ୍ୱାଇପ୍ କରନ୍ତୁ" "ଆପଣ ଆପଣଙ୍କ ଫୋନ୍ ବ୍ୟବହାର କରିବା ପାଇଁ ପ୍ରସ୍ତୁତ ଅଛନ୍ତି" - "ସିଷ୍ଟମ୍ ନାଭିଗେସନ୍ ସେଟିଂସ୍" + "ସିଷ୍ଟମ ନାଭିଗେସନ ସେଟିଂସ" "ସେୟାର୍ କରନ୍ତୁ" "ସ୍କ୍ରିନସଟ୍" "ସ୍ପ୍ଲିଟ୍" diff --git a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java index 17635df355..27e89baa90 100644 --- a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java @@ -64,6 +64,9 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements /** Callback invoked when a drag is initiated within this context. */ public abstract void onDragStart(); + /** Callback invoked when a drag is finished within this context. */ + public abstract void onDragEnd(); + /** Callback invoked when a popup is shown or closed within this context. */ public abstract void onPopupVisibilityChanged(boolean isVisible); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 2c2cc434ac..fa0a60684f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -21,6 +21,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; +import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; @@ -385,6 +386,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { setTaskbarWindowFullscreen(true); } + @Override + public void onDragEnd() { + maybeSetTaskbarWindowNotFullscreen(); + } + @Override public void onPopupVisibilityChanged(boolean isVisible) { setTaskbarWindowFocusable(isVisible); @@ -488,6 +494,17 @@ public class TaskbarActivityContext extends BaseTaskbarContext { setTaskbarWindowHeight(fullscreen ? MATCH_PARENT : mLastRequestedNonFullscreenHeight); } + /** + * Reverts Taskbar window to its original size, if all floating views are closed and there is + * no system drag operation in progress. + */ + void maybeSetTaskbarWindowNotFullscreen() { + if (AbstractFloatingView.getAnyView(this, TYPE_ALL) == null + && !mControllers.taskbarDragController.isSystemDragInProgress()) { + setTaskbarWindowFullscreen(false); + } + } + public boolean isTaskbarWindowFullscreen() { return mIsFullscreen; } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java index 12b11959e8..24c5d0e75b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java @@ -391,11 +391,17 @@ public class TaskbarDragController extends DragController im return super.isDragging() || mIsSystemDragInProgress; } + /** {@code true} if the system is currently handling the drag. */ + public boolean isSystemDragInProgress() { + return mIsSystemDragInProgress; + } + private void maybeOnDragEnd() { if (!isDragging()) { ((BubbleTextView) mDragObject.originalView).getIcon().setIsDisabled(false); mControllers.taskbarAutohideSuspendController.updateFlag( TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING, false); + mActivity.onDragEnd(); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index 1bd76b99bb..cdac497c4c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -181,6 +181,9 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa } else if (!mControllers.uiController.isTaskbarTouchable()) { // Let touches pass through us. insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); + } else if (mControllers.taskbarDragController.isSystemDragInProgress()) { + // Let touches pass through us. + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); } else if (mControllers.taskbarViewController.areIconsVisible() || AbstractFloatingView.getOpenView(mActivity, TYPE_ALL) != null || mActivity.isNavBarKidsModeActive()) { @@ -208,9 +211,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa * Called when a child is removed from TaskbarDragLayer. */ public void onDragLayerViewRemoved() { - if (AbstractFloatingView.getAnyView(mActivity, TYPE_ALL) == null) { - mActivity.setTaskbarWindowFullscreen(false); - } + mActivity.maybeSetTaskbarWindowNotFullscreen(); } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java index 4245119e7f..7f3add3761 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java @@ -19,6 +19,8 @@ import static android.view.KeyEvent.ACTION_UP; import static android.view.KeyEvent.KEYCODE_BACK; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; +import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION; + import android.content.Context; import android.view.KeyEvent; import android.view.View; @@ -37,6 +39,9 @@ import com.android.launcher3.taskbar.TaskbarStashController; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.TouchController; import com.android.launcher3.views.BaseDragLayer; +import com.android.systemui.shared.system.ViewTreeObserverWrapper; +import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo; +import com.android.systemui.shared.system.ViewTreeObserverWrapper.OnComputeInsetsListener; /** * Window context for the taskbar all apps overlay. @@ -48,6 +53,7 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { private final TaskbarActivityContext mTaskbarContext; private final OnboardingPrefs mOnboardingPrefs; + private final TaskbarAllAppsController mWindowController; private final TaskbarAllAppsViewController mAllAppsViewController; private final TaskbarDragController mDragController; private final TaskbarAllAppsDragLayer mDragLayer; @@ -66,6 +72,7 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { mDragLayer = new TaskbarAllAppsDragLayer(this); TaskbarAllAppsSlideInView slideInView = (TaskbarAllAppsSlideInView) mLayoutInflater.inflate( R.layout.taskbar_all_apps, mDragLayer, false); + mWindowController = windowController; mAllAppsViewController = new TaskbarAllAppsViewController( this, slideInView, @@ -127,11 +134,17 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { @Override public void onDragStart() {} + @Override + public void onDragEnd() { + mWindowController.maybeCloseWindow(); + } + @Override public void onPopupVisibilityChanged(boolean isVisible) {} /** Root drag layer for this context. */ - private static class TaskbarAllAppsDragLayer extends BaseDragLayer { + private static class TaskbarAllAppsDragLayer extends + BaseDragLayer implements OnComputeInsetsListener { private TaskbarAllAppsDragLayer(Context context) { super(context, null, 1); @@ -142,9 +155,17 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); + ViewTreeObserverWrapper.addOnComputeInsetsListener( + getViewTreeObserver(), this); mActivity.mAllAppsViewController.show(); } + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + ViewTreeObserverWrapper.removeOnComputeInsetsListener(this); + } + @Override public void recreateControllers() { mControllers = new TouchController[]{mActivity.mDragController}; @@ -160,5 +181,13 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { } return super.dispatchKeyEvent(event); } + + @Override + public void onComputeInsets(InsetsInfo inoutInfo) { + if (mActivity.mDragController.isSystemDragInProgress()) { + inoutInfo.touchableRegion.setEmpty(); + inoutInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); + } + } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index 93024521d4..87133fcb5a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -17,6 +17,8 @@ package com.android.launcher3.taskbar.allapps; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; +import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; + import android.content.Context; import android.graphics.PixelFormat; import android.view.Gravity; @@ -129,11 +131,16 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList } /** - * Removes the all apps window from the hierarchy. + * Removes the all apps window from the hierarchy, if all floating views are closed and there is + * no system drag operation in progress. *

* This method should be called after an exit animation finishes, if applicable. */ - void closeWindow() { + void maybeCloseWindow() { + if (AbstractFloatingView.getOpenView(mAllAppsContext, TYPE_ALL) != null + || mAllAppsContext.getDragController().isSystemDragInProgress()) { + return; + } mProxyView.close(false); mTaskbarContext.removeOnDeviceProfileChangeListener(this); Optional.ofNullable(mAllAppsContext) diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java index c1abaaca06..648c486eb4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java @@ -49,7 +49,7 @@ final class TaskbarAllAppsViewController { setUpIconLongClick(); setUpAppDivider(); setUpTaskbarStashing(); - mSlideInView.addOnCloseListener(windowController::closeWindow); + mSlideInView.addOnCloseListener(windowController::maybeCloseWindow); } /** Starts the {@link TaskbarAllAppsSlideInView} enter transition. */ diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java index be7535a90e..08d147f7cf 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java @@ -79,7 +79,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler { } } activityOptions.options.setPendingIntentLaunchFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_EMPTY); + activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR); options = Pair.create(options.first, activityOptions.options); if (pendingIntent.isActivity()) { logAppLaunch(itemInfo); diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 2cb7100378..9c28bce026 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -833,12 +833,9 @@ public abstract class AbsSwipeUpHandler, // Notify when the animation starts flushOnRecentsAnimationAndLauncherBound(); - // Start hiding the divider - setDividerShown(false /* shown */, false /* immediate */); - // Only add the callback to enable the input consumer after we actually have the controller mStateCallback.runOnceAtState(STATE_APP_CONTROLLER_RECEIVED | STATE_GESTURE_STARTED, - mRecentsAnimationController::enableInputConsumer); + this::startInterceptingTouchesForGesture); mStateCallback.setStateOnUiThread(STATE_APP_CONTROLLER_RECEIVED); mPassedOverviewThreshold = false; @@ -1457,6 +1454,17 @@ public abstract class AbsSwipeUpHandler, return swipePipToHomeAnimator; } + private void startInterceptingTouchesForGesture() { + if (mRecentsAnimationController == null) { + return; + } + + mRecentsAnimationController.enableInputConsumer(); + + // Start hiding the divider + setDividerShown(false /* shown */, true /* immediate */); + } + private void computeRecentsScrollIfInvisible() { if (mRecentsView != null && mRecentsView.getVisibility() != View.VISIBLE) { // Views typically don't compute scroll when invisible as an optimization, diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index 12a638a804..04fc3ba181 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -141,7 +141,9 @@ public class StatsLogCompatManager extends StatsLogManager { getCardinality(info) /* cardinality */, info.getWidget().getSpanX(), info.getWidget().getSpanY(), - getFeatures(info)); + getFeatures(info), + null /* attributes */ + ); } /** @@ -170,7 +172,8 @@ public class StatsLogCompatManager extends StatsLogManager { info.getAttribute().getNumber(), // attribute_id = 15; getCardinality(info), // cardinality = 16; info.getWidget().getSpanX(), // span_x = 17 [default = 1]; - info.getWidget().getSpanY() // span_y = 18 [default = 1]; + info.getWidget().getSpanY(), // span_y = 18 [default = 1]; + null /* attributes */ ); } @@ -413,7 +416,8 @@ public class StatsLogCompatManager extends StatsLogManager { atomInfo.getFolderIcon().getLabelInfo() /* edittext */, getCardinality(atomInfo) /* cardinality */, getFeatures(atomInfo) /* features */, - getSearchAttributes(atomInfo) /* searchAttributes */ + getSearchAttributes(atomInfo) /* searchAttributes */, + null /* attributes */ ); } } diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index 04af3c11ab..111c07aa79 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -272,7 +272,8 @@ public class GroupedTaskView extends TaskView { getPagedOrientationHandler().setSplitIconParams(mIconView, mIconView2, taskIconHeight, mSnapshotView.getMeasuredWidth(), mSnapshotView.getMeasuredHeight(), - isRtl, deviceProfile, mSplitBoundsConfig); + getMeasuredHeight(), getMeasuredWidth(), isRtl, deviceProfile, + mSplitBoundsConfig); } private void updateSecondaryDwbPlacement() { diff --git a/res/values-or/strings.xml b/res/values-or/strings.xml index 1149e021d8..56121910b3 100644 --- a/res/values-or/strings.xml +++ b/res/values-or/strings.xml @@ -53,9 +53,9 @@ "ବାର୍ତ୍ତାଳାପଗୁଡ଼ିକ" "ଉପଯୋଗୀ ସୂଚନା ଆପଣଙ୍କ ପାଖରେ ସହଜରେ ଉପଲବ୍ଧ" "ଆପଗୁଡ଼ିକୁ ନଖୋଲି ସୂଚନା ପାଇବା ପାଇଁ, ଆପଣ ଆପଣଙ୍କ ମୂଳସ୍କ୍ରିନରେ ୱିଜେଟଗୁଡ଼ିକୁ ଯୋଗ କରିପାରିବେ" - "ୱିଜେଟ୍ ସେଟିଂସ୍ ପରିବର୍ତ୍ତନ କରିବାକୁ ଟାପ୍ କରନ୍ତୁ" + "ୱିଜେଟ ସେଟିଂସ ପରିବର୍ତ୍ତନ କରିବାକୁ ଟାପ କରନ୍ତୁ" "ବୁଝିଗଲି" - "ୱିଜେଟ୍ ସେଟିଂସ୍ ପରିବର୍ତ୍ତନ କରନ୍ତୁ" + "ୱିଜେଟ ସେଟିଂସ ପରିବର୍ତ୍ତନ କରନ୍ତୁ" "ଆପ୍‌ ଖୋଜନ୍ତୁ" "ଆପ୍‌ ଲୋଡ୍‌ ହେଉଛି..." "\"%1$s\" ସହିତ ମେଳ ହେଉଥିବା କୌଣସି ଆପ୍‌ ମିଳିଲା ନାହିଁ" @@ -79,10 +79,10 @@ "ପୂର୍ବାନୁମାନକୁ ପିନ୍ କରନ୍ତୁ" "ସର୍ଟକଟ୍‍ ଇନଷ୍ଟଲ୍‌ କରନ୍ତୁ" "ୟୁଜରଙ୍କ ବିନା ହସ୍ତକ୍ଷେପରେ ଶର୍ଟକଟ୍‌ ଯୋଡ଼ିବାକୁ ଆପକୁ ଅନୁମତି ଦିଏ।" - "ହୋମ୍‌ ସେଟିଙ୍ଗ ଏବଂ ଶର୍ଟକଟ୍‌ ପଢ଼ନ୍ତୁ" - "ହୋମରେ ସେଟିଙ୍ଗ ପଢ଼ିବାକୁ ଆପ ଏବଂ ଶର୍ଟକଟକୁ ଅନୁମତି ଦିଏ।" - "ହୋମ୍‌ ସେଟିଙ୍ଗ ଏବଂ ଶର୍ଟକଟ୍‌ ଲେଖନ୍ତୁ" - "ହୋମରେ ସେଟିଙ୍ଗ ଏବଂ ଶର୍ଟକଟ୍‌ ପରିବର୍ତ୍ତନ କରିବାକୁ ଆପକୁ ଅନୁମତି ଦିଏ।" + "ହୋମ ସେଟିଂସ ଏବଂ ସର୍ଟକଟ ପଢ଼ନ୍ତୁ" + "ହୋମରେ ସେଟିଂସ ଏବଂ ସର୍ଟକଟକୁ ପଢ଼ିବା ପାଇଁ ଆପକୁ ଅନୁମତି ଦିଏ।" + "ହୋମ ସେଟିଂସ ଏବଂ ସର୍ଟକଟ ଲେଖନ୍ତୁ" + "ହୋମରେ ସେଟିଂସ ଏବଂ ସର୍ଟକଟକୁ ପରିବର୍ତ୍ତନ କରିବା ପାଇଁ ଆପକୁ ଅନୁମତି ଦିଏ।" "ଫୋନ୍‌ କଲ୍‌ କରିବାକୁ %1$sକୁ ଅନୁମତି ଦିଆଯାଇ ନାହିଁ" "ୱିଜେଟ୍ ଲୋଡ୍ କରାଯାଇପାରିବ ନାହିଁ" "ୱିଜେଟ ସେଟିଂସ" @@ -103,7 +103,7 @@ "ଫୋଲ୍ଡର୍: %1$s, %2$d କିମ୍ବା ଅଧିକ ଆଇଟମ୍" "ୱାଲପେପର୍‌" "ୱାଲପେପର୍ ଏବଂ ଷ୍ଟାଇଲ୍" - "ହୋମ୍‌ ସେଟିଂସ୍" + "ହୋମ ସେଟିଂସ" "ଆପଣଙ୍କ ଆଡମିନଙ୍କ ଦ୍ୱାରା ଅକ୍ଷମ କରାଯାଇଛି" "ହୋମ୍‌ ସ୍କ୍ରିନ୍ ବୁଲାଇବାକୁ ଅନୁମତି ଦିଅନ୍ତୁ" "ଯେତେବେଳେ ଫୋନକୁ ବୁଲାଯାଇଥାଏ" @@ -112,7 +112,7 @@ "ବନ୍ଦ କରନ୍ତୁ" "ବିଜ୍ଞପ୍ତି ଆକ୍ସେସ୍‌ ଆବଶ୍ୟକ ଅଟେ" "ବିଜ୍ଞପ୍ତି ବିନ୍ଦୁ ଦେଖାଇବାକୁ, %1$s ପାଇଁ ଆପ୍‌ ବିଜ୍ଞପ୍ତି ଅନ୍‌ କରନ୍ତୁ" - "ସେଟିଂସ୍ ପରିବର୍ତ୍ତନ କରନ୍ତୁ" + "ସେଟିଂସ ପରିବର୍ତ୍ତନ କରନ୍ତୁ" "ବିଜ୍ଞପ୍ତି ଡଟ୍‌ଗୁଡ଼ିକୁ ଦେଖାନ୍ତୁ" "ହୋମ୍ ସ୍କ୍ରିନରେ ଆପ୍ ଆଇକନଗୁଡ଼ିକୁ ଯୋଗ କରନ୍ତୁ" "ନୂଆ ଆପ୍‌ ପାଇଁ" diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index ab88ef4e37..ce679a5d8e 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -96,6 +96,13 @@ public final class FeatureFlags { getDebugFlag("ENABLE_FLOATING_SEARCH_BAR", false, "Keep All Apps search bar at the bottom (but above keyboard if open)"); + public static final BooleanFlag INJECT_WEB_TOP = new DeviceFlag("INJECT_WEB_TOP", false, + "Show web suggestions on top of the search results"); + + public static final BooleanFlag USE_FALLBACK_APP_SEARCH = new DeviceFlag( + "USE_FALLBACK_APP_SEARCH", false, + "Use fallback launcher app search results instead of AiAi app results"); + public static final BooleanFlag COLLECT_SEARCH_HISTORY = new DeviceFlag( "COLLECT_SEARCH_HISTORY", false, "Allow launcher to collect search history for log"); diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 2609e549a5..d1f54cea29 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -16,6 +16,7 @@ package com.android.launcher3.touch; +import static android.view.Gravity.BOTTOM; import static android.view.Gravity.CENTER_VERTICAL; import static android.view.Gravity.END; import static android.view.Gravity.START; @@ -468,18 +469,42 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, - boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { + int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, + DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = new FrameLayout.LayoutParams(primaryIconParams); - primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END); + // We calculate the "midpoint" of the thumbnail area, and place the icons there. + // This is the place where the thumbnail area splits by default, in a near-50/50 split. + // It is usually not exactly 50/50, due to insets/screen cutouts. + int fullscreenInsetThickness = deviceProfile.getInsets().top; + int fullscreenMidpointFromBottom = ((deviceProfile.heightPx - fullscreenInsetThickness) + / 2); + float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.heightPx; + float insetPct = (float) fullscreenInsetThickness / deviceProfile.heightPx; + int spaceAboveSnapshots = deviceProfile.overviewTaskThumbnailTopMarginPx; + int overviewThumbnailAreaThickness = groupedTaskViewHeight - spaceAboveSnapshots; + int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); + int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); + + primaryIconParams.gravity = BOTTOM | (isRtl ? START : END); + secondaryIconParams.gravity = BOTTOM | (isRtl ? START : END); primaryIconView.setTranslationX(0); - primaryIconView.setTranslationY(-(taskIconHeight / 2f)); - secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END); secondaryIconView.setTranslationX(0); - secondaryIconView.setTranslationY(taskIconHeight / 2f); + if (splitConfig.initiatedFromSeascape) { + // if the split was initiated from seascape, + // the task on the right (secondary) is slightly larger + primaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset); + secondaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset + + taskIconHeight); + } else { + // if not, + // the task on the left (primary) is slightly larger + primaryIconView.setTranslationY(-bottomToMidpointOffset); + secondaryIconView.setTranslationY(-bottomToMidpointOffset + taskIconHeight); + } primaryIconView.setLayoutParams(primaryIconParams); secondaryIconView.setLayoutParams(secondaryIconParams); diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index 6e594e9cc6..1b171266fa 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -146,7 +146,8 @@ public interface PagedOrientationHandler { int taskIconMargin, int taskIconHeight, int thumbnailTopMargin, boolean isRtl); void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, - boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig); + int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, + DeviceProfile deviceProfile, StagedSplitBounds splitConfig); /* * The following two methods try to center the TaskMenuView in landscape by finding the center diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 926946ba7f..88c3bfe206 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -18,6 +18,7 @@ package com.android.launcher3.touch; import static android.view.Gravity.BOTTOM; import static android.view.Gravity.CENTER_HORIZONTAL; +import static android.view.Gravity.END; import static android.view.Gravity.START; import static android.view.Gravity.TOP; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; @@ -565,18 +566,70 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, - boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { + int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, + DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = new FrameLayout.LayoutParams(primaryIconParams); - primaryIconParams.gravity = TOP | CENTER_HORIZONTAL; - // shifts icon half a width left (height is used conveniently here since icons are square) - primaryIconView.setTranslationX(-(taskIconHeight / 2f)); + if (deviceProfile.isLandscape) { + // We calculate the "midpoint" of the thumbnail area, and place the icons there. + // This is the place where the thumbnail area splits by default, in a near-50/50 split. + // It is usually not exactly 50/50, due to insets/screen cutouts. + int fullscreenInsetThickness = deviceProfile.isSeascape() + ? deviceProfile.getInsets().right + : deviceProfile.getInsets().left; + int fullscreenMidpointFromBottom = ((deviceProfile.widthPx + - fullscreenInsetThickness) / 2); + float midpointFromBottomPct = (float) fullscreenMidpointFromBottom + / deviceProfile.widthPx; + float insetPct = (float) fullscreenInsetThickness / deviceProfile.widthPx; + int spaceAboveSnapshots = 0; + int overviewThumbnailAreaThickness = groupedTaskViewWidth - spaceAboveSnapshots; + int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness + * midpointFromBottomPct); + int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); + + if (deviceProfile.isSeascape()) { + primaryIconParams.gravity = TOP | (isRtl ? END : START); + secondaryIconParams.gravity = TOP | (isRtl ? END : START); + if (splitConfig.initiatedFromSeascape) { + // if the split was initiated from seascape, + // the task on the right (secondary) is slightly larger + primaryIconView.setTranslationX(bottomToMidpointOffset - taskIconHeight); + secondaryIconView.setTranslationX(bottomToMidpointOffset); + } else { + // if not, + // the task on the left (primary) is slightly larger + primaryIconView.setTranslationX(bottomToMidpointOffset + insetOffset + - taskIconHeight); + secondaryIconView.setTranslationX(bottomToMidpointOffset + insetOffset); + } + } else { + primaryIconParams.gravity = TOP | (isRtl ? START : END); + secondaryIconParams.gravity = TOP | (isRtl ? START : END); + if (!splitConfig.initiatedFromSeascape) { + // if the split was initiated from landscape, + // the task on the left (primary) is slightly larger + primaryIconView.setTranslationX(-bottomToMidpointOffset); + secondaryIconView.setTranslationX(-bottomToMidpointOffset + taskIconHeight); + } else { + // if not, + // the task on the right (secondary) is slightly larger + primaryIconView.setTranslationX(-bottomToMidpointOffset - insetOffset); + secondaryIconView.setTranslationX(-bottomToMidpointOffset - insetOffset + + taskIconHeight); + } + } + } else { + primaryIconParams.gravity = TOP | CENTER_HORIZONTAL; + // shifts icon half a width left (height is used here since icons are square) + primaryIconView.setTranslationX(-(taskIconHeight / 2f)); + secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL; + secondaryIconView.setTranslationX(taskIconHeight / 2f); + } primaryIconView.setTranslationY(0); - secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL; - secondaryIconView.setTranslationX(taskIconHeight / 2f); secondaryIconView.setTranslationY(0); primaryIconView.setLayoutParams(primaryIconParams); diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java index 9151796fc5..74b6a5b28e 100644 --- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java @@ -178,16 +178,46 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, - boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { + int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, + DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { super.setSplitIconParams(primaryIconView, secondaryIconView, taskIconHeight, - primarySnapshotWidth, primarySnapshotHeight, isRtl, deviceProfile, splitConfig); + primarySnapshotWidth, primarySnapshotHeight, groupedTaskViewHeight, + groupedTaskViewWidth, isRtl, deviceProfile, splitConfig); FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = (FrameLayout.LayoutParams) secondaryIconView.getLayoutParams(); - primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START); - secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START); + // We calculate the "midpoint" of the thumbnail area, and place the icons there. + // This is the place where the thumbnail area splits by default, in a near-50/50 split. + // It is usually not exactly 50/50, due to insets/screen cutouts. + int fullscreenInsetThickness = deviceProfile.getInsets().top; + int fullscreenMidpointFromBottom = ((deviceProfile.heightPx + - fullscreenInsetThickness) / 2); + float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.heightPx; + float insetPct = (float) fullscreenInsetThickness / deviceProfile.heightPx; + int spaceAboveSnapshots = deviceProfile.overviewTaskThumbnailTopMarginPx; + int overviewThumbnailAreaThickness = groupedTaskViewHeight - spaceAboveSnapshots; + int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); + int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); + + primaryIconParams.gravity = BOTTOM | (isRtl ? END : START); + secondaryIconParams.gravity = BOTTOM | (isRtl ? END : START); + primaryIconView.setTranslationX(0); + secondaryIconView.setTranslationX(0); + if (splitConfig.initiatedFromSeascape) { + // if the split was initiated from seascape, + // the task on the right (secondary) is slightly larger + primaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset); + secondaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset + + taskIconHeight); + } else { + // if not, + // the task on the left (primary) is slightly larger + primaryIconView.setTranslationY(-bottomToMidpointOffset); + secondaryIconView.setTranslationY(-bottomToMidpointOffset + taskIconHeight); + } + primaryIconView.setLayoutParams(primaryIconParams); secondaryIconView.setLayoutParams(secondaryIconParams); } diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java index cb714b2a8f..b40493ac25 100644 --- a/src/com/android/launcher3/util/SplitConfigurationOptions.java +++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java @@ -113,6 +113,14 @@ public final class SplitConfigurationOptions { * the bounds were originally in */ public final boolean appsStackedVertically; + /** + * If {@code true}, that means at the time of creation of this object, the phone was in + * seascape orientation. This is important on devices with insets, because they do not split + * evenly -- one of the insets must be slightly larger to account for the inset. + * From landscape, it is the leftTop task that expands slightly. + * From seascape, it is the rightBottom task that expands slightly. + */ + public final boolean initiatedFromSeascape; public final int leftTopTaskId; public final int rightBottomTaskId; @@ -128,11 +136,22 @@ public final class SplitConfigurationOptions { this.visualDividerBounds = new Rect(leftTopBounds.left, leftTopBounds.bottom, leftTopBounds.right, rightBottomBounds.top); appsStackedVertically = true; + initiatedFromSeascape = false; } else { // horizontal apps, vertical divider this.visualDividerBounds = new Rect(leftTopBounds.right, leftTopBounds.top, rightBottomBounds.left, leftTopBounds.bottom); appsStackedVertically = false; + // The following check is unreliable on devices without insets + // (initiatedFromSeascape will always be set to false.) This happens to be OK for + // all our current uses, but should be refactored. + // TODO: Create a more reliable check, or refactor how splitting works on devices + // with insets. + if (rightBottomBounds.width() > leftTopBounds.width()) { + initiatedFromSeascape = true; + } else { + initiatedFromSeascape = false; + } } leftTaskPercent = this.leftTopBounds.width() / (float) rightBottomBounds.right; diff --git a/tests/src/com/android/launcher3/compat/PromiseIconUiTest.java b/tests/src/com/android/launcher3/compat/PromiseIconUiTest.java index f34a29e9f8..92e3e64e4b 100644 --- a/tests/src/com/android/launcher3/compat/PromiseIconUiTest.java +++ b/tests/src/com/android/launcher3/compat/PromiseIconUiTest.java @@ -34,6 +34,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import java.util.UUID; +import java.util.concurrent.TimeUnit; /** @@ -44,6 +45,8 @@ import java.util.UUID; public class PromiseIconUiTest extends AbstractLauncherUiTest { private int mSessionId = -1; + // TODO(b/202985412): Revert to default timeout when PackageManager bug is fixed. + private static final long PROMISE_ICON_TIMEOUT = TimeUnit.SECONDS.toMillis(60); @Override public void setUp() throws Exception { @@ -85,7 +88,8 @@ public class PromiseIconUiTest extends AbstractLauncherUiTest { // Verify promise icon is added waitForLauncherCondition("Test Promise App not found on workspace", launcher -> - launcher.getWorkspace().getFirstMatch(findPromiseApp) != null); + launcher.getWorkspace().getFirstMatch(findPromiseApp) != null, + PROMISE_ICON_TIMEOUT); // Remove session mTargetContext.getPackageManager().getPackageInstaller().abandonSession(mSessionId); @@ -93,7 +97,8 @@ public class PromiseIconUiTest extends AbstractLauncherUiTest { // Verify promise icon is removed waitForLauncherCondition("Test Promise App not removed from workspace", launcher -> - launcher.getWorkspace().getFirstMatch(findPromiseApp) == null); + launcher.getWorkspace().getFirstMatch(findPromiseApp) == null, + PROMISE_ICON_TIMEOUT); } @Test @@ -111,6 +116,7 @@ public class PromiseIconUiTest extends AbstractLauncherUiTest { // Verify promise icon is not added waitForLauncherCondition("Test Promise App not found on workspace", launcher -> - launcher.getWorkspace().getFirstMatch(findPromiseApp) == null); + launcher.getWorkspace().getFirstMatch(findPromiseApp) == null, + PROMISE_ICON_TIMEOUT); } } diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 5abdcd3508..02b2cff52e 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -33,6 +33,7 @@ import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.graphics.Point; import android.os.Debug; import android.os.Process; import android.os.RemoteException; @@ -55,6 +56,8 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.statemanager.StateManager; +import com.android.launcher3.tapl.HomeAllApps; +import com.android.launcher3.tapl.HomeAppIcon; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType; import com.android.launcher3.tapl.TestHelpers; @@ -602,4 +605,26 @@ public abstract class AbstractLauncherUiTest { protected void onLauncherActivityClose(Launcher launcher) { } + + protected HomeAppIcon createShortcutInCenterIfNotExist(String name) { + Point dimension = mLauncher.getWorkspace().getIconGridDimensions(); + return createShortcutIfNotExist(name, dimension.x / 2, dimension.y / 2); + } + + protected HomeAppIcon createShortcutIfNotExist(String name, int cellX, int cellY) { + HomeAppIcon homeAppIcon = mLauncher.getWorkspace().tryGetWorkspaceAppIcon(name); + if (homeAppIcon == null) { + HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps(); + allApps.freeze(); + try { + allApps.getAppIcon(name).dragToWorkspace(cellX, cellY); + } finally { + allApps.unfreeze(); + } + homeAppIcon = mLauncher.getWorkspace().getWorkspaceAppIcon(name); + } + return homeAppIcon; + } + + } diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index da8bf6e882..61ec8bd9c5 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -365,27 +365,11 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } } - private HomeAppIcon createShortcutIfNotExist(String name) { - HomeAppIcon homeAppIcon = mLauncher.getWorkspace().tryGetWorkspaceAppIcon(name); - if (homeAppIcon == null) { - HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps(); - allApps.freeze(); - try { - allApps.getAppIcon(name).dragToWorkspace(false, false); - } finally { - allApps.unfreeze(); - } - homeAppIcon = mLauncher.getWorkspace().getWorkspaceAppIcon(name); - } - return homeAppIcon; - } - - @Ignore("b/205014516") @Test @PortraitLandscape public void testDragToFolder() throws Exception { - final HomeAppIcon playStoreIcon = createShortcutIfNotExist("Play Store"); - final HomeAppIcon gmailIcon = createShortcutIfNotExist("Gmail"); + final HomeAppIcon playStoreIcon = createShortcutIfNotExist("Play Store", 0, 1); + final HomeAppIcon gmailIcon = createShortcutIfNotExist("Gmail", 1, 1); FolderIcon folderIcon = gmailIcon.dragToIcon(playStoreIcon); @@ -399,7 +383,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { assertNull("Play Store should be moved to a folder.", workspace.tryGetWorkspaceAppIcon("Play Store")); - final HomeAppIcon youTubeIcon = createShortcutIfNotExist("YouTube"); + final HomeAppIcon youTubeIcon = createShortcutInCenterIfNotExist("YouTube"); folderIcon = youTubeIcon.dragToIcon(folderIcon); folder = folderIcon.open(); @@ -433,8 +417,8 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @PortraitLandscape public void testDeleteFromWorkspace() throws Exception { // test delete both built-in apps and user-installed app from workspace - for (String appName : new String[] {"Gmail", "Play Store", APP_NAME}) { - final HomeAppIcon homeAppIcon = createShortcutIfNotExist(appName); + for (String appName : new String[]{"Gmail", "Play Store", APP_NAME}) { + final HomeAppIcon homeAppIcon = createShortcutInCenterIfNotExist(appName); Workspace workspace = mLauncher.getWorkspace().deleteAppIcon(homeAppIcon); assertNull(appName + " app was found after being deleted from workspace", workspace.tryGetWorkspaceAppIcon(appName)); @@ -458,7 +442,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { TestUtil.installDummyApp(); try { verifyAppUninstalledFromAllApps( - createShortcutIfNotExist(DUMMY_APP_NAME).uninstall(), DUMMY_APP_NAME); + createShortcutInCenterIfNotExist(DUMMY_APP_NAME).uninstall(), DUMMY_APP_NAME); } finally { TestUtil.uninstallDummyApp(); } @@ -509,7 +493,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } // test to move a shortcut to other cell. - final HomeAppIcon launcherTestAppIcon = createShortcutIfNotExist(APP_NAME); + final HomeAppIcon launcherTestAppIcon = createShortcutInCenterIfNotExist(APP_NAME); for (Point target : targets) { launcherTestAppIcon.dragToWorkspace(target.x, target.y); } diff --git a/tests/tapl/com/android/launcher3/tapl/HomeAppIcon.java b/tests/tapl/com/android/launcher3/tapl/HomeAppIcon.java index 4b36dc0e42..baabe12688 100644 --- a/tests/tapl/com/android/launcher3/tapl/HomeAppIcon.java +++ b/tests/tapl/com/android/launcher3/tapl/HomeAppIcon.java @@ -115,7 +115,7 @@ public abstract class HomeAppIcon extends AppIcon implements FolderDragTarget, W String.format("want to drag the icon to cell(%d, %d)", cellX, cellY)) ) { final Supplier dest = () -> Workspace.getCellCenter(mLauncher, cellX, cellY); - Workspace.dragIconToWorkspace(mLauncher, this, dest, true, getLongPressIndicator(), + Workspace.dragIconToWorkspace(mLauncher, this, dest, getLongPressIndicator(), () -> addExpectedEventsForLongClick(), null); try (LauncherInstrumentation.Closable ignore = mLauncher.addContextLayer("dragged")) { WorkspaceAppIcon appIcon = diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 02a6b91209..a28eac6bad 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -139,7 +139,7 @@ abstract class Launchable { mLauncher.waitForLauncherObject(longPressIndicator); LauncherInstrumentation.log("movePointerForStartDrag: indicator"); mLauncher.movePointer(iconCenter, dragStartCenter, DEFAULT_DRAG_STEPS, false, - downTime, true, LauncherInstrumentation.GestureScope.INSIDE); + downTime, downTime, true, LauncherInstrumentation.GestureScope.INSIDE); } private int getStartDragThreshold() { diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index db72cc3e88..e35ade8c62 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -1109,11 +1109,13 @@ public final class LauncherInstrumentation { } } - @NonNull UiObject2 waitForObjectInContainer(UiObject2 container, BySelector selector) { + @NonNull + UiObject2 waitForObjectInContainer(UiObject2 container, BySelector selector) { return waitForObjectsInContainer(container, selector).get(0); } - @NonNull List waitForObjectsInContainer( + @NonNull + List waitForObjectsInContainer( UiObject2 container, BySelector selector) { try { final List objects = container.wait( @@ -1408,13 +1410,13 @@ public final class LauncherInstrumentation { final Point end = new Point(endX, endY); sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, start, gestureScope); final long endTime = movePointer( - start, end, steps, false, downTime, slowDown, gestureScope); + start, end, steps, false, downTime, downTime, slowDown, gestureScope); sendPointer(downTime, endTime, MotionEvent.ACTION_UP, end, gestureScope); } - long movePointer(Point start, Point end, int steps, boolean isDecelerating, - long downTime, boolean slowDown, GestureScope gestureScope) { - long endTime = movePointer(downTime, downTime, steps * GESTURE_STEP_MS, + long movePointer(Point start, Point end, int steps, boolean isDecelerating, long downTime, + long startTime, boolean slowDown, GestureScope gestureScope) { + long endTime = movePointer(downTime, startTime, steps * GESTURE_STEP_MS, isDecelerating, start, end, gestureScope); if (slowDown) { endTime = movePointer(downTime, endTime + GESTURE_STEP_MS, 5 * GESTURE_STEP_MS, end, diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java index 4f4ce30774..3bc53893ff 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -178,10 +178,10 @@ public final class Workspace extends Home { * pageDelta: 3, the latest page that can be created is 2) the icon will be dragged onto the * page that can be created and is closest to the target page. * - * @param homeAppIcon - icon to drag. - * @param pageDelta - how many pages should the icon be dragged from the current page. - * It can be a negative value. currentPage + pageDelta should be greater - * than or equal to 0. + * @param homeAppIcon - icon to drag. + * @param pageDelta - how many pages should the icon be dragged from the current page. + * It can be a negative value. currentPage + pageDelta should be greater + * than or equal to 0. */ public void dragIcon(HomeAppIcon homeAppIcon, int pageDelta) { if (mHotseat.getVisibleBounds().height() > mHotseat.getVisibleBounds().width()) { @@ -246,7 +246,6 @@ public final class Workspace extends Home { dragIconToWorkspace( mLauncher, homeAppIcon, () -> getDropPointFromDropTargetBar(mLauncher, DELETE_TARGET_TEXT_ID), - true, /* decelerating */ homeAppIcon.getLongPressIndicator(), () -> mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT), null); @@ -261,8 +260,9 @@ public final class Workspace extends Home { /** * Uninstall the appIcon by dragging it to the 'uninstall' drop point of the drop_target_bar. * - * @param launcher the root TAPL instrumentation object of {@link LauncherInstrumentation} type. - * @param homeAppIcon to be uninstalled. + * @param launcher the root TAPL instrumentation object of {@link + * LauncherInstrumentation} type. + * @param homeAppIcon to be uninstalled. * @param launcher the root TAPL instrumentation object of {@link * LauncherInstrumentation} type. * @param homeAppIcon to be uninstalled. @@ -276,7 +276,6 @@ public final class Workspace extends Home { dragIconToWorkspace( launcher, homeAppIcon, () -> getDropPointFromDropTargetBar(launcher, UNINSTALL_TARGET_TEXT_ID), - true, /* decelerating */ homeAppIcon.getLongPressIndicator(), expectLongClickEvents, null); @@ -353,23 +352,24 @@ public final class Workspace extends Home { expectDropEvents = () -> launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } - dragIconToWorkspace(launcher, launchable, () -> dest, false, longPressIndicator, + dragIconToWorkspace(launcher, launchable, () -> dest, longPressIndicator, expectLongClickEvents, expectDropEvents); } /** - * Drag icon in workspace to else where. + * Drag icon in workspace to else where and drop it immediately. + * (There is no slow down time before drop event) * This function expects the launchable is inside the workspace and there is no drop event. */ static void dragIconToWorkspace(LauncherInstrumentation launcher, Launchable launchable, Supplier destSupplier, String longPressIndicator) { - dragIconToWorkspace(launcher, launchable, destSupplier, false, longPressIndicator, + dragIconToWorkspace(launcher, launchable, destSupplier, longPressIndicator, () -> launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT), null); } static void dragIconToWorkspace( LauncherInstrumentation launcher, Launchable launchable, Supplier dest, - boolean isDecelerating, String longPressIndicator, Runnable expectLongClickEvents, + String longPressIndicator, Runnable expectLongClickEvents, @Nullable Runnable expectDropEvents) { try (LauncherInstrumentation.Closable ignored = launcher.addContextLayer( "want to drag icon to workspace")) { @@ -391,7 +391,7 @@ public final class Workspace extends Home { Point finalDragStart = dragStart; executeAndWaitForPageScroll(launcher, () -> launcher.movePointer(finalDragStart, screenEdge, DEFAULT_DRAG_STEPS, - isDecelerating, downTime, true, + true, downTime, downTime, true, LauncherInstrumentation.GestureScope.INSIDE)); targetDest.x += displayX * (targetDest.x > 0 ? -1 : 1); dragStart = screenEdge; @@ -399,8 +399,9 @@ public final class Workspace extends Home { // targetDest.x is now between 0 and displayX so we found the target page, // we just have to put move the icon to the destination and drop it - launcher.movePointer(dragStart, targetDest, DEFAULT_DRAG_STEPS, isDecelerating, - downTime, true, LauncherInstrumentation.GestureScope.INSIDE); + launcher.movePointer(dragStart, targetDest, DEFAULT_DRAG_STEPS, true, + downTime, SystemClock.uptimeMillis(), false, + LauncherInstrumentation.GestureScope.INSIDE); dropDraggedIcon(launcher, targetDest, downTime, expectDropEvents); } } @@ -488,4 +489,4 @@ public final class Workspace extends Home { return widget != null ? new Widget(mLauncher, widget) : null; } } -} \ No newline at end of file +}