From 8a9cc9689ab4478f9e4aa27d6889b355df730bf3 Mon Sep 17 00:00:00 2001 From: Sreyas Date: Thu, 18 Mar 2021 19:54:15 -0700 Subject: [PATCH 01/14] Shared element transition between image and sharesheet. Bug: 182373655 Test: Manual Change-Id: I6f5abffa0c4911d939ba45476fe1301d65b840cf --- .../quickstep/util/ImageActionUtils.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java index 0f2d778623..2285d74d73 100644 --- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java +++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java @@ -19,9 +19,12 @@ package com.android.quickstep.util; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; +import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; +import android.app.Activity; +import android.app.ActivityOptions; import android.app.prediction.AppTarget; import android.content.ClipData; import android.content.ClipDescription; @@ -37,11 +40,13 @@ import android.graphics.Rect; import android.graphics.RectF; import android.net.Uri; import android.util.Log; +import android.view.View; import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; import androidx.core.content.FileProvider; +import com.android.internal.app.ChooserActivity; import com.android.launcher3.BuildConfig; import com.android.quickstep.SystemUiProxy; import com.android.systemui.shared.recents.model.Task; @@ -125,6 +130,22 @@ public class ImageActionUtils { tag)); } + /** + * Launch the activity to share image with shared element transition. + */ + @UiThread + public static void startShareActivity(Context context, Supplier bitmapSupplier, + Rect crop, Intent intent, String tag, View sharedElement) { + if (bitmapSupplier.get() == null) { + Log.e(tag, "No snapshot available, not starting share."); + return; + } + + UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(context, + bitmapSupplier.get(), crop, intent, ImageActionUtils::getShareIntentForImageUri, + tag, sharedElement)); + } + /** * Starts activity based on given intent created from image uri. */ @@ -141,6 +162,30 @@ public class ImageActionUtils { } } + /** + * Starts activity based on given intent created from image uri with shared element transition. + */ + @WorkerThread + public static void persistBitmapAndStartActivity(Context context, Bitmap bitmap, Rect crop, + Intent intent, BiFunction uriToIntentMap, String tag, + View scaledImage) { + Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent); + + // Work around b/159412574 + if (intents.length == 1) { + MAIN_EXECUTOR.execute(() -> context.startActivity(intents[0], + ActivityOptions.makeSceneTransitionAnimation((Activity) context, scaledImage, + ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME).toBundle())); + + } else { + MAIN_EXECUTOR.execute(() -> context.startActivities(intents, + ActivityOptions.makeSceneTransitionAnimation((Activity) context, scaledImage, + ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME).toBundle())); + } + } + + + /** * Converts image bitmap to Uri by temporarily saving bitmap to cache, and creating Uri pointing * to that location. Used to be able to share an image with another app. From e3f7d0d1b4210111126e9e8dd25386985b004733 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 5 Apr 2021 12:41:06 -0700 Subject: [PATCH 02/14] Add split placeholder view above OverviewScrim Only show single split option for landscape and seascape overview menu options. Bug: 181705607 Change-Id: I577fbaed41b5debd007c953851ec2056988057d9 --- quickstep/res/layout/overview_panel.xml | 3 +-- .../com/android/launcher3/BaseQuickstepLauncher.java | 11 ++++++++--- .../uioverrides/BaseRecentsViewStateController.java | 5 +++++ .../uioverrides/RecentsViewStateController.java | 2 +- .../android/launcher3/graphics/OverviewScrim.java | 7 +++++++ .../launcher3/touch/LandscapePagedViewHandler.java | 12 +++--------- .../launcher3/touch/PortraitPagedViewHandler.java | 11 ++++++----- .../launcher3/touch/SeascapePagedViewHandler.java | 12 +++--------- 8 files changed, 34 insertions(+), 29 deletions(-) diff --git a/quickstep/res/layout/overview_panel.xml b/quickstep/res/layout/overview_panel.xml index 394e8808c8..9d71000276 100644 --- a/quickstep/res/layout/overview_panel.xml +++ b/quickstep/res/layout/overview_panel.xml @@ -19,8 +19,7 @@ android:id="@+id/split_placeholder" android:layout_width="match_parent" android:layout_height="@dimen/split_placeholder_size" - android:background="@android:color/white" - android:alpha=".8" + android:background="@android:color/darker_gray" android:visibility="gone" /> config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR)); setter.setFloat(scrim, SCRIM_MULTIPLIER, 1f, config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR)); + if (toState.areElementsVisible(mLauncher, LauncherState.SPLIT_PLACHOLDER_VIEW)) { + scrim.updateStableScrimmedView(mLauncher.getSplitPlaceholderView()); + } else { + scrim.updateStableScrimmedView(mLauncher.getOverviewPanel()); + } setter.setFloat( mRecentsView, getTaskModalnessProperty(), diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 6929b5dc9c..9097c8b4c2 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -113,7 +113,7 @@ public final class RecentsViewStateController extends ANIM_OVERVIEW_ACTIONS_FADE, LINEAR)); float splitPlaceholderAlpha = state.areElementsVisible(mLauncher, SPLIT_PLACHOLDER_VIEW) ? - 1 : 0; + 0.7f : 0; propertySetter.setFloat(mRecentsView.getSplitPlaceholder(), ALPHA_FLOAT, splitPlaceholderAlpha, LINEAR); } diff --git a/src/com/android/launcher3/graphics/OverviewScrim.java b/src/com/android/launcher3/graphics/OverviewScrim.java index 7d52744b44..7aadb962f7 100644 --- a/src/com/android/launcher3/graphics/OverviewScrim.java +++ b/src/com/android/launcher3/graphics/OverviewScrim.java @@ -66,6 +66,13 @@ public class OverviewScrim extends Scrim { mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel(); } + /** + * @param view The view we want the scrim to be behind + */ + public void updateStableScrimmedView(View view) { + mStableScrimmedView = view; + } + public void updateCurrentScrimmedView(ViewGroup root) { // Find the lowest view that is at or above the view we want to show the scrim behind. mCurrentScrimmedView = mStableScrimmedView; diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 19dfe15f62..dd5611e7de 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -24,7 +24,6 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.HORIZONTAL; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN; -import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE; import android.content.res.Resources; import android.graphics.PointF; @@ -45,7 +44,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.util.OverScroller; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; public class LandscapePagedViewHandler implements PagedOrientationHandler { @@ -308,15 +307,10 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { @Override public List getSplitPositionOptions(DeviceProfile dp) { - List options = new ArrayList<>(2); - // Add left/right options where left => position top, right => position bottom - options.add(new SplitPositionOption( + // Add "left" side of phone which is actually the top + return Collections.singletonList(new SplitPositionOption( R.drawable.ic_split_screen, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN)); - options.add(new SplitPositionOption( - R.drawable.ic_split_screen, R.string.split_screen_position_right, - STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE)); - return options; } @Override diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 29be62733c..2ca0340ee7 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -306,16 +306,17 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override public List getSplitPositionOptions(DeviceProfile dp) { - List options = new ArrayList<>(2); + List options = new ArrayList<>(1); // TODO: Add in correct icons - if (dp.isLandscape) { // or seascape + if (dp.isSeascape()) { // or seascape // Add left/right options + options.add(new SplitPositionOption( + R.drawable.ic_split_screen, R.string.split_screen_position_right, + STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN)); + } else if (dp.isLandscape) { options.add(new SplitPositionOption( R.drawable.ic_split_screen, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN)); - options.add(new SplitPositionOption( - R.drawable.ic_split_screen, R.string.split_screen_position_right, - STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE)); } else { // Only add top option options.add(new SplitPositionOption( diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java index b5252f73ea..bd6e31be02 100644 --- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java @@ -20,7 +20,6 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.HORIZONTAL; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN; -import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE; import android.content.res.Resources; import android.graphics.PointF; @@ -33,7 +32,7 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; public class SeascapePagedViewHandler extends LandscapePagedViewHandler { @@ -96,15 +95,10 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { @Override public List getSplitPositionOptions(DeviceProfile dp) { - List options = new ArrayList<>(2); - // Add left/right options where left => position bottom, right => position top - options.add(new SplitPositionOption( - R.drawable.ic_split_screen, R.string.split_screen_position_left, - STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE)); - options.add(new SplitPositionOption( + // Add "right" option which is actually the top + return Collections.singletonList(new SplitPositionOption( R.drawable.ic_split_screen, R.string.split_screen_position_right, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN)); - return options; } /* ---------- The following are only used by TaskViewTouchHandler. ---------- */ From 71b954a25789e4ef02a05aa8b0b65935b77073de Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 5 Apr 2021 16:59:15 -0400 Subject: [PATCH 03/14] Update device padding to allocate more space to workspaceBottomPAdding. Bug: 175329686 Test: verify using DeviceProfile dump Change-Id: I7054a49bf33e2c44bd1886a88dbed75c6807ab37 --- res/xml/size_limits_80x104.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/xml/size_limits_80x104.xml b/res/xml/size_limits_80x104.xml index e11bc5ecfa..f3755498dc 100644 --- a/res/xml/size_limits_80x104.xml +++ b/res/xml/size_limits_80x104.xml @@ -36,11 +36,11 @@ launcher:a="0" launcher:b="16dp"/> From 2043f2009f9de2d7f59ba8ed733b95c55ac2299d Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Mon, 5 Apr 2021 16:47:01 -0500 Subject: [PATCH 04/14] [Hotseat] Don't show hotseat edu in tests Bug: 180972179 Test: presubmit Change-Id: I2e82c0c90804d0149717ebdcd83fdac9c822ce7d --- .../com/android/quickstep/util/QuickstepOnboardingPrefs.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java index 1544f00d49..6d6e802231 100644 --- a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java +++ b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java @@ -26,6 +26,7 @@ import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import android.content.SharedPreferences; import com.android.launcher3.LauncherState; +import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.hybridhotseat.HotseatPredictionController; @@ -63,7 +64,8 @@ public class QuickstepOnboardingPrefs extends OnboardingPrefs }); } - if (!hasReachedMaxCount(HOTSEAT_DISCOVERY_TIP_COUNT)) { + if (!Utilities.IS_RUNNING_IN_TEST_HARNESS + && !hasReachedMaxCount(HOTSEAT_DISCOVERY_TIP_COUNT)) { stateManager.addStateListener(new StateListener() { boolean mFromAllApps = false; From e78a70ba836c821f49b722d041a72b712bec75eb Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 29 Mar 2021 16:45:59 -0700 Subject: [PATCH 05/14] Send a notification when there's an uncaught exception Guarded by FeatureFlag.NOTIFIY_CRASHES and IS_DEBUG_DEVICE Test: Add a crash in the code, ensure a notification is posted and can share the stack trace Change-Id: I828cca3a99debf62f492960eb3cdc699cc0d7f9a --- src/com/android/launcher3/Launcher.java | 42 +++++++++++++++++++ .../launcher3/config/FeatureFlags.java | 3 ++ 2 files changed, 45 insertions(+) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index f7cf66bf6a..f4ffa1f2a1 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -60,6 +60,10 @@ import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.annotation.TargetApi; +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetManager; import android.content.ActivityNotFoundException; @@ -373,6 +377,44 @@ public class Launcher extends StatefulActivity implements Launche .build()); } + if (Utilities.IS_DEBUG_DEVICE && FeatureFlags.NOTIFY_CRASHES.get()) { + final String notificationChannelId = "com.android.launcher3.Debug"; + final String notificationChannelName = "Debug"; + final String notificationTag = "Debug"; + final int notificationId = 0; + + NotificationManager notificationManager = getSystemService(NotificationManager.class); + notificationManager.createNotificationChannel(new NotificationChannel( + notificationChannelId, notificationChannelName, + NotificationManager.IMPORTANCE_HIGH)); + + Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> { + String stackTrace = Log.getStackTraceString(throwable); + + Intent shareIntent = new Intent(Intent.ACTION_SEND); + shareIntent.setType("text/plain"); + shareIntent.putExtra(Intent.EXTRA_TEXT, stackTrace); + shareIntent = Intent.createChooser(shareIntent, null); + PendingIntent sharePendingIntent = PendingIntent.getActivity( + this, 0, shareIntent, PendingIntent.FLAG_UPDATE_CURRENT + ); + + Notification notification = new Notification.Builder(this, notificationChannelId) + .setSmallIcon(android.R.drawable.ic_menu_close_clear_cancel) + .setContentTitle("Launcher crash detected!") + .setStyle(new Notification.BigTextStyle().bigText(stackTrace)) + .addAction(android.R.drawable.ic_menu_share, "Share", sharePendingIntent) + .build(); + notificationManager.notify(notificationTag, notificationId, notification); + + Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = + Thread.getDefaultUncaughtExceptionHandler(); + if (defaultUncaughtExceptionHandler != null) { + defaultUncaughtExceptionHandler.uncaughtException(thread, throwable); + } + }); + } + super.onCreate(savedInstanceState); LauncherAppState app = LauncherAppState.getInstance(this); diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index c7f01334a6..f5fbe2b11a 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -218,6 +218,9 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_ENFORCED_ROUNDED_CORNERS = new DeviceFlag( "ENABLE_ENFORCED_ROUNDED_CORNERS", true, "Enforce rounded corners on all App Widgets"); + public static final BooleanFlag NOTIFY_CRASHES = getDebugFlag("NOTIFY_CRASHES", false, + "Sends a notification whenever launcher encounters an uncaught exception."); + public static void initialize(Context context) { synchronized (sDebugFlags) { for (DebugFlag flag : sDebugFlags) { From 6a74e65953adfbef2fc29951cde82e40272bf1b5 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 25 Mar 2021 17:15:18 -0700 Subject: [PATCH 06/14] Explicitly set which taskbar view is visible at each caller This makes it more clear which taskbar view is expected for particular code flows. Also makes it easier to set it to null in cleanup(). Test: call cleanup() while taskbarOnHome is invisible, ensure hotseat icons go back to being visible Bug: 182512211 Fixes: 183633496 Change-Id: I680a15582c8034a049b20e035b4d54f5ea5aee04 --- .../launcher3/taskbar/TaskbarController.java | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java index de23ad2efa..c4cbf8b761 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java @@ -88,7 +88,6 @@ public class TaskbarController { private @Nullable Animator mAnimator; private boolean mIsAnimatingToLauncher; - private boolean mIsAnimatingToApp; public TaskbarController(BaseQuickstepLauncher launcher, TaskbarContainerView taskbarContainerView, TaskbarView taskbarViewOnHome) { @@ -250,7 +249,9 @@ public class TaskbarController { mHotseatController.init(); mRecentsController.init(); - updateWhichTaskbarViewIsVisible(); + setWhichTaskbarViewIsVisible(mLauncher.hasBeenResumed() + ? mTaskbarViewOnHome + : mTaskbarViewInApp); } private TaskbarStateHandlerCallbacks createTaskbarStateHandlerCallbacks() { @@ -284,6 +285,8 @@ public class TaskbarController { mTaskbarAnimationController.cleanup(); mHotseatController.cleanup(); mRecentsController.cleanup(); + + setWhichTaskbarViewIsVisible(null); } private void removeFromWindowManager() { @@ -364,7 +367,7 @@ public class TaskbarController { @Override public void onAnimationEnd(Animator animation) { mIsAnimatingToLauncher = false; - updateWhichTaskbarViewIsVisible(); + setWhichTaskbarViewIsVisible(mTaskbarViewOnHome); } }); @@ -377,14 +380,12 @@ public class TaskbarController { anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { - mIsAnimatingToApp = true; mTaskbarViewInApp.updateHotseatItemsVisibility(); - updateWhichTaskbarViewIsVisible(); + setWhichTaskbarViewIsVisible(mTaskbarViewInApp); } @Override public void onAnimationEnd(Animator animation) { - mIsAnimatingToApp = false; } }); return anim.buildAnim(); @@ -487,18 +488,12 @@ public class TaskbarController { mTaskbarViewOnHome.getHeight() - hotseatBounds.bottom); } - private void updateWhichTaskbarViewIsVisible() { - boolean isInApp = !mLauncher.hasBeenResumed() || mIsAnimatingToLauncher - || mIsAnimatingToApp; - if (isInApp) { - mTaskbarViewInApp.setVisibility(View.VISIBLE); - mTaskbarViewOnHome.setVisibility(View.INVISIBLE); - mLauncher.getHotseat().setIconsAlpha(0); - } else { - mTaskbarViewInApp.setVisibility(View.INVISIBLE); - mTaskbarViewOnHome.setVisibility(View.VISIBLE); - mLauncher.getHotseat().setIconsAlpha(1); - } + private void setWhichTaskbarViewIsVisible(@Nullable TaskbarView visibleTaskbar) { + mTaskbarViewInApp.setVisibility(visibleTaskbar == mTaskbarViewInApp + ? View.VISIBLE : View.INVISIBLE); + mTaskbarViewOnHome.setVisibility(visibleTaskbar == mTaskbarViewOnHome + ? View.VISIBLE : View.INVISIBLE); + mLauncher.getHotseat().setIconsAlpha(visibleTaskbar != mTaskbarViewInApp ? 1f : 0f); } /** From 23b7fea6ebd5473a80369263bdd4549a97b3b697 Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Mon, 5 Apr 2021 15:53:51 -0700 Subject: [PATCH 07/14] Overview - update Clear All and Empty message drawing Update Clear All and Empty message to use primary color, not workspace color, as they are drawn on floating background now, not wallpaper. Bug: 184260454 Fixes: 184260454 Test: local build, flash and run Change-Id: Ie8ef4b7ace3053c2068a27b7cbedbbb039fc36d8 --- quickstep/res/layout/overview_clear_all_button.xml | 2 +- quickstep/res/layout/overview_panel.xml | 1 - quickstep/src/com/android/quickstep/views/RecentsView.java | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quickstep/res/layout/overview_clear_all_button.xml b/quickstep/res/layout/overview_clear_all_button.xml index c61610a438..1ee726e62e 100644 --- a/quickstep/res/layout/overview_clear_all_button.xml +++ b/quickstep/res/layout/overview_clear_all_button.xml @@ -21,5 +21,5 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/recents_clear_all" - android:textColor="?attr/workspaceTextColor" + android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> \ No newline at end of file diff --git a/quickstep/res/layout/overview_panel.xml b/quickstep/res/layout/overview_panel.xml index 394e8808c8..34b7ee3ef3 100644 --- a/quickstep/res/layout/overview_panel.xml +++ b/quickstep/res/layout/overview_panel.xml @@ -30,7 +30,6 @@ android:accessibilityPaneTitle="@string/accessibility_recent_apps" android:clipChildren="false" android:clipToPadding="false" - android:theme="@style/HomeScreenElementTheme" android:visibility="invisible" /> Date: Mon, 5 Apr 2021 16:14:39 -0700 Subject: [PATCH 08/14] Cleanup taskbar touchableInsets - Remove obsolete visibleInsets hack and isDraggingItem() check - Have TaskbarController determine whether taskbar is touchable, rather than TaskbarContainerView. - Disallow touches during transition to home (can potentially improve this later) Test: Swupe home, tap taskbar folder during transition, ensure don't end up in broken state with the uninteractable folder open Bug: 182512211 Change-Id: Id625ce8b9b876a8a1b450b7d6fb771540e23bc08 --- .../launcher3/taskbar/TaskbarContainerView.java | 16 +++++----------- .../launcher3/taskbar/TaskbarController.java | 9 +++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java index 5202d91684..ccf6b41e5d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java @@ -27,7 +27,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.R; -import com.android.launcher3.anim.AlphaUpdateListener; import com.android.launcher3.util.TouchController; import com.android.launcher3.views.BaseDragLayer; import com.android.systemui.shared.system.ViewTreeObserverWrapper; @@ -83,18 +82,13 @@ public class TaskbarContainerView extends BaseDragLayer private ViewTreeObserverWrapper.OnComputeInsetsListener createTaskbarInsetsComputer() { return insetsInfo -> { - if (getAlpha() < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD - || mTaskbarView.getVisibility() != VISIBLE || mTaskbarView.isDraggingItem()) { - // We're invisible or dragging out of taskbar, let touches pass through us. + if (mControllerCallbacks.isTaskbarTouchable()) { + // Accept touches anywhere in our bounds. + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME); + } else { + // Let touches pass through us. insetsInfo.touchableRegion.setEmpty(); insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); - // TODO(b/182234653): Shouldn't need to do this, but for the meantime, reporting - // that visibleInsets is empty allows DragEvents through. Setting them as completely - // empty reverts to default behavior, so set 1 px instead. - insetsInfo.visibleInsets.set(0, 0, 0, 1); - } else { - // We're visible again, accept touches anywhere in our bounds. - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME); } // TaskbarContainerView provides insets to other apps based on contentInsets. These diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java index de23ad2efa..bd22bc5fa0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java @@ -42,6 +42,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherState; import com.android.launcher3.QuickstepTransitionManager; import com.android.launcher3.R; +import com.android.launcher3.anim.AlphaUpdateListener; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; @@ -141,6 +142,13 @@ public class TaskbarController { setTaskbarWindowFullscreen(false); } } + + @Override + public boolean isTaskbarTouchable() { + return mTaskbarContainerView.getAlpha() > AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD + && mTaskbarViewInApp.getVisibility() == View.VISIBLE + && !mIsAnimatingToLauncher; + } }; } @@ -549,6 +557,7 @@ public class TaskbarController { */ protected interface TaskbarContainerViewCallbacks { void onViewRemoved(); + boolean isTaskbarTouchable(); } /** From 9f436dfe8ebc046670ca241c3328dc02d92a08d1 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 5 Apr 2021 16:07:16 -0700 Subject: [PATCH 09/14] Ensure taskbar animation ends when running window animation does - Store the possible parallel animation to cancel/end in AbsSwipeUpHandler#endRunningWindowAnim() Test: 1. remove taskbar during transition, ensure cleaned up properly 2. open a second app during transition to home, ensure taskbar maintains correct visibility Bug: 182512211 Change-Id: I71a6b6ce624113d43ad5a599cb5cfec28a555310 --- .../com/android/quickstep/AbsSwipeUpHandler.java | 15 ++++++++++++++- .../android/quickstep/BaseActivityInterface.java | 4 +++- .../quickstep/LauncherActivityInterface.java | 8 +++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index b7c6743780..5a3e009b8d 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -217,6 +217,8 @@ public abstract class AbsSwipeUpHandler, // Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise private RunningWindowAnim mRunningWindowAnim; + // Possible second animation running at the same time as mRunningWindowAnim + private Animator mParallelRunningAnim; private boolean mIsMotionPaused; private boolean mHasMotionEverBeenPaused; @@ -798,6 +800,13 @@ public abstract class AbsSwipeUpHandler, mRunningWindowAnim.end(); } } + if (mParallelRunningAnim != null) { + if (cancel) { + mParallelRunningAnim.cancel(); + } else { + mParallelRunningAnim.end(); + } + } } private void onSettledOnEndTarget() { @@ -1060,7 +1069,11 @@ public abstract class AbsSwipeUpHandler, ActivityManagerWrapper.getInstance().registerTaskStackListener( mActivityRestartListener); - mActivityInterface.onAnimateToLauncher(mGestureState.getEndTarget(), duration); + mParallelRunningAnim = mActivityInterface.getParallelAnimationToLauncher( + mGestureState.getEndTarget(), duration); + if (mParallelRunningAnim != null) { + mParallelRunningAnim.start(); + } } if (mGestureState.getEndTarget() == HOME) { diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 3afffc1dad..d810947ee5 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -347,7 +347,9 @@ public abstract class BaseActivityInterface Date: Mon, 5 Apr 2021 21:37:01 -0700 Subject: [PATCH 10/14] Fix noisy log from sysui flag changes Bug: 144854916 Test: Logcat after sysui flag changes, ensure no tracing change logs Change-Id: I36b6b71bae08303787508ab6eb63ca989866370c --- .../quickstep/TouchInteractionService.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 1fb946550e..e9d2eb4632 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -239,8 +239,9 @@ public class TouchInteractionService extends Service implements PluginListener { + int lastFlags = mDeviceState.getSystemUiStateFlags(); mDeviceState.setSystemUiFlags(stateFlags); - TouchInteractionService.this.onSystemUiFlagsChanged(); + TouchInteractionService.this.onSystemUiFlagsChanged(lastFlags); }); } @@ -362,7 +363,7 @@ public class TouchInteractionService extends Service implements PluginListenerYour predicted apps - Close + Close Get app suggestions on the bottom row of your Home screen @@ -91,14 +91,6 @@ Predicted app: %1$s - - Search your phone for apps, people, settings and more! - - Tap keyboard search button to launch the first search - result. - - - Got it. Make sure you swipe from the far-left edge. diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index c7f01334a6..7b92d112cf 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -95,6 +95,10 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_DEVICE_SEARCH = new DeviceFlag( "ENABLE_DEVICE_SEARCH", true, "Allows on device search in all apps"); + public static final BooleanFlag ENABLE_PEOPLE_TILE_PREVIEW = getDebugFlag( + "ENABLE_PEOPLE_TILE_PREVIEW", false, + "Experimental: Shows conversation shortcuts on home screen as search results"); + public static final BooleanFlag FOLDER_NAME_SUGGEST = new DeviceFlag( "FOLDER_NAME_SUGGEST", true, "Suggests folder names instead of blank text."); diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java index e08f881bab..f79313f026 100644 --- a/src/com/android/launcher3/views/AbstractSlideInView.java +++ b/src/com/android/launcher3/views/AbstractSlideInView.java @@ -216,7 +216,7 @@ public abstract class AbstractSlideInView extends AbstractFloatingView return mLauncher.getDragLayer(); } - protected static View createColorScrim(Context context, int bgColor) { + protected View createColorScrim(Context context, int bgColor) { View view = new View(context); view.forceHasOverlappingRendering(false); view.setBackgroundColor(bgColor); From 5461089baa474da4b59bdb20fb5bfe882f0f68f2 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Tue, 6 Apr 2021 04:05:13 -0500 Subject: [PATCH 12/14] [Search][Layout] Fix blank space when predictions are disabled This regression is caused due to getExpectedHeight relying on view visibility state while AlphaUpdateListener.updateVisibility was reseting the views visibility. Bug: 184211402 Test: local Change-Id: Ib756f5eb8f6356a18a025626008b97fd7c77fec9 --- .../android/launcher3/appprediction/PredictionRowView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java index 8e92b59ae1..cc3ccea4d0 100644 --- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -237,7 +237,9 @@ public class PredictionRowView extends LinearLayout implements setTranslationY(scroll); } setAlpha(mScrolledOut ? 0 : 1); - AlphaUpdateListener.updateVisibility(this); + if (getVisibility() != GONE) { + AlphaUpdateListener.updateVisibility(this); + } } @Override From fbdb50aa489f39a1ef6736b2f2318b665c55e0e2 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 6 Apr 2021 10:07:55 -0700 Subject: [PATCH 13/14] Fix HINT_STATE not tracking the entire height of the screen Explicitly use DeviceProfile#heightPx instead of getShiftRange(), which might be less depending on AllAppsTransitionController Test: swipe up from bottom on home, ensure workspace scales down as the gesture goes all the way to the top of the screen Change-Id: I9c2988d361c22d437c7eb9bea8ed715d06054c59 --- .../NoButtonNavbarToOverviewTouchController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index 65bbeea52e..464b90a2cb 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -111,7 +111,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch float progressMultiplier = super.initCurrentAnimation(); if (mToState == HINT_STATE) { // Track the drag across the entire height of the screen. - progressMultiplier = -1 / getShiftRange(); + progressMultiplier = -1f / mLauncher.getDeviceProfile().heightPx; } return progressMultiplier; } From b77fa8da529056198a6236d5c7c60cc097e04ead Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 6 Apr 2021 12:07:02 -0700 Subject: [PATCH 14/14] Consolidate two different onTransitionCancelled implementations There was previously two different onTransitionCancelled(), one in BaseActivityInterface and one in AnimationFactory. They are pretty similar and the differences seem subtle and not necessary. In this bug, the AnimationFactory version was going to mStartState instead of StateManager#getRestState() (which is the same, unless mStartState disables restore). Instead, always use the mActivityInterface implemenation, which seems more robust. Test: Open app A, open app B, quick switch from B to A, swipe home during that transition, then touch nav region during home transtion; ensure we don't goToState(BACKGROUND_APP) in the subsequent onTransitionCanceled(). Fixes: 184583037 Change-Id: I315a5087b12413d88c3ccc1e3245a55a76a73e62 --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 8 ++------ .../src/com/android/quickstep/BaseActivityInterface.java | 7 ------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index b7c6743780..0a497bfc39 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -317,9 +317,9 @@ public abstract class AbsSwipeUpHandler, mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, this::invalidateHandlerWithLauncher); mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_RESUME_LAST_TASK, - this::notifyTransitionCancelled); + this::resetStateForAnimationCancel); mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_FINISH_WITH_NO_END, - this::notifyTransitionCancelled); + this::resetStateForAnimationCancel); if (!LIVE_TILE.get()) { mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT @@ -1370,10 +1370,6 @@ public abstract class AbsSwipeUpHandler, mActivity.getRootView().setOnApplyWindowInsetsListener(null); } - private void notifyTransitionCancelled() { - mAnimationFactory.onTransitionCancelled(); - } - private void resetStateForAnimationCancel() { boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted; mActivityInterface.onTransitionCancelled(wasVisible); diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 3afffc1dad..b9c2450ccc 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -366,8 +366,6 @@ public abstract class BaseActivityInterface