From 43d53432aa8ec30beac88e8db3fa2f472b740a96 Mon Sep 17 00:00:00 2001 From: Takeshi Hagikura Date: Wed, 9 Jun 2021 18:49:14 +0900 Subject: [PATCH 01/11] Update the colors of the tabs of work profile pagination Update the tab colors based on the discussion in the bug and the design mock. Rename the color/all_apps_tab_bg to color/all_apps_tab_background_selected to make the usage of the color explicit. (Confirmed it's only used for the color of the selected tab) Bug: 189488670 Test: Visual inspection Change-Id: I6ac38f71a8dd8852e1ab2e70f2f8434e9101daa1 --- .../all_apps_tab_background_selected.xml | 18 ++++++++++++++++++ res/color-night-v31/all_apps_tab_text.xml | 19 +++++++++++++++++++ .../all_apps_tabs_background.xml | 18 ++++++++++++++++++ .../all_apps_tab_background_selected.xml | 18 ++++++++++++++++++ res/color-night/all_apps_tab_text.xml | 19 +++++++++++++++++++ res/color-night/all_apps_tabs_background.xml | 18 ++++++++++++++++++ .../all_apps_tab_background_selected.xml | 18 ++++++++++++++++++ res/color-v31/all_apps_tab_text.xml | 19 +++++++++++++++++++ res/color-v31/all_apps_tabs_background.xml | 18 ++++++++++++++++++ ...l => all_apps_tab_background_selected.xml} | 5 ++--- res/color/all_apps_tab_text.xml | 4 ++-- res/color/all_apps_tabs_background.xml | 18 ++++++++++++++++++ res/drawable/all_apps_tabs_background.xml | 8 +++----- .../PersonalWorkSlidingTabStrip.java | 3 ++- 14 files changed, 192 insertions(+), 11 deletions(-) create mode 100644 res/color-night-v31/all_apps_tab_background_selected.xml create mode 100644 res/color-night-v31/all_apps_tab_text.xml create mode 100644 res/color-night-v31/all_apps_tabs_background.xml create mode 100644 res/color-night/all_apps_tab_background_selected.xml create mode 100644 res/color-night/all_apps_tab_text.xml create mode 100644 res/color-night/all_apps_tabs_background.xml create mode 100644 res/color-v31/all_apps_tab_background_selected.xml create mode 100644 res/color-v31/all_apps_tab_text.xml create mode 100644 res/color-v31/all_apps_tabs_background.xml rename res/color/{all_apps_tab_bg.xml => all_apps_tab_background_selected.xml} (82%) create mode 100644 res/color/all_apps_tabs_background.xml diff --git a/res/color-night-v31/all_apps_tab_background_selected.xml b/res/color-night-v31/all_apps_tab_background_selected.xml new file mode 100644 index 0000000000..b7c9ff64f2 --- /dev/null +++ b/res/color-night-v31/all_apps_tab_background_selected.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-night-v31/all_apps_tab_text.xml b/res/color-night-v31/all_apps_tab_text.xml new file mode 100644 index 0000000000..83237b49e5 --- /dev/null +++ b/res/color-night-v31/all_apps_tab_text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/color-night-v31/all_apps_tabs_background.xml b/res/color-night-v31/all_apps_tabs_background.xml new file mode 100644 index 0000000000..b396f3377e --- /dev/null +++ b/res/color-night-v31/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-night/all_apps_tab_background_selected.xml b/res/color-night/all_apps_tab_background_selected.xml new file mode 100644 index 0000000000..b22bc8b673 --- /dev/null +++ b/res/color-night/all_apps_tab_background_selected.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-night/all_apps_tab_text.xml b/res/color-night/all_apps_tab_text.xml new file mode 100644 index 0000000000..183af01f42 --- /dev/null +++ b/res/color-night/all_apps_tab_text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/color-night/all_apps_tabs_background.xml b/res/color-night/all_apps_tabs_background.xml new file mode 100644 index 0000000000..c0c1621d17 --- /dev/null +++ b/res/color-night/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-v31/all_apps_tab_background_selected.xml b/res/color-v31/all_apps_tab_background_selected.xml new file mode 100644 index 0000000000..dac8fa2994 --- /dev/null +++ b/res/color-v31/all_apps_tab_background_selected.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-v31/all_apps_tab_text.xml b/res/color-v31/all_apps_tab_text.xml new file mode 100644 index 0000000000..c3520a7ab5 --- /dev/null +++ b/res/color-v31/all_apps_tab_text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/color-v31/all_apps_tabs_background.xml b/res/color-v31/all_apps_tabs_background.xml new file mode 100644 index 0000000000..30757b0b3c --- /dev/null +++ b/res/color-v31/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color/all_apps_tab_bg.xml b/res/color/all_apps_tab_background_selected.xml similarity index 82% rename from res/color/all_apps_tab_bg.xml rename to res/color/all_apps_tab_background_selected.xml index e59e8d2198..5cb9bd8928 100644 --- a/res/color/all_apps_tab_bg.xml +++ b/res/color/all_apps_tab_background_selected.xml @@ -13,7 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. --> - - + + \ No newline at end of file diff --git a/res/color/all_apps_tab_text.xml b/res/color/all_apps_tab_text.xml index 2db0fb5d74..dace3800cd 100644 --- a/res/color/all_apps_tab_text.xml +++ b/res/color/all_apps_tab_text.xml @@ -14,6 +14,6 @@ limitations under the License. --> - - + + \ No newline at end of file diff --git a/res/color/all_apps_tabs_background.xml b/res/color/all_apps_tabs_background.xml new file mode 100644 index 0000000000..a4b7d1f216 --- /dev/null +++ b/res/color/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/drawable/all_apps_tabs_background.xml b/res/drawable/all_apps_tabs_background.xml index a345dd3afc..4e953152d0 100644 --- a/res/drawable/all_apps_tabs_background.xml +++ b/res/drawable/all_apps_tabs_background.xml @@ -13,14 +13,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + android:bottom="@dimen/all_apps_tabs_vertical_padding"> - + diff --git a/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java b/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java index 8f9cdc8a4c..be5822dca4 100644 --- a/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java +++ b/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java @@ -59,7 +59,8 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd R.dimen.all_apps_header_pill_corner_radius); mSelectedIndicatorPaint = new Paint(); - mSelectedIndicatorPaint.setColor(context.getColor(R.color.all_apps_tab_bg)); + mSelectedIndicatorPaint.setColor( + context.getColor(R.color.all_apps_tab_background_selected)); mIsRtl = Utilities.isRtl(getResources()); } From e46c7613a30a0e7225e5424abfe5bb215a8001dc Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 10 Jun 2021 14:50:17 -0700 Subject: [PATCH 02/11] Ensure we pass the pointer id to the velocity tracker and not the index Bug: 189259717 Test: Swipe up with two fingers using accessibility + gesture nav Change-Id: Icef48276c6da824d43dea0f7d567691af9cdedaf --- .../src/com/android/quickstep/util/MotionPauseDetector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java index 8151d412ab..1ed2da3051 100644 --- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java +++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java @@ -121,7 +121,7 @@ public class MotionPauseDetector { mForcePauseTimeout.setAlarm(mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT); - float newVelocity = mVelocityProvider.addMotionEvent(ev, pointerIndex); + float newVelocity = mVelocityProvider.addMotionEvent(ev, ev.getPointerId(pointerIndex)); if (mPreviousVelocity != null) { checkMotionPaused(newVelocity, mPreviousVelocity, ev.getEventTime()); } From 2dab912b950653377c2d87fd825611963480114d Mon Sep 17 00:00:00 2001 From: Stevie Kideckel Date: Fri, 11 Jun 2021 13:03:41 +0000 Subject: [PATCH 03/11] Use LayoutManager.onLayoutCompleted as a signal that content has changed onChildAttachedToWindow is called before the layout manager is finished processing the layout, so incorrect measurements / intermediate animation states can be present. onLayoutCompleted occurs after each full layout calculation, including measuring multiple views or animating, and is a better signal to use. Fix: 190391539 Test: verified locally with search use case and other expand collapse cases Change-Id: If01caf33c6c3371636895e1361d80de536363239 --- .../picker/WidgetsListLayoutManager.java | 51 +++++++++++++++++++ .../widget/picker/WidgetsRecyclerView.java | 25 +++------ 2 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 src/com/android/launcher3/widget/picker/WidgetsListLayoutManager.java diff --git a/src/com/android/launcher3/widget/picker/WidgetsListLayoutManager.java b/src/com/android/launcher3/widget/picker/WidgetsListLayoutManager.java new file mode 100644 index 0000000000..2b7f544c56 --- /dev/null +++ b/src/com/android/launcher3/widget/picker/WidgetsListLayoutManager.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.widget.picker; + +import android.content.Context; + +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.android.launcher3.widget.picker.SearchAndRecommendationsScrollController.OnContentChangeListener; + +/** + * A layout manager for the {@link WidgetsRecyclerView}. + * + * {@link #setOnContentChangeListener(OnContentChangeListener)} can be used to register a callback + * for when the content of the layout manager has changed, following measurement and animation. + */ +public final class WidgetsListLayoutManager extends LinearLayoutManager { + @Nullable + private OnContentChangeListener mOnContentChangeListener; + + public WidgetsListLayoutManager(Context context) { + super(context); + } + + @Override + public void onLayoutCompleted(RecyclerView.State state) { + super.onLayoutCompleted(state); + if (mOnContentChangeListener != null) { + mOnContentChangeListener.onContentChanged(); + } + } + + public void setOnContentChangeListener(@Nullable OnContentChangeListener listener) { + mOnContentChangeListener = listener; + } +} diff --git a/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java index 090362ba33..6e10bf6fc3 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java +++ b/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java @@ -23,7 +23,6 @@ import android.view.MotionEvent; import android.view.View; import android.widget.TableLayout; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -78,7 +77,9 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch super.onFinishInflate(); // create a layout manager with Launcher's context so that scroll position // can be preserved during screen rotation. - setLayoutManager(new LinearLayoutManager(getContext())); + WidgetsListLayoutManager layoutManager = new WidgetsListLayoutManager(getContext()); + layoutManager.setOnContentChangeListener(mOnContentChangeListener); + setLayoutManager(layoutManager); } @Override @@ -87,22 +88,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch mAdapter = (WidgetsListAdapter) adapter; } - @Override - public void onChildAttachedToWindow(@NonNull View child) { - super.onChildAttachedToWindow(child); - if (mOnContentChangeListener != null) { - mOnContentChangeListener.onContentChanged(); - } - } - - @Override - public void onChildDetachedFromWindow(@NonNull View child) { - super.onChildDetachedFromWindow(child); - if (mOnContentChangeListener != null) { - mOnContentChangeListener.onContentChanged(); - } - } - /** * Maps the touch (from 0..1) to the adapter position that should be visible. */ @@ -266,6 +251,10 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch public void setOnContentChangeListener(@Nullable OnContentChangeListener listener) { mOnContentChangeListener = listener; + WidgetsListLayoutManager layoutManager = (WidgetsListLayoutManager) getLayoutManager(); + if (layoutManager != null) { + layoutManager.setOnContentChangeListener(listener); + } } /** From 77edb686d7de170fb492342148eaecd2de2d3144 Mon Sep 17 00:00:00 2001 From: Jon Spivack Date: Thu, 10 Jun 2021 18:12:58 -0700 Subject: [PATCH 04/11] Send NIU Actions Intents to default Assistant This changes the recipient for NIU Actions from a package hard-coded in a config file to the currently selected default Assistant. The user can change this under Settings -> Default apps. ImageActionUtils has also been updated to handle the case where its Intents cannot be resolved, preventing a crash if the user sets the default Assistant to something that cannot receive NIU Actions. Bug: 186655099 Test: Manual (Pixel 3A, set default Assistant to Google Go and None) Test: m -j RunLauncherGoGoogleRoboTests Change-Id: I03b93597092575902d507615f32b63f4050c4c69 --- go/quickstep/res/values/config.xml | 2 -- .../quickstep/TaskOverlayFactoryGo.java | 20 ++++++++++++------- .../quickstep/util/ImageActionUtils.java | 16 ++++++++++----- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/go/quickstep/res/values/config.xml b/go/quickstep/res/values/config.xml index 402bf9ad13..796d14db16 100644 --- a/go/quickstep/res/values/config.xml +++ b/go/quickstep/res/values/config.xml @@ -16,8 +16,6 @@ - - true diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java index 65cdcf06ba..3a6e9b57cc 100644 --- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java +++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java @@ -21,6 +21,7 @@ import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED; import android.annotation.SuppressLint; import android.app.assist.AssistContent; +import android.content.ActivityNotFoundException; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -29,10 +30,10 @@ import android.os.SystemClock; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; +import android.util.Log; import androidx.annotation.VisibleForTesting; -import com.android.launcher3.R; import com.android.quickstep.util.AssistContentRequester; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.TaskThumbnailView; @@ -90,9 +91,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix, boolean rotated) { getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null); - mNIUPackageName = - mApplicationContext.getString(R.string.niu_actions_package); - + checkSettings(); if (thumbnail == null || TextUtils.isEmpty(mNIUPackageName)) { return; } @@ -105,7 +104,6 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task)); mTaskPackageName = task.key.getPackageName(); - checkPermissions(); if (!mAssistPermissionsEnabled) { return; } @@ -137,7 +135,11 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { mImageApi.shareAsDataWithExplicitIntent(/* crop */ null, intent); } else { intent.putExtra(ACTIONS_ERROR_CODE, ERROR_PERMISSIONS); - mApplicationContext.startActivity(intent); + try { + mApplicationContext.startActivity(intent); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "No activity found to receive permission error intent"); + } } } @@ -160,13 +162,17 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { * Checks whether the Assistant has screen context permissions */ @VisibleForTesting - public void checkPermissions() { + public void checkSettings() { ContentResolver contentResolver = mApplicationContext.getContentResolver(); boolean structureEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0; boolean screenshotEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0; mAssistPermissionsEnabled = structureEnabled && screenshotEnabled; + + String assistantPackage = + Settings.Secure.getString(contentResolver, Settings.Secure.ASSISTANT); + mNIUPackageName = assistantPackage.split("/", 2)[0]; } protected class OverlayUICallbacksGoImpl extends OverlayUICallbacksImpl diff --git a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java index 2285d74d73..de7dbd64f5 100644 --- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java +++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java @@ -26,6 +26,7 @@ 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.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipDescription; import android.content.ComponentName; @@ -68,6 +69,7 @@ public class ImageActionUtils { private static final long FILE_LIFE = 1000L /*ms*/ * 60L /*s*/ * 60L /*m*/ * 24L /*h*/; private static final String SUB_FOLDER = "Overview"; private static final String BASE_NAME = "overview_image_"; + private static final String TAG = "ImageActionUtils"; /** * Saves screenshot to location determine by SystemUiProxy @@ -154,11 +156,15 @@ public class ImageActionUtils { Intent intent, BiFunction uriToIntentMap, String tag) { Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent); - // Work around b/159412574 - if (intents.length == 1) { - context.startActivity(intents[0]); - } else { - context.startActivities(intents); + try { + // Work around b/159412574 + if (intents.length == 1) { + context.startActivity(intents[0]); + } else { + context.startActivities(intents); + } + } catch (ActivityNotFoundException e) { + Log.e(TAG, "No activity found to receive image intent"); } } From a7b018535b3257f0d974b4a766ba732c338465da Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 11 Jun 2021 14:52:25 -0700 Subject: [PATCH 05/11] Ensure that the cancel and end listener are called when cancelling state animation Bug: 190856140 Test: Manual Change-Id: Ib6b869445cee9fad2a97a590d27429140f2b3ba9 --- .../launcher3/anim/AnimatorPlaybackController.java | 5 ++++- .../android/launcher3/statemanager/StateManager.java | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/anim/AnimatorPlaybackController.java b/src/com/android/launcher3/anim/AnimatorPlaybackController.java index f6d1651cb6..7d8b82a8eb 100644 --- a/src/com/android/launcher3/anim/AnimatorPlaybackController.java +++ b/src/com/android/launcher3/anim/AnimatorPlaybackController.java @@ -290,7 +290,10 @@ public class AnimatorPlaybackController implements ValueAnimator.AnimatorUpdateL callAnimatorCommandRecursively(mAnim, a -> a.setInterpolator(interpolator)); } - private static void callListenerCommandRecursively( + /** + * Recursively calls a command on all the listeners of the provided animation + */ + public static void callListenerCommandRecursively( Animator anim, BiConsumer command) { callAnimatorCommandRecursively(anim, a-> { for (AnimatorListener l : nonNullList(a.getListeners())) { diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index 03b68535bc..13d6568f78 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -18,6 +18,7 @@ package com.android.launcher3.statemanager; import static android.animation.ValueAnimator.areAnimatorsEnabled; +import static com.android.launcher3.anim.AnimatorPlaybackController.callListenerCommandRecursively; import static com.android.launcher3.states.StateAnimationConfig.SKIP_ALL_ANIMATIONS; import android.animation.Animator; @@ -514,8 +515,15 @@ public class StateManager> { playbackController.getAnimationPlayer().cancel(); playbackController.dispatchOnCancel(); } else if (currentAnimation != null) { - currentAnimation.setDuration(0); - currentAnimation.cancel(); + AnimatorSet anim = currentAnimation; + anim.setDuration(0); + if (!anim.isStarted()) { + // If the animation is not started the listeners do not get notified, + // notify manually. + callListenerCommandRecursively(anim, AnimatorListener::onAnimationCancel); + callListenerCommandRecursively(anim, AnimatorListener::onAnimationEnd); + } + anim.cancel(); } currentAnimation = null; From af6ebe87ea1de17f948031b218d9bc44e6f01e21 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Fri, 11 Jun 2021 17:57:05 -0700 Subject: [PATCH 06/11] Do not add padding left/right when cell layout border spacing exists. Bug: 188094809 Test: enable layout bounds and view text spanning entire cell Change-Id: Ia7ed45d0e844b2594a8708e03fe385a321345f5e --- .../launcher3/ShortcutAndWidgetContainer.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index 2c24c3a52e..4579705f5a 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -18,6 +18,9 @@ package com.android.launcher3; import static android.view.MotionEvent.ACTION_DOWN; +import static com.android.launcher3.CellLayout.FOLDER; +import static com.android.launcher3.CellLayout.WORKSPACE; + import android.app.WallpaperManager; import android.content.Context; import android.graphics.Rect; @@ -124,21 +127,27 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon. public void measureChild(View child) { CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams(); - final DeviceProfile profile = mActivity.getDeviceProfile(); + final DeviceProfile dp = mActivity.getDeviceProfile(); if (child instanceof LauncherAppWidgetHostView) { - ((LauncherAppWidgetHostView) child).getWidgetInset(profile, mTempRect); + ((LauncherAppWidgetHostView) child).getWidgetInset(dp, mTempRect); lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX, mCountY, - profile.appWidgetScale.x, profile.appWidgetScale.y, mBorderSpacing, mTempRect); + dp.appWidgetScale.x, dp.appWidgetScale.y, mBorderSpacing, mTempRect); } else { lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX, mCountY, mBorderSpacing, null); // Center the icon/folder int cHeight = getCellContentHeight(); int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f)); - int cellPaddingX = mContainerType == CellLayout.WORKSPACE - ? profile.workspaceCellPaddingXPx - : (int) (profile.edgeMarginPx / 2f); + + // No need to add padding when cell layout border spacing is present. + boolean noPadding = (dp.cellLayoutBorderSpacingPx > 0 && mContainerType == WORKSPACE) + || (dp.folderCellLayoutBorderSpacingPx > 0 && mContainerType == FOLDER); + int cellPaddingX = noPadding + ? 0 + : mContainerType == WORKSPACE + ? dp.workspaceCellPaddingXPx + : (int) (dp.edgeMarginPx / 2f); child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0); } int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY); From 5300fce94ffb621c82d917b22232a86d34812339 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sat, 12 Jun 2021 13:46:50 -0700 Subject: [PATCH 07/11] Don't use icon home animator when entering PIP - If the app supports pip, can just do the fallback workspace home animation since the app will not be going to the icon Bug: 190464560 Test: Open YT, swipe up, ensure it goes to the icon, Reopen YT video, swipe up, ensure it goes into PIP without icon animation Change-Id: Ic22ccf17c664b9941ed944c0e39dc1f8d4efa84a --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 11 ++++++----- .../com/android/quickstep/FallbackSwipeHandler.java | 2 +- .../com/android/quickstep/LauncherSwipeHandlerV2.java | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 52f34d90e0..b5c52179c8 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1072,7 +1072,7 @@ public abstract class AbsSwipeUpHandler, protected abstract HomeAnimationFactory createHomeAnimationFactory( ArrayList launchCookies, long duration, boolean isTargetTranslucent, - RemoteAnimationTargetCompat runningTaskTarget); + boolean appCanEnterPip, RemoteAnimationTargetCompat runningTaskTarget); private final TaskStackChangeListener mActivityRestartListener = new TaskStackChangeListener() { @Override @@ -1117,13 +1117,14 @@ public abstract class AbsSwipeUpHandler, ? runningTaskTarget.taskInfo.launchCookies : new ArrayList<>(); boolean isTranslucent = runningTaskTarget != null && runningTaskTarget.isTranslucent; - HomeAnimationFactory homeAnimFactory = - createHomeAnimationFactory(cookies, duration, isTranslucent, runningTaskTarget); - mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome() - && runningTaskTarget != null + boolean appCanEnterPip = runningTaskTarget != null && runningTaskTarget.taskInfo.pictureInPictureParams != null && TaskInfoCompat.isAutoEnterPipEnabled( runningTaskTarget.taskInfo.pictureInPictureParams); + HomeAnimationFactory homeAnimFactory = + createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip, + runningTaskTarget); + mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome() && appCanEnterPip; if (mIsSwipingPipToHome) { mSwipePipToHomeAnimator = getSwipePipToHomeAnimator( homeAnimFactory, runningTaskTarget, start); diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java index 7290ff6a41..fd44e023a7 100644 --- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java @@ -129,7 +129,7 @@ public class FallbackSwipeHandler extends @Override protected HomeAnimationFactory createHomeAnimationFactory(ArrayList launchCookies, - long duration, boolean isTargetTranslucent, + long duration, boolean isTargetTranslucent, boolean appCanEnterPip, RemoteAnimationTargetCompat runningTaskTarget) { mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration); ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0); diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java index 40741e4945..47d94ba2ad 100644 --- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java @@ -88,7 +88,7 @@ public class LauncherSwipeHandlerV2 extends @Override protected HomeAnimationFactory createHomeAnimationFactory(ArrayList launchCookies, - long duration, boolean isTargetTranslucent, + long duration, boolean isTargetTranslucent, boolean appCanEnterPip, RemoteAnimationTargetCompat runningTaskTarget) { if (mActivity == null) { mStateCallback.addChangeListener(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, @@ -108,7 +108,7 @@ public class LauncherSwipeHandlerV2 extends mActivity.getRootView().setForceHideBackArrow(true); mActivity.setHintUserWillBeActive(); - if (!canUseWorkspaceView) { + if (!canUseWorkspaceView || appCanEnterPip) { return new LauncherHomeAnimationFactory(); } if (workspaceView instanceof LauncherAppWidgetHostView) { From 954681d837e3374b120df023c899e439ec34b5b0 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 9 Jun 2021 21:51:14 -0700 Subject: [PATCH 08/11] Disallow auto-enter PIP when there is an existing PIP - Remove some deprecated calls when registering task stack listeners Bug: 190464560 Test: Enter YT Pip, try to enter another auto-enter PIP app Change-Id: Ib7d3a07effadb7b13f7c37f938741e27cf0e254e --- .../android/quickstep/AbsSwipeUpHandler.java | 11 +++-- .../android/quickstep/RecentTasksList.java | 3 +- .../RecentsAnimationDeviceState.java | 41 ++++++++++++++++--- .../com/android/quickstep/RecentsModel.java | 3 +- .../quickstep/RotationTouchHelper.java | 7 ++-- .../quickstep/TaskAnimationManager.java | 9 ++-- 6 files changed, 56 insertions(+), 18 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index b5c52179c8..8f42993b62 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -117,6 +117,7 @@ import com.android.systemui.shared.system.LatencyTrackerCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.TaskInfoCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.util.ArrayList; import java.util.function.Consumer; @@ -1083,7 +1084,7 @@ public abstract class AbsSwipeUpHandler, // Since this is an edge case, just cancel and relaunch with default activity // options (since we don't know if there's an associated app icon to launch from) endRunningWindowAnim(true /* cancel */); - ActivityManagerWrapper.getInstance().unregisterTaskStackListener( + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( mActivityRestartListener); ActivityManagerWrapper.getInstance().startActivityFromRecents(task.taskId, null); } @@ -1098,7 +1099,7 @@ public abstract class AbsSwipeUpHandler, // If we are transitioning to launcher, then listen for the activity to be restarted while // the transition is in progress if (mGestureState.getEndTarget().isLauncher) { - ActivityManagerWrapper.getInstance().registerTaskStackListener( + TaskStackChangeListeners.getInstance().registerTaskStackListener( mActivityRestartListener); mParallelRunningAnim = mActivityInterface.getParallelAnimationToLauncher( @@ -1117,7 +1118,8 @@ public abstract class AbsSwipeUpHandler, ? runningTaskTarget.taskInfo.launchCookies : new ArrayList<>(); boolean isTranslucent = runningTaskTarget != null && runningTaskTarget.isTranslucent; - boolean appCanEnterPip = runningTaskTarget != null + boolean appCanEnterPip = !mDeviceState.isPipActive() + && runningTaskTarget != null && runningTaskTarget.taskInfo.pictureInPictureParams != null && TaskInfoCompat.isAutoEnterPipEnabled( runningTaskTarget.taskInfo.pictureInPictureParams); @@ -1400,7 +1402,8 @@ public abstract class AbsSwipeUpHandler, } mActivityInitListener.unregister(); - ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mActivityRestartListener); + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( + mActivityRestartListener); mTaskSnapshot = null; } diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 3302da0f77..3080f040ac 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -33,6 +33,7 @@ import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.util.ArrayList; import java.util.Collections; @@ -66,7 +67,7 @@ public class RecentTasksList extends TaskStackChangeListener { mKeyguardManager = keyguardManager; mChangeId = 1; mActivityManagerWrapper = activityManagerWrapper; - mActivityManagerWrapper.registerTaskStackListener(this); + TaskStackChangeListeners.getInstance().registerTaskStackListener(this); } @VisibleForTesting diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index fa37901f27..444d77a612 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -15,6 +15,8 @@ */ package com.android.quickstep; +import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; +import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.Intent.ACTION_USER_UNLOCKED; import static com.android.launcher3.util.DisplayController.CHANGE_ALL; @@ -41,6 +43,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_S import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; import android.app.ActivityManager; +import android.app.ActivityTaskManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; @@ -50,6 +53,7 @@ import android.content.res.Resources; import android.graphics.Region; import android.net.Uri; import android.os.Process; +import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserManager; import android.provider.Settings; @@ -75,6 +79,8 @@ import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags; import com.android.systemui.shared.system.SystemGestureExclusionListenerCompat; +import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.io.PrintWriter; import java.util.ArrayList; @@ -96,6 +102,8 @@ public class RecentsAnimationDeviceState implements private final DisplayController mDisplayController; private final int mDisplayId; private final RotationTouchHelper mRotationTouchHelper; + private final TaskStackChangeListener mPipListener; + private final List mGestureBlockedActivities; private final ArrayList mOnDestroyActions = new ArrayList<>(); @@ -106,9 +114,11 @@ public class RecentsAnimationDeviceState implements private final Region mDeferredGestureRegion = new Region(); private boolean mAssistantAvailable; private float mAssistantVisibility; + private boolean mIsUserSetupComplete; private boolean mIsOneHandedModeEnabled; private boolean mIsSwipeToNotificationEnabled; private final boolean mIsOneHandedModeSupported; + private boolean mPipIsActive; private boolean mIsUserUnlocked; private final ArrayList mUserUnlockedActions = new ArrayList<>(); @@ -125,10 +135,6 @@ public class RecentsAnimationDeviceState implements private Region mExclusionRegion; private SystemGestureExclusionListenerCompat mExclusionListener; - private final List mGestureBlockedActivities; - - private boolean mIsUserSetupComplete; - public RecentsAnimationDeviceState(Context context) { this(context, false); } @@ -204,7 +210,6 @@ public class RecentsAnimationDeviceState implements mIsOneHandedModeEnabled = false; } - Uri swipeBottomNotificationUri = Settings.Secure.getUriFor(ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED); SettingsCache.OnChangeListener onChangeListener = @@ -220,6 +225,27 @@ public class RecentsAnimationDeviceState implements settingsCache.register(setupCompleteUri, userSetupChangeListener); runOnDestroy(() -> settingsCache.unregister(setupCompleteUri, userSetupChangeListener)); } + + try { + mPipIsActive = ActivityTaskManager.getService().getRootTaskInfo( + WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED) != null; + } catch (RemoteException e) { + // Do nothing + } + mPipListener = new TaskStackChangeListener() { + @Override + public void onActivityPinned(String packageName, int userId, int taskId, int stackId) { + mPipIsActive = true; + } + + @Override + public void onActivityUnpinned() { + mPipIsActive = false; + } + }; + TaskStackChangeListeners.getInstance().registerTaskStackListener(mPipListener); + runOnDestroy(() -> + TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mPipListener)); } private void runOnDestroy(Runnable action) { @@ -579,6 +605,10 @@ public class RecentsAnimationDeviceState implements return mIsSwipeToNotificationEnabled; } + public boolean isPipActive() { + return mPipIsActive; + } + public RotationTouchHelper getRotationTouchHelper() { return mRotationTouchHelper; } @@ -596,6 +626,7 @@ public class RecentsAnimationDeviceState implements pw.println(" isOneHandedModeEnabled=" + mIsOneHandedModeEnabled); pw.println(" isSwipeToNotificationEnabled=" + mIsSwipeToNotificationEnabled); pw.println(" deferredGestureRegion=" + mDeferredGestureRegion); + pw.println(" pipIsActive=" + mPipIsActive); mRotationTouchHelper.dump(pw); } } diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java index 2eb9dd84eb..1e82c8cbfa 100644 --- a/quickstep/src/com/android/quickstep/RecentsModel.java +++ b/quickstep/src/com/android/quickstep/RecentsModel.java @@ -39,6 +39,7 @@ import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.util.ArrayList; import java.util.List; @@ -75,7 +76,7 @@ public class RecentsModel extends TaskStackChangeListener implements IconChangeL mIconCache = new TaskIconCache(context, RECENTS_MODEL_EXECUTOR, iconProvider); mThumbnailCache = new TaskThumbnailCache(context, RECENTS_MODEL_EXECUTOR); - ActivityManagerWrapper.getInstance().registerTaskStackListener(this); + TaskStackChangeListeners.getInstance().registerTaskStackListener(this); iconProvider.registerIconChangeListener(this, MAIN_EXECUTOR.getHandler()); } diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index fc7a3dfde3..678b176151 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -38,6 +38,7 @@ import com.android.quickstep.util.RecentsOrientedState; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.io.PrintWriter; import java.util.ArrayList; @@ -178,14 +179,14 @@ public class RotationTouchHelper implements } private void setupOrientationSwipeHandler() { - ActivityManagerWrapper.getInstance().registerTaskStackListener(mFrozenTaskListener); - mOnDestroyFrozenTaskRunnable = () -> ActivityManagerWrapper.getInstance() + TaskStackChangeListeners.getInstance().registerTaskStackListener(mFrozenTaskListener); + mOnDestroyFrozenTaskRunnable = () -> TaskStackChangeListeners.getInstance() .unregisterTaskStackListener(mFrozenTaskListener); runOnDestroy(mOnDestroyFrozenTaskRunnable); } private void destroyOrientationSwipeHandlerCallback() { - ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mFrozenTaskListener); + TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mFrozenTaskListener); mOnDestroyActions.remove(mOnDestroyFrozenTaskRunnable); } diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 29ddde0c99..9731bf187e 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -39,6 +39,7 @@ import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.RemoteTransitionCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAnimationListener { public static final boolean ENABLE_SHELL_TRANSITIONS = @@ -58,7 +59,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task, boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) { if (mLastGestureState == null) { - ActivityManagerWrapper.getInstance().unregisterTaskStackListener( + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( mLiveTileRestartListener); return; } @@ -68,7 +69,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel(); if (recentsView != null) { recentsView.launchSideTaskInLiveTileModeForRestartedApp(task.taskId); - ActivityManagerWrapper.getInstance().unregisterTaskStackListener( + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( mLiveTileRestartListener); } } @@ -197,7 +198,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn } public void enableLiveTileRestartListener() { - ActivityManagerWrapper.getInstance().registerTaskStackListener(mLiveTileRestartListener); + TaskStackChangeListeners.getInstance().registerTaskStackListener(mLiveTileRestartListener); } /** @@ -241,7 +242,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn mLiveTileCleanUpHandler.run(); mLiveTileCleanUpHandler = null; } - ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mLiveTileRestartListener); + TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mLiveTileRestartListener); // Release all the target leashes if (mTargets != null) { From 62b56927365c9c8a973a71766a3c7d5cfcffb7a4 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 9 Jun 2021 22:25:51 -0700 Subject: [PATCH 09/11] Ignore source hint rect if it is too small - When the source hint rect is too small, we can't do a nice transition when going home (it would require scaling the surface up to fit the rect, which conflicts spatially with the crop down to launcher icon/pip), so in this case, just fallback to the overlay Bug: 190464560 Test: Enter YT Pip, play video, swipe it down to miniplayer then enter pip Change-Id: I44b253ca440f6d2ca0eb20eef3454c5d4e3ae3e9 --- .../android/quickstep/util/SwipePipToHomeAnimator.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java index 36311302bf..1062652ed4 100644 --- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java +++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java @@ -121,6 +121,15 @@ public class SwipePipToHomeAnimator extends ValueAnimator { mDestinationBoundsAnimation.set(mDestinationBounds); mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius); + if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width() + || sourceRectHint.height() < destinationBounds.height())) { + // This is a situation in which the source hint rect on at least one axis is smaller + // than the destination bounds, which presents a problem because we would have to scale + // up that axis to fit the bounds. So instead, just fallback to the non-source hint + // animation in this case. + sourceRectHint = null; + } + if (sourceRectHint == null) { mSourceHintRectInsets = null; From 45e0e26971fdd81c0d91e18571ea8e3977fd95bc Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Tue, 25 May 2021 19:21:37 -0500 Subject: [PATCH 10/11] [AllApps][Work] Introduce work toggle Fab Screenshot: https://screenshot.googleplex.com/C4r7kKPxv3PKdyN Bug: 186856928 Test: on-device Change-Id: Ifd8ce20fcf2247a6e80537dc7631458e594a8a63 --- res/drawable/work_apps_toggle_background.xml | 31 +++ res/layout/work_mode_fab.xml | 33 +++ res/layout/work_mode_switch.xml | 9 +- res/layout/work_profile_edu.xml | 61 ----- res/values/dimens.xml | 4 + res/values/strings.xml | 19 +- .../allapps/AllAppsContainerView.java | 4 +- .../allapps/LauncherAllAppsContainerView.java | 8 - .../launcher3/allapps/WorkModeSwitch.java | 171 ++++--------- .../android/launcher3/views/WorkEduView.java | 230 ------------------ 10 files changed, 124 insertions(+), 446 deletions(-) create mode 100644 res/drawable/work_apps_toggle_background.xml create mode 100644 res/layout/work_mode_fab.xml delete mode 100644 res/layout/work_profile_edu.xml delete mode 100644 src/com/android/launcher3/views/WorkEduView.java diff --git a/res/drawable/work_apps_toggle_background.xml b/res/drawable/work_apps_toggle_background.xml new file mode 100644 index 0000000000..a04d269875 --- /dev/null +++ b/res/drawable/work_apps_toggle_background.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/layout/work_mode_fab.xml b/res/layout/work_mode_fab.xml new file mode 100644 index 0000000000..21f269fed6 --- /dev/null +++ b/res/layout/work_mode_fab.xml @@ -0,0 +1,33 @@ + + + \ No newline at end of file diff --git a/res/layout/work_mode_switch.xml b/res/layout/work_mode_switch.xml index 31953c72aa..538a180992 100644 --- a/res/layout/work_mode_switch.xml +++ b/res/layout/work_mode_switch.xml @@ -1,5 +1,4 @@ - - - + android:paddingTop="@dimen/work_profile_footer_padding" /> diff --git a/res/layout/work_profile_edu.xml b/res/layout/work_profile_edu.xml deleted file mode 100644 index c3c7010f7e..0000000000 --- a/res/layout/work_profile_edu.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - -