From 512da48db8810a73cd4402c13cd696c529767086 Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Fri, 3 Apr 2020 10:56:59 -0700 Subject: [PATCH 01/55] Overview actions - rename chips flag and make it a device flag. We want to be able to control this value with deviceconfig. Test: local Change-Id: I05de087afcf2f558424706a59de2521bb6fddc4e --- src/com/android/launcher3/config/FeatureFlags.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 92f511222d..525f13db4c 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -92,8 +92,8 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_QUICKSTEP_LIVE_TILE = getDebugFlag( "ENABLE_QUICKSTEP_LIVE_TILE", false, "Enable live tile in Quickstep overview"); - public static final BooleanFlag ENABLE_HINTS_IN_OVERVIEW = getDebugFlag( - "ENABLE_HINTS_IN_OVERVIEW", false, "Show chip hints and gleams on the overview screen"); + public static final BooleanFlag ENABLE_SUGGESTED_ACTIONS_OVERVIEW = new DeviceFlag( + "ENABLE_SUGGESTED_ACTIONS_OVERVIEW", false, "Show chip hints on the overview screen"); public static final BooleanFlag FAKE_LANDSCAPE_UI = getDebugFlag( "FAKE_LANDSCAPE_UI", false, "Rotate launcher UI instead of using transposed layout"); From 73d0bb99fd9ebc20c1415ad61e730901fd14472d Mon Sep 17 00:00:00 2001 From: thiruram Date: Fri, 3 Apr 2020 14:05:38 -0700 Subject: [PATCH 02/55] Add new FolderLabelStates to better understand smart folder acceptance rate based on primary suggestion. Bug: 153358870 Change-Id: I863536f0f2563aab33484d45e9bb518e08a9ebe5 --- protos/launcher_log.proto | 12 ++- src/com/android/launcher3/folder/Folder.java | 96 ++++++++++++-------- 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto index 0fe53100b7..9423cb2642 100644 --- a/protos/launcher_log.proto +++ b/protos/launcher_log.proto @@ -63,14 +63,14 @@ message Target { // Note: proto does not support duplicate enum values, even if they belong to different enum type. // Hence "FROM" and "TO" prefix added. - enum FromFolderLabelState{ + enum FromFolderLabelState { FROM_FOLDER_LABEL_STATE_UNSPECIFIED = 0; FROM_EMPTY = 1; FROM_CUSTOM = 2; FROM_SUGGESTED = 3; } - enum ToFolderLabelState{ + enum ToFolderLabelState { TO_FOLDER_LABEL_STATE_UNSPECIFIED = 0; TO_SUGGESTION0_WITH_VALID_PRIMARY = 1; TO_SUGGESTION1_WITH_VALID_PRIMARY = 2; @@ -79,10 +79,14 @@ message Target { TO_SUGGESTION2_WITH_EMPTY_PRIMARY = 5; TO_SUGGESTION3_WITH_VALID_PRIMARY = 6; TO_SUGGESTION3_WITH_EMPTY_PRIMARY = 7; - TO_EMPTY_WITH_VALID_SUGGESTIONS = 8; + TO_EMPTY_WITH_VALID_SUGGESTIONS = 8 [deprecated = true]; + TO_EMPTY_WITH_VALID_PRIMARY = 15; + TO_EMPTY_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 16; TO_EMPTY_WITH_EMPTY_SUGGESTIONS = 9; TO_EMPTY_WITH_SUGGESTIONS_DISABLED = 10; - TO_CUSTOM_WITH_VALID_SUGGESTIONS = 11; + TO_CUSTOM_WITH_VALID_SUGGESTIONS = 11 [deprecated = true]; + TO_CUSTOM_WITH_VALID_PRIMARY = 17; + TO_CUSTOM_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 18; TO_CUSTOM_WITH_EMPTY_SUGGESTIONS = 12; TO_CUSTOM_WITH_SUGGESTIONS_DISABLED = 13; UNCHANGED = 14; diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 202836daa5..ea7317a1f0 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -98,6 +98,7 @@ import com.android.launcher3.userevent.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.LauncherLogProto.ItemType; import com.android.launcher3.userevent.LauncherLogProto.LauncherEvent; import com.android.launcher3.userevent.LauncherLogProto.Target; +import com.android.launcher3.userevent.LauncherLogProto.Target.ToFolderLabelState; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.Executors; import com.android.launcher3.util.Thunk; @@ -110,6 +111,7 @@ import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.OptionalInt; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -346,7 +348,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo } mInfo.title = newTitle; - mInfo.setOption(FLAG_MANUAL_FOLDER_NAME, getAcceptedSuggestionIndex() < 0, + mInfo.setOption(FLAG_MANUAL_FOLDER_NAME, !getAcceptedSuggestionIndex().isPresent(), mLauncher.getModelWriter()); mFolderIcon.onTitleChanged(newTitle); mLauncher.getModelWriter().updateItemInDatabase(mInfo); @@ -1679,36 +1681,58 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo private Target.ToFolderLabelState getToFolderLabelState() { String newLabel = checkNotNull(mFolderName.getText().toString(), - "Expected valid folder label, but found null"); + "Expected valid folder label, but found null"); + if (newLabel.equals(mPreviousLabel)) { + return Target.ToFolderLabelState.UNCHANGED; + } + + if (!FeatureFlags.FOLDER_NAME_SUGGEST.get()) { + return newLabel.isEmpty() + ? ToFolderLabelState.TO_EMPTY_WITH_SUGGESTIONS_DISABLED + : ToFolderLabelState.TO_CUSTOM_WITH_SUGGESTIONS_DISABLED; + } Optional suggestedLabels = getSuggestedLabels(); - int accepted_suggestion_index = getAcceptedSuggestionIndex(); - boolean hasValidPrimary = suggestedLabels - .map(labels -> labels.length > 0 && !isEmpty(labels[0])) - .orElse(false); - String primarySuffix = hasValidPrimary - ? "_WITH_VALID_PRIMARY" - : "_WITH_EMPTY_PRIMARY"; - boolean isEmptySuggestions = suggestedLabels .map(labels -> stream(labels).allMatch(TextUtils::isEmpty)) .orElse(true); - boolean isSuggestionsEnabled = FeatureFlags.FOLDER_NAME_SUGGEST.get(); - String suggestionsSuffix = isSuggestionsEnabled - ? isEmptySuggestions - ? "_WITH_EMPTY_SUGGESTIONS" - : "_WITH_VALID_SUGGESTIONS" - : "_WITH_SUGGESTIONS_DISABLED"; + if (isEmptySuggestions) { + return newLabel.isEmpty() + ? ToFolderLabelState.TO_EMPTY_WITH_EMPTY_SUGGESTIONS + : ToFolderLabelState.TO_CUSTOM_WITH_EMPTY_SUGGESTIONS; + } + + boolean hasValidPrimary = suggestedLabels + .map(labels -> !isEmpty(labels[0])) + .orElse(false); + if (newLabel.isEmpty()) { + return hasValidPrimary ? ToFolderLabelState.TO_EMPTY_WITH_VALID_PRIMARY + : ToFolderLabelState.TO_EMPTY_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY; + } + + OptionalInt accepted_suggestion_index = getAcceptedSuggestionIndex(); + if (!accepted_suggestion_index.isPresent()) { + return hasValidPrimary ? ToFolderLabelState.TO_CUSTOM_WITH_VALID_PRIMARY + : ToFolderLabelState.TO_CUSTOM_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY; + } + + switch (accepted_suggestion_index.getAsInt()) { + case 0: + return ToFolderLabelState.TO_SUGGESTION0_WITH_VALID_PRIMARY; + case 1: + return hasValidPrimary ? ToFolderLabelState.TO_SUGGESTION1_WITH_VALID_PRIMARY + : ToFolderLabelState.TO_SUGGESTION1_WITH_EMPTY_PRIMARY; + case 2: + return hasValidPrimary ? ToFolderLabelState.TO_SUGGESTION2_WITH_VALID_PRIMARY + : ToFolderLabelState.TO_SUGGESTION2_WITH_EMPTY_PRIMARY; + case 3: + return hasValidPrimary ? ToFolderLabelState.TO_SUGGESTION3_WITH_VALID_PRIMARY + : ToFolderLabelState.TO_SUGGESTION3_WITH_EMPTY_PRIMARY; + default: + // fall through + } + return ToFolderLabelState.TO_FOLDER_LABEL_STATE_UNSPECIFIED; - return newLabel.equals(mPreviousLabel) - ? Target.ToFolderLabelState.UNCHANGED - : newLabel.isEmpty() - ? Target.ToFolderLabelState.valueOf("TO_EMPTY" + suggestionsSuffix) - : accepted_suggestion_index >= 0 - ? Target.ToFolderLabelState.valueOf("TO_SUGGESTION" - + accepted_suggestion_index - + primarySuffix) - : Target.ToFolderLabelState.valueOf("TO_CUSTOM" + suggestionsSuffix); } private Optional getSuggestedLabels() { @@ -1728,19 +1752,18 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo .toArray(String[]::new)); } - private int getAcceptedSuggestionIndex() { - String newLabel = - checkNotNull(mFolderName.getText().toString(), - "Expected valid folder label, but found null"); - + private OptionalInt getAcceptedSuggestionIndex() { + String newLabel = checkNotNull(mFolderName.getText().toString(), + "Expected valid folder label, but found null"); return getSuggestedLabels() .map(suggestionsArray -> - IntStream.range(0, suggestionsArray.length) - .filter(index -> newLabel.equalsIgnoreCase( - suggestionsArray[index])) - .findFirst() - .orElse(-1) - ).orElse(-1); + IntStream.range(0, suggestionsArray.length) + .filter( + index -> !isEmpty(suggestionsArray[index]) + && newLabel.equalsIgnoreCase(suggestionsArray[index])) + .sequential() + .findFirst() + ).orElse(OptionalInt.empty()); } @@ -1761,7 +1784,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo private Target.Builder newParentContainerTarget() { Target.Builder builder = Target.newBuilder().setType(Target.Type.CONTAINER); - switch (mInfo.container) { case CONTAINER_HOTSEAT: return builder.setContainerType(ContainerType.HOTSEAT); From bb353d3741127be59e041c674afe70d012c4c2fa Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 20 Mar 2020 16:04:05 -0700 Subject: [PATCH 03/55] Switch to public API for surface view when rendering preview Bug: 152003916 Test: Manual Change-Id: I539ed2876d869366fa7635f4467d19e8488b7a1a --- .../uioverrides/PreviewSurfaceRenderer.java | 48 ------- .../graphics/GridOptionsProvider.java | 6 +- .../graphics/PreviewSurfaceRenderer.java | 128 ++++++++++++++++++ 3 files changed, 130 insertions(+), 52 deletions(-) delete mode 100644 quickstep/src/com/android/launcher3/uioverrides/PreviewSurfaceRenderer.java create mode 100644 src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java diff --git a/quickstep/src/com/android/launcher3/uioverrides/PreviewSurfaceRenderer.java b/quickstep/src/com/android/launcher3/uioverrides/PreviewSurfaceRenderer.java deleted file mode 100644 index c7cce0b563..0000000000 --- a/quickstep/src/com/android/launcher3/uioverrides/PreviewSurfaceRenderer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2020 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.uioverrides; - -import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; - -import android.content.Context; -import android.os.Bundle; -import android.util.Size; -import android.view.View; - -import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.graphics.LauncherPreviewRenderer; -import com.android.systemui.shared.system.SurfaceViewRequestReceiver; - -/** Render preview using surface view. */ -public class PreviewSurfaceRenderer { - - /** Handle a received surface view request. */ - public static void render(Context context, Bundle bundle) { - String gridName = bundle.getString("name"); - bundle.remove("name"); - if (gridName == null) { - gridName = InvariantDeviceProfile.getCurrentGridName(context); - } - final InvariantDeviceProfile idp = new InvariantDeviceProfile(context, gridName); - - MAIN_EXECUTOR.execute(() -> { - View view = new LauncherPreviewRenderer(context, idp).getRenderedView(); - new SurfaceViewRequestReceiver().onReceive(context, bundle, view, - new Size(view.getMeasuredWidth(), view.getMeasuredHeight())); - }); - } -} diff --git a/src/com/android/launcher3/graphics/GridOptionsProvider.java b/src/com/android/launcher3/graphics/GridOptionsProvider.java index 607aba9e6b..af974f80c1 100644 --- a/src/com/android/launcher3/graphics/GridOptionsProvider.java +++ b/src/com/android/launcher3/graphics/GridOptionsProvider.java @@ -20,7 +20,6 @@ import android.util.Xml; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.InvariantDeviceProfile.GridOption; import com.android.launcher3.R; -import com.android.launcher3.uioverrides.PreviewSurfaceRenderer; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -201,12 +200,11 @@ public class GridOptionsProvider extends ContentProvider { } @Override - public Bundle call(String method, String arg, Bundle extras) { + public Bundle call(String method, String arg, Bundle extras) { if (!METHOD_GET_PREVIEW.equals(method)) { return null; } - PreviewSurfaceRenderer.render(getContext(), extras); - return null; + return new PreviewSurfaceRenderer(getContext(), extras).render(); } } diff --git a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java new file mode 100644 index 0000000000..20eec9a7c6 --- /dev/null +++ b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2020 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.graphics; + +import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; + +import android.content.Context; +import android.hardware.display.DisplayManager; +import android.os.Bundle; +import android.os.Handler; +import android.os.IBinder; +import android.os.Looper; +import android.os.Message; +import android.os.Messenger; +import android.view.Display; +import android.view.SurfaceControlViewHost; +import android.view.View; + +import com.android.launcher3.InvariantDeviceProfile; + +import java.util.concurrent.TimeUnit; + +/** Render preview using surface view. */ +public class PreviewSurfaceRenderer implements IBinder.DeathRecipient { + + private static final String KEY_HOST_TOKEN = "host_token"; + private static final String KEY_VIEW_WIDTH = "width"; + private static final String KEY_VIEW_HEIGHT = "height"; + private static final String KEY_DISPLAY_ID = "display_id"; + private static final String KEY_SURFACE_PACKAGE = "surface_package"; + private static final String KEY_CALLBACK = "callback"; + + private final Context mContext; + private final InvariantDeviceProfile mIdp; + private final IBinder mHostToken; + private final int mWidth; + private final int mHeight; + private final Display mDisplay; + + private SurfaceControlViewHost mSurfaceControlViewHost; + + PreviewSurfaceRenderer(Context context, Bundle bundle) { + mContext = context; + + String gridName = bundle.getString("name"); + bundle.remove("name"); + if (gridName == null) { + gridName = InvariantDeviceProfile.getCurrentGridName(context); + } + mIdp = new InvariantDeviceProfile(context, gridName); + + mHostToken = bundle.getBinder(KEY_HOST_TOKEN); + mWidth = bundle.getInt(KEY_VIEW_WIDTH); + mHeight = bundle.getInt(KEY_VIEW_HEIGHT); + + final DisplayManager displayManager = (DisplayManager) context.getSystemService( + Context.DISPLAY_SERVICE); + mDisplay = displayManager.getDisplay(bundle.getInt(KEY_DISPLAY_ID)); + } + + /** Handle a received surface view request. */ + Bundle render() { + if (mSurfaceControlViewHost != null) { + binderDied(); + } + + try { + mSurfaceControlViewHost = MAIN_EXECUTOR + .submit(() -> new SurfaceControlViewHost(mContext, mDisplay, mHostToken)) + .get(5, TimeUnit.SECONDS); + mHostToken.linkToDeath(this, 0); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + MAIN_EXECUTOR.execute(() -> { + View view = new LauncherPreviewRenderer(mContext, mIdp).getRenderedView(); + // This aspect scales the view to fit in the surface and centers it + final float scale = Math.min(mWidth / (float) view.getMeasuredWidth(), + mHeight / (float) view.getMeasuredHeight()); + view.setScaleX(scale); + view.setScaleY(scale); + view.setPivotX(0); + view.setPivotY(0); + view.setTranslationX((mWidth - scale * view.getWidth()) / 2); + view.setTranslationY((mHeight - scale * view.getHeight()) / 2); + mSurfaceControlViewHost.setView(view, view.getMeasuredWidth(), + view.getMeasuredHeight()); + }); + + Bundle result = new Bundle(); + result.putParcelable(KEY_SURFACE_PACKAGE, mSurfaceControlViewHost.getSurfacePackage()); + + Handler handler = new Handler(Looper.getMainLooper(), Loopermessage -> { + binderDied(); + return true; + }); + Messenger messenger = new Messenger(handler); + Message msg = Message.obtain(); + msg.replyTo = messenger; + result.putParcelable(KEY_CALLBACK, msg); + return result; + } + + @Override + public void binderDied() { + if (mSurfaceControlViewHost != null) { + mSurfaceControlViewHost.release(); + mSurfaceControlViewHost = null; + } + mHostToken.unlinkToDeath(this, 0); + } +} From c343cb865884dc6a5033708fd3036b1a4e2e6053 Mon Sep 17 00:00:00 2001 From: Becky Qiu Date: Tue, 10 Mar 2020 11:20:41 -0700 Subject: [PATCH 04/55] [Overview Actions] Resizes the select mode UI and adds animations. Demo video: https://drive.google.com/a/google.com/file/d/1m0CasV2tQEGNelcjwvFRUlTeyBd7WhM6/view?usp=sharing Spec: https://docs.google.com/presentation/d/1gXWNdCRXvXuEhgDmE0TX2KYqCxIQBXVtWKdl4pKrno8/edit#slide=id.g6f30ae9caf_14_4 Test:local Bug:139828243 Change-Id: Iaecad62365c687f78494edd235b2e11433fe6907 --- .../android/quickstep/views/RecentsView.java | 8 +++-- .../com/android/quickstep/views/TaskView.java | 32 +++++++++++++++++-- quickstep/res/values/dimens.xml | 2 ++ .../android/quickstep/util/LayoutUtils.java | 4 ++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index e3b3102562..bb0a5b7d1c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -710,11 +710,15 @@ public abstract class RecentsView extends PagedView impl int currentIndex = indexOfChild(taskView); TaskView previousTask = getTaskViewAt(currentIndex - 1); TaskView nextTask = getTaskViewAt(currentIndex + 1); + float alpha = isTaskOverlayModal ? 0.0f : 1.0f; if (previousTask != null) { - previousTask.setVisibility(isTaskOverlayModal ? View.INVISIBLE : View.VISIBLE); + previousTask.animate().alpha(alpha) + .translationX(isTaskOverlayModal ? previousTask.getWidth() / 2 : 0); } if (nextTask != null) { - nextTask.setVisibility(isTaskOverlayModal ? View.INVISIBLE : View.VISIBLE); + nextTask.animate().alpha(alpha) + .translationX(isTaskOverlayModal ? -nextTask.getWidth() / 2 : 0); + } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index 7010f9ab8a..e393a2c473 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -180,6 +180,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private float mStableAlpha = 1; private boolean mShowScreenshot; + private boolean mRunningModalAnimation = false; // The current background requests to load the task thumbnail and icon private TaskThumbnailCache.ThumbnailLoadRequest mThumbnailLoadRequest; @@ -262,17 +263,40 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { /** Updates UI based on whether the task is modal. */ public void updateUiForModalTask() { boolean isOverlayModal = isTaskOverlayModal(); + mRunningModalAnimation = true; if (getRecentsView() != null) { getRecentsView().updateUiForModalTask(this, isOverlayModal); } - // Hide footers when overlay is modal. + + // Hides footers and icon when overlay is modal. if (isOverlayModal) { for (FooterWrapper footer : mFooters) { if (footer != null) { footer.animateHide(); } } + mIconView.animate().alpha(0.0f); + } else { + mIconView.animate().alpha(1.0f); } + + // Sets animations for modal UI. We will remove the margins to zoom in the snapshot. + float topMargin = + getResources().getDimension(R.dimen.task_thumbnail_top_margin_with_actions); + float bottomMargin = + getResources().getDimension(R.dimen.task_thumbnail_bottom_margin_with_actions); + float newHeight = mSnapshotView.getHeight() + topMargin + bottomMargin; + float scale = isOverlayModal ? newHeight / mSnapshotView.getHeight() : 1.0f; + float centerDifference = (bottomMargin - topMargin) / 2; + float translationY = isOverlayModal ? centerDifference : 0; + this.animate().scaleX(scale).scaleY(scale).translationY(translationY) + .withEndAction(new Runnable() { + @Override + public void run() { + setCurveScale(scale); + mRunningModalAnimation = false; + } + }); } public TaskMenuView getMenuView() { @@ -579,11 +603,15 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { @Override public void onPageScroll(ScrollState scrollState) { + // Don't do anything if it's modal. + if (mRunningModalAnimation || isTaskOverlayModal()) { + return; + } + float curveInterpolation = CURVE_INTERPOLATOR.getInterpolation(scrollState.linearInterpolation); float curveScaleForCurveInterpolation = getCurveScaleForCurveInterpolation( curveInterpolation); - mSnapshotView.setDimAlpha(curveInterpolation * MAX_PAGE_SCRIM_ALPHA); setCurveScale(curveScaleForCurveInterpolation); diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index dcc85d52cc..7f1a8bf3d8 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -17,6 +17,8 @@ 24dp + 60dp + 76dp 12dp 48dp diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java index 1f1a99937e..f71bcfbdd4 100644 --- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java +++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java @@ -122,7 +122,9 @@ public class LayoutUtils { paddingHorz = res.getDimension(paddingResId); } - float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin); + float topIconMargin = overviewActionsEnabled + ? res.getDimension(R.dimen.task_thumbnail_top_margin_with_actions) + : res.getDimension(R.dimen.task_thumbnail_top_margin); float bottomMargin = thumbnailBottomMargin(context); float paddingVert = overviewActionsEnabled && removeShelfFromOverview(context) From 5626583228729b99cac91182a76193c9a4e40907 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 6 Apr 2020 18:20:51 -0700 Subject: [PATCH 05/55] Fixing insets not getting applied to workspace Change-Id: I7512849efd91d4aa2b9da6aba0602c65422c606d --- src/com/android/launcher3/Workspace.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 3a3de264fd..7c504a6aa8 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -282,6 +282,7 @@ public class Workspace extends PagedView Rect padding = grid.workspacePadding; setPadding(padding.left, padding.top, padding.right, padding.bottom); + mInsets.set(insets); if (mWorkspaceFadeInAdjacentScreens) { // In landscape mode the page spacing is set to the default. From acd17dfc18e57436ab138d00c97961b26387d83b Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 3 Apr 2020 15:58:45 -0700 Subject: [PATCH 06/55] Removing some new object creation during touch handling > Motion various transformation methods to Orientation Handler > Moving orientation handler to quickstep package Bug: 150300347 Bug: 151269990 Bug: 149610456 Change-Id: I28434c1d1f62a3b85f3583740f0a8f827513fab3 --- .../android/quickstep/BaseSwipeUpHandler.java | 22 +- .../quickstep/FallbackActivityInterface.java | 2 - .../quickstep/FallbackSwipeHandler.java | 6 +- .../util/AppWindowAnimationHelper.java | 19 +- .../quickstep/views/ClearAllButton.java | 15 -- .../android/quickstep/views/RecentsView.java | 53 +++-- .../com/android/quickstep/views/TaskView.java | 26 +-- .../OrientationTouchTransformer.java | 63 ++--- .../quickstep/util/RecentsOrientedState.java | 217 ++++++++++++++++++ src/com/android/launcher3/PagedView.java | 40 +--- .../model/PagedViewOrientedState.java | 106 --------- .../launcher3/states/RotationHelper.java | 137 ----------- .../touch/PagedOrientationHandler.java | 4 + 13 files changed, 320 insertions(+), 390 deletions(-) create mode 100644 quickstep/src/com/android/quickstep/util/RecentsOrientedState.java delete mode 100644 src/com/android/launcher3/model/PagedViewOrientedState.java diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 5abeae4653..85741eda86 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -46,11 +46,8 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorPlaybackController; -import com.android.launcher3.model.PagedViewOrientedState; -import com.android.launcher3.states.RotationHelper; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.touch.PortraitPagedViewHandler; import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.views.FloatingIconView; import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory; @@ -59,6 +56,7 @@ import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AppWindowAnimationHelper; import com.android.quickstep.util.AppWindowAnimationHelper.TransformParams; +import com.android.quickstep.util.RecentsOrientedState; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; @@ -127,7 +125,7 @@ public abstract class BaseSwipeUpHandler a; private TargetAlphaProvider mBaseAlphaCallback = (t, a) -> 1; - public AppWindowAnimationHelper(PagedViewOrientedState orientedState, Context context) { + public AppWindowAnimationHelper(RecentsOrientedState orientedState, Context context) { Resources res = context.getResources(); mOrientedState = orientedState; mWindowCornerRadius = getWindowCornerRadius(res); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java index 763f5beb10..e455939f0e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java @@ -78,21 +78,6 @@ public class ClearAllButton extends Button implements PageCallbacks { } } - public void onLayoutChanged() { - if (mParent == null) { - return; - } - setRotation(mParent.getPagedOrientationHandler().getDegreesRotated()); - } - - public void setRtl(boolean rtl) { - if (mIsRtl == rtl) { - return; - } - mIsRtl = rtl; - invalidate(); - } - public void setVisibilityAlpha(float alpha) { if (mVisibilityAlpha != alpha) { mVisibilityAlpha = alpha; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index e3b3102562..5e8c232fd3 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -100,8 +100,8 @@ import com.android.launcher3.anim.SpringProperty; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statehandlers.DepthController; -import com.android.launcher3.states.RotationHelper; import com.android.launcher3.testing.TestProtocol; +import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.touch.PagedOrientationHandler.CurveProperties; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; @@ -122,6 +122,7 @@ import com.android.quickstep.TaskUtils; import com.android.quickstep.ViewUtils; import com.android.quickstep.util.AppWindowAnimationHelper; import com.android.quickstep.util.LayoutUtils; +import com.android.quickstep.util.RecentsOrientedState; import com.android.systemui.plugins.ResourceProvider; import com.android.systemui.shared.recents.IPinnedStackAnimationListener; import com.android.systemui.shared.recents.model.Task; @@ -171,6 +172,8 @@ public abstract class RecentsView extends PagedView impl } }; + protected final RecentsOrientedState mOrientationState = new RecentsOrientedState(); + private OrientationEventListener mOrientationListener; private int mPreviousRotation; protected RecentsAnimationController mRecentsAnimationController; @@ -383,7 +386,7 @@ public abstract class RecentsView extends PagedView impl mOrientationListener = new OrientationEventListener(getContext()) { @Override public void onOrientationChanged(int i) { - int rotation = RotationHelper.getRotationFromDegrees(i); + int rotation = RecentsOrientedState.getRotationForUserDegreesRotated(i); if (mPreviousRotation != rotation) { animateRecentsRotationInPlace(rotation); if (rotation == 0) { @@ -661,7 +664,7 @@ public abstract class RecentsView extends PagedView impl final int pageIndex = requiredTaskCount - i - 1 + mTaskViewStartIndex; final Task task = tasks.get(i); final TaskView taskView = (TaskView) getChildAt(pageIndex); - taskView.bind(task, mLayoutRotation); + taskView.bind(task, mOrientationState); } if (mNextPage == INVALID_PAGE) { @@ -973,7 +976,7 @@ public abstract class RecentsView extends PagedView impl AnimatorSet pa = setRecentsChangedOrientation(true); pa.addListener(AnimationSuccessListener.forRunnable(() -> { - updateLayoutRotation(newRotation); + setLayoutRotation(newRotation, mOrientationState.getDisplayRotation()); mActivity.getDragLayer().recreateControllers(); rotateAllChildTasks(); setRecentsChangedOrientation(false).start(); @@ -999,8 +1002,7 @@ public abstract class RecentsView extends PagedView impl private void rotateAllChildTasks() { for (int i = 0; i < getTaskViewCount(); i++) { - TaskView taskView = getTaskViewAt(i); - taskView.setOverviewRotation(mLayoutRotation); + getTaskViewAt(i).setOrientationState(mOrientationState); } } @@ -1041,7 +1043,7 @@ public abstract class RecentsView extends PagedView impl new ComponentName(getContext(), getClass()), 0, 0), null, null, "", "", 0, 0, false, true, false, false, new ActivityManager.TaskDescription(), 0, new ComponentName("", ""), false); - taskView.bind(mTmpRunningTask, mLayoutRotation); + taskView.bind(mTmpRunningTask, mOrientationState); } boolean runningTaskTileHidden = mRunningTaskTileHidden; @@ -1530,16 +1532,28 @@ public abstract class RecentsView extends PagedView impl } } - @Override public void setLayoutRotation(int touchRotation, int displayRotation) { - if (!FeatureFlags.ENABLE_FIXED_ROTATION_TRANSFORM.get()) { - return; + if (mOrientationState.update(touchRotation, displayRotation)) { + mOrientationHandler = mOrientationState.getOrientationHandler(); + mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources()); + setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR); + mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated()); + requestLayout(); } + } - super.setLayoutRotation(touchRotation, displayRotation); - mClearAllButton.onLayoutChanged(); - mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources()); - setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR); + public void disableMultipleLayoutRotations(boolean disable) { + mOrientationState.disableMultipleOrientations(disable); + mOrientationHandler = mOrientationState.getOrientationHandler(); + requestLayout(); + } + + public RecentsOrientedState getPagedViewOrientedState() { + return mOrientationState; + } + + public PagedOrientationHandler getPagedOrientationHandler() { + return mOrientationHandler; } @Override @@ -1986,8 +2000,7 @@ public abstract class RecentsView extends PagedView impl public Consumer getEventDispatcher(float navbarRotation) { float degreesRotated; if (navbarRotation == 0) { - degreesRotated = mOrientationState.areMultipleLayoutOrientationsDisabled() ? 0 : - RotationHelper.getDegreesFromRotation(mLayoutRotation); + degreesRotated = mOrientationState.getTouchRotationDegrees(); } else { degreesRotated = -navbarRotation; } @@ -2001,14 +2014,14 @@ public abstract class RecentsView extends PagedView impl return e -> { if (navbarRotation != 0 && !mOrientationState.areMultipleLayoutOrientationsDisabled()) { - RotationHelper.transformEventForNavBar(e, true); + mOrientationState.flipVertical(e); super.onTouchEvent(e); - RotationHelper.transformEventForNavBar(e, false); + mOrientationState.flipVertical(e); return; } - RotationHelper.transformEvent(-degreesRotated, e, true); + mOrientationState.transformEvent(-degreesRotated, e, true); super.onTouchEvent(e); - RotationHelper.transformEvent(-degreesRotated, e, false); + mOrientationState.transformEvent(-degreesRotated, e, false); }; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index 7010f9ab8a..ceb099f3a1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -64,7 +64,6 @@ import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.popup.SystemShortcut; -import com.android.launcher3.states.RotationHelper; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.PagedOrientationHandler; @@ -79,6 +78,7 @@ import com.android.quickstep.TaskOverlayFactory; import com.android.quickstep.TaskThumbnailCache; import com.android.quickstep.TaskUtils; import com.android.quickstep.util.LayoutUtils; +import com.android.quickstep.util.RecentsOrientedState; import com.android.quickstep.util.TaskCornerRadius; import com.android.quickstep.views.RecentsView.PageCallbacks; import com.android.quickstep.views.RecentsView.ScrollState; @@ -119,19 +119,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private static final List SYSTEM_GESTURE_EXCLUSION_RECT = Collections.singletonList(new Rect()); - public static final FloatProperty FULLSCREEN_PROGRESS = - new FloatProperty("fullscreenProgress") { - @Override - public void setValue(TaskView taskView, float v) { - taskView.setFullscreenProgress(v); - } - - @Override - public Float get(TaskView taskView) { - return taskView.mFullscreenProgress; - } - }; - private static final FloatProperty FOCUS_TRANSITION = new FloatProperty("focusTransition") { @Override @@ -286,11 +273,11 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { /** * Updates this task view to the given {@param task}. */ - public void bind(Task task, int recentsRotation) { + public void bind(Task task, RecentsOrientedState orientedState) { cancelPendingLoadTasks(); mTask = task; mSnapshotView.bind(task); - setOverviewRotation(recentsRotation); + setOrientationState(orientedState); } public Task getTask() { @@ -459,14 +446,15 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } } - void setOverviewRotation(int iconRotation) { - PagedOrientationHandler orientationHandler = getRecentsView().getPagedOrientationHandler(); + public void setOrientationState(RecentsOrientedState orientationState) { + int iconRotation = orientationState.getTouchRotation(); + PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler(); boolean isRtl = orientationHandler.getRecentsRtlSetting(getResources()); LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams(); snapshotParams.bottomMargin = LayoutUtils.thumbnailBottomMargin(getContext()); int thumbnailPadding = (int) getResources().getDimension(R.dimen.task_thumbnail_top_margin); LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams(); - int rotation = RotationHelper.getDegreesFromRotation(iconRotation); + int rotation = orientationState.getTouchRotationDegrees(); switch (iconRotation) { case Surface.ROTATION_90: iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL; diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java index 3e73f49f37..95cd4f2c13 100644 --- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java +++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java @@ -22,6 +22,8 @@ import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_UP; +import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation; + import android.content.res.Resources; import android.graphics.Matrix; import android.graphics.Point; @@ -33,8 +35,8 @@ import android.view.Surface; import com.android.launcher3.R; import com.android.launcher3.ResourceUtils; -import com.android.launcher3.states.RotationHelper; import com.android.launcher3.util.DefaultDisplay; +import com.android.quickstep.util.RecentsOrientedState.SurfaceRotation; import java.io.PrintWriter; @@ -52,6 +54,9 @@ class OrientationTouchTransformer { private static final boolean DEBUG = false; private static final int MAX_ORIENTATIONS = 4; + private final Matrix mTmpMatrix = new Matrix(); + private final float[] mTmpPoint = new float[2]; + private SparseArray mSwipeTouchRegions = new SparseArray<>(MAX_ORIENTATIONS); private final RectF mAssistantLeftRegion = new RectF(); private final RectF mAssistantRightRegion = new RectF(); @@ -304,42 +309,46 @@ class OrientationTouchTransformer { } boolean applyTransform(MotionEvent event, boolean forceTransform) { - // TODO(b/149658423): See if we can use RotationHelper.getRotationMatrix here - MotionEvent tmp = MotionEvent.obtain(event); - Matrix outMatrix = new Matrix(); - int delta = RotationHelper.deltaRotation(mCurrentRotation, mRotation); - switch (delta) { - case Surface.ROTATION_0: - outMatrix.reset(); - break; - case Surface.ROTATION_90: - outMatrix.setRotate(270); - outMatrix.postTranslate(0, mHeight); - break; - case Surface.ROTATION_180: - outMatrix.setRotate(180); - outMatrix.postTranslate(mHeight, mWidth); - break; - case Surface.ROTATION_270: - outMatrix.setRotate(90); - outMatrix.postTranslate(mWidth, 0); - break; + mTmpMatrix.reset(); + postDisplayRotation(deltaRotation(mCurrentRotation, mRotation), + mHeight, mWidth, mTmpMatrix); + if (forceTransform) { + if (DEBUG) { + Log.d(TAG, "Transforming rotation due to forceTransform, " + + "mCurrentRotation: " + mCurrentRotation + + "mRotation: " + mRotation); + } + event.transform(mTmpMatrix); + return true; } + mTmpPoint[0] = event.getX(); + mTmpPoint[1] = event.getY(); + mTmpMatrix.mapPoints(mTmpPoint); - tmp.transform(outMatrix); if (DEBUG) { Log.d(TAG, "original: " + event.getX() + ", " + event.getY() - + " new: " + tmp.getX() + ", " + tmp.getY() + + " new: " + mTmpPoint[0] + ", " + mTmpPoint[1] + " rect: " + this + " forceTransform: " + forceTransform - + " contains: " + contains(tmp.getX(), tmp.getY())); + + " contains: " + contains(mTmpPoint[0], mTmpPoint[1])); } - if (forceTransform || contains(tmp.getX(), tmp.getY())) { - event.transform(outMatrix); - tmp.recycle(); + if (contains(mTmpPoint[0], mTmpPoint[1])) { + event.transform(mTmpMatrix); return true; } return false; } } + + /** + * @return how many factors {@param newRotation} is rotated 90 degrees clockwise. + * E.g. 1->Rotated by 90 degrees clockwise, 2->Rotated 180 clockwise... + * A value of 0 means no rotation has been applied + */ + @SurfaceRotation + private static int deltaRotation(int oldRotation, int newRotation) { + int delta = newRotation - oldRotation; + if (delta < 0) delta += 4; + return delta; + } } diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java new file mode 100644 index 0000000000..f72e4588ca --- /dev/null +++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java @@ -0,0 +1,217 @@ +/* + * Copyright (C) 2020 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.quickstep.util; + +import static android.hardware.camera2.params.OutputConfiguration.ROTATION_180; +import static android.view.Surface.ROTATION_0; +import static android.view.Surface.ROTATION_270; +import static android.view.Surface.ROTATION_90; + +import static java.lang.annotation.RetentionPolicy.SOURCE; + +import android.graphics.Matrix; +import android.graphics.RectF; +import android.view.MotionEvent; +import android.view.Surface; + +import androidx.annotation.IntDef; + +import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.touch.PagedOrientationHandler; +import com.android.launcher3.touch.PortraitPagedViewHandler; + +import java.lang.annotation.Retention; + +/** + * Container to hold orientation/rotation related information for Launcher. + * This is not meant to be an abstraction layer for applying different functionality between + * the different orientation/rotations. For that see {@link PagedOrientationHandler} + * + * This class has initial default state assuming the device and foreground app have + * no ({@link Surface#ROTATION_0} rotation. + */ +public final class RecentsOrientedState { + + @Retention(SOURCE) + @IntDef({ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270}) + public @interface SurfaceRotation {} + + private PagedOrientationHandler mOrientationHandler = PagedOrientationHandler.PORTRAIT; + + private @SurfaceRotation int mTouchRotation = ROTATION_0; + private @SurfaceRotation int mDisplayRotation = ROTATION_0; + /** + * If {@code true} we default to {@link PortraitPagedViewHandler} and don't support any fake + * launcher orientations. + */ + private boolean mDisableMultipleOrientations; + + private final Matrix mTmpMatrix = new Matrix(); + private final Matrix mTmpInverseMatrix = new Matrix(); + + /** + * Sets the appropriate {@link PagedOrientationHandler} for {@link #mOrientationHandler} + * @param touchRotation The rotation the nav bar region that is touched is in + * @param displayRotation Rotation of the display/device + * + * @return true if there was any change in the internal state as a result of this call, + * false otherwise + */ + public boolean update( + @SurfaceRotation int touchRotation, @SurfaceRotation int displayRotation) { + if (!FeatureFlags.ENABLE_FIXED_ROTATION_TRANSFORM.get()) { + return false; + } + if (mDisableMultipleOrientations) { + return false; + } + if (mDisplayRotation == displayRotation && mTouchRotation == touchRotation) { + return false; + } + + mDisplayRotation = displayRotation; + mTouchRotation = touchRotation; + if (mTouchRotation == ROTATION_90) { + mOrientationHandler = PagedOrientationHandler.LANDSCAPE; + } else if (mTouchRotation == ROTATION_270) { + mOrientationHandler = PagedOrientationHandler.SEASCAPE; + } else { + mOrientationHandler = PagedOrientationHandler.PORTRAIT; + } + return true; + } + + public boolean areMultipleLayoutOrientationsDisabled() { + return mDisableMultipleOrientations; + } + + /** + * Setting this preference will render future calls to {@link #update(int, int)} as a no-op. + */ + public void disableMultipleOrientations(boolean disable) { + mDisableMultipleOrientations = disable; + if (disable) { + mDisplayRotation = mTouchRotation = ROTATION_0; + mOrientationHandler = PagedOrientationHandler.PORTRAIT; + } + } + + @SurfaceRotation + public int getDisplayRotation() { + return mDisplayRotation; + } + + @SurfaceRotation + public int getTouchRotation() { + return mTouchRotation; + } + + public int getTouchRotationDegrees() { + switch (mTouchRotation) { + case ROTATION_90: + return 90; + case ROTATION_180: + return 180; + case ROTATION_270: + return 270; + case ROTATION_0: + default: + return 0; + } + } + + public PagedOrientationHandler getOrientationHandler() { + return mOrientationHandler; + } + + /** + * For landscape, since the navbar is already in a vertical position, we don't have to do any + * rotations as the change in Y coordinate is what is read. We only flip the sign of the + * y coordinate to make it match existing behavior of swipe to the top to go previous + */ + public void flipVertical(MotionEvent ev) { + mTmpMatrix.setScale(1, -1); + ev.transform(mTmpMatrix); + } + + /** + * Creates a matrix to transform the given motion event specified by degrees. + * If inverse is {@code true}, the inverse of that matrix will be applied + */ + public void transformEvent(float degrees, MotionEvent ev, boolean inverse) { + mTmpMatrix.setRotate(inverse ? -degrees : degrees); + ev.transform(mTmpMatrix); + + // TODO: Add scaling back in based on degrees + /* + if (getWidth() > 0 && getHeight() > 0) { + float scale = ((float) getWidth()) / getHeight(); + transform.postScale(scale, 1 / scale); + } + */ + } + + public void mapRectFromNormalOrientation(RectF src, int screenWidth, int screenHeight) { + mTmpMatrix.reset(); + postDisplayRotation(mDisplayRotation, screenWidth, screenHeight, mTmpMatrix); + mTmpMatrix.mapRect(src); + } + + public void mapInverseRectFromNormalOrientation(RectF src, int screenWidth, int screenHeight) { + mTmpMatrix.reset(); + postDisplayRotation(mDisplayRotation, screenWidth, screenHeight, mTmpMatrix); + mTmpMatrix.invert(mTmpInverseMatrix); + mTmpInverseMatrix.mapRect(src); + } + + @SurfaceRotation + public static int getRotationForUserDegreesRotated(float degrees) { + int threshold = 70; + if (degrees >= (360 - threshold) || degrees < (threshold)) { + return ROTATION_0; + } else if (degrees < (90 + threshold)) { + return ROTATION_270; + } else if (degrees < 180 + threshold) { + return ROTATION_180; + } else { + return ROTATION_90; + } + } + + /** + * Posts the transformation on the matrix representing the provided display rotation + */ + public static void postDisplayRotation(@SurfaceRotation int displayRotation, + float screenWidth, float screenHeight, Matrix out) { + switch (displayRotation) { + case ROTATION_0: + return; + case ROTATION_90: + out.postRotate(270); + out.postTranslate(0, screenWidth); + break; + case ROTATION_180: + out.postRotate(180); + out.postTranslate(screenHeight, screenWidth); + break; + case ROTATION_270: + out.postRotate(90); + out.postTranslate(screenHeight, 0); + break; + } + } +} diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 5e47e2ff73..e36ae94648 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -38,7 +38,6 @@ import android.util.Log; import android.view.InputDevice; import android.view.KeyEvent; import android.view.MotionEvent; -import android.view.Surface; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; @@ -55,12 +54,10 @@ import androidx.annotation.Nullable; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.model.PagedViewOrientedState; import com.android.launcher3.pageindicators.PageIndicator; import com.android.launcher3.touch.OverScroll; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.touch.PagedOrientationHandler.ChildBounds; -import com.android.launcher3.touch.PortraitPagedViewHandler; import com.android.launcher3.util.OverScroller; import com.android.launcher3.util.Thunk; import com.android.launcher3.views.ActivityContext; @@ -121,8 +118,7 @@ public abstract class PagedView extends ViewGrou private float mLastMotion; private float mLastMotionRemainder; private float mTotalMotion; - protected PagedOrientationHandler mOrientationHandler = new PortraitPagedViewHandler(); - protected final PagedViewOrientedState mOrientationState = new PagedViewOrientedState(); + protected PagedOrientationHandler mOrientationHandler = PagedOrientationHandler.PORTRAIT; protected int[] mPageScrolls; private boolean mIsBeingDragged; @@ -144,9 +140,6 @@ public abstract class PagedView extends ViewGrou protected int mUnboundedScroll; - protected int mLayoutRotation = Surface.ROTATION_0; - protected int mDisplayRotation = Surface.ROTATION_0; - // Page Indicator @Thunk int mPageIndicatorViewId; protected T mPageIndicator; @@ -417,37 +410,6 @@ public abstract class PagedView extends ViewGrou return mUnboundedScroll; } - protected void updateLayoutRotation(int touchRotation) { - setLayoutRotation(touchRotation, mDisplayRotation); - } - - /** @param touchRotation Must be one of {@link android.view.Surface.ROTATION_0/90/180/270} */ - public void setLayoutRotation(int touchRotation, int displayRotation) { - if (mLayoutRotation == touchRotation && mDisplayRotation == displayRotation) { - return; - } - - mOrientationState.update(touchRotation, displayRotation); - mOrientationHandler = mOrientationState.getOrientationHandler(); - mLayoutRotation = touchRotation; - mDisplayRotation = displayRotation; - requestLayout(); - } - - public PagedViewOrientedState getPagedViewOrientedState() { - return mOrientationState; - } - - public PagedOrientationHandler getPagedOrientationHandler() { - return getPagedViewOrientedState().getOrientationHandler(); - } - - public void disableMultipleLayoutRotations(boolean disable) { - mOrientationState.disableMultipleOrientations(disable); - mOrientationHandler = mOrientationState.getOrientationHandler(); - requestLayout(); - } - @Override public void scrollBy(int x, int y) { mOrientationHandler.delegateScrollBy(this, getUnboundedScroll(), x, y); diff --git a/src/com/android/launcher3/model/PagedViewOrientedState.java b/src/com/android/launcher3/model/PagedViewOrientedState.java deleted file mode 100644 index e48b8c1848..0000000000 --- a/src/com/android/launcher3/model/PagedViewOrientedState.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * - * * Copyright (C) 2020 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.model; - -import android.view.Surface; - -import com.android.launcher3.states.RotationHelper; -import com.android.launcher3.touch.PortraitPagedViewHandler; -import com.android.launcher3.touch.LandscapePagedViewHandler; -import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.touch.SeascapePagedViewHandler; - -/** - * Container to hold orientation/rotation related information for Launcher. - * This is not meant to be an abstraction layer for applying different functionality between - * the different orientation/rotations. For that see {@link PagedOrientationHandler} - * - * This class has initial default state assuming the device and foreground app have - * no ({@link Surface.ROTATION_0} rotation. - * - * Currently this class resides in {@link com.android.launcher3.PagedView}, but there's a ticket - * to disassociate it from Launcher since it's needed before Launcher is instantiated - * See TODO(b/150300347) - */ -public final class PagedViewOrientedState { - - private PagedOrientationHandler mOrientationHandler = new PortraitPagedViewHandler(); - - private int mTouchRotation = Surface.ROTATION_0; - private int mDisplayRotation = Surface.ROTATION_0; - /** - * If {@code true} we default to {@link PortraitPagedViewHandler} and don't support any fake - * launcher orientations. - */ - private boolean mDisableMultipleOrientations; - - /** - * Sets the appropriate {@link PagedOrientationHandler} for {@link #mOrientationHandler} - * @param touchRotation The rotation the nav bar region that is touched is in - * @param displayRotation Rotation of the display/device - */ - public void update(int touchRotation, int displayRotation) { - if (mDisableMultipleOrientations) { - return; - } - - mDisplayRotation = displayRotation; - mTouchRotation = touchRotation; - if (mTouchRotation == Surface.ROTATION_90) { - mOrientationHandler = new LandscapePagedViewHandler(); - } else if (mTouchRotation == Surface.ROTATION_270) { - mOrientationHandler = new SeascapePagedViewHandler(); - } else { - mOrientationHandler = new PortraitPagedViewHandler(); - } - } - - public boolean areMultipleLayoutOrientationsDisabled() { - return mDisableMultipleOrientations; - } - - /** - * Setting this preference will render future calls to {@link #update(int, int)} as a no-op. - */ - public void disableMultipleOrientations(boolean disable) { - mDisableMultipleOrientations = disable; - if (disable) { - mOrientationHandler = new PortraitPagedViewHandler(); - } - } - - public int getDisplayRotation() { - return mDisplayRotation; - } - - /** - * Gets the difference between the rotation of the device/display and which region the - * user is currently interacting with in factors of 90 degree clockwise rotations. - * Ex. Display is in portrait -> 0, user touches landscape region -> 1, this - * method would return 3 because it takes 3 clockwise 90 degree rotations from normal to - * landscape (portrait -> seascape -> reverse portrait -> landscape) - */ - public int getTouchDisplayDelta() { - return RotationHelper.deltaRotation(mTouchRotation, mDisplayRotation); - } - - public PagedOrientationHandler getOrientationHandler() { - return mOrientationHandler; - } -} diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java index 8bb6a08a34..2e0521f34c 100644 --- a/src/com/android/launcher3/states/RotationHelper.java +++ b/src/com/android/launcher3/states/RotationHelper.java @@ -31,12 +31,7 @@ import android.content.ContentResolver; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.res.Resources; -import android.graphics.Matrix; -import android.graphics.Rect; -import android.graphics.RectF; import android.provider.Settings; -import android.view.MotionEvent; -import android.view.Surface; import com.android.launcher3.R; import com.android.launcher3.Utilities; @@ -258,138 +253,6 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { } } - public static int getDegreesFromRotation(int rotation) { - int degrees; - switch (rotation) { - case Surface.ROTATION_90: - degrees = 90; - break; - case Surface.ROTATION_180: - degrees = 180; - break; - case Surface.ROTATION_270: - degrees = 270; - break; - case Surface.ROTATION_0: - default: - degrees = 0; - break; - } - return degrees; - } - - public static int getRotationFromDegrees(float degrees) { - int threshold = 70; - if (degrees >= (360 - threshold) || degrees < (threshold)) { - return Surface.ROTATION_0; - } else if (degrees < (90 + threshold)) { - return Surface.ROTATION_270; - } else if (degrees < 180 + threshold) { - return Surface.ROTATION_180; - } else { - return Surface.ROTATION_90; - } - } - - /** - * @return how many factors {@param newRotation} is rotated 90 degrees clockwise. - * E.g. 1->Rotated by 90 degrees clockwise, 2->Rotated 180 clockwise... - * A value of 0 means no rotation has been applied - */ - public static int deltaRotation(int oldRotation, int newRotation) { - int delta = newRotation - oldRotation; - if (delta < 0) delta += 4; - return delta; - } - - /** - * For landscape, since the navbar is already in a vertical position, we don't have to do any - * rotations as the change in Y coordinate is what is read. We only flip the sign of the - * y coordinate to make it match existing behavior of swipe to the top to go previous - */ - public static void transformEventForNavBar(MotionEvent ev, boolean inverse) { - // TODO(b/151269990): Use a temp matrix - Matrix m = new Matrix(); - m.setScale(1, -1); - if (inverse) { - Matrix inv = new Matrix(); - m.invert(inv); - ev.transform(inv); - } else { - ev.transform(m); - } - } - - /** - * Creates a matrix to transform the given motion event specified by degrees. - * If {@param inverse} is {@code true}, the inverse of that matrix will be applied - */ - public static void transformEvent(float degrees, MotionEvent ev, boolean inverse) { - Matrix transform = new Matrix(); - // TODO(b/151269990): Use a temp matrix - transform.setRotate(degrees); - if (inverse) { - Matrix inv = new Matrix(); - transform.invert(inv); - ev.transform(inv); - } else { - ev.transform(transform); - } - // TODO: Add scaling back in based on degrees -// if (getWidth() > 0 && getHeight() > 0) { -// float scale = ((float) getWidth()) / getHeight(); -// transform.postScale(scale, 1 / scale); -// } - } - - /** - * TODO(b/149658423): Have {@link com.android.quickstep.OrientationTouchTransformer - * also use this} - */ - public static Matrix getRotationMatrix(int screenWidth, int screenHeight, int displayRotation) { - Matrix m = new Matrix(); - // TODO(b/151269990): Use a temp matrix - switch (displayRotation) { - case Surface.ROTATION_0: - return m; - case Surface.ROTATION_90: - m.setRotate(360 - RotationHelper.getDegreesFromRotation(displayRotation)); - m.postTranslate(0, screenWidth); - break; - case Surface.ROTATION_270: - m.setRotate(360 - RotationHelper.getDegreesFromRotation(displayRotation)); - m.postTranslate(screenHeight, 0); - break; - } - return m; - } - - public static void mapRectFromNormalOrientation(RectF src, int screenWidth, int screenHeight, - int displayRotation) { - Matrix m = RotationHelper.getRotationMatrix(screenWidth, screenHeight, displayRotation); - m.mapRect(src); - } - - public static void mapInverseRectFromNormalOrientation(RectF src, int screenWidth, - int screenHeight, int displayRotation) { - Matrix m = RotationHelper.getRotationMatrix(screenWidth, screenHeight, displayRotation); - Matrix inverse = new Matrix(); - m.invert(inverse); - inverse.mapRect(src); - } - - public static void getTargetRectForRotation(Rect srcOut, int screenWidth, int screenHeight, - int displayRotation) { - RectF wrapped = new RectF(srcOut); - Matrix m = RotationHelper.getRotationMatrix(screenWidth, screenHeight, displayRotation); - m.mapRect(wrapped); - wrapped.round(srcOut); - } - - public static boolean isRotationLandscape(int rotation) { - return rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90; - } - @Override public String toString() { return String.format("[mStateHandlerRequest=%d, mCurrentStateRequest=%d," diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index 24fa81590a..974e3f3d31 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -39,6 +39,10 @@ import com.android.launcher3.util.OverScroller; */ public interface PagedOrientationHandler { + PagedOrientationHandler PORTRAIT = new PortraitPagedViewHandler(); + PagedOrientationHandler LANDSCAPE = new LandscapePagedViewHandler(); + PagedOrientationHandler SEASCAPE = new SeascapePagedViewHandler(); + interface Int2DAction { void call(T target, int x, int y); } From 15a12f3a86ff9a95937653195510f0b30d599c8e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 1 Apr 2020 15:15:20 -0700 Subject: [PATCH 07/55] Fixing task start index not getting updated on all View add/remove calls Change-Id: Icbd3cd7e9cee33d2f91546ff4efcf6abfa474e1e --- .../android/quickstep/views/RecentsView.java | 55 ++++++++----------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 5e8c232fd3..2bf522bb13 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -508,6 +508,29 @@ public abstract class RecentsView extends PagedView impl mHasVisibleTaskData.delete(taskView.getTask().key.id); mTaskViewPool.recycle(taskView); } + updateTaskStartIndex(child); + } + + @Override + public void onViewAdded(View child) { + super.onViewAdded(child); + child.setAlpha(mContentAlpha); + // RecentsView is set to RTL in the constructor when system is using LTR. Here we set the + // child direction back to match system settings. + child.setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_LTR : View.LAYOUT_DIRECTION_RTL); + updateTaskStartIndex(child); + } + + private void updateTaskStartIndex(View affectingView) { + if (!(affectingView instanceof TaskView) && !(affectingView instanceof ClearAllButton)) { + int childCount = getChildCount(); + + mTaskViewStartIndex = 0; + while (mTaskViewStartIndex < childCount + && !(getChildAt(mTaskViewStartIndex) instanceof TaskView)) { + mTaskViewStartIndex++; + } + } } public boolean isTaskViewVisible(TaskView tv) { @@ -1556,12 +1579,6 @@ public abstract class RecentsView extends PagedView impl return mOrientationHandler; } - @Override - public void onViewAdded(View child) { - super.onViewAdded(child); - child.setAlpha(mContentAlpha); - } - @Nullable public TaskView getNextTaskView() { return getTaskViewAtByAbsoluteIndex(getRunningTaskIndex() + 1); @@ -2069,37 +2086,11 @@ public abstract class RecentsView extends PagedView impl } } - @Override - public void addView(View child, int index) { - // RecentsView is set to RTL in the constructor when system is using LTR. Here we set the - // child direction back to match system settings. - child.setLayoutDirection( - Utilities.isRtl(getResources()) - ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR); - super.addView(child, index); - if (isExtraCardView(child, index)) { - mTaskViewStartIndex++; - } - } - - @Override - public void removeView(View view) { - if (isExtraCardView(view, indexOfChild(view))) { - mTaskViewStartIndex--; - } - super.removeView(view); - } - @Nullable protected DepthController getDepthController() { return null; } - private boolean isExtraCardView(View view, int index) { - return !(view instanceof TaskView) && !(view instanceof ClearAllButton) - && index <= mTaskViewStartIndex; - } - /** * Used to register callbacks for when our empty message state changes. * From a726df9208129fd140b3c2b876bdfa68f6c86777 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 7 Apr 2020 16:36:05 -0700 Subject: [PATCH 08/55] Fix issue with delegate consumers being overwritten - Whenever the delegate consumer sets itself as active, it will cancel the base consumers which can cause onConsumerInactive() which will clear the active consumer. Instead, we should only clear the active consumer, and in the case where isConsumerDetachedFromGesture() is checked, only check the active consumer before resetting. ie. base ic (detached) -> on touch up (do nothing) -> onConsumerInactive (active == base) -> reset base ic (detached), wrapped ic (active) -> onConsumerInactive (active != base) -> on touch up (active == wrapped) -> reset base ic (detached, active), wrapped ic -> on touch up (do nothing) -> onConsumerInactive (active == base) -> reset base ic (not detached) -> on touch up (active == base) -> reset base ic (not detached), wrapped ic (active) -> onConsumerInactive (active != base) -> on touch up (active == wrapped) -> reset base ic (not detached, active), wrapped ic -> on touch up (active == base) -> reset Change-Id: I2d623c501d9c9799dadcf2005f34e1e0062c113f --- .../quickstep/TouchInteractionService.java | 24 ++++++++++++------- .../inputconsumers/DelegateInputConsumer.java | 12 ++++------ .../com/android/quickstep/InputConsumer.java | 6 ++--- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 61fe6cb09a..0c4cd43e72 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -481,14 +481,14 @@ public class TouchInteractionService extends Service implements PluginListener Date: Sun, 22 Mar 2020 13:11:29 -0700 Subject: [PATCH 09/55] Update launcher call to fetch recent tasks - Always just fetch the tasks that will end up in recents Bug: 152133859 Test: Manual, swipe up with pip/assistant and verify nothing changed Change-Id: I41719e111cba85da7e93f65681b7b50b4c5c4a46 (cherry picked from commit 8e714d42aed4df42d2a4d90c74f28284cd172bdf) --- .../quickstep/TouchInteractionService.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 0c4cd43e72..32672ba789 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -496,7 +496,7 @@ public class TouchInteractionService extends Service implements PluginListener mAM.getRunningTask(0))); + () -> mAM.getRunningTask(true /* filterOnlyVisibleRecents */))); return gestureState; } @@ -596,18 +596,10 @@ public class TouchInteractionService extends Service implements PluginListener mAM.getRunningTask(ACTIVITY_TYPE_ASSISTANT /* ignoreActivityType */))); - ComponentName homeComponent = mOverviewComponentObserver.getHomeIntent().getComponent(); - ComponentName runningComponent = - gestureState.getRunningTask().baseIntent.getComponent(); - forceOverviewInputConsumer = - runningComponent != null && runningComponent.equals(homeComponent); - } + RunningTaskInfo runningTask = gestureState.getRunningTask(); + ComponentName homeComponent = mOverviewComponentObserver.getHomeIntent().getComponent(); + boolean forceOverviewInputConsumer = runningTask != null + && runningTask.baseIntent.getComponent().equals(homeComponent); if (previousGestureState.getFinishingRecentsAnimationTaskId() > 0) { // If the finish animation was interrupted, then continue using the other activity input From 5e2cd32ac38a2a4274fb0016d2cd7d4154862244 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 7 Apr 2020 15:43:21 -0700 Subject: [PATCH 10/55] Temporarily revert changes from ag/10899350 Change-Id: I6608f252fd779b23e84348e52c247a8e2fa9ec7a --- .../quickstep/TouchInteractionService.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 32672ba789..a06762fb22 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -496,7 +496,7 @@ public class TouchInteractionService extends Service implements PluginListener mAM.getRunningTask(true /* filterOnlyVisibleRecents */))); + () -> mAM.getRunningTask(false /* filterOnlyVisibleRecents */))); return gestureState; } @@ -596,10 +596,18 @@ public class TouchInteractionService extends Service implements PluginListener mAM.getRunningTask(true /* filterOnlyVisibleRecents */))); + ComponentName homeComponent = mOverviewComponentObserver.getHomeIntent().getComponent(); + ComponentName runningComponent = + gestureState.getRunningTask().baseIntent.getComponent(); + forceOverviewInputConsumer = + runningComponent != null && runningComponent.equals(homeComponent); + } if (previousGestureState.getFinishingRecentsAnimationTaskId() > 0) { // If the finish animation was interrupted, then continue using the other activity input From 16cd3677bc5b30f9d3d43a23ec808dfc033af84b Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 24 Mar 2020 16:55:07 -0700 Subject: [PATCH 11/55] Add onQuickSwitchToNewTask(int rotation) ag/10830421 ag/10831581 Fixes: 150250451 Change-Id: I2d6dbdd0fc7637949bb5ff7707c414f14dbf6d49 --- .../android/quickstep/LauncherSwipeHandler.java | 4 ---- .../com/android/quickstep/SystemUiProxy.java | 17 ++++++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java index b3b0b0263a..1bd03330fe 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java @@ -782,10 +782,6 @@ public class LauncherSwipeHandler } } - if (endTarget == NEW_TASK) { - SystemUiProxy.INSTANCE.get(mContext).onQuickSwitchToNewTask(); - } - if (endTarget == RECENTS || endTarget == HOME) { // Since we're now done quickStepping, we want to only listen for touch events // for the main orientation's nav bar, instead of multiple diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 0210a814cf..f5aaf1dece 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -334,14 +334,13 @@ public class SystemUiProxy implements ISystemUiProxy { } } - public void onQuickSwitchToNewTask() { - //TODO(b/150250451) add back in after big CL goes through -// if (mSystemUiProxy != null) { -// try { -// mSystemUiProxy.onQuickSwitchToNewTask(); -// } catch (RemoteException e) { -// Log.w(TAG, "Failed call onQuickstepStarted", e); -// } -// } + public void onQuickSwitchToNewTask(int rotation) { + if (mSystemUiProxy != null) { + try { + mSystemUiProxy.onQuickSwitchToNewTask(rotation); + } catch (RemoteException e) { + Log.w(TAG, "Failed call onQuickSwitchToNewTask with arg: " + rotation, e); + } + } } } From 180c2e10fc15599c701d775e109a8162f1bd4030 Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 6 Apr 2020 12:39:21 -0700 Subject: [PATCH 12/55] Adding diags to getWidget Also avoiding scrolling widgets horizontally when the gesture could happen in the lower system gesture area. Change-Id: I80192db7e407f8c1715aad3b96178c00b5710e71 --- .../com/android/launcher3/tapl/Widgets.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java index 5be57c6c0b..d4dfb4c9e6 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widgets.java +++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java @@ -88,8 +88,9 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { } public Widget getWidget(String labelText) { - try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( - "getting widget " + labelText + " in widgets list")) { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "getting widget " + labelText + " in widgets list")) { final UiObject2 widgetsContainer = verifyActiveContainer(); final Point displaySize = mLauncher.getRealDisplaySize(); final BySelector labelSelector = By.clazz("android.widget.TextView").text(labelText); @@ -114,17 +115,17 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { maxWidth = Math.max(mLauncher.getVisibleBounds(sibling).width(), maxWidth); } - int visibleDelta = maxWidth - mLauncher.getVisibleBounds(widget).width(); - if (visibleDelta > 0) { - Rect parentBounds = mLauncher.getVisibleBounds(cell); - mLauncher.linearGesture(parentBounds.centerX() + visibleDelta - + mLauncher.getTouchSlop(), - parentBounds.centerY(), parentBounds.centerX(), - parentBounds.centerY(), 10, true, GestureScope.INSIDE); - } - if (mLauncher.getVisibleBounds(widget).bottom <= displaySize.y - mLauncher.getBottomGestureSize()) { + int visibleDelta = maxWidth - mLauncher.getVisibleBounds(widget).width(); + if (visibleDelta > 0) { + Rect parentBounds = mLauncher.getVisibleBounds(cell); + mLauncher.linearGesture(parentBounds.centerX() + visibleDelta + + mLauncher.getTouchSlop(), + parentBounds.centerY(), parentBounds.centerX(), + parentBounds.centerY(), 10, true, GestureScope.INSIDE); + } + return new Widget(mLauncher, widget); } } From e32f48469383888e0961dd12c471be7c4f3cb781 Mon Sep 17 00:00:00 2001 From: Becky Qiu Date: Wed, 8 Apr 2020 14:56:30 -0700 Subject: [PATCH 13/55] [Overview Actions] Update Overview UI to match new spec. See spec in the design: https://docs.google.com/presentation/d/1gXWNdCRXvXuEhgDmE0TX2KYqCxIQBXVtWKdl4pKrno8/edit#slide=id.g6f30ae9caf_14_4 Test: local Bug: 139828243 Change-Id: I6e01dd5de4e4d9ccb4ec7febe81b3e789119bfa0 --- .../src/com/android/quickstep/views/TaskView.java | 3 +-- quickstep/res/values/dimens.xml | 3 +-- quickstep/src/com/android/quickstep/util/LayoutUtils.java | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index 9193efba50..470b720f5e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -268,8 +268,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } // Sets animations for modal UI. We will remove the margins to zoom in the snapshot. - float topMargin = - getResources().getDimension(R.dimen.task_thumbnail_top_margin_with_actions); + float topMargin = getResources().getDimension(R.dimen.task_thumbnail_top_margin); float bottomMargin = getResources().getDimension(R.dimen.task_thumbnail_bottom_margin_with_actions); float newHeight = mSnapshotView.getHeight() + topMargin + bottomMargin; diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 7f1a8bf3d8..6d8d54f389 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -17,8 +17,7 @@ 24dp - 60dp - 76dp + 44dp 12dp 48dp diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java index f71bcfbdd4..1f1a99937e 100644 --- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java +++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java @@ -122,9 +122,7 @@ public class LayoutUtils { paddingHorz = res.getDimension(paddingResId); } - float topIconMargin = overviewActionsEnabled - ? res.getDimension(R.dimen.task_thumbnail_top_margin_with_actions) - : res.getDimension(R.dimen.task_thumbnail_top_margin); + float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin); float bottomMargin = thumbnailBottomMargin(context); float paddingVert = overviewActionsEnabled && removeShelfFromOverview(context) From 370164c4f77972675f4582618088e1a6fef9518f Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 8 Apr 2020 18:00:30 -0700 Subject: [PATCH 14/55] Fix drag and drop regression when dragging a scaled widget Missed this case in ag/10736229; the symptom was that if you picked up a widget when it was scaled due to split-screen, the widget would disappear Test: manual Change-Id: I26810fcf820f7053b6445989dce6598e1df55a8e --- src/com/android/launcher3/CellLayout.java | 9 +++++++-- .../android/launcher3/graphics/DragPreviewProvider.java | 4 +++- .../launcher3/widget/LauncherAppWidgetHostView.java | 9 ++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 4259196465..d7b5cf10ae 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -959,8 +959,13 @@ public class CellLayout extends ViewGroup { height = r.height(); } - if (v != null && v.getViewType() == DraggableView.DRAGGABLE_ICON) { - left += ((mCellWidth * spanX) - dragOutline.getWidth()) / 2; + // Center horizontaly + left += ((mCellWidth * spanX) - dragOutline.getWidth()) / 2; + + if (v != null && v.getViewType() == DraggableView.DRAGGABLE_WIDGET) { + // Center vertically + top += ((mCellHeight * spanY) - dragOutline.getHeight()) / 2; + } else if (v != null && v.getViewType() == DraggableView.DRAGGABLE_ICON) { int cHeight = getShortcutsAndWidgets().getCellContentHeight(); int cellPaddingY = (int) Math.max(0, ((mCellHeight - cHeight) / 2f)); top += cellPaddingY; diff --git a/src/com/android/launcher3/graphics/DragPreviewProvider.java b/src/com/android/launcher3/graphics/DragPreviewProvider.java index ed9dfbbd79..848c04a730 100644 --- a/src/com/android/launcher3/graphics/DragPreviewProvider.java +++ b/src/com/android/launcher3/graphics/DragPreviewProvider.java @@ -92,6 +92,8 @@ public class DragPreviewProvider { public Bitmap createDragBitmap() { int width = 0; int height = 0; + // Assume scaleX == scaleY, which is always the case for workspace items. + float scale = mView.getScaleX(); if (mView instanceof DraggableView) { ((DraggableView) mView).getVisualDragBounds(mTempRect); width = mTempRect.width(); @@ -102,7 +104,7 @@ public class DragPreviewProvider { } return BitmapRenderer.createHardwareBitmap(width + blurSizeOutline, - height + blurSizeOutline, (c) -> drawDragView(c, 1)); + height + blurSizeOutline, (c) -> drawDragView(c, scale)); } public final void generateDragOutline(Bitmap preview) { diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java index 78acc344d9..6232a1d871 100644 --- a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java @@ -365,10 +365,9 @@ public class LauncherAppWidgetHostView extends NavigableAppWidgetHostView @Override public void getVisualDragBounds(Rect bounds) { - int x = (int) (1 - getScaleToFit()) * getMeasuredWidth() / 2; - int y = (int) (1 - getScaleToFit()) * getMeasuredWidth() / 2; - int width = (int) getScaleToFit() * getMeasuredWidth(); - int height = (int) getScaleToFit() * getMeasuredHeight(); - bounds.set(x, y , x + width, y + height); + int width = (int) (getMeasuredWidth() * mScaleToFit); + int height = (int) (getMeasuredHeight() * mScaleToFit); + + bounds.set(0, 0 , width, height); } } From 9915a7c60fce897f9a450e82d5d45fec61713a63 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 8 Apr 2020 18:56:52 -0700 Subject: [PATCH 15/55] TAPL waits for widgets recycler to become scrollable On the Launcher side, moving setLayoutFrozen from the posted action to avoid a possible short scrollable period just after the view is shown. Bug: 152354290 Change-Id: I7319236d8a6e49a7e017fd54d593ee131dff10a9 --- src/com/android/launcher3/widget/WidgetsFullSheet.java | 2 +- tests/tapl/com/android/launcher3/tapl/Widgets.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java index b3e9734e9d..37a30af22a 100644 --- a/src/com/android/launcher3/widget/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java @@ -193,6 +193,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet .setDuration(DEFAULT_OPEN_DURATION) .setInterpolator(AnimationUtils.loadInterpolator( getContext(), android.R.interpolator.linear_out_slow_in)); + mRecyclerView.setLayoutFrozen(true); mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -202,7 +203,6 @@ public class WidgetsFullSheet extends BaseWidgetSheet } }); post(() -> { - mRecyclerView.setLayoutFrozen(true); mOpenCloseAnimator.start(); mContent.animate().alpha(1).setDuration(FADE_IN_DURATION); }); diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java index 5be57c6c0b..6f847e9c77 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widgets.java +++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java @@ -16,6 +16,8 @@ package com.android.launcher3.tapl; +import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS; + import android.graphics.Point; import android.graphics.Rect; @@ -23,6 +25,7 @@ import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; +import androidx.test.uiautomator.Until; import com.android.launcher3.tapl.LauncherInstrumentation.GestureScope; @@ -91,6 +94,8 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "getting widget " + labelText + " in widgets list")) { final UiObject2 widgetsContainer = verifyActiveContainer(); + mLauncher.assertTrue("Widgets container didn't become scrollable", + widgetsContainer.wait(Until.scrollable(true), WAIT_TIME_MS)); final Point displaySize = mLauncher.getRealDisplaySize(); final BySelector labelSelector = By.clazz("android.widget.TextView").text(labelText); From 512a2c1dbe3b29cba43c3e6a690d85610f97b929 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 8 Apr 2020 12:52:45 -0700 Subject: [PATCH 16/55] Adding All Apps action even when launcher is not in foreground > Also avoids additional binder call on resume/pause > Removes a system API which needs to be mocked for robo tests Change-Id: I23d0cba62c17f7659121c53d1804df40f5069005 --- .../quickstep/TouchInteractionService.java | 35 ++++++++ .../launcher3/BaseQuickstepLauncher.java | 18 ---- .../accessibility/SystemActions.java | 90 ------------------- .../quickstep/OverviewComponentObserver.java | 14 ++- src/com/android/launcher3/Launcher.java | 2 + 5 files changed, 50 insertions(+), 109 deletions(-) delete mode 100644 quickstep/src/com/android/launcher3/accessibility/SystemActions.java diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 0c4cd43e72..f957c37505 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -31,6 +31,8 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACT import android.annotation.TargetApi; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; +import android.app.PendingIntent; +import android.app.RemoteAction; import android.app.Service; import android.content.ComponentName; import android.content.Context; @@ -38,6 +40,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Region; +import android.graphics.drawable.Icon; import android.os.Build; import android.os.Bundle; import android.os.IBinder; @@ -46,6 +49,7 @@ import android.util.Log; import android.view.Choreographer; import android.view.InputEvent; import android.view.MotionEvent; +import android.view.accessibility.AccessibilityManager; import androidx.annotation.BinderThread; import androidx.annotation.Nullable; @@ -53,6 +57,7 @@ import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; +import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.config.FeatureFlags; @@ -126,6 +131,12 @@ public class TouchInteractionService extends Service implements PluginListener mOverviewChangeListener = b -> { }; + private String mUpdateRegisteredPackage; private BaseActivityInterface mActivityInterface; private Intent mOverviewIntent; @@ -64,10 +68,10 @@ public final class OverviewComponentObserver { private boolean mIsDefaultHome; private boolean mIsHomeDisabled; + public OverviewComponentObserver(Context context, RecentsAnimationDeviceState deviceState) { mContext = context; mDeviceState = deviceState; - mCurrentHomeIntent = new Intent(Intent.ACTION_MAIN) .addCategory(Intent.CATEGORY_HOME) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -95,6 +99,13 @@ public final class OverviewComponentObserver { updateOverviewTargets(); } + /** + * Sets a listener for changes in {@link #isHomeAndOverviewSame()} + */ + public void setOverviewChangeListener(Consumer overviewChangeListener) { + mOverviewChangeListener = overviewChangeListener; + } + public void onSystemUiStateChanged() { if (mDeviceState.isHomeDisabled() != mIsHomeDisabled) { updateOverviewTargets(); @@ -159,6 +170,7 @@ public final class OverviewComponentObserver { ACTION_PACKAGE_REMOVED)); } } + mOverviewChangeListener.accept(mIsHomeAndOverviewSame); } /** diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 043ea2fc10..6a35e800da 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1443,6 +1443,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, mLauncherCallbacks.onHomeIntent(internalStateHandled); } mOverlayManager.hideOverlay(isStarted() && !isForceInvisible()); + } else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) { + getStateManager().goToState(ALL_APPS, alreadyOnHome); } TraceHelper.INSTANCE.endSection(traceToken); From 8e5db81c3b76dd7dce1f0d712bf9ea2f3365169d Mon Sep 17 00:00:00 2001 From: Pinyao Ting Date: Mon, 6 Apr 2020 18:11:29 -0700 Subject: [PATCH 17/55] Fix the issue "Turn on work profile?" dialog not displayed for work profile deep shortcuts when disabled. When work profile is locked, the state change doesn't propagated into UserManagerService immediately. This CL remove that dependency, rather than having Launcher calls UserManager#isUserUnlocked, the state is passed into UserLockStateChangedTask by extracting user state from broadcasted intent at the call-site. Bug: 147210578 Test: manual Change-Id: I87f3d0478df44df60e273189f77b61bc40dd2630 --- src/com/android/launcher3/LauncherModel.java | 3 ++- .../launcher3/model/UserLockStateChangedTask.java | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index e61b7a8513..9e91e7019a 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -235,7 +235,8 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi // we need to run the state change task again. if (Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action) || Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)) { - enqueueModelUpdateTask(new UserLockStateChangedTask(user)); + enqueueModelUpdateTask(new UserLockStateChangedTask( + user, Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action))); } } } else if (IS_STUDIO_BUILD && ACTION_FORCE_ROLOAD.equals(action)) { diff --git a/src/com/android/launcher3/model/UserLockStateChangedTask.java b/src/com/android/launcher3/model/UserLockStateChangedTask.java index a3adc823dd..03c0cfc866 100644 --- a/src/com/android/launcher3/model/UserLockStateChangedTask.java +++ b/src/com/android/launcher3/model/UserLockStateChangedTask.java @@ -20,7 +20,6 @@ import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; import android.content.Context; import android.content.pm.ShortcutInfo; import android.os.UserHandle; -import android.os.UserManager; import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; @@ -43,18 +42,19 @@ import java.util.Iterator; public class UserLockStateChangedTask extends BaseModelUpdateTask { private final UserHandle mUser; + private boolean mIsUserUnlocked; - public UserLockStateChangedTask(UserHandle user) { + public UserLockStateChangedTask(UserHandle user, boolean isUserUnlocked) { mUser = user; + mIsUserUnlocked = isUserUnlocked; } @Override public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) { Context context = app.getContext(); - boolean isUserUnlocked = context.getSystemService(UserManager.class).isUserUnlocked(mUser); HashMap pinnedShortcuts = new HashMap<>(); - if (isUserUnlocked) { + if (mIsUserUnlocked) { QueryResult shortcuts = new ShortcutRequest(context, mUser) .query(ShortcutRequest.PINNED); if (shortcuts.wasSuccess()) { @@ -65,7 +65,7 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask { // Shortcut manager can fail due to some race condition when the lock state // changes too frequently. For the purpose of the update, // consider it as still locked. - isUserUnlocked = false; + mIsUserUnlocked = false; } } @@ -77,7 +77,7 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask { if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT && mUser.equals(itemInfo.user)) { WorkspaceItemInfo si = (WorkspaceItemInfo) itemInfo; - if (isUserUnlocked) { + if (mIsUserUnlocked) { ShortcutKey key = ShortcutKey.fromItemInfo(si); ShortcutInfo shortcut = pinnedShortcuts.get(key); // We couldn't verify the shortcut during loader. If its no longer available @@ -108,7 +108,7 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask { } } - if (isUserUnlocked) { + if (mIsUserUnlocked) { dataModel.updateDeepShortcutCounts( null, mUser, new ShortcutRequest(context, mUser).query(ShortcutRequest.ALL)); From 38a6404a8f5e5ba860197a7dd8d3e8f8f1f2cf8e Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 9 Apr 2020 11:06:28 -0700 Subject: [PATCH 18/55] More tracking for get-widgets flake Bug: 152354290 Change-Id: I2883d04c3db0cba6323b125d6c15ffc7aeb1e5b4 --- .../android/launcher3/widget/WidgetsRecyclerView.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java index 7ec62145e1..63e063f59e 100644 --- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java +++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java @@ -22,6 +22,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.launcher3.BaseRecyclerView; import com.android.launcher3.R; @@ -220,4 +221,13 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch } super.setLayoutFrozen(frozen); } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { + Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, + "onInitializeAccessibilityNodeInfo, scrollable: " + info.isScrollable()); + } + } } \ No newline at end of file From c57a79721d43dd52dec0a2cab945f8527299fd8d Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 8 Apr 2020 16:27:28 -0700 Subject: [PATCH 19/55] Using config for robo test configuration so that it can easily be customized Change-Id: Ibd0957ac5c28fae1f88d524cda29bbc84a7ff7bc --- robolectric_tests/Android.mk | 4 +- .../config/robolectric.properties | 16 +++ .../folder/FolderNameProviderTest.java | 10 +- .../launcher3/logging/FileLogTest.java | 5 +- .../model/AddWorkspaceItemsTaskTest.java | 4 +- .../launcher3/model/BackupRestoreTest.java | 4 +- .../model/CacheDataUpdatedTaskTest.java | 4 +- .../model/DbDowngradeHelperTest.java | 4 +- .../model/DefaultLayoutProviderTest.java | 4 +- .../launcher3/model/GridBackupTableTest.java | 4 +- .../model/GridSizeMigrationTaskTest.java | 4 +- .../model/GridSizeMigrationTaskV2Test.java | 4 +- .../launcher3/model/LoaderCursorTest.java | 4 +- .../model/ModelMultiCallbacksTest.java | 4 +- .../PackageInstallStateChangedTaskTest.java | 4 +- .../launcher3/popup/PopupPopulatorTest.java | 5 +- .../launcher3/provider/RestoreDbTaskTest.java | 4 +- .../shadows/LShadowAppPredictionManager.java | 38 +++++++ .../launcher3/shadows/LShadowUserManager.java | 9 -- ...SyncRtSurfaceTransactionApplierCompat.java | 42 ++++++++ .../launcher3/ui/LauncherUIScrollTest.java | 32 +----- .../launcher3/util/GridOccupancyTest.java | 9 +- .../android/launcher3/util/IntArrayTest.java | 3 +- .../android/launcher3/util/IntSetTest.java | 9 +- .../util/LauncherRoboTestRunner.java | 101 ----------------- .../util/LauncherTestApplication.java | 54 ++++++++++ .../launcher3/util/LauncherUIHelper.java | 102 ++++++++++++++++++ .../widget/WidgetsListAdapterTest.java | 4 +- 28 files changed, 306 insertions(+), 185 deletions(-) create mode 100644 robolectric_tests/src/com/android/launcher3/shadows/LShadowAppPredictionManager.java create mode 100644 robolectric_tests/src/com/android/launcher3/shadows/ShadowSyncRtSurfaceTransactionApplierCompat.java delete mode 100644 robolectric_tests/src/com/android/launcher3/util/LauncherRoboTestRunner.java create mode 100644 robolectric_tests/src/com/android/launcher3/util/LauncherTestApplication.java create mode 100644 robolectric_tests/src/com/android/launcher3/util/LauncherUIHelper.java diff --git a/robolectric_tests/Android.mk b/robolectric_tests/Android.mk index 7c7e73c374..bbc62e90a8 100644 --- a/robolectric_tests/Android.mk +++ b/robolectric_tests/Android.mk @@ -21,7 +21,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := LauncherRoboTests LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_SDK_VERSION := current +LOCAL_SDK_VERSION := system_current LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_STATIC_JAVA_LIBRARIES := \ androidx.test.runner \ @@ -47,7 +47,7 @@ include $(BUILD_STATIC_JAVA_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := RunLauncherRoboTests -LOCAL_SDK_VERSION := current +LOCAL_SDK_VERSION := system_current LOCAL_JAVA_LIBRARIES := LauncherRoboTests LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res diff --git a/robolectric_tests/config/robolectric.properties b/robolectric_tests/config/robolectric.properties index 3d78689f29..0579400655 100644 --- a/robolectric_tests/config/robolectric.properties +++ b/robolectric_tests/config/robolectric.properties @@ -1 +1,17 @@ sdk=29 +shadows= \ + com.android.launcher3.shadows.LShadowAppPredictionManager \ + com.android.launcher3.shadows.LShadowAppWidgetManager \ + com.android.launcher3.shadows.LShadowBackupManager \ + com.android.launcher3.shadows.LShadowBitmap \ + com.android.launcher3.shadows.LShadowLauncherApps \ + com.android.launcher3.shadows.LShadowTypeface \ + com.android.launcher3.shadows.LShadowUserManager \ + com.android.launcher3.shadows.LShadowWallpaperManager \ + com.android.launcher3.shadows.ShadowDeviceFlag \ + com.android.launcher3.shadows.ShadowLooperExecutor \ + com.android.launcher3.shadows.ShadowMainThreadInitializedObject \ + com.android.launcher3.shadows.ShadowOverrides \ + com.android.launcher3.shadows.ShadowSyncRtSurfaceTransactionApplierCompat \ + +application=com.android.launcher3.util.LauncherTestApplication \ No newline at end of file diff --git a/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java b/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java index 74ef55eb68..32d4f272b2 100644 --- a/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java +++ b/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java @@ -20,20 +20,20 @@ import static org.junit.Assert.assertEquals; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.os.UserHandle; import com.android.launcher3.AppInfo; import com.android.launcher3.WorkspaceItemInfo; -import com.android.launcher3.shadows.LShadowUserManager; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.ArrayList; -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public final class FolderNameProviderTest { private Context mContext; private WorkspaceItemInfo mItem1; @@ -45,13 +45,13 @@ public final class FolderNameProviderTest { mItem1 = new WorkspaceItemInfo(new AppInfo( new ComponentName("a.b.c", "a.b.c/a.b.c.d"), "title1", - LShadowUserManager.newUserHandle(10), + UserHandle.of(10), new Intent().setComponent(new ComponentName("a.b.c", "a.b.c/a.b.c.d")) )); mItem2 = new WorkspaceItemInfo(new AppInfo( new ComponentName("a.b.c", "a.b.c/a.b.c.d"), "title2", - LShadowUserManager.newUserHandle(10), + UserHandle.of(10), new Intent().setComponent(new ComponentName("a.b.c", "a.b.c/a.b.c.d")) )); } diff --git a/robolectric_tests/src/com/android/launcher3/logging/FileLogTest.java b/robolectric_tests/src/com/android/launcher3/logging/FileLogTest.java index 95a41465eb..c892618a9d 100644 --- a/robolectric_tests/src/com/android/launcher3/logging/FileLogTest.java +++ b/robolectric_tests/src/com/android/launcher3/logging/FileLogTest.java @@ -3,12 +3,11 @@ package com.android.launcher3.logging; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import com.android.launcher3.util.LauncherRoboTestRunner; - import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.Shadows; import org.robolectric.util.Scheduler; @@ -21,7 +20,7 @@ import java.util.Calendar; /** * Tests for {@link FileLog} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class FileLogTest { private File mTempDir; diff --git a/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java index b7f224310f..83b217521b 100644 --- a/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java @@ -25,12 +25,12 @@ import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.IntSparseArrayMap; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.LooperMode; import org.robolectric.annotation.LooperMode.Mode; @@ -41,7 +41,7 @@ import java.util.List; /** * Tests for {@link AddWorkspaceItemsTask} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(Mode.PAUSED) public class AddWorkspaceItemsTaskTest { diff --git a/robolectric_tests/src/com/android/launcher3/model/BackupRestoreTest.java b/robolectric_tests/src/com/android/launcher3/model/BackupRestoreTest.java index 7072adf160..90313abe1d 100644 --- a/robolectric_tests/src/com/android/launcher3/model/BackupRestoreTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/BackupRestoreTest.java @@ -43,11 +43,11 @@ import com.android.launcher3.provider.RestoreDbTask; import com.android.launcher3.shadows.LShadowBackupManager; import com.android.launcher3.shadows.LShadowUserManager; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.LooperMode; import org.robolectric.shadow.api.Shadow; @@ -55,7 +55,7 @@ import org.robolectric.shadow.api.Shadow; /** * Tests to verify backup and restore flow. */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(LooperMode.Mode.PAUSED) public class BackupRestoreTest { diff --git a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java index f128e24912..09d611d0ff 100644 --- a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java @@ -25,11 +25,11 @@ import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.cache.CachingLogic; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.LooperMode; import org.robolectric.annotation.LooperMode.Mode; @@ -40,7 +40,7 @@ import java.util.HashSet; /** * Tests for {@link CacheDataUpdatedTask} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(Mode.PAUSED) public class CacheDataUpdatedTaskTest { diff --git a/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java b/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java index 1442c55c2e..b7340cf7d0 100644 --- a/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/DbDowngradeHelperTest.java @@ -36,11 +36,11 @@ import com.android.launcher3.LauncherProvider; import com.android.launcher3.LauncherProvider.DatabaseHelper; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.R; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.io.File; @@ -48,7 +48,7 @@ import java.io.File; /** * Tests for {@link DbDowngradeHelper} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class DbDowngradeHelperTest { private static final String SCHEMA_FILE = "test_schema.json"; diff --git a/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java b/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java index 7bc34cf91f..cdabf79e39 100644 --- a/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java @@ -34,11 +34,11 @@ import com.android.launcher3.LauncherSettings; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.LooperMode; import org.robolectric.annotation.LooperMode.Mode; @@ -46,7 +46,7 @@ import org.robolectric.annotation.LooperMode.Mode; /** * Tests for layout parser for remote layout */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(Mode.PAUSED) public class DefaultLayoutProviderTest { diff --git a/robolectric_tests/src/com/android/launcher3/model/GridBackupTableTest.java b/robolectric_tests/src/com/android/launcher3/model/GridBackupTableTest.java index f46b849a84..56ce215d96 100644 --- a/robolectric_tests/src/com/android/launcher3/model/GridBackupTableTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/GridBackupTableTest.java @@ -23,17 +23,17 @@ import android.graphics.Point; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.LauncherSettings.Settings; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; /** * Unit tests for {@link GridBackupTable} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class GridBackupTableTest { private static final int BACKUP_ITEM_COUNT = 12; diff --git a/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskTest.java index c426dc593f..8e00dcb854 100644 --- a/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskTest.java @@ -20,11 +20,11 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.GridSizeMigrationTask.MultiStepMigrationTask; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.HashSet; @@ -33,7 +33,7 @@ import java.util.LinkedList; /** * Unit tests for {@link GridSizeMigrationTask} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class GridSizeMigrationTaskTest { private LauncherModelHelper mModelHelper; diff --git a/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.java b/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.java index 8f58d8b507..59c94806b7 100644 --- a/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.java +++ b/robolectric_tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.java @@ -39,17 +39,17 @@ import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherSettings; import com.android.launcher3.pm.UserCache; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.HashSet; /** Unit tests for {@link GridSizeMigrationTaskV2} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class GridSizeMigrationTaskV2Test { private LauncherModelHelper mModelHelper; diff --git a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java index 6e41a4f3e8..8531014bea 100644 --- a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java @@ -55,12 +55,12 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.util.Executors; -import com.android.launcher3.util.LauncherRoboTestRunner; import com.android.launcher3.util.PackageManagerHelper; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.LooperMode; import org.robolectric.annotation.LooperMode.Mode; @@ -68,7 +68,7 @@ import org.robolectric.annotation.LooperMode.Mode; /** * Tests for {@link LoaderCursor} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(Mode.PAUSED) public class LoaderCursorTest { diff --git a/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java b/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java index c7979b21d2..d81ac69f69 100644 --- a/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java @@ -33,13 +33,13 @@ import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.util.Executors; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.ViewOnDrawExecutor; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.LooperMode; import org.robolectric.annotation.LooperMode.Mode; @@ -55,7 +55,7 @@ import java.util.stream.Collectors; /** * Tests to verify multiple callbacks in Loader */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(Mode.PAUSED) public class ModelMultiCallbacksTest { diff --git a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java index bd71f01b6b..f017c82200 100644 --- a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java @@ -7,11 +7,11 @@ import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.LooperMode; import org.robolectric.annotation.LooperMode.Mode; @@ -21,7 +21,7 @@ import java.util.HashSet; /** * Tests for {@link PackageInstallStateChangedTask} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(Mode.PAUSED) public class PackageInstallStateChangedTaskTest { diff --git a/robolectric_tests/src/com/android/launcher3/popup/PopupPopulatorTest.java b/robolectric_tests/src/com/android/launcher3/popup/PopupPopulatorTest.java index 7612ae105a..83bf7dac89 100644 --- a/robolectric_tests/src/com/android/launcher3/popup/PopupPopulatorTest.java +++ b/robolectric_tests/src/com/android/launcher3/popup/PopupPopulatorTest.java @@ -27,10 +27,9 @@ import static org.mockito.Mockito.spy; import android.content.pm.ShortcutInfo; -import com.android.launcher3.util.LauncherRoboTestRunner; - import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.ArrayList; @@ -40,7 +39,7 @@ import java.util.List; /** * Tests the sorting and filtering of shortcuts in {@link PopupPopulator}. */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class PopupPopulatorTest { @Test diff --git a/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java b/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java index 7ef670c270..58174c793c 100644 --- a/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java @@ -23,16 +23,16 @@ import android.database.sqlite.SQLiteDatabase; import com.android.launcher3.LauncherProvider.DatabaseHelper; import com.android.launcher3.LauncherSettings.Favorites; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; /** * Tests for {@link RestoreDbTask} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class RestoreDbTaskTest { @Test diff --git a/robolectric_tests/src/com/android/launcher3/shadows/LShadowAppPredictionManager.java b/robolectric_tests/src/com/android/launcher3/shadows/LShadowAppPredictionManager.java new file mode 100644 index 0000000000..ae051f7d7c --- /dev/null +++ b/robolectric_tests/src/com/android/launcher3/shadows/LShadowAppPredictionManager.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2020 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.shadows; + +import static org.mockito.Mockito.mock; + +import android.app.prediction.AppPredictionContext; +import android.app.prediction.AppPredictionManager; +import android.app.prediction.AppPredictor; + +import org.robolectric.annotation.Implementation; +import org.robolectric.annotation.Implements; + +/** + * Shadow for {@link AppPredictionManager} which create mock predictors + */ +@Implements(value = AppPredictionManager.class) +public class LShadowAppPredictionManager { + + @Implementation + public AppPredictor createAppPredictionSession(AppPredictionContext predictionContext) { + return mock(AppPredictor.class); + } +} diff --git a/robolectric_tests/src/com/android/launcher3/shadows/LShadowUserManager.java b/robolectric_tests/src/com/android/launcher3/shadows/LShadowUserManager.java index 576ddbd407..edf8edbb43 100644 --- a/robolectric_tests/src/com/android/launcher3/shadows/LShadowUserManager.java +++ b/robolectric_tests/src/com/android/launcher3/shadows/LShadowUserManager.java @@ -16,7 +16,6 @@ package com.android.launcher3.shadows; -import android.os.Parcel; import android.os.UserHandle; import android.os.UserManager; import android.util.SparseBooleanArray; @@ -51,12 +50,4 @@ public class LShadowUserManager extends ShadowUserManager { public void setUserLocked(UserHandle userHandle, boolean enabled) { mLockedUsers.put(userHandle.hashCode(), enabled); } - - // Create user handle from parcel since UserHandle.of() was only added in later APIs. - public static UserHandle newUserHandle(int uid) { - Parcel userParcel = Parcel.obtain(); - userParcel.writeInt(uid); - userParcel.setDataPosition(0); - return new UserHandle(userParcel); - } } diff --git a/robolectric_tests/src/com/android/launcher3/shadows/ShadowSyncRtSurfaceTransactionApplierCompat.java b/robolectric_tests/src/com/android/launcher3/shadows/ShadowSyncRtSurfaceTransactionApplierCompat.java new file mode 100644 index 0000000000..238926c65f --- /dev/null +++ b/robolectric_tests/src/com/android/launcher3/shadows/ShadowSyncRtSurfaceTransactionApplierCompat.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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.shadows; + +import static org.robolectric.shadow.api.Shadow.invokeConstructor; +import static org.robolectric.util.ReflectionHelpers.ClassParameter.from; + +import android.view.View; + +import org.robolectric.annotation.Implementation; +import org.robolectric.annotation.Implements; +import org.robolectric.annotation.RealObject; + +/** + * Shadow for SyncRtSurfaceTransactionApplierCompat to override default functionality + */ +@Implements(className = "com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat", + isInAndroidSdk = false) +public class ShadowSyncRtSurfaceTransactionApplierCompat { + + @RealObject + private Object mRealObject; + + @Implementation + protected void __constructor__(View view) { + invokeConstructor(mRealObject.getClass(), mRealObject, from(View.class, null)); + } +} diff --git a/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java b/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java index 209bae06a8..d330d10133 100644 --- a/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java +++ b/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java @@ -14,23 +14,20 @@ * limitations under the License. */package com.android.launcher3.ui; -import static android.view.View.MeasureSpec.EXACTLY; -import static android.view.View.MeasureSpec.makeMeasureSpec; - import static com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE; +import static com.android.launcher3.util.LauncherUIHelper.buildAndBindLauncher; +import static com.android.launcher3.util.LauncherUIHelper.doLayout; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.mockito.Mockito.mock; -import android.app.Activity; import android.content.Context; import android.os.SystemClock; import android.provider.Settings; import android.view.InputDevice; import android.view.MotionEvent; import android.view.MotionEvent.PointerProperties; -import android.view.View; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; @@ -44,24 +41,21 @@ import com.android.launcher3.shadows.ShadowOverrides; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.LauncherLayoutBuilder.FolderBuilder; import com.android.launcher3.util.LauncherModelHelper; -import com.android.launcher3.util.LauncherRoboTestRunner; -import com.android.launcher3.util.ViewOnDrawExecutor; import com.android.launcher3.widget.WidgetsFullSheet; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.LooperMode; import org.robolectric.annotation.LooperMode.Mode; import org.robolectric.shadows.ShadowLooper; -import org.robolectric.util.ReflectionHelpers; /** * Tests scroll behavior at various Launcher UI components */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) @LooperMode(Mode.PAUSED) public class LauncherUIScrollTest { @@ -166,23 +160,7 @@ public class LauncherUIScrollTest { private Launcher loadLauncher() throws Exception { mModelHelper.setupDefaultLayoutProvider(mLayoutBuilder).loadModelSync(); - - Launcher launcher = Robolectric.buildActivity(Launcher.class).setup().get(); - doLayout(launcher); - ViewOnDrawExecutor executor = ReflectionHelpers.getField(launcher, "mPendingExecutor"); - if (executor != null) { - executor.runAllTasks(); - } - return launcher; - } - - private static void doLayout(Activity activity) { - DeviceProfile dp = InvariantDeviceProfile.INSTANCE - .get(RuntimeEnvironment.application).portraitProfile; - View view = activity.getWindow().getDecorView(); - view.measure(makeMeasureSpec(dp.widthPx, EXACTLY), makeMeasureSpec(dp.heightPx, EXACTLY)); - view.layout(0, 0, dp.widthPx, dp.heightPx); - ShadowLooper.idleMainLooper(); + return buildAndBindLauncher(); } private static MotionEvent createScrollEvent(int scroll) { diff --git a/robolectric_tests/src/com/android/launcher3/util/GridOccupancyTest.java b/robolectric_tests/src/com/android/launcher3/util/GridOccupancyTest.java index e453e31a41..2f3fc3764d 100644 --- a/robolectric_tests/src/com/android/launcher3/util/GridOccupancyTest.java +++ b/robolectric_tests/src/com/android/launcher3/util/GridOccupancyTest.java @@ -1,16 +1,17 @@ package com.android.launcher3.util; -import org.junit.Test; -import org.junit.runner.RunWith; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; + /** * Unit tests for {@link GridOccupancy} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class GridOccupancyTest { @Test diff --git a/robolectric_tests/src/com/android/launcher3/util/IntArrayTest.java b/robolectric_tests/src/com/android/launcher3/util/IntArrayTest.java index 5974ea5db9..c08e198a8c 100644 --- a/robolectric_tests/src/com/android/launcher3/util/IntArrayTest.java +++ b/robolectric_tests/src/com/android/launcher3/util/IntArrayTest.java @@ -19,11 +19,12 @@ import static com.google.common.truth.Truth.assertThat; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; /** * Robolectric unit tests for {@link IntArray} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class IntArrayTest { @Test diff --git a/robolectric_tests/src/com/android/launcher3/util/IntSetTest.java b/robolectric_tests/src/com/android/launcher3/util/IntSetTest.java index aedf71ecbc..7a8c00b3c7 100644 --- a/robolectric_tests/src/com/android/launcher3/util/IntSetTest.java +++ b/robolectric_tests/src/com/android/launcher3/util/IntSetTest.java @@ -17,17 +17,18 @@ package com.android.launcher3.util; import static com.google.common.truth.Truth.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; + /** * Robolectric unit tests for {@link IntSet} */ -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class IntSetTest { @Test diff --git a/robolectric_tests/src/com/android/launcher3/util/LauncherRoboTestRunner.java b/robolectric_tests/src/com/android/launcher3/util/LauncherRoboTestRunner.java deleted file mode 100644 index 744b478b2a..0000000000 --- a/robolectric_tests/src/com/android/launcher3/util/LauncherRoboTestRunner.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2019 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.util; - -import static org.mockito.Mockito.mock; - -import com.android.launcher3.shadows.LShadowAppWidgetManager; -import com.android.launcher3.shadows.LShadowBackupManager; -import com.android.launcher3.shadows.LShadowBitmap; -import com.android.launcher3.shadows.LShadowLauncherApps; -import com.android.launcher3.shadows.LShadowTypeface; -import com.android.launcher3.shadows.LShadowUserManager; -import com.android.launcher3.shadows.LShadowWallpaperManager; -import com.android.launcher3.shadows.ShadowDeviceFlag; -import com.android.launcher3.shadows.ShadowLooperExecutor; -import com.android.launcher3.shadows.ShadowMainThreadInitializedObject; -import com.android.launcher3.shadows.ShadowOverrides; -import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; - -import org.junit.runners.model.InitializationError; -import org.robolectric.DefaultTestLifecycle; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.TestLifecycle; -import org.robolectric.annotation.Config; -import org.robolectric.shadows.ShadowLog; - -import java.lang.reflect.Method; - -import javax.annotation.Nonnull; - -/** - * Test runner with Launcher specific configurations - */ -public class LauncherRoboTestRunner extends RobolectricTestRunner { - - private static final Class[] SHADOWS = new Class[] { - LShadowAppWidgetManager.class, - LShadowUserManager.class, - LShadowLauncherApps.class, - LShadowBitmap.class, - LShadowBackupManager.class, - LShadowTypeface.class, - LShadowWallpaperManager.class, - ShadowLooperExecutor.class, - ShadowMainThreadInitializedObject.class, - ShadowDeviceFlag.class, - ShadowOverrides.class - }; - - public LauncherRoboTestRunner(Class testClass) throws InitializationError { - super(testClass); - } - - @Override - protected Config buildGlobalConfig() { - return new Config.Builder().setShadows(SHADOWS).build(); - } - - @Nonnull - @Override - protected Class getTestLifecycleClass() { - return LauncherTestLifecycle.class; - } - - public static class LauncherTestLifecycle extends DefaultTestLifecycle { - - @Override - public void beforeTest(Method method) { - super.beforeTest(method); - ShadowLog.stream = System.out; - - // Disable plugins - PluginManagerWrapper.INSTANCE.initializeForTesting(mock(PluginManagerWrapper.class)); - - // Initialize mock wallpaper manager - LShadowWallpaperManager.initializeMock(); - } - - @Override - public void afterTest(Method method) { - super.afterTest(method); - - ShadowLog.stream = null; - ShadowMainThreadInitializedObject.resetInitializedObjects(); - ShadowOverrides.clearProvider(); - } - } -} diff --git a/robolectric_tests/src/com/android/launcher3/util/LauncherTestApplication.java b/robolectric_tests/src/com/android/launcher3/util/LauncherTestApplication.java new file mode 100644 index 0000000000..6dd4df8377 --- /dev/null +++ b/robolectric_tests/src/com/android/launcher3/util/LauncherTestApplication.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2020 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.util; + +import static org.mockito.Mockito.mock; + +import android.app.Application; + +import com.android.launcher3.shadows.LShadowWallpaperManager; +import com.android.launcher3.shadows.ShadowMainThreadInitializedObject; +import com.android.launcher3.shadows.ShadowOverrides; +import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; + +import org.robolectric.TestLifecycleApplication; +import org.robolectric.shadows.ShadowLog; + +import java.lang.reflect.Method; + +public class LauncherTestApplication extends Application implements TestLifecycleApplication { + + @Override + public void beforeTest(Method method) { + ShadowLog.stream = System.out; + + // Disable plugins + PluginManagerWrapper.INSTANCE.initializeForTesting(mock(PluginManagerWrapper.class)); + + // Initialize mock wallpaper manager + LShadowWallpaperManager.initializeMock(); + } + + @Override + public void prepareTest(Object test) { } + + @Override + public void afterTest(Method method) { + ShadowLog.stream = null; + ShadowMainThreadInitializedObject.resetInitializedObjects(); + ShadowOverrides.clearProvider(); + } +} diff --git a/robolectric_tests/src/com/android/launcher3/util/LauncherUIHelper.java b/robolectric_tests/src/com/android/launcher3/util/LauncherUIHelper.java new file mode 100644 index 0000000000..f019a2019d --- /dev/null +++ b/robolectric_tests/src/com/android/launcher3/util/LauncherUIHelper.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2020 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.util; + +import static android.view.View.MeasureSpec.EXACTLY; +import static android.view.View.MeasureSpec.makeMeasureSpec; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.pm.ResolveInfo; +import android.graphics.Point; +import android.view.View; +import android.view.WindowManager; + +import com.android.launcher3.Launcher; + +import org.robolectric.Robolectric; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.android.controller.ActivityController; +import org.robolectric.shadows.ShadowLooper; +import org.robolectric.util.ReflectionHelpers; + +import java.util.List; + +/** + * Utility class to help manage Launcher UI and related objects for test. + */ +public class LauncherUIHelper { + + /** + * Returns the class name for the Launcher activity as defined in the manifest + */ + public static String getLauncherClassName() { + Context context = RuntimeEnvironment.application; + Intent homeIntent = new Intent(Intent.ACTION_MAIN) + .addCategory(Intent.CATEGORY_HOME) + .setPackage(context.getPackageName()) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + List launchers = context.getPackageManager() + .queryIntentActivities(homeIntent, 0); + if (launchers.size() != 1) { + return null; + } + return launchers.get(0).activityInfo.name; + } + + /** + * Returns an activity controller for Launcher activity defined in the manifest + */ + public static ActivityController buildLauncher() { + try { + Class tClass = (Class) Class.forName(getLauncherClassName()); + return Robolectric.buildActivity(tClass); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Creates and binds a Launcher activity defined in the manifest. + * Note that the model must be bound before calling this + */ + public static T buildAndBindLauncher() { + ActivityController controller = buildLauncher(); + + T launcher = controller.setup().get(); + doLayout(launcher); + ViewOnDrawExecutor executor = ReflectionHelpers.getField(launcher, "mPendingExecutor"); + if (executor != null) { + executor.runAllTasks(); + } + return launcher; + } + + /** + * Performs a measure and layout pass for the given activity + */ + public static void doLayout(Activity activity) { + Point size = new Point(); + RuntimeEnvironment.application.getSystemService(WindowManager.class) + .getDefaultDisplay().getSize(size); + View view = activity.getWindow().getDecorView(); + view.measure(makeMeasureSpec(size.x, EXACTLY), makeMeasureSpec(size.y, EXACTLY)); + view.layout(0, 0, size.x, size.y); + ShadowLooper.idleMainLooper(); + } +} diff --git a/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java b/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java index daae8186a6..76c395245d 100644 --- a/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java +++ b/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java @@ -36,13 +36,13 @@ import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.IconCache; import com.android.launcher3.model.PackageItemInfo; import com.android.launcher3.model.WidgetItem; -import com.android.launcher3.util.LauncherRoboTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.shadows.ShadowPackageManager; import org.robolectric.util.ReflectionHelpers; @@ -50,7 +50,7 @@ import org.robolectric.util.ReflectionHelpers; import java.util.ArrayList; import java.util.Collections; -@RunWith(LauncherRoboTestRunner.class) +@RunWith(RobolectricTestRunner.class) public class WidgetsListAdapterTest { @Mock private LayoutInflater mMockLayoutInflater; From dcbed4b5a3a2862da03855067fe556329593ffc7 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 24 Mar 2020 16:23:32 -0700 Subject: [PATCH 20/55] Notify SysUi of NavBar region user interacts with SysUi can then adjust things like disabling the edge back gesture region or re-drawing the home handle in the correct positions. Fixes: 150250451 Test: Tested quickswitch manually with test apps fixed to different rotations. Ensured back only showed when rotation of touch and display matched. Change-Id: Ie4ea3063835a09fc12ab1d4f8b504b3a9555fa9b --- .../OrientationTouchTransformer.java | 63 +++++++++++++------ .../RecentsAnimationDeviceState.java | 12 +++- .../com/android/quickstep/SystemUiProxy.java | 1 + 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java index 95cd4f2c13..495c09297e 100644 --- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java +++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java @@ -60,12 +60,24 @@ class OrientationTouchTransformer { private SparseArray mSwipeTouchRegions = new SparseArray<>(MAX_ORIENTATIONS); private final RectF mAssistantLeftRegion = new RectF(); private final RectF mAssistantRightRegion = new RectF(); - private int mCurrentRotation; + private int mCurrentDisplayRotation; private boolean mEnableMultipleRegions; private Resources mResources; private OrientationRectF mLastRectTouched; private SysUINavigationMode.Mode mMode; private QuickStepContractInfo mContractInfo; + + /** + * Represents if we're currently in a swipe "session" of sorts. If value is -1, then user + * has not tapped on an active nav region. Otherwise it will be the rotation of the display + * when the user first interacted with the active nav bar region. + * The "session" ends when {@link #enableMultipleRegions(boolean, DefaultDisplay.Info)} is + * called - usually from a timeout or if user starts interacting w/ the foreground app. + * + * This is different than {@link #mLastRectTouched} as it can get reset by the system whereas + * the rect is purely used for tracking touch interactions and usually this "session" will + * outlast the touch interaction. + */ private int mQuickStepStartingRotation = -1; /** For testability */ @@ -73,6 +85,7 @@ class OrientationTouchTransformer { float getWindowCornerRadius(); } + OrientationTouchTransformer(Resources resources, SysUINavigationMode.Mode mode, QuickStepContractInfo contractInfo) { mResources = resources; @@ -97,20 +110,21 @@ class OrientationTouchTransformer { * @see #enableMultipleRegions(boolean, DefaultDisplay.Info) */ void createOrAddTouchRegion(DefaultDisplay.Info info) { - mCurrentRotation = info.rotation; - if (mQuickStepStartingRotation > -1 && mCurrentRotation == mQuickStepStartingRotation) { - // Ignore nav bars in other rotations except for the one we started out in + mCurrentDisplayRotation = info.rotation; + if (mQuickStepStartingRotation > -1 + && mCurrentDisplayRotation == mQuickStepStartingRotation) { + // User already was swiping and the current screen is same rotation as the starting one + // Remove active nav bars in other rotations except for the one we started out in resetSwipeRegions(info); return; } - - OrientationRectF region = mSwipeTouchRegions.get(mCurrentRotation); + OrientationRectF region = mSwipeTouchRegions.get(mCurrentDisplayRotation); if (region != null) { return; } if (mEnableMultipleRegions) { - mSwipeTouchRegions.put(mCurrentRotation, createRegionForDisplay(info)); + mSwipeTouchRegions.put(mCurrentDisplayRotation, createRegionForDisplay(info)); } else { resetSwipeRegions(info); } @@ -128,12 +142,6 @@ class OrientationTouchTransformer { if (!enableMultipleRegions) { mQuickStepStartingRotation = -1; resetSwipeRegions(info); - } else { - if (mLastRectTouched != null) { - // mLastRectTouched can be null if gesture type is changed (ex. from settings) - // but nav bar hasn't been interacted with yet. - mQuickStepStartingRotation = mLastRectTouched.mRotation; - } } } @@ -145,17 +153,25 @@ class OrientationTouchTransformer { */ private void resetSwipeRegions(DefaultDisplay.Info region) { if (DEBUG) { - Log.d(TAG, "clearing all regions except rotation: " + mCurrentRotation); + Log.d(TAG, "clearing all regions except rotation: " + mCurrentDisplayRotation); } - mCurrentRotation = region.rotation; + mCurrentDisplayRotation = region.rotation; + OrientationRectF regionToKeep = mSwipeTouchRegions.get(mCurrentDisplayRotation); mSwipeTouchRegions.clear(); - mSwipeTouchRegions.put(mCurrentRotation, createRegionForDisplay(region)); + mSwipeTouchRegions.put(mCurrentDisplayRotation, + regionToKeep != null ? regionToKeep : createRegionForDisplay(region)); + } + + private void resetSwipeRegions() { + OrientationRectF regionToKeep = mSwipeTouchRegions.get(mCurrentDisplayRotation); + mSwipeTouchRegions.clear(); + mSwipeTouchRegions.put(mCurrentDisplayRotation, regionToKeep); } private OrientationRectF createRegionForDisplay(DefaultDisplay.Info display) { if (DEBUG) { - Log.d(TAG, "creating rotation region for: " + mCurrentRotation); + Log.d(TAG, "creating rotation region for: " + mCurrentDisplayRotation); } Point size = display.realSize; @@ -225,6 +241,10 @@ class OrientationTouchTransformer { } } + int getQuickStepStartingRotation() { + return mQuickStepStartingRotation; + } + public void transform(MotionEvent event) { int eventAction = event.getActionMasked(); switch (eventAction) { @@ -257,6 +277,11 @@ class OrientationTouchTransformer { } if (rect.applyTransform(event, false)) { mLastRectTouched = rect; + if (mCurrentDisplayRotation == mLastRectTouched.mRotation) { + // Start a touch session for the default nav region for the display + mQuickStepStartingRotation = mLastRectTouched.mRotation; + resetSwipeRegions(); + } if (DEBUG) { Log.d(TAG, "set active region: " + rect); } @@ -310,12 +335,12 @@ class OrientationTouchTransformer { boolean applyTransform(MotionEvent event, boolean forceTransform) { mTmpMatrix.reset(); - postDisplayRotation(deltaRotation(mCurrentRotation, mRotation), + postDisplayRotation(deltaRotation(mCurrentDisplayRotation, mRotation), mHeight, mWidth, mTmpMatrix); if (forceTransform) { if (DEBUG) { Log.d(TAG, "Transforming rotation due to forceTransform, " - + "mCurrentRotation: " + mCurrentRotation + + "mCurrentRotation: " + mCurrentDisplayRotation + "mRotation: " + mRotation); } event.transform(mTmpMatrix); diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index 491c6110db..8cb27a3889 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -17,6 +17,7 @@ package com.android.quickstep; import static android.content.Intent.ACTION_USER_UNLOCKED; +import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS; import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; @@ -120,7 +121,6 @@ public class RecentsAnimationDeviceState implements private Runnable mOnDestroyFrozenTaskRunnable; public RecentsAnimationDeviceState(Context context) { - final ContentResolver resolver = context.getContentResolver(); mContext = context; mSysUiNavMode = SysUINavigationMode.INSTANCE.get(context); mDefaultDisplay = DefaultDisplay.INSTANCE.get(context); @@ -511,8 +511,16 @@ public class RecentsAnimationDeviceState implements mOrientationTouchTransformer.transform(event); } - public void enableMultipleRegions(boolean enable) { + void enableMultipleRegions(boolean enable) { mOrientationTouchTransformer.enableMultipleRegions(enable, mDefaultDisplay.getInfo()); + if (enable) { + UI_HELPER_EXECUTOR.execute(() -> { + int quickStepStartingRotation = + mOrientationTouchTransformer.getQuickStepStartingRotation(); + SystemUiProxy.INSTANCE.get(mContext) + .onQuickSwitchToNewTask(quickStepStartingRotation); + }); + } } public int getCurrentActiveRotation() { diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index f5aaf1dece..20d133c3c6 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -334,6 +334,7 @@ public class SystemUiProxy implements ISystemUiProxy { } } + @Override public void onQuickSwitchToNewTask(int rotation) { if (mSystemUiProxy != null) { try { From 8cb2f9ce08c9d2cf8b0a302c4a8467dd66c4ac06 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 9 Apr 2020 13:02:34 -0700 Subject: [PATCH 21/55] Adding tracing for apparently skipping verifiable events Bug: 153670015 Change-Id: I481c095f1245ba4252eb07e08b4130c857dd6e72 --- .../com/android/launcher3/tapl/LogEventChecker.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java b/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java index 49901ea868..78dfc361f6 100644 --- a/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java +++ b/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java @@ -44,6 +44,7 @@ public class LogEventChecker { private static final String START_PREFIX = "START_READER "; private static final String FINISH_PREFIX = "FINISH_READER "; + private static final String SKIP_EVENTS_TAG = "b/153670015"; private volatile CountDownLatch mFinished; @@ -72,6 +73,7 @@ public class LogEventChecker { mFinished = null; } mEvents.clear(); + Log.d(SKIP_EVENTS_TAG, "Cleared events"); mExpectedEvents.clear(); mEventsCounter.drainPermits(); final String id = UUID.randomUUID().toString(); @@ -89,27 +91,30 @@ public class LogEventChecker { try (BufferedReader reader = new BufferedReader(new InputStreamReader( Runtime.getRuntime().exec(cmd).getInputStream()))) { - for (;;) { + for (; ; ) { // Skip everything before the next start command. - for (;;) { + for (; ; ) { final String event = reader.readLine(); if (event.contains(TestProtocol.TAPL_EVENTS_TAG) && event.contains(mStartCommand)) { + Log.d(SKIP_EVENTS_TAG, "Read start: " + event); break; } } // Store all actual events until the finish command. - for (;;) { + for (; ; ) { final String event = reader.readLine(); if (event.contains(TestProtocol.TAPL_EVENTS_TAG)) { if (event.contains(mFinishCommand)) { mFinished.countDown(); + Log.d(SKIP_EVENTS_TAG, "Read finish: " + event); break; } else { final Matcher matcher = EVENT_LOG_ENTRY.matcher(event); if (matcher.find()) { mEvents.add(matcher.group("sequence"), matcher.group("event")); + Log.d(SKIP_EVENTS_TAG, "Read event: " + event); mEventsCounter.release(); } } @@ -154,6 +159,7 @@ public class LogEventChecker { String sequence = expectedEvents.getKey(); List actual = new ArrayList<>(mEvents.getNonNull(sequence)); + Log.d(SKIP_EVENTS_TAG, "Verifying events"); final int mismatchPosition = getMismatchPosition(expectedEvents.getValue(), actual); hasMismatches = hasMismatches || mismatchPosition != -1; formatSequenceWithMismatch( From e396abf502c9d0011e87f564178539d39c84bcfd Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 6 Apr 2020 15:11:17 -0700 Subject: [PATCH 22/55] Moving model data structures to a separate file Change-Id: I77ad7a5219e72d2e0d6c1803de2ac3ed6a65a8f7 --- .../appprediction/ComponentKeyMapper.java | 4 +-- .../appprediction/DynamicItemCache.java | 4 +-- .../appprediction/InstantAppItemInfo.java | 6 ++-- .../appprediction/PredictionRowView.java | 8 ++--- .../PredictionUiStateManager.java | 4 +-- .../hybridhotseat/HotseatEduController.java | 6 ++-- .../hybridhotseat/HotseatEduDialog.java | 5 ++-- .../HotseatPredictionController.java | 10 +++---- .../uioverrides/PredictedAppIcon.java | 4 +-- .../uioverrides/QuickstepLauncher.java | 4 +-- .../quickstep/TaskShortcutFactory.java | 4 +-- .../com/android/quickstep/TaskViewUtils.java | 2 +- ...EventDispatcherAppPredictionExtension.java | 2 +- .../launcher3/model/WellbeingModel.java | 2 +- .../quickstep/InstantAppResolverImpl.java | 2 +- .../logging/StatsLogCompatManager.java | 6 ++-- .../quickstep/ViewInflationDuringSwipeUp.java | 2 +- .../cache_data_updated_task_data.txt | 2 +- ...package_install_state_change_task_data.txt | 4 +-- .../folder/FolderNameProviderTest.java | 4 +-- .../model/AddWorkspaceItemsTaskTest.java | 4 +-- .../model/CacheDataUpdatedTaskTest.java | 6 ++-- .../model/DefaultLayoutProviderTest.java | 4 +-- .../launcher3/model/LoaderCursorTest.java | 8 ++--- .../model/ModelMultiCallbacksTest.java | 4 +-- .../PackageInstallStateChangedTaskTest.java | 6 ++-- .../launcher3/util/LauncherModelHelper.java | 4 +-- .../widget/WidgetsListAdapterTest.java | 2 +- .../launcher3/AppWidgetResizeFrame.java | 2 +- .../launcher3/AppWidgetsRestoredReceiver.java | 1 + .../android/launcher3/AutoInstallsLayout.java | 2 ++ .../launcher3/BaseDraggingActivity.java | 2 ++ src/com/android/launcher3/BubbleTextView.java | 7 ++++- .../android/launcher3/ButtonDropTarget.java | 1 + src/com/android/launcher3/CellLayout.java | 1 + .../android/launcher3/DeleteDropTarget.java | 4 +++ src/com/android/launcher3/DropTarget.java | 1 + .../android/launcher3/FastBitmapDrawable.java | 1 + src/com/android/launcher3/FocusHelper.java | 1 + src/com/android/launcher3/Hotseat.java | 1 + .../launcher3/InstallShortcutReceiver.java | 4 +++ src/com/android/launcher3/Launcher.java | 6 ++++ .../LauncherAppWidgetProviderInfo.java | 1 + src/com/android/launcher3/LauncherModel.java | 3 ++ .../android/launcher3/LauncherSettings.java | 6 ++-- .../android/launcher3/PendingAddItemInfo.java | 2 ++ .../launcher3/SecondaryDropTarget.java | 7 +++-- src/com/android/launcher3/Utilities.java | 4 ++- src/com/android/launcher3/Workspace.java | 5 ++++ .../launcher3/WorkspaceLayoutManager.java | 1 + .../LauncherAccessibilityDelegate.java | 10 +++---- .../ShortcutMenuAccessibilityDelegate.java | 4 +-- .../WorkspaceAccessibilityHelper.java | 12 ++++---- .../allapps/AllAppsContainerView.java | 4 +-- .../launcher3/allapps/AllAppsGridAdapter.java | 2 +- .../allapps/AllAppsRecyclerView.java | 2 +- .../launcher3/allapps/AllAppsStore.java | 10 +++---- .../allapps/AlphabeticalAppsList.java | 2 +- .../launcher3/allapps/AppInfoComparator.java | 2 +- .../search/DefaultAppSearchAlgorithm.java | 2 +- .../launcher3/dragndrop/DragController.java | 4 +-- .../android/launcher3/dragndrop/DragView.java | 2 +- .../dragndrop/PinItemDragListener.java | 2 +- .../PinShortcutRequestActivityInfo.java | 2 +- .../dragndrop/PinWidgetFlowHandler.java | 2 +- src/com/android/launcher3/folder/Folder.java | 12 ++++---- .../launcher3/folder/FolderGridOrganizer.java | 4 +-- .../android/launcher3/folder/FolderIcon.java | 10 +++---- .../launcher3/folder/FolderNameProvider.java | 6 ++-- .../launcher3/folder/FolderPagedView.java | 4 +-- .../folder/PreviewItemDrawingParams.java | 2 +- .../launcher3/folder/PreviewItemManager.java | 2 +- .../graphics/LauncherPreviewRenderer.java | 8 ++--- .../graphics/PreloadIconDrawable.java | 2 +- .../android/launcher3/icons/IconCache.java | 8 ++--- .../keyboard/CustomActionsPopup.java | 2 +- .../launcher3/logging/LoggerUtils.java | 4 +-- .../launcher3/logging/StatsLogUtils.java | 2 +- .../logging/UserEventDispatcher.java | 2 +- .../model/AddWorkspaceItemsTask.java | 10 +++---- .../android/launcher3/model/AllAppsList.java | 8 ++--- .../launcher3/model/BaseLoaderResults.java | 6 ++-- .../launcher3/model/BaseModelUpdateTask.java | 4 +-- .../android/launcher3/model/BgDataModel.java | 12 ++++---- .../launcher3/model/CacheDataUpdatedTask.java | 6 ++-- .../launcher3/model/FirstScreenBroadcast.java | 10 +++---- .../model/GridSizeMigrationTask.java | 2 +- .../model/GridSizeMigrationTaskV2.java | 2 +- .../android/launcher3/model/LoaderCursor.java | 6 ++-- .../android/launcher3/model/LoaderTask.java | 19 ++++++------ .../android/launcher3/model/ModelUtils.java | 2 +- .../android/launcher3/model/ModelWriter.java | 8 ++--- .../model/PackageInstallStateChangedTask.java | 8 ++--- .../launcher3/model/PackageUpdatedTask.java | 12 ++++---- .../launcher3/model/ShortcutsChangedTask.java | 4 +-- .../model/UserLockStateChangedTask.java | 6 ++-- .../launcher3/{ => model/data}/AppInfo.java | 7 +++-- .../{ => model/data}/FolderInfo.java | 4 ++- .../launcher3/{ => model/data}/ItemInfo.java | 29 ++++++++++--------- .../{ => model/data}/ItemInfoWithIcon.java | 8 ++--- .../data}/LauncherAppWidgetInfo.java | 12 ++++---- .../model/{ => data}/PackageItemInfo.java | 3 +- .../{ => model/data}/PromiseAppInfo.java | 2 +- .../{ => model/data}/WorkspaceItemInfo.java | 14 +++++---- .../notification/NotificationMainView.java | 2 +- .../launcher3/pm/PinRequestHelper.java | 2 +- .../pm/ShortcutConfigActivityInfo.java | 2 +- .../popup/PopupContainerWithArrow.java | 4 +-- .../launcher3/popup/PopupDataProvider.java | 2 +- .../launcher3/popup/PopupPopulator.java | 4 +-- .../launcher3/popup/RemoteActionShortcut.java | 2 +- .../launcher3/popup/SystemShortcut.java | 9 +++--- .../launcher3/provider/ImportDataTask.java | 2 +- .../launcher3/provider/RestoreDbTask.java | 4 +-- .../secondarydisplay/PinnedAppsAdapter.java | 4 +-- .../SecondaryDisplayLauncher.java | 10 +++---- .../secondarydisplay/SecondaryDragLayer.java | 2 +- .../launcher3/shortcuts/DeepShortcutView.java | 2 +- .../launcher3/shortcuts/ShortcutKey.java | 2 +- .../launcher3/touch/ItemClickHandler.java | 27 ++++++++--------- .../touch/ItemLongClickListener.java | 2 +- .../android/launcher3/util/GridOccupancy.java | 2 +- .../launcher3/util/InstantAppResolver.java | 2 +- .../launcher3/util/ItemInfoMatcher.java | 8 ++--- .../launcher3/util/PackageManagerHelper.java | 10 +++---- .../launcher3/util/PackageUserKey.java | 2 +- .../launcher3/util/PendingRequestArgs.java | 2 +- .../android/launcher3/util/ShortcutUtil.java | 4 +-- .../launcher3/views/ActivityContext.java | 2 +- .../launcher3/views/FloatingIconView.java | 2 +- .../launcher3/widget/BaseWidgetSheet.java | 2 +- .../widget/LauncherAppWidgetHostView.java | 4 +-- .../widget/PendingAppWidgetHostView.java | 6 ++-- .../widget/WidgetAddFlowHandler.java | 4 +-- .../launcher3/widget/WidgetListRowEntry.java | 4 +-- .../launcher3/widget/WidgetManagerHelper.java | 2 +- .../launcher3/widget/WidgetsBottomSheet.java | 2 +- .../launcher3/widget/WidgetsDiffReporter.java | 2 +- .../widget/custom/CustomWidgetManager.java | 2 +- .../android/launcher3/model/WidgetsModel.java | 1 + .../search/DefaultAppSearchAlgorithmTest.java | 8 ++--- .../launcher3/ui/AbstractLauncherUiTest.java | 2 +- .../ui/widget/AddConfigWidgetTest.java | 4 +-- .../launcher3/ui/widget/AddWidgetTest.java | 2 +- .../launcher3/ui/widget/BindWidgetTest.java | 2 +- .../ui/widget/RequestPinItemTest.java | 6 ++-- 146 files changed, 375 insertions(+), 314 deletions(-) rename src/com/android/launcher3/{ => model/data}/AppInfo.java (94%) rename src/com/android/launcher3/{ => model/data}/FolderInfo.java (97%) rename src/com/android/launcher3/{ => model/data}/ItemInfo.java (92%) rename src/com/android/launcher3/{ => model/data}/ItemInfoWithIcon.java (94%) rename src/com/android/launcher3/{ => model/data}/LauncherAppWidgetInfo.java (93%) rename src/com/android/launcher3/model/{ => data}/PackageItemInfo.java (95%) rename src/com/android/launcher3/{ => model/data}/PromiseAppInfo.java (97%) rename src/com/android/launcher3/{ => model/data}/WorkspaceItemInfo.java (94%) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java index 0712285aec..fdb8e4c571 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java @@ -18,9 +18,9 @@ package com.android.launcher3.appprediction; import static com.android.quickstep.InstantAppResolverImpl.COMPONENT_CLASS_MARKER; -import com.android.launcher3.AppInfo; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.allapps.AllAppsStore; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.util.ComponentKey; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java index 54f58e2081..6c4bfe8a21 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java @@ -38,11 +38,11 @@ import androidx.annotation.Nullable; import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; -import com.android.launcher3.AppInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.shortcuts.ShortcutRequest; import com.android.launcher3.util.InstantAppResolver; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java index 6e5f4617f4..6c4c601b45 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java @@ -21,9 +21,9 @@ import static com.android.quickstep.InstantAppResolverImpl.COMPONENT_CLASS_MARKE import android.content.ComponentName; import android.content.Intent; -import com.android.launcher3.AppInfo; import com.android.launcher3.LauncherSettings; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; public class InstantAppItemInfo extends AppInfo { @@ -44,7 +44,7 @@ public class InstantAppItemInfo extends AppInfo { workspaceItemInfo.status = WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON | WorkspaceItemInfo.FLAG_RESTORE_STARTED | WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI; - workspaceItemInfo.intent.setPackage(componentName.getPackageName()); + workspaceItemInfo.getIntent().setPackage(componentName.getPackageName()); return workspaceItemInfo; } } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index 8faec46580..d4cc1298c6 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -38,18 +38,14 @@ import android.widget.LinearLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.FloatingHeaderRow; import com.android.launcher3.allapps.FloatingHeaderView; @@ -60,6 +56,10 @@ import com.android.launcher3.keyboard.FocusIndicatorHelper; import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; import com.android.launcher3.model.AppLaunchTracker; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.touch.ItemLongClickListener; import com.android.launcher3.userevent.nano.LauncherLogProto; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java index 632b9b504a..8e55609e7d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java @@ -28,8 +28,6 @@ import androidx.annotation.NonNull; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; @@ -40,6 +38,8 @@ import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.allapps.AllAppsStore.OnUpdateListener; import com.android.launcher3.hybridhotseat.HotseatPredictionController; import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.ComponentKey; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java index 773c6c8a6a..f9070893ab 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java @@ -27,16 +27,16 @@ import android.view.View; import androidx.core.app.NotificationCompat; import com.android.launcher3.CellLayout; -import com.android.launcher3.FolderInfo; import com.android.launcher3.Hotseat; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.Workspace; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.ActivityTracker; import com.android.launcher3.util.GridOccupancy; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java index b8c4a2147f..4213740c13 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java @@ -16,8 +16,7 @@ package com.android.launcher3.hybridhotseat; import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType - .HYBRID_HOTSEAT_CANCELED; +import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.HYBRID_HOTSEAT_CANCELED; import android.animation.PropertyValuesHolder; import android.content.Context; @@ -34,10 +33,10 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.Launcher; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.UserEventDispatcher; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.uioverrides.PredictedAppIcon; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.views.AbstractSlideInView; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java index 9bc097527c..7c002875fa 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java @@ -39,22 +39,17 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget; -import com.android.launcher3.FolderInfo; import com.android.launcher3.Hotseat; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.appprediction.ComponentKeyMapper; @@ -64,6 +59,11 @@ import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.icons.IconCache; import com.android.launcher3.logging.FileLog; import com.android.launcher3.logging.UserEventDispatcher; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.touch.ItemLongClickListener; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java index 304c77f3da..70880ebdba 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java @@ -33,14 +33,14 @@ import androidx.core.graphics.ColorUtils; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.graphics.IconPalette; import com.android.launcher3.hybridhotseat.HotseatPredictionController; import com.android.launcher3.icons.IconNormalizer; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.touch.ItemLongClickListener; import com.android.launcher3.views.DoubleShadowBubbleTextView; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index da8111430b..87ca2b688a 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -28,14 +28,14 @@ import androidx.annotation.Nullable; import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.Folder; import com.android.launcher3.hybridhotseat.HotseatPredictionController; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java index 9ba2e5a684..021d39dd6e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java @@ -35,8 +35,8 @@ import android.view.View; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.WellbeingModel; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.popup.SystemShortcut.AppInfo; import com.android.launcher3.userevent.nano.LauncherLogProto; @@ -71,7 +71,7 @@ public interface TaskShortcutFactory { WorkspaceItemInfo dummyInfo = new WorkspaceItemInfo(); dummyInfo.intent = new Intent(); ComponentName component = task.getTopComponent(); - dummyInfo.intent.setComponent(component); + dummyInfo.getIntent().setComponent(component); dummyInfo.user = UserHandle.of(task.key.userId); dummyInfo.title = TaskUtils.getTitle(view.getContext(), task); return dummyInfo; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java index 6a3e1feddb..47c07afa80 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java @@ -33,8 +33,8 @@ import android.view.View; import com.android.launcher3.BaseActivity; import com.android.launcher3.BaseDraggingActivity; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Utilities; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.statehandlers.DepthController; import com.android.quickstep.util.AppWindowAnimationHelper; import com.android.quickstep.util.MultiValueUpdateListener; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java index b9ef57eaa3..e0008033b4 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/logging/UserEventDispatcherAppPredictionExtension.java @@ -19,8 +19,8 @@ import android.content.Context; import androidx.annotation.NonNull; -import com.android.launcher3.ItemInfo; import com.android.launcher3.appprediction.PredictionUiStateManager; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto; import java.util.ArrayList; diff --git a/quickstep/src/com/android/launcher3/model/WellbeingModel.java b/quickstep/src/com/android/launcher3/model/WellbeingModel.java index 92c857388a..2181aa826a 100644 --- a/quickstep/src/com/android/launcher3/model/WellbeingModel.java +++ b/quickstep/src/com/android/launcher3/model/WellbeingModel.java @@ -45,8 +45,8 @@ import android.util.Log; import androidx.annotation.MainThread; import com.android.launcher3.BaseDraggingActivity; -import com.android.launcher3.ItemInfo; import com.android.launcher3.R; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.RemoteActionShortcut; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.util.MainThreadInitializedObject; diff --git a/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java b/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java index 3e9872a2ff..7638541023 100644 --- a/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java +++ b/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java @@ -21,7 +21,7 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import com.android.launcher3.AppInfo; +import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.util.InstantAppResolver; /** diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index 58bb980ab6..ac2200dcc4 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -23,16 +23,16 @@ import static android.stats.launcher.nano.Launcher.OVERVIEW; import android.content.Context; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogUtils; import com.android.launcher3.model.AllAppsList; import com.android.launcher3.model.BaseModelUpdateTask; import com.android.launcher3.model.BgDataModel; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.util.IntSparseArrayMap; import java.util.ArrayList; diff --git a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java index f8f22a1943..8ecd88a45e 100644 --- a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java +++ b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java @@ -48,9 +48,9 @@ import androidx.test.uiautomator.By; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.Until; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.LauncherSettings; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.tapl.Background; import com.android.launcher3.testcomponent.ListViewService; import com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory; diff --git a/robolectric_tests/resources/cache_data_updated_task_data.txt b/robolectric_tests/resources/cache_data_updated_task_data.txt index 302d58f842..603dbe3f92 100644 --- a/robolectric_tests/resources/cache_data_updated_task_data.txt +++ b/robolectric_tests/resources/cache_data_updated_task_data.txt @@ -1,6 +1,6 @@ # Model data used by CacheDataUpdatedTaskTest -classMap s com.android.launcher3.WorkspaceItemInfo +classMap s com.android.launcher3.model.data.WorkspaceItemInfo # Items for the BgDataModel diff --git a/robolectric_tests/resources/package_install_state_change_task_data.txt b/robolectric_tests/resources/package_install_state_change_task_data.txt index 4d63664c78..e82ea9d4d6 100644 --- a/robolectric_tests/resources/package_install_state_change_task_data.txt +++ b/robolectric_tests/resources/package_install_state_change_task_data.txt @@ -1,7 +1,7 @@ # Model data used by PackageInstallStateChangeTaskTest -classMap s com.android.launcher3.WorkspaceItemInfo -classMap w com.android.launcher3.LauncherAppWidgetInfo +classMap s com.android.launcher3.model.data.WorkspaceItemInfo +classMap w com.android.launcher3.model.data.LauncherAppWidgetInfo # Items for the BgDataModel diff --git a/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java b/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java index 32d4f272b2..d927ffc051 100644 --- a/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java +++ b/robolectric_tests/src/com/android/launcher3/folder/FolderNameProviderTest.java @@ -22,8 +22,8 @@ import android.content.Context; import android.content.Intent; import android.os.UserHandle; -import com.android.launcher3.AppInfo; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import org.junit.Before; import org.junit.Test; diff --git a/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java index 83b217521b..8aa6f374aa 100644 --- a/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java @@ -14,12 +14,12 @@ import android.graphics.Rect; import android.util.Pair; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.BgDataModel.Callbacks; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.ContentWriter; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.IntArray; diff --git a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java index 09d611d0ff..5610b0ee0a 100644 --- a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java @@ -17,13 +17,13 @@ import android.os.UserManager; import androidx.annotation.NonNull; -import com.android.launcher3.AppInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.cache.CachingLogic; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.LauncherModelHelper; import org.junit.Before; diff --git a/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java b/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java index cdabf79e39..7ca416d520 100644 --- a/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java @@ -28,10 +28,10 @@ import android.content.pm.PackageInstaller; import android.content.pm.PackageInstaller.SessionInfo; import android.content.pm.PackageInstaller.SessionParams; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherSettings; import com.android.launcher3.icons.BitmapInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.LauncherModelHelper; diff --git a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java index 8531014bea..2584f65c52 100644 --- a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java @@ -50,10 +50,10 @@ import android.database.MatrixCursor; import android.os.Process; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.Executors; import com.android.launcher3.util.PackageManagerHelper; @@ -127,7 +127,7 @@ public class LoaderCursorTest { new Intent().setComponent(cn), false /* allowMissingTarget */, true)) .get(); assertNotNull(info); - assertTrue(PackageManagerHelper.isLauncherAppTarget(info.intent)); + assertTrue(PackageManagerHelper.isLauncherAppTarget(info.getIntent())); } @Test @@ -141,7 +141,7 @@ public class LoaderCursorTest { new Intent().setComponent(cn), true /* allowMissingTarget */, true)) .get(); assertNotNull(info); - assertTrue(PackageManagerHelper.isLauncherAppTarget(info.intent)); + assertTrue(PackageManagerHelper.isLauncherAppTarget(info.getIntent())); } @Test diff --git a/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java b/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java index d81ac69f69..4b0ae7ed29 100644 --- a/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/ModelMultiCallbacksTest.java @@ -26,10 +26,10 @@ import static org.robolectric.Shadows.shadowOf; import android.os.Process; -import com.android.launcher3.AppInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.PagedView; import com.android.launcher3.model.BgDataModel.Callbacks; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.Executors; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.LauncherModelHelper; diff --git a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java index f017c82200..e43df21ae9 100644 --- a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java +++ b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java @@ -2,9 +2,9 @@ package com.android.launcher3.model; import static org.junit.Assert.assertEquals; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppWidgetInfo; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.util.LauncherModelHelper; diff --git a/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java b/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java index d593d84778..03880879d7 100644 --- a/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java +++ b/robolectric_tests/src/com/android/launcher3/util/LauncherModelHelper.java @@ -36,9 +36,7 @@ import android.net.Uri; import android.os.Process; import android.provider.Settings; -import com.android.launcher3.AppInfo; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherModel.ModelUpdateTask; @@ -47,6 +45,8 @@ import com.android.launcher3.LauncherSettings; import com.android.launcher3.model.AllAppsList; import com.android.launcher3.model.BgDataModel; import com.android.launcher3.model.BgDataModel.Callbacks; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.pm.UserCache; import org.mockito.ArgumentCaptor; diff --git a/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java b/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java index 76c395245d..84c65b1108 100644 --- a/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java +++ b/robolectric_tests/src/com/android/launcher3/widget/WidgetsListAdapterTest.java @@ -34,8 +34,8 @@ import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.WidgetPreviewLoader; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.IconCache; -import com.android.launcher3.model.PackageItemInfo; import com.android.launcher3.model.WidgetItem; +import com.android.launcher3.model.data.PackageItemInfo; import org.junit.Before; import org.junit.Test; diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java index 73d8a88d77..6f7b684537 100644 --- a/src/com/android/launcher3/AppWidgetResizeFrame.java +++ b/src/com/android/launcher3/AppWidgetResizeFrame.java @@ -350,7 +350,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O mWidgetView.requestLayout(); } - static void updateWidgetSizeRanges(AppWidgetHostView widgetView, Launcher launcher, + public static void updateWidgetSizeRanges(AppWidgetHostView widgetView, Launcher launcher, int spanX, int spanY) { getWidgetSizeRanges(launcher, spanX, spanY, sTmpRect); widgetView.updateAppWidgetSize(null, sTmpRect.left, sTmpRect.top, diff --git a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java index 71b720628b..a55c90d341 100644 --- a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java +++ b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java @@ -17,6 +17,7 @@ import androidx.annotation.WorkerThread; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.model.LoaderTask; import com.android.launcher3.model.WidgetsModel; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.provider.RestoreDbTask; import com.android.launcher3.util.ContentWriter; diff --git a/src/com/android/launcher3/AutoInstallsLayout.java b/src/com/android/launcher3/AutoInstallsLayout.java index ac4396778a..5971a028ca 100644 --- a/src/com/android/launcher3/AutoInstallsLayout.java +++ b/src/com/android/launcher3/AutoInstallsLayout.java @@ -44,6 +44,8 @@ import com.android.launcher3.LauncherProvider.SqlArguments; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.icons.GraphicsUtils; import com.android.launcher3.icons.LauncherIcons; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.qsb.QsbContainerView; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.PackageManagerHelper; diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java index 6fa3c28b21..2dc783672d 100644 --- a/src/com/android/launcher3/BaseDraggingActivity.java +++ b/src/com/android/launcher3/BaseDraggingActivity.java @@ -39,6 +39,8 @@ import androidx.annotation.Nullable; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.model.AppLaunchTracker; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.ItemClickHandler; diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 921e8ac14d..93247abe6c 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -53,7 +53,12 @@ import com.android.launcher3.graphics.PreloadIconDrawable; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.icons.IconCache.IconLoadRequest; import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver; -import com.android.launcher3.model.PackageItemInfo; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; +import com.android.launcher3.model.data.PackageItemInfo; +import com.android.launcher3.model.data.PromiseAppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.IconLabelDotView; diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java index 34d70673ae..09827d664b 100644 --- a/src/com/android/launcher3/ButtonDropTarget.java +++ b/src/com/android/launcher3/ButtonDropTarget.java @@ -46,6 +46,7 @@ import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.dragndrop.DragView; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index d7b5cf10ae..99416c4e2d 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -59,6 +59,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dragndrop.DraggableView; import com.android.launcher3.folder.PreviewBackground; import com.android.launcher3.graphics.DragPreviewProvider; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.CellAndSpan; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.ParcelableSparseArray; diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java index 6f0ebd2a09..b4c5f96acb 100644 --- a/src/com/android/launcher3/DeleteDropTarget.java +++ b/src/com/android/launcher3/DeleteDropTarget.java @@ -28,6 +28,10 @@ import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.logging.LoggerUtils; import com.android.launcher3.model.ModelWriter; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.views.Snackbar; diff --git a/src/com/android/launcher3/DropTarget.java b/src/com/android/launcher3/DropTarget.java index ef02e87a6b..0a0f9adb82 100644 --- a/src/com/android/launcher3/DropTarget.java +++ b/src/com/android/launcher3/DropTarget.java @@ -25,6 +25,7 @@ import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.dragndrop.DragView; import com.android.launcher3.dragndrop.DraggableView; import com.android.launcher3.folder.FolderNameProvider; +import com.android.launcher3.model.data.ItemInfo; /** * Interface defining an object that can receive a drag. diff --git a/src/com/android/launcher3/FastBitmapDrawable.java b/src/com/android/launcher3/FastBitmapDrawable.java index a78159f570..f96aafa6b8 100644 --- a/src/com/android/launcher3/FastBitmapDrawable.java +++ b/src/com/android/launcher3/FastBitmapDrawable.java @@ -35,6 +35,7 @@ import android.util.Property; import com.android.launcher3.graphics.PlaceHolderIconDrawable; import com.android.launcher3.icons.BitmapInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; public class FastBitmapDrawable extends Drawable { diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java index f07040db03..e5aecf7be1 100644 --- a/src/com/android/launcher3/FocusHelper.java +++ b/src/com/android/launcher3/FocusHelper.java @@ -25,6 +25,7 @@ import android.view.ViewGroup; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderPagedView; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.FocusLogic; import com.android.launcher3.util.Thunk; diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 78bd2ff502..be941f2e56 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -28,6 +28,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index a5142d815c..62c9b4dc93 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -46,6 +46,10 @@ import androidx.annotation.WorkerThread; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.GraphicsUtils; import com.android.launcher3.icons.LauncherIcons; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.shortcuts.ShortcutRequest; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 6a35e800da..14638a1dda 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -110,6 +110,12 @@ import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.ModelWriter; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PromiseAppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.pm.PinRequestHelper; import com.android.launcher3.pm.UserCache; diff --git a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java index 56cce78659..618b5de79e 100644 --- a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java +++ b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java @@ -13,6 +13,7 @@ import android.os.UserHandle; import com.android.launcher3.icons.ComponentWithLabelAndIcon; import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; /** * This class is a thin wrapper around the framework AppWidgetProviderInfo class. This class affords diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 9e91e7019a..3b1c7bbd67 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -51,6 +51,9 @@ import com.android.launcher3.model.PackageInstallStateChangedTask; import com.android.launcher3.model.PackageUpdatedTask; import com.android.launcher3.model.ShortcutsChangedTask; import com.android.launcher3.model.UserLockStateChangedTask; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.InstallSessionTracker; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.pm.UserCache; diff --git a/src/com/android/launcher3/LauncherSettings.java b/src/com/android/launcher3/LauncherSettings.java index 5262b185db..d3af5fca6b 100644 --- a/src/com/android/launcher3/LauncherSettings.java +++ b/src/com/android/launcher3/LauncherSettings.java @@ -22,6 +22,8 @@ import android.net.Uri; import android.os.Bundle; import android.provider.BaseColumns; +import com.android.launcher3.model.data.ItemInfo; + /** * Settings related utilities. */ @@ -151,7 +153,7 @@ public class LauncherSettings { public static final int CONTAINER_PREDICTION = -102; public static final int CONTAINER_HOTSEAT_PREDICTION = -103; - static final String containerToString(int container) { + public static final String containerToString(int container) { switch (container) { case CONTAINER_DESKTOP: return "desktop"; case CONTAINER_HOTSEAT: return "hotseat"; @@ -160,7 +162,7 @@ public class LauncherSettings { } } - static final String itemTypeToString(int type) { + public static final String itemTypeToString(int type) { switch(type) { case ITEM_TYPE_APPLICATION: return "APP"; case ITEM_TYPE_SHORTCUT: return "SHORTCUT"; diff --git a/src/com/android/launcher3/PendingAddItemInfo.java b/src/com/android/launcher3/PendingAddItemInfo.java index 76de3e7644..29c9d935ae 100644 --- a/src/com/android/launcher3/PendingAddItemInfo.java +++ b/src/com/android/launcher3/PendingAddItemInfo.java @@ -18,6 +18,8 @@ package com.android.launcher3; import android.content.ComponentName; +import com.android.launcher3.model.data.ItemInfo; + /** * Meta data that is used for deferred binding. * e.g., this object is used to pass information on draggable targets when they are dropped onto diff --git a/src/com/android/launcher3/SecondaryDropTarget.java b/src/com/android/launcher3/SecondaryDropTarget.java index 983c289956..9dbb5fc675 100644 --- a/src/com/android/launcher3/SecondaryDropTarget.java +++ b/src/com/android/launcher3/SecondaryDropTarget.java @@ -3,12 +3,12 @@ package com.android.launcher3; import static android.appwidget.AppWidgetManager.INVALID_APPWIDGET_ID; import static android.appwidget.AppWidgetProviderInfo.WIDGET_FEATURE_RECONFIGURABLE; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_SYSTEM_MASK; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_SYSTEM_NO; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DISMISS_PREDICTION; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.RECONFIGURE; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.UNINSTALL; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SYSTEM_MASK; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SYSTEM_NO; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetProviderInfo; @@ -35,6 +35,9 @@ import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.logging.FileLog; import com.android.launcher3.logging.LoggerUtils; import com.android.launcher3.model.AppLaunchTracker; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.PackageManagerHelper; diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 0cd08d4faa..3c3ab6cc62 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -16,7 +16,7 @@ package com.android.launcher3; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ICON_BADGED; import android.animation.ValueAnimator; import android.annotation.TargetApi; @@ -66,6 +66,8 @@ import com.android.launcher3.graphics.TintedDrawableSpan; import com.android.launcher3.icons.IconProvider; import com.android.launcher3.icons.LauncherIcons; import com.android.launcher3.icons.ShortcutCachingLogic; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.pm.ShortcutConfigActivityInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.shortcuts.ShortcutRequest; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 7c504a6aa8..70a5cc5d23 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -77,6 +77,11 @@ import com.android.launcher3.graphics.DragPreviewProvider; import com.android.launcher3.graphics.PreloadIconDrawable; import com.android.launcher3.icons.BitmapRenderer; import com.android.launcher3.logging.UserEventDispatcher; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pageindicators.WorkspacePageIndicator; import com.android.launcher3.popup.PopupContainerWithArrow; import com.android.launcher3.states.StateAnimationConfig; diff --git a/src/com/android/launcher3/WorkspaceLayoutManager.java b/src/com/android/launcher3/WorkspaceLayoutManager.java index 0b9d60249e..c3d4aeb745 100644 --- a/src/com/android/launcher3/WorkspaceLayoutManager.java +++ b/src/com/android/launcher3/WorkspaceLayoutManager.java @@ -21,6 +21,7 @@ import android.view.ViewGroup; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.touch.ItemLongClickListener; public interface WorkspaceLayoutManager { diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java index 414ababc98..136d43ea73 100644 --- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java +++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java @@ -19,26 +19,26 @@ import android.view.View.AccessibilityDelegate; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; -import com.android.launcher3.AppInfo; import com.android.launcher3.AppWidgetResizeFrame; import com.android.launcher3.BubbleTextView; import com.android.launcher3.ButtonDropTarget; import com.android.launcher3.CellLayout; import com.android.launcher3.DropTarget.DragObject; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.PendingAddItemInfo; import com.android.launcher3.R; import com.android.launcher3.Workspace; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.dragndrop.DragController.DragListener; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.folder.Folder; import com.android.launcher3.keyboard.CustomActionsPopup; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.popup.PopupContainerWithArrow; import com.android.launcher3.touch.ItemLongClickListener; diff --git a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java index c0c0b37c5c..d4ba11ef68 100644 --- a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java +++ b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java @@ -23,11 +23,11 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import com.android.launcher3.AbstractFloatingView; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationMainView; import com.android.launcher3.shortcuts.DeepShortcutView; diff --git a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java index 17daeb84e2..65a261de82 100644 --- a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java +++ b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java @@ -21,17 +21,17 @@ import android.graphics.Rect; import android.text.TextUtils; import android.view.View; -import com.android.launcher3.AppInfo; +import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; + import com.android.launcher3.CellLayout; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DragType; import com.android.launcher3.dragndrop.DragLayer; - -import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; /** * Implementation of {@link DragAndDropAccessibilityDelegate} to support DnD on workspace. diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 8d1a102f58..69faa498bd 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -42,7 +42,6 @@ import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.android.launcher3.AppInfo; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; @@ -50,10 +49,11 @@ import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget.DragObject; import com.android.launcher3.Insettable; import com.android.launcher3.InsettableFrameLayout; -import com.android.launcher3.ItemInfo; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.keyboard.FocusedItemDecorator; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index 1f861bcc0e..4aebec0798 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -37,12 +37,12 @@ import androidx.core.view.accessibility.AccessibilityRecordCompat; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.android.launcher3.AppInfo; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.BubbleTextView; import com.android.launcher3.R; import com.android.launcher3.allapps.AlphabeticalAppsList.AdapterItem; import com.android.launcher3.model.AppLaunchTracker; +import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.util.PackageManagerHelper; import java.util.List; diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 8fe4633256..069472f7dd 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -35,11 +35,11 @@ import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.BaseRecyclerView; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsGridAdapter.AppsGridLayoutManager; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.views.RecyclerViewFastScroller; diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java index a6ef10a8f9..d2dcfd2c37 100644 --- a/src/com/android/launcher3/allapps/AllAppsStore.java +++ b/src/com/android/launcher3/allapps/AllAppsStore.java @@ -15,17 +15,17 @@ */ package com.android.launcher3.allapps; -import static com.android.launcher3.AppInfo.COMPONENT_KEY_COMPARATOR; -import static com.android.launcher3.AppInfo.EMPTY_ARRAY; +import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR; +import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY; import android.util.Log; import android.view.View; import android.view.ViewGroup; -import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.PromiseAppInfo; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.PromiseAppInfo; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageUserKey; diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index b501c82b25..06209bba85 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -18,8 +18,8 @@ package com.android.launcher3.allapps; import android.content.Context; -import com.android.launcher3.AppInfo; import com.android.launcher3.BaseDraggingActivity; +import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LabelComparator; diff --git a/src/com/android/launcher3/allapps/AppInfoComparator.java b/src/com/android/launcher3/allapps/AppInfoComparator.java index 8baf56c219..823f98efea 100644 --- a/src/com/android/launcher3/allapps/AppInfoComparator.java +++ b/src/com/android/launcher3/allapps/AppInfoComparator.java @@ -19,7 +19,7 @@ import android.content.Context; import android.os.Process; import android.os.UserHandle; -import com.android.launcher3.AppInfo; +import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.util.LabelComparator; diff --git a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java index 26f6ec3572..f72a9888cf 100644 --- a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java +++ b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java @@ -17,7 +17,7 @@ package com.android.launcher3.allapps.search; import android.os.Handler; -import com.android.launcher3.AppInfo; +import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.util.ComponentKey; import java.text.Collator; diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index db61f59133..d93fb1a6cd 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -37,11 +37,11 @@ import android.view.View; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.accessibility.DragViewStateAnnouncer; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.TouchController; diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java index 7c76d34e03..d07635bc15 100644 --- a/src/com/android/launcher3/dragndrop/DragView.java +++ b/src/com/android/launcher3/dragndrop/DragView.java @@ -46,7 +46,6 @@ import androidx.dynamicanimation.animation.SpringForce; import com.android.launcher3.FastBitmapDrawable; import com.android.launcher3.FirstFrameAnimatorHelper; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; @@ -55,6 +54,7 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.icons.LauncherIcons; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; diff --git a/src/com/android/launcher3/dragndrop/PinItemDragListener.java b/src/com/android/launcher3/dragndrop/PinItemDragListener.java index 77c630638b..bf3aa7f7cb 100644 --- a/src/com/android/launcher3/dragndrop/PinItemDragListener.java +++ b/src/com/android/launcher3/dragndrop/PinItemDragListener.java @@ -30,10 +30,10 @@ import android.view.View; import android.widget.RemoteViews; import com.android.launcher3.DragSource; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.PendingAddItemInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.widget.PendingAddShortcutInfo; import com.android.launcher3.widget.PendingAddWidgetInfo; diff --git a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java index f71cfb8eb0..9982b39339 100644 --- a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java +++ b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java @@ -35,8 +35,8 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.PinRequestHelper; import com.android.launcher3.pm.ShortcutConfigActivityInfo; diff --git a/src/com/android/launcher3/dragndrop/PinWidgetFlowHandler.java b/src/com/android/launcher3/dragndrop/PinWidgetFlowHandler.java index 9f617e4f61..c501ab5aaa 100644 --- a/src/com/android/launcher3/dragndrop/PinWidgetFlowHandler.java +++ b/src/com/android/launcher3/dragndrop/PinWidgetFlowHandler.java @@ -25,8 +25,8 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.widget.WidgetAddFlowHandler; /** diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index ea7317a1f0..b9b33fe14a 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -20,7 +20,6 @@ import static android.text.TextUtils.isEmpty; import static androidx.core.util.Preconditions.checkNotNull; -import static com.android.launcher3.FolderInfo.FLAG_MANUAL_FOLDER_NAME; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; @@ -28,6 +27,7 @@ import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; import static com.android.launcher3.config.FeatureFlags.ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; +import static com.android.launcher3.model.data.FolderInfo.FLAG_MANUAL_FOLDER_NAME; import static com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState.FROM_CUSTOM; import static com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState.FROM_EMPTY; import static com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState.FROM_FOLDER_LABEL_STATE_UNSPECIFIED; @@ -65,16 +65,12 @@ import android.widget.TextView; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Alarm; -import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget; import com.android.launcher3.ExtendedEditText; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.FolderInfo.FolderListener; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.OnAlarmListener; @@ -84,7 +80,6 @@ import com.android.launcher3.ShortcutAndWidgetContainer; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.Workspace.ItemOperator; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.accessibility.AccessibleDragListenerAdapter; import com.android.launcher3.accessibility.FolderAccessibilityHelper; import com.android.launcher3.config.FeatureFlags; @@ -92,6 +87,11 @@ import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragController.DragListener; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragOptions; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.FolderInfo.FolderListener; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pageindicators.PageIndicatorDots; import com.android.launcher3.userevent.LauncherLogProto.Action; import com.android.launcher3.userevent.LauncherLogProto.ContainerType; diff --git a/src/com/android/launcher3/folder/FolderGridOrganizer.java b/src/com/android/launcher3/folder/FolderGridOrganizer.java index 9d14a5ffb3..4be82ed8d3 100644 --- a/src/com/android/launcher3/folder/FolderGridOrganizer.java +++ b/src/com/android/launcher3/folder/FolderGridOrganizer.java @@ -20,9 +20,9 @@ import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_I import android.graphics.Point; -import com.android.launcher3.FolderInfo; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; import java.util.ArrayList; import java.util.List; diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index eda9545b17..680c3ba542 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -38,22 +38,17 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import com.android.launcher3.Alarm; -import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; import com.android.launcher3.CellLayout; import com.android.launcher3.CheckLongPressHelper; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DropTarget.DragObject; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.FolderInfo.FolderListener; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.OnAlarmListener; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dot.FolderDotInfo; @@ -62,6 +57,11 @@ import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragView; import com.android.launcher3.dragndrop.DraggableView; import com.android.launcher3.icons.DotRenderer; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.FolderInfo.FolderListener; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.util.Executors; import com.android.launcher3.util.Thunk; diff --git a/src/com/android/launcher3/folder/FolderNameProvider.java b/src/com/android/launcher3/folder/FolderNameProvider.java index 07161da232..7731e6e3f3 100644 --- a/src/com/android/launcher3/folder/FolderNameProvider.java +++ b/src/com/android/launcher3/folder/FolderNameProvider.java @@ -22,14 +22,14 @@ import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; -import com.android.launcher3.AppInfo; -import com.android.launcher3.FolderInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.AllAppsList; import com.android.launcher3.model.BaseModelUpdateTask; import com.android.launcher3.model.BgDataModel; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.IntSparseArrayMap; import com.android.launcher3.util.ResourceBasedOverride; diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java index dcd0e144bc..96ddd57ef3 100644 --- a/src/com/android/launcher3/folder/FolderPagedView.java +++ b/src/com/android/launcher3/folder/FolderPagedView.java @@ -36,7 +36,6 @@ import com.android.launcher3.BubbleTextView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.PagedView; @@ -44,9 +43,10 @@ import com.android.launcher3.R; import com.android.launcher3.ShortcutAndWidgetContainer; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace.ItemOperator; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.keyboard.ViewGroupFocusHelper; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pageindicators.PageIndicatorDots; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.util.Thunk; diff --git a/src/com/android/launcher3/folder/PreviewItemDrawingParams.java b/src/com/android/launcher3/folder/PreviewItemDrawingParams.java index caf6e55b78..a14a0d8efc 100644 --- a/src/com/android/launcher3/folder/PreviewItemDrawingParams.java +++ b/src/com/android/launcher3/folder/PreviewItemDrawingParams.java @@ -17,7 +17,7 @@ package com.android.launcher3.folder; import android.graphics.drawable.Drawable; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; /** * Manages the parameters used to draw a Folder preview item. diff --git a/src/com/android/launcher3/folder/PreviewItemManager.java b/src/com/android/launcher3/folder/PreviewItemManager.java index 27aa43ef3d..7f8a15c927 100644 --- a/src/com/android/launcher3/folder/PreviewItemManager.java +++ b/src/com/android/launcher3/folder/PreviewItemManager.java @@ -38,8 +38,8 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.graphics.PreloadIconDrawable; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.views.ActivityContext; import java.util.ArrayList; diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index 7d4eb0e999..6e91d7006d 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -54,19 +54,15 @@ import android.widget.TextClock; import com.android.launcher3.BubbleTextView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.FolderInfo; import com.android.launcher3.Hotseat; import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.WorkspaceLayoutManager; import com.android.launcher3.allapps.SearchUiManager; import com.android.launcher3.config.FeatureFlags; @@ -84,6 +80,10 @@ import com.android.launcher3.model.LoaderResults; import com.android.launcher3.model.LoaderTask; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.model.WidgetsModel; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.InstallSessionHelper; import com.android.launcher3.pm.UserCache; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; diff --git a/src/com/android/launcher3/graphics/PreloadIconDrawable.java b/src/com/android/launcher3/graphics/PreloadIconDrawable.java index b0e1db1019..4439284824 100644 --- a/src/com/android/launcher3/graphics/PreloadIconDrawable.java +++ b/src/com/android/launcher3/graphics/PreloadIconDrawable.java @@ -35,8 +35,8 @@ import android.util.Property; import android.util.SparseArray; import com.android.launcher3.FastBitmapDrawable; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.anim.Interpolators; +import com.android.launcher3.model.data.ItemInfoWithIcon; import java.lang.ref.WeakReference; diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java index f27c9da284..ff0f773468 100644 --- a/src/com/android/launcher3/icons/IconCache.java +++ b/src/com/android/launcher3/icons/IconCache.java @@ -38,18 +38,18 @@ import android.util.Log; import androidx.annotation.NonNull; -import com.android.launcher3.AppInfo; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.LauncherFiles; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.icons.ComponentWithLabel.ComponentCachingLogic; import com.android.launcher3.icons.cache.BaseIconCache; import com.android.launcher3.icons.cache.CachingLogic; import com.android.launcher3.icons.cache.HandlerRunnable; -import com.android.launcher3.model.PackageItemInfo; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; +import com.android.launcher3.model.data.PackageItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.util.ComponentKey; diff --git a/src/com/android/launcher3/keyboard/CustomActionsPopup.java b/src/com/android/launcher3/keyboard/CustomActionsPopup.java index 938955ca2c..800598e23f 100644 --- a/src/com/android/launcher3/keyboard/CustomActionsPopup.java +++ b/src/com/android/launcher3/keyboard/CustomActionsPopup.java @@ -24,9 +24,9 @@ import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.PopupMenu; import android.widget.PopupMenu.OnMenuItemClickListener; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.PopupContainerWithArrow; import java.util.ArrayList; diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java index 1b70fde88c..0f79bd6fd6 100644 --- a/src/com/android/launcher3/logging/LoggerUtils.java +++ b/src/com/android/launcher3/logging/LoggerUtils.java @@ -19,10 +19,10 @@ import android.util.ArrayMap; import android.util.SparseArray; import android.view.View; -import com.android.launcher3.AppInfo; import com.android.launcher3.ButtonDropTarget; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherSettings; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogExtensions.TargetExtension; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ItemType; diff --git a/src/com/android/launcher3/logging/StatsLogUtils.java b/src/com/android/launcher3/logging/StatsLogUtils.java index 844961205e..97aaf84eb2 100644 --- a/src/com/android/launcher3/logging/StatsLogUtils.java +++ b/src/com/android/launcher3/logging/StatsLogUtils.java @@ -7,7 +7,7 @@ import android.view.ViewParent; import androidx.annotation.Nullable; -import com.android.launcher3.ItemInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java index 89077ee1d3..da081a0e8d 100644 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ b/src/com/android/launcher3/logging/UserEventDispatcher.java @@ -46,11 +46,11 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.DropTarget; -import com.android.launcher3.ItemInfo; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent; diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java index eb953951c2..c236fa6dec 100644 --- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java +++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java @@ -23,16 +23,16 @@ import android.os.UserHandle; import android.util.LongSparseArray; import android.util.Pair; -import com.android.launcher3.AppInfo; -import com.android.launcher3.FolderInfo; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherModel.CallbackTask; import com.android.launcher3.LauncherSettings; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.BgDataModel.Callbacks; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.InstallSessionHelper; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.IntArray; diff --git a/src/com/android/launcher3/model/AllAppsList.java b/src/com/android/launcher3/model/AllAppsList.java index 9f1843f04e..4f349caaad 100644 --- a/src/com/android/launcher3/model/AllAppsList.java +++ b/src/com/android/launcher3/model/AllAppsList.java @@ -16,8 +16,8 @@ package com.android.launcher3.model; -import static com.android.launcher3.AppInfo.COMPONENT_KEY_COMPARATOR; -import static com.android.launcher3.AppInfo.EMPTY_ARRAY; +import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR; +import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY; import android.content.ComponentName; import android.content.Context; @@ -33,10 +33,10 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.AppFilter; -import com.android.launcher3.AppInfo; -import com.android.launcher3.PromiseAppInfo; import com.android.launcher3.compat.AlphabeticIndexCompat; import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.PromiseAppInfo; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.util.FlagOp; import com.android.launcher3.util.ItemInfoMatcher; diff --git a/src/com/android/launcher3/model/BaseLoaderResults.java b/src/com/android/launcher3/model/BaseLoaderResults.java index 0d12183ade..c98be5691f 100644 --- a/src/com/android/launcher3/model/BaseLoaderResults.java +++ b/src/com/android/launcher3/model/BaseLoaderResults.java @@ -21,14 +21,14 @@ import static com.android.launcher3.model.ModelUtils.sortWorkspaceItemsSpatially import android.util.Log; -import com.android.launcher3.AppInfo; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherModel.CallbackTask; import com.android.launcher3.PagedView; import com.android.launcher3.model.BgDataModel.Callbacks; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.LooperIdleLock; diff --git a/src/com/android/launcher3/model/BaseModelUpdateTask.java b/src/com/android/launcher3/model/BaseModelUpdateTask.java index 5a7b4d37bc..7ce970d253 100644 --- a/src/com/android/launcher3/model/BaseModelUpdateTask.java +++ b/src/com/android/launcher3/model/BaseModelUpdateTask.java @@ -17,13 +17,13 @@ package com.android.launcher3.model; import android.util.Log; -import com.android.launcher3.AppInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherModel.CallbackTask; import com.android.launcher3.LauncherModel.ModelUpdateTask; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.BgDataModel.Callbacks; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.widget.WidgetListRowEntry; diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java index 206688aaff..f79a9d14a7 100644 --- a/src/com/android/launcher3/model/BgDataModel.java +++ b/src/com/android/launcher3/model/BgDataModel.java @@ -26,16 +26,16 @@ import android.text.TextUtils; import android.util.Log; import android.util.MutableInt; -import com.android.launcher3.AppInfo; -import com.android.launcher3.FolderInfo; import com.android.launcher3.InstallShortcutReceiver; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherSettings; -import com.android.launcher3.PromiseAppInfo; import com.android.launcher3.Workspace; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PromiseAppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.shortcuts.ShortcutRequest; import com.android.launcher3.util.ComponentKey; diff --git a/src/com/android/launcher3/model/CacheDataUpdatedTask.java b/src/com/android/launcher3/model/CacheDataUpdatedTask.java index c1c8be3169..8e6b064498 100644 --- a/src/com/android/launcher3/model/CacheDataUpdatedTask.java +++ b/src/com/android/launcher3/model/CacheDataUpdatedTask.java @@ -18,11 +18,11 @@ package com.android.launcher3.model; import android.content.ComponentName; import android.os.UserHandle; -import com.android.launcher3.WorkspaceItemInfo; -import com.android.launcher3.icons.IconCache; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; +import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import java.util.ArrayList; import java.util.HashSet; diff --git a/src/com/android/launcher3/model/FirstScreenBroadcast.java b/src/com/android/launcher3/model/FirstScreenBroadcast.java index a0b7177630..5112304fb8 100644 --- a/src/com/android/launcher3/model/FirstScreenBroadcast.java +++ b/src/com/android/launcher3/model/FirstScreenBroadcast.java @@ -15,16 +15,18 @@ */ package com.android.launcher3.model; +import static android.os.Process.myUserHandle; + import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.PackageInstaller.SessionInfo; import android.util.Log; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherSettings; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.util.MultiHashMap; import com.android.launcher3.util.PackageUserKey; @@ -35,8 +37,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import static android.os.Process.myUserHandle; - /** * Helper class to send broadcasts to package installers that have: * - Items on the first screen diff --git a/src/com/android/launcher3/model/GridSizeMigrationTask.java b/src/com/android/launcher3/model/GridSizeMigrationTask.java index a0846001a1..b27e4ea72e 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationTask.java +++ b/src/com/android/launcher3/model/GridSizeMigrationTask.java @@ -22,7 +22,6 @@ import android.util.SparseArray; import androidx.annotation.VisibleForTesting; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.LauncherSettings; @@ -32,6 +31,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.LauncherPreviewRenderer; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.pm.InstallSessionHelper; import com.android.launcher3.provider.LauncherDbUtils; import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction; diff --git a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java index 79ae4c5edb..1c44fc381e 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java +++ b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java @@ -36,12 +36,12 @@ import android.util.Log; import androidx.annotation.VisibleForTesting; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.LauncherSettings; import com.android.launcher3.Utilities; import com.android.launcher3.graphics.LauncherPreviewRenderer; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.pm.InstallSessionHelper; import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction; import com.android.launcher3.util.GridOccupancy; diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java index 695d2a6940..244de96bae 100644 --- a/src/com/android/launcher3/model/LoaderCursor.java +++ b/src/com/android/launcher3/model/LoaderCursor.java @@ -37,19 +37,19 @@ import android.util.LongSparseArray; import androidx.annotation.VisibleForTesting; -import com.android.launcher3.AppInfo; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.LauncherIcons; import com.android.launcher3.logging.FileLog; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.ContentWriter; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.IntArray; diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java index fc0997b198..4c02837fd1 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -16,11 +16,11 @@ package com.android.launcher3.model; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED; import static com.android.launcher3.config.FeatureFlags.MULTI_DB_GRID_MIRATION_ALGO; import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission; import static com.android.launcher3.util.PackageManagerHelper.isSystemApp; @@ -45,16 +45,11 @@ import android.util.LongSparseArray; import android.util.MutableInt; import android.util.TimingLogger; -import com.android.launcher3.AppInfo; -import com.android.launcher3.FolderInfo; import com.android.launcher3.InstallShortcutReceiver; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherSettings; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderGridOrganizer; @@ -67,6 +62,12 @@ import com.android.launcher3.icons.LauncherActivityCachingLogic; import com.android.launcher3.icons.ShortcutCachingLogic; import com.android.launcher3.icons.cache.IconCacheUpdateHandler; import com.android.launcher3.logging.FileLog; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PackageItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.InstallSessionHelper; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.pm.UserCache; @@ -534,7 +535,7 @@ public class LoaderTask implements Runnable { pinnedShortcut.getPackage(), info.user)) { info.runtimeStatusFlags |= FLAG_DISABLED_SUSPENDED; } - intent = info.intent; + intent = info.getIntent(); allDeepShortcuts.add(pinnedShortcut); } else { // Create a shortcut info in disabled mode for now. diff --git a/src/com/android/launcher3/model/ModelUtils.java b/src/com/android/launcher3/model/ModelUtils.java index 1473124fdf..ef7e828ff1 100644 --- a/src/com/android/launcher3/model/ModelUtils.java +++ b/src/com/android/launcher3/model/ModelUtils.java @@ -16,9 +16,9 @@ package com.android.launcher3.model; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherSettings; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.IntSet; import java.util.ArrayList; diff --git a/src/com/android/launcher3/model/ModelWriter.java b/src/com/android/launcher3/model/ModelWriter.java index 27fa580154..2c99df7a81 100644 --- a/src/com/android/launcher3/model/ModelWriter.java +++ b/src/com/android/launcher3/model/ModelWriter.java @@ -27,20 +27,20 @@ import android.os.Handler; import android.os.Looper; import android.util.Log; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetHost; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherProvider; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.LauncherSettings.Settings; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.FileLog; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.ContentWriter; import com.android.launcher3.util.ItemInfoMatcher; diff --git a/src/com/android/launcher3/model/PackageInstallStateChangedTask.java b/src/com/android/launcher3/model/PackageInstallStateChangedTask.java index 2832150d23..203f1ca8e3 100644 --- a/src/com/android/launcher3/model/PackageInstallStateChangedTask.java +++ b/src/com/android/launcher3/model/PackageInstallStateChangedTask.java @@ -19,13 +19,13 @@ import android.content.ComponentName; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherModel.CallbackTask; -import com.android.launcher3.PromiseAppInfo; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.BgDataModel.Callbacks; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PromiseAppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.util.InstantAppResolver; diff --git a/src/com/android/launcher3/model/PackageUpdatedTask.java b/src/com/android/launcher3/model/PackageUpdatedTask.java index 48c56e970e..0d975967c7 100644 --- a/src/com/android/launcher3/model/PackageUpdatedTask.java +++ b/src/com/android/launcher3/model/PackageUpdatedTask.java @@ -15,8 +15,8 @@ */ package com.android.launcher3.model; -import static com.android.launcher3.WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON; -import static com.android.launcher3.WorkspaceItemInfo.FLAG_RESTORED_ICON; +import static com.android.launcher3.model.data.WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON; +import static com.android.launcher3.model.data.WorkspaceItemInfo.FLAG_RESTORED_ICON; import android.content.ComponentName; import android.content.Context; @@ -29,18 +29,18 @@ import android.os.UserManager; import android.util.Log; import com.android.launcher3.InstallShortcutReceiver; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.SessionCommitReceiver; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.LauncherIcons; import com.android.launcher3.logging.FileLog; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutRequest; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.FlagOp; @@ -233,7 +233,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask { } else if (!isTargetValid) { removedShortcuts.put(si.id, true); FileLog.e(TAG, "Restored shortcut no longer valid " - + si.intent); + + si.getIntent()); continue; } else { si.status = WorkspaceItemInfo.DEFAULT; diff --git a/src/com/android/launcher3/model/ShortcutsChangedTask.java b/src/com/android/launcher3/model/ShortcutsChangedTask.java index 3f79ad020d..1cbe5c2f1b 100644 --- a/src/com/android/launcher3/model/ShortcutsChangedTask.java +++ b/src/com/android/launcher3/model/ShortcutsChangedTask.java @@ -19,10 +19,10 @@ import android.content.Context; import android.content.pm.ShortcutInfo; import android.os.UserHandle; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.shortcuts.ShortcutRequest; import com.android.launcher3.util.ItemInfoMatcher; diff --git a/src/com/android/launcher3/model/UserLockStateChangedTask.java b/src/com/android/launcher3/model/UserLockStateChangedTask.java index 03c0cfc866..7ec884f424 100644 --- a/src/com/android/launcher3/model/UserLockStateChangedTask.java +++ b/src/com/android/launcher3/model/UserLockStateChangedTask.java @@ -15,16 +15,16 @@ */ package com.android.launcher3.model; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; import android.content.Context; import android.content.pm.ShortcutInfo; import android.os.UserHandle; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.shortcuts.ShortcutRequest; import com.android.launcher3.shortcuts.ShortcutRequest.QueryResult; diff --git a/src/com/android/launcher3/AppInfo.java b/src/com/android/launcher3/model/data/AppInfo.java similarity index 94% rename from src/com/android/launcher3/AppInfo.java rename to src/com/android/launcher3/model/data/AppInfo.java index f76ca502e8..ae79f0d95a 100644 --- a/src/com/android/launcher3/AppInfo.java +++ b/src/com/android/launcher3/model/data/AppInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.model.data; import android.content.ComponentName; import android.content.Context; @@ -28,6 +28,8 @@ import android.os.UserManager; import androidx.annotation.VisibleForTesting; +import com.android.launcher3.LauncherSettings; +import com.android.launcher3.Utilities; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageManagerHelper; @@ -121,7 +123,8 @@ public class AppInfo extends ItemInfoWithIcon { return new Intent(Intent.ACTION_MAIN) .addCategory(Intent.CATEGORY_LAUNCHER) .setComponent(cn) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); } public static void updateRuntimeFlagsForActivityTarget( diff --git a/src/com/android/launcher3/FolderInfo.java b/src/com/android/launcher3/model/data/FolderInfo.java similarity index 97% rename from src/com/android/launcher3/FolderInfo.java rename to src/com/android/launcher3/model/data/FolderInfo.java index b75a5e7987..cfe34c1fc0 100644 --- a/src/com/android/launcher3/FolderInfo.java +++ b/src/com/android/launcher3/model/data/FolderInfo.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.model.data; import android.content.Intent; import android.os.Process; +import com.android.launcher3.LauncherSettings; +import com.android.launcher3.Utilities; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.util.ContentWriter; diff --git a/src/com/android/launcher3/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java similarity index 92% rename from src/com/android/launcher3/ItemInfo.java rename to src/com/android/launcher3/model/data/ItemInfo.java index 8c4e4a0946..bd843e77c9 100644 --- a/src/com/android/launcher3/ItemInfo.java +++ b/src/com/android/launcher3/model/data/ItemInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.model.data; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; @@ -31,11 +31,12 @@ import android.os.UserHandle; import androidx.annotation.Nullable; +import com.android.launcher3.LauncherSettings; +import com.android.launcher3.LauncherSettings.Favorites; +import com.android.launcher3.Workspace; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.util.ContentWriter; - - /** * Represents an item in the launcher. */ @@ -50,18 +51,18 @@ public class ItemInfo { public int id = NO_ID; /** - * One of {@link LauncherSettings.Favorites#ITEM_TYPE_APPLICATION}, - * {@link LauncherSettings.Favorites#ITEM_TYPE_SHORTCUT}, - * {@link LauncherSettings.Favorites#ITEM_TYPE_DEEP_SHORTCUT} - * {@link LauncherSettings.Favorites#ITEM_TYPE_FOLDER}, - * {@link LauncherSettings.Favorites#ITEM_TYPE_APPWIDGET} or - * {@link LauncherSettings.Favorites#ITEM_TYPE_CUSTOM_APPWIDGET}. + * One of {@link Favorites#ITEM_TYPE_APPLICATION}, + * {@link Favorites#ITEM_TYPE_SHORTCUT}, + * {@link Favorites#ITEM_TYPE_DEEP_SHORTCUT} + * {@link Favorites#ITEM_TYPE_FOLDER}, + * {@link Favorites#ITEM_TYPE_APPWIDGET} or + * {@link Favorites#ITEM_TYPE_CUSTOM_APPWIDGET}. */ public int itemType; /** * The id of the container that holds this item. For the desktop, this will be - * {@link LauncherSettings.Favorites#CONTAINER_DESKTOP}. For the all applications folder it + * {@link Favorites#CONTAINER_DESKTOP}. For the all applications folder it * will be {@link #NO_ID} (since it is not stored in the settings DB). For user folders * it will be the id of the folder. */ @@ -69,8 +70,8 @@ public class ItemInfo { /** * Indicates the screen in which the shortcut appears if the container types is - * {@link LauncherSettings.Favorites#CONTAINER_DESKTOP}. (i.e., ignore if the container type is - * {@link LauncherSettings.Favorites#CONTAINER_HOTSEAT}) + * {@link Favorites#CONTAINER_DESKTOP}. (i.e., ignore if the container type is + * {@link Favorites#CONTAINER_HOTSEAT}) */ public int screenId = -1; @@ -125,7 +126,7 @@ public class ItemInfo { user = Process.myUserHandle(); } - ItemInfo(ItemInfo info) { + protected ItemInfo(ItemInfo info) { copyFrom(info); } @@ -200,7 +201,7 @@ public class ItemInfo { protected String dumpProperties() { return "id=" + id + " type=" + LauncherSettings.Favorites.itemTypeToString(itemType) - + " container=" + LauncherSettings.Favorites.containerToString((int)container) + + " container=" + LauncherSettings.Favorites.containerToString(container) + " targetComponent=" + getTargetComponent() + " screen=" + screenId + " cell(" + cellX + "," + cellY + ")" diff --git a/src/com/android/launcher3/ItemInfoWithIcon.java b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java similarity index 94% rename from src/com/android/launcher3/ItemInfoWithIcon.java rename to src/com/android/launcher3/model/data/ItemInfoWithIcon.java index 19414550f8..d95f94f79f 100644 --- a/src/com/android/launcher3/ItemInfoWithIcon.java +++ b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.model.data; import com.android.launcher3.icons.BitmapInfo; @@ -60,9 +60,9 @@ public abstract class ItemInfoWithIcon extends ItemInfo { */ public static final int FLAG_DISABLED_LOCKED_USER = 1 << 5; - public static final int FLAG_DISABLED_MASK = FLAG_DISABLED_SAFEMODE | - FLAG_DISABLED_NOT_AVAILABLE | FLAG_DISABLED_SUSPENDED | - FLAG_DISABLED_QUIET_USER | FLAG_DISABLED_BY_PUBLISHER | FLAG_DISABLED_LOCKED_USER; + public static final int FLAG_DISABLED_MASK = FLAG_DISABLED_SAFEMODE + | FLAG_DISABLED_NOT_AVAILABLE | FLAG_DISABLED_SUSPENDED + | FLAG_DISABLED_QUIET_USER | FLAG_DISABLED_BY_PUBLISHER | FLAG_DISABLED_LOCKED_USER; /** * The item points to a system app. diff --git a/src/com/android/launcher3/LauncherAppWidgetInfo.java b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java similarity index 93% rename from src/com/android/launcher3/LauncherAppWidgetInfo.java rename to src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java index 3a478dd8e0..adb97dc072 100644 --- a/src/com/android/launcher3/LauncherAppWidgetInfo.java +++ b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java @@ -14,15 +14,17 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.model.data; import android.appwidget.AppWidgetHostView; import android.content.ComponentName; import android.content.Intent; import android.os.Process; +import com.android.launcher3.AppWidgetResizeFrame; +import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherSettings; import com.android.launcher3.logger.LauncherAtom; -import com.android.launcher3.model.PackageItemInfo; import com.android.launcher3.util.ContentWriter; /** @@ -154,7 +156,7 @@ public class LauncherAppWidgetInfo extends ItemInfo { * When we bind the widget, we should notify the widget that the size has changed if we have not * done so already (only really for default workspace widgets). */ - void onBindAppWidget(Launcher launcher, AppWidgetHostView hostView) { + public void onBindAppWidget(Launcher launcher, AppWidgetHostView hostView) { if (!mHasNotifiedInitialWidgetSizeChanged) { AppWidgetResizeFrame.updateWidgetSizeRanges(hostView, launcher, spanX, spanY); mHasNotifiedInitialWidgetSizeChanged = true; @@ -169,8 +171,8 @@ public class LauncherAppWidgetInfo extends ItemInfo { } public final boolean isWidgetIdAllocated() { - return (restoreStatus & FLAG_ID_NOT_VALID) == 0 || - (restoreStatus & FLAG_ID_ALLOCATED) == FLAG_ID_ALLOCATED; + return (restoreStatus & FLAG_ID_NOT_VALID) == 0 + || (restoreStatus & FLAG_ID_ALLOCATED) == FLAG_ID_ALLOCATED; } public final boolean hasRestoreFlag(int flag) { diff --git a/src/com/android/launcher3/model/PackageItemInfo.java b/src/com/android/launcher3/model/data/PackageItemInfo.java similarity index 95% rename from src/com/android/launcher3/model/PackageItemInfo.java rename to src/com/android/launcher3/model/data/PackageItemInfo.java index 2fc064c422..b70d0d4fe6 100644 --- a/src/com/android/launcher3/model/PackageItemInfo.java +++ b/src/com/android/launcher3/model/data/PackageItemInfo.java @@ -14,9 +14,8 @@ * limitations under the License. */ -package com.android.launcher3.model; +package com.android.launcher3.model.data; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.LauncherSettings; import java.util.Objects; diff --git a/src/com/android/launcher3/PromiseAppInfo.java b/src/com/android/launcher3/model/data/PromiseAppInfo.java similarity index 97% rename from src/com/android/launcher3/PromiseAppInfo.java rename to src/com/android/launcher3/model/data/PromiseAppInfo.java index e55e4bd651..b6231ede19 100644 --- a/src/com/android/launcher3/PromiseAppInfo.java +++ b/src/com/android/launcher3/model/data/PromiseAppInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.model.data; import android.content.Context; import android.content.Intent; diff --git a/src/com/android/launcher3/WorkspaceItemInfo.java b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java similarity index 94% rename from src/com/android/launcher3/WorkspaceItemInfo.java rename to src/com/android/launcher3/model/data/WorkspaceItemInfo.java index be907e5aa8..a7bf1f38af 100644 --- a/src/com/android/launcher3/WorkspaceItemInfo.java +++ b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3; +package com.android.launcher3.model.data; import android.app.Person; import android.content.ComponentName; @@ -25,7 +25,9 @@ import android.text.TextUtils; import androidx.annotation.NonNull; +import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; +import com.android.launcher3.Utilities; import com.android.launcher3.icons.IconCache; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.uioverrides.ApiWrapper; @@ -120,7 +122,7 @@ public class WorkspaceItemInfo extends ItemInfoWithIcon { public WorkspaceItemInfo(AppInfo info) { super(info); title = Utilities.trim(info.title); - intent = new Intent(info.intent); + intent = new Intent(info.getIntent()); } /** @@ -199,8 +201,8 @@ public class WorkspaceItemInfo extends ItemInfoWithIcon { /** Returns the WorkspaceItemInfo id associated with the deep shortcut. */ public String getDeepShortcutId() { - return itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT ? - getIntent().getStringExtra(ShortcutKey.EXTRA_SHORTCUT_ID) : null; + return itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT + ? getIntent().getStringExtra(ShortcutKey.EXTRA_SHORTCUT_ID) : null; } @NonNull @@ -211,8 +213,8 @@ public class WorkspaceItemInfo extends ItemInfoWithIcon { @Override public ComponentName getTargetComponent() { ComponentName cn = super.getTargetComponent(); - if (cn == null && (itemType == Favorites.ITEM_TYPE_SHORTCUT - || hasStatusFlag(FLAG_SUPPORTS_WEB_UI|FLAG_AUTOINSTALL_ICON|FLAG_RESTORED_ICON))) { + if (cn == null && (itemType == Favorites.ITEM_TYPE_SHORTCUT || hasStatusFlag( + FLAG_SUPPORTS_WEB_UI | FLAG_AUTOINSTALL_ICON | FLAG_RESTORED_ICON))) { // Legacy shortcuts and promise icons with web UI may not have a componentName but just // a packageName. In that case create a dummy componentName instead of adding additional // check everywhere. diff --git a/src/com/android/launcher3/notification/NotificationMainView.java b/src/com/android/launcher3/notification/NotificationMainView.java index b193ffd8cb..b03aa9c3fe 100644 --- a/src/com/android/launcher3/notification/NotificationMainView.java +++ b/src/com/android/launcher3/notification/NotificationMainView.java @@ -34,10 +34,10 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.TextView; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.anim.AnimationSuccessListener; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.touch.BaseSwipeDetector; import com.android.launcher3.touch.OverScroll; import com.android.launcher3.touch.SingleAxisSwipeDetector; diff --git a/src/com/android/launcher3/pm/PinRequestHelper.java b/src/com/android/launcher3/pm/PinRequestHelper.java index 74a5a31b60..179061f45d 100644 --- a/src/com/android/launcher3/pm/PinRequestHelper.java +++ b/src/com/android/launcher3/pm/PinRequestHelper.java @@ -30,8 +30,8 @@ import android.os.Parcelable; import androidx.annotation.Nullable; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.icons.ShortcutCachingLogic; +import com.android.launcher3.model.data.WorkspaceItemInfo; public class PinRequestHelper { diff --git a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java index ac0e0652c8..40d7031ac0 100644 --- a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java +++ b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java @@ -40,9 +40,9 @@ import androidx.annotation.Nullable; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.icons.ComponentWithLabelAndIcon; import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.PackageUserKey; import java.util.ArrayList; diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index 406e1b2180..36c8ee2337 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -49,8 +49,6 @@ import com.android.launcher3.BubbleTextView; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget; import com.android.launcher3.DropTarget.DragObject; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; @@ -60,6 +58,8 @@ import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.dragndrop.DragView; import com.android.launcher3.dragndrop.DraggableView; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.notification.NotificationInfo; import com.android.launcher3.notification.NotificationItemView; import com.android.launcher3.notification.NotificationKeyData; diff --git a/src/com/android/launcher3/popup/PopupDataProvider.java b/src/com/android/launcher3/popup/PopupDataProvider.java index 1092c7b0cb..a6b9356c95 100644 --- a/src/com/android/launcher3/popup/PopupDataProvider.java +++ b/src/com/android/launcher3/popup/PopupDataProvider.java @@ -23,9 +23,9 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.launcher3.ItemInfo; import com.android.launcher3.dot.DotInfo; import com.android.launcher3.model.WidgetItem; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.notification.NotificationKeyData; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.util.ComponentKey; diff --git a/src/com/android/launcher3/popup/PopupPopulator.java b/src/com/android/launcher3/popup/PopupPopulator.java index fdcf04ff71..7da86cc0af 100644 --- a/src/com/android/launcher3/popup/PopupPopulator.java +++ b/src/com/android/launcher3/popup/PopupPopulator.java @@ -25,10 +25,10 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.BaseDraggingActivity; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationInfo; import com.android.launcher3.notification.NotificationKeyData; import com.android.launcher3.notification.NotificationListener; diff --git a/src/com/android/launcher3/popup/RemoteActionShortcut.java b/src/com/android/launcher3/popup/RemoteActionShortcut.java index 8751202538..3875d2e143 100644 --- a/src/com/android/launcher3/popup/RemoteActionShortcut.java +++ b/src/com/android/launcher3/popup/RemoteActionShortcut.java @@ -33,9 +33,9 @@ import android.widget.Toast; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; -import com.android.launcher3.ItemInfo; import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto; @TargetApi(Build.VERSION_CODES.Q) diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index 21c5ac5cc2..ae35d4c594 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -14,11 +14,11 @@ import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.WidgetItem; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; import com.android.launcher3.util.InstantAppResolver; @@ -145,8 +145,9 @@ public abstract class SystemShortcut extends Ite && ((WorkspaceItemInfo) itemInfo).hasStatusFlag( WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI); boolean isInstantApp = false; - if (itemInfo instanceof com.android.launcher3.AppInfo) { - com.android.launcher3.AppInfo appInfo = (com.android.launcher3.AppInfo) itemInfo; + if (itemInfo instanceof com.android.launcher3.model.data.AppInfo) { + com.android.launcher3.model.data.AppInfo + appInfo = (com.android.launcher3.model.data.AppInfo) itemInfo; isInstantApp = InstantAppResolver.newInstance(activity).isInstantApp(appInfo); } boolean enabled = supportsWebUI || isInstantApp; diff --git a/src/com/android/launcher3/provider/ImportDataTask.java b/src/com/android/launcher3/provider/ImportDataTask.java index 732fb0bb77..a5462a6c34 100644 --- a/src/com/android/launcher3/provider/ImportDataTask.java +++ b/src/com/android/launcher3/provider/ImportDataTask.java @@ -37,7 +37,6 @@ import android.util.SparseBooleanArray; import com.android.launcher3.AutoInstallsLayout.LayoutParserCallback; import com.android.launcher3.DefaultLayoutParser; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherProvider; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; @@ -46,6 +45,7 @@ import com.android.launcher3.Workspace; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.FileLog; import com.android.launcher3.model.GridSizeMigrationTask; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.IntSparseArrayMap; diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java index 0fe3673ab0..33eff5716f 100644 --- a/src/com/android/launcher3/provider/RestoreDbTask.java +++ b/src/com/android/launcher3/provider/RestoreDbTask.java @@ -35,13 +35,13 @@ import androidx.annotation.NonNull; import com.android.launcher3.AppWidgetsRestoredReceiver; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherProvider.DatabaseHelper; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.logging.FileLog; import com.android.launcher3.model.GridBackupTable; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.LogConfig; diff --git a/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java b/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java index 54b7fb952f..e9058c343d 100644 --- a/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java +++ b/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java @@ -30,12 +30,12 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import com.android.launcher3.AbstractFloatingView; -import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; -import com.android.launcher3.ItemInfo; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AppInfoComparator; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.util.ComponentKey; diff --git a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java index 1cc01f48e3..f1f271f9fd 100644 --- a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java +++ b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java @@ -28,18 +28,18 @@ import android.view.ViewAnimationUtils; import android.view.inputmethod.InputMethodManager; import com.android.launcher3.AbstractFloatingView; -import com.android.launcher3.AppInfo; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherModel; -import com.android.launcher3.PromiseAppInfo; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.model.BgDataModel; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PromiseAppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.PopupDataProvider; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.IntArray; diff --git a/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java b/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java index 936d377fde..e35e884c77 100644 --- a/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java +++ b/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java @@ -30,9 +30,9 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsContainerView; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.PopupContainerWithArrow; import com.android.launcher3.util.ShortcutUtil; import com.android.launcher3.util.TouchController; diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutView.java b/src/com/android/launcher3/shortcuts/DeepShortcutView.java index 9cc7d8f8bd..e9b92e2f10 100644 --- a/src/com/android/launcher3/shortcuts/DeepShortcutView.java +++ b/src/com/android/launcher3/shortcuts/DeepShortcutView.java @@ -28,7 +28,7 @@ import com.android.launcher3.BubbleTextView; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.PopupContainerWithArrow; /** diff --git a/src/com/android/launcher3/shortcuts/ShortcutKey.java b/src/com/android/launcher3/shortcuts/ShortcutKey.java index fa1a85f98c..3ca9490cc5 100644 --- a/src/com/android/launcher3/shortcuts/ShortcutKey.java +++ b/src/com/android/launcher3/shortcuts/ShortcutKey.java @@ -6,7 +6,7 @@ import android.content.Intent; import android.content.pm.ShortcutInfo; import android.os.UserHandle; -import com.android.launcher3.ItemInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.ComponentKey; /** diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java index f7ce1609be..f7091fc3ad 100644 --- a/src/com/android/launcher3/touch/ItemClickHandler.java +++ b/src/com/android/launcher3/touch/ItemClickHandler.java @@ -15,14 +15,14 @@ */ package com.android.launcher3.touch; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_BY_PUBLISHER; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_QUIET_USER; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE; -import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED; import static com.android.launcher3.Launcher.REQUEST_BIND_PENDING_APPWIDGET; import static com.android.launcher3.Launcher.REQUEST_RECONFIGURE_APPWIDGET; import static com.android.launcher3.model.AppLaunchTracker.CONTAINER_ALL_APPS; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_BY_PUBLISHER; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_QUIET_USER; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED; import android.app.AlertDialog; import android.content.Intent; @@ -38,19 +38,19 @@ import android.widget.Toast; import androidx.annotation.Nullable; -import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; -import com.android.launcher3.PromiseAppInfo; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PromiseAppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.InstallSessionHelper; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.views.FloatingIconView; @@ -224,8 +224,9 @@ public class ItemClickHandler { // Check for abandoned promise if ((v instanceof BubbleTextView) && shortcut.hasPromiseIconUi()) { - String packageName = shortcut.intent.getComponent() != null ? - shortcut.intent.getComponent().getPackageName() : shortcut.intent.getPackage(); + String packageName = shortcut.getIntent().getComponent() != null + ? shortcut.getIntent().getComponent().getPackageName() + : shortcut.getIntent().getPackage(); if (!TextUtils.isEmpty(packageName)) { onClickPendingAppItem(v, launcher, packageName, shortcut.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE)); diff --git a/src/com/android/launcher3/touch/ItemLongClickListener.java b/src/com/android/launcher3/touch/ItemLongClickListener.java index 8537bdfab8..7baeab806b 100644 --- a/src/com/android/launcher3/touch/ItemLongClickListener.java +++ b/src/com/android/launcher3/touch/ItemLongClickListener.java @@ -28,11 +28,11 @@ import android.view.View.OnLongClickListener; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DropTarget; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.folder.Folder; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; diff --git a/src/com/android/launcher3/util/GridOccupancy.java b/src/com/android/launcher3/util/GridOccupancy.java index 6a10b0aa5f..9c752a7043 100644 --- a/src/com/android/launcher3/util/GridOccupancy.java +++ b/src/com/android/launcher3/util/GridOccupancy.java @@ -2,7 +2,7 @@ package com.android.launcher3.util; import android.graphics.Rect; -import com.android.launcher3.ItemInfo; +import com.android.launcher3.model.data.ItemInfo; /** * Utility object to manage the occupancy in a grid. diff --git a/src/com/android/launcher3/util/InstantAppResolver.java b/src/com/android/launcher3/util/InstantAppResolver.java index 031a40dc0b..6f706d2be1 100644 --- a/src/com/android/launcher3/util/InstantAppResolver.java +++ b/src/com/android/launcher3/util/InstantAppResolver.java @@ -21,8 +21,8 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.util.Log; -import com.android.launcher3.AppInfo; import com.android.launcher3.R; +import com.android.launcher3.model.data.AppInfo; /** * A wrapper class to access instant app related APIs. diff --git a/src/com/android/launcher3/util/ItemInfoMatcher.java b/src/com/android/launcher3/util/ItemInfoMatcher.java index 59a5ed6074..4d5405d102 100644 --- a/src/com/android/launcher3/util/ItemInfoMatcher.java +++ b/src/com/android/launcher3/util/ItemInfoMatcher.java @@ -19,11 +19,11 @@ package com.android.launcher3.util; import android.content.ComponentName; import android.os.UserHandle; -import com.android.launcher3.FolderInfo; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherSettings.Favorites; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.FolderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import java.util.HashSet; diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java index 6c187475d3..ddde6d3a88 100644 --- a/src/com/android/launcher3/util/PackageManagerHelper.java +++ b/src/com/android/launcher3/util/PackageManagerHelper.java @@ -47,14 +47,14 @@ import android.widget.Toast; import androidx.annotation.NonNull; -import com.android.launcher3.AppInfo; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.PendingAddItemInfo; -import com.android.launcher3.PromiseAppInfo; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PromiseAppInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import java.net.URISyntaxException; import java.util.List; diff --git a/src/com/android/launcher3/util/PackageUserKey.java b/src/com/android/launcher3/util/PackageUserKey.java index f243ca6283..46e7070ed5 100644 --- a/src/com/android/launcher3/util/PackageUserKey.java +++ b/src/com/android/launcher3/util/PackageUserKey.java @@ -5,7 +5,7 @@ import android.service.notification.StatusBarNotification; import androidx.annotation.Nullable; -import com.android.launcher3.ItemInfo; +import com.android.launcher3.model.data.ItemInfo; import java.util.Arrays; diff --git a/src/com/android/launcher3/util/PendingRequestArgs.java b/src/com/android/launcher3/util/PendingRequestArgs.java index b8bcfeda85..9b8c6a61e9 100644 --- a/src/com/android/launcher3/util/PendingRequestArgs.java +++ b/src/com/android/launcher3/util/PendingRequestArgs.java @@ -20,7 +20,7 @@ import android.content.Intent; import android.os.Parcel; import android.os.Parcelable; -import com.android.launcher3.ItemInfo; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.widget.WidgetAddFlowHandler; /** diff --git a/src/com/android/launcher3/util/ShortcutUtil.java b/src/com/android/launcher3/util/ShortcutUtil.java index 49c97daf35..1ec0690401 100644 --- a/src/com/android/launcher3/util/ShortcutUtil.java +++ b/src/com/android/launcher3/util/ShortcutUtil.java @@ -15,11 +15,11 @@ */ package com.android.launcher3.util; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherSettings; import com.android.launcher3.Utilities; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.model.WidgetsModel; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; public class ShortcutUtil { diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java index c9cdeffb9b..ae459e1847 100644 --- a/src/com/android/launcher3/views/ActivityContext.java +++ b/src/com/android/launcher3/views/ActivityContext.java @@ -21,8 +21,8 @@ import android.view.ContextThemeWrapper; import android.view.View.AccessibilityDelegate; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.ItemInfo; import com.android.launcher3.dot.DotInfo; +import com.android.launcher3.model.data.ItemInfo; /** * An interface to be used along with a context for various activities in Launcher. This allows a diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index ad8d69dfa7..e114cf8499 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -50,7 +50,6 @@ import androidx.annotation.WorkerThread; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InsettableFrameLayout; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.Utilities; @@ -58,6 +57,7 @@ import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.FolderAdaptiveIcon; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.icons.LauncherIcons; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.shortcuts.DeepShortcutView; diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java index 23c2160848..3e5113a231 100644 --- a/src/com/android/launcher3/widget/BaseWidgetSheet.java +++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java @@ -28,10 +28,10 @@ import android.widget.Toast; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget.DragObject; -import com.android.launcher3.ItemInfo; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.dragndrop.DragOptions; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.PopupDataProvider; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java index 6232a1d871..5d33f13de1 100644 --- a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java @@ -35,14 +35,14 @@ import android.widget.Advanceable; import android.widget.RemoteViews; import com.android.launcher3.CheckLongPressHelper; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DraggableView; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.util.Executors; import com.android.launcher3.util.Themes; import com.android.launcher3.views.BaseDragLayer.TouchCompleteListener; diff --git a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java index 895f8de5a9..9021d9eb21 100644 --- a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java +++ b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java @@ -37,12 +37,12 @@ import android.widget.RemoteViews; import com.android.launcher3.DeviceProfile; import com.android.launcher3.FastBitmapDrawable; -import com.android.launcher3.ItemInfoWithIcon; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.R; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver; -import com.android.launcher3.model.PackageItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.PackageItemInfo; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.util.Themes; diff --git a/src/com/android/launcher3/widget/WidgetAddFlowHandler.java b/src/com/android/launcher3/widget/WidgetAddFlowHandler.java index 5387be8392..ebc2a25753 100644 --- a/src/com/android/launcher3/widget/WidgetAddFlowHandler.java +++ b/src/com/android/launcher3/widget/WidgetAddFlowHandler.java @@ -20,10 +20,10 @@ import android.content.Context; import android.os.Parcel; import android.os.Parcelable; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.util.PendingRequestArgs; /** diff --git a/src/com/android/launcher3/widget/WidgetListRowEntry.java b/src/com/android/launcher3/widget/WidgetListRowEntry.java index 335b8c7592..17e4673c44 100644 --- a/src/com/android/launcher3/widget/WidgetListRowEntry.java +++ b/src/com/android/launcher3/widget/WidgetListRowEntry.java @@ -15,9 +15,9 @@ */ package com.android.launcher3.widget; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.model.PackageItemInfo; import com.android.launcher3.model.WidgetItem; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.PackageItemInfo; import java.util.ArrayList; diff --git a/src/com/android/launcher3/widget/WidgetManagerHelper.java b/src/com/android/launcher3/widget/WidgetManagerHelper.java index f3c7822d0b..4b6c569d6c 100644 --- a/src/com/android/launcher3/widget/WidgetManagerHelper.java +++ b/src/com/android/launcher3/widget/WidgetManagerHelper.java @@ -28,10 +28,10 @@ import android.os.UserHandle; import androidx.annotation.Nullable; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.Utilities; import com.android.launcher3.model.WidgetsModel; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageUserKey; diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java index 8d1a3b01d5..30be7a673d 100644 --- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java +++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java @@ -32,12 +32,12 @@ import android.view.animation.Interpolator; import android.widget.TextView; import com.android.launcher3.Insettable; -import com.android.launcher3.ItemInfo; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.ResourceUtils; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.model.WidgetItem; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.PackageUserKey; import java.util.List; diff --git a/src/com/android/launcher3/widget/WidgetsDiffReporter.java b/src/com/android/launcher3/widget/WidgetsDiffReporter.java index f3b325db58..df6e2c3023 100644 --- a/src/com/android/launcher3/widget/WidgetsDiffReporter.java +++ b/src/com/android/launcher3/widget/WidgetsDiffReporter.java @@ -21,7 +21,7 @@ import android.util.Log; import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.icons.IconCache; -import com.android.launcher3.model.PackageItemInfo; +import com.android.launcher3.model.data.PackageItemInfo; import com.android.launcher3.widget.WidgetsListAdapter.WidgetListRowEntryComparator; import java.util.ArrayList; diff --git a/src/com/android/launcher3/widget/custom/CustomWidgetManager.java b/src/com/android/launcher3/widget/custom/CustomWidgetManager.java index 0ea7d854ee..0b66ec01b6 100644 --- a/src/com/android/launcher3/widget/custom/CustomWidgetManager.java +++ b/src/com/android/launcher3/widget/custom/CustomWidgetManager.java @@ -29,8 +29,8 @@ import android.util.SparseArray; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.PackageUserKey; diff --git a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java index 0b99e7a898..9d877881ec 100644 --- a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java +++ b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java @@ -24,6 +24,7 @@ import com.android.launcher3.compat.AlphabeticIndexCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.icons.ComponentWithLabelAndIcon; import com.android.launcher3.icons.IconCache; +import com.android.launcher3.model.data.PackageItemInfo; import com.android.launcher3.pm.ShortcutConfigActivityInfo; import com.android.launcher3.util.MultiHashMap; import com.android.launcher3.util.PackageUserKey; diff --git a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java index 293b04a587..bdf01f3cf9 100644 --- a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java +++ b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java @@ -20,14 +20,14 @@ import static org.junit.Assert.assertTrue; import android.content.ComponentName; -import com.android.launcher3.AppInfo; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; + +import com.android.launcher3.model.data.AppInfo; import org.junit.Test; import org.junit.runner.RunWith; -import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; - /** * Unit tests for {@link DefaultAppSearchAlgorithm} */ diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 873f1cbe6d..a7089fef15 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -47,7 +47,6 @@ import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.Until; -import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; @@ -55,6 +54,7 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager; import com.android.launcher3.Utilities; import com.android.launcher3.model.AppLaunchTracker; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType; import com.android.launcher3.tapl.TestHelpers; diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java index d93915c33b..0a6579a37c 100644 --- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java +++ b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java @@ -28,10 +28,10 @@ import android.view.View; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.Workspace; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.tapl.Widgets; import com.android.launcher3.testcomponent.WidgetConfigActivity; import com.android.launcher3.ui.AbstractLauncherUiTest; diff --git a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java index 788e0410b8..5e26aa62e6 100644 --- a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java +++ b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java @@ -23,8 +23,8 @@ import static org.junit.Assert.assertTrue; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.tapl.Widget; import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.TestViewHelpers; diff --git a/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java index 001a88fdf6..62ce085e8d 100644 --- a/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java +++ b/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java @@ -40,10 +40,10 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import com.android.launcher3.LauncherAppWidgetHost; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.pm.InstallSessionHelper; import com.android.launcher3.tapl.Widget; import com.android.launcher3.tapl.Workspace; diff --git a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java index 0246f95003..0e43d81475 100644 --- a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java +++ b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java @@ -29,12 +29,12 @@ import android.view.View; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace.ItemOperator; -import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.LauncherAppWidgetInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.tapl.AddToHomeScreenPrompt; import com.android.launcher3.testcomponent.AppWidgetNoConfig; From 94ea8fa77e13b11c34aaabed8ad0ecea98495eca Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 9 Apr 2020 13:42:11 -0700 Subject: [PATCH 23/55] Log InputConsumer name instead of type Also slightly optimize getName() by using StringBuilder Change-Id: I7037ba0204378a716bc292d5ced710e0ac37bb78 --- .../com/android/quickstep/TouchInteractionService.java | 3 +-- quickstep/src/com/android/quickstep/InputConsumer.java | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 270714b2d0..79796010fd 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -26,7 +26,6 @@ import static com.android.quickstep.GestureState.DEFAULT_STATE; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INPUT_MONITOR; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED; -import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_ASSISTANT; import android.annotation.TargetApi; import android.app.ActivityManager; @@ -486,7 +485,7 @@ public class TouchInteractionService extends Service implements PluginListener 0) { - name += ":"; + name.append(":"); } - name += NAMES[i]; + name.append(NAMES[i]); } } - return name; + return name.toString(); } } From a24c341b521c070ca082913f10db3bf35b00deb0 Mon Sep 17 00:00:00 2001 From: Becky Qiu Date: Thu, 9 Apr 2020 14:10:03 -0700 Subject: [PATCH 24/55] [Overview Actions] Update the actions container UI. Make the overview actions container not limited by the taskview any more, and add left and right margin as 16dp to it. Screenshot: https://hsv.googleplex.com/5938979251683328 Test: local Bug: 153591867 Change-Id: I8056105fe4c03311e473bb317cba345048ec2203 --- .../src/com/android/quickstep/views/RecentsView.java | 8 +++++--- quickstep/res/values/dimens.xml | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 3e88ecb560..b46d6f6491 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -2139,13 +2139,15 @@ public abstract class RecentsView extends PagedView impl && SysUINavigationMode.removeShelfFromOverview(mActivity)) { mActionsView = ((ViewGroup) getParent()).findViewById(R.id.overview_actions_view); if (mActionsView != null) { - Rect rect = new Rect(); - getTaskSize(rect); InsettableFrameLayout.LayoutParams layoutParams = - new InsettableFrameLayout.LayoutParams(rect.width(), + new InsettableFrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize( R.dimen.overview_actions_height)); layoutParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; + int margin = getResources().getDimensionPixelSize( + R.dimen.overview_actions_horizontal_margin); + layoutParams.setMarginStart(margin); + layoutParams.setMarginEnd(margin); mActionsView.setLayoutParams(layoutParams); showActionsView(); } diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 6d8d54f389..9a61165c40 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -25,6 +25,7 @@ 110dp + 16dp 10dp 70dp From e206b031a65bed4542f886c3f2818cc1eafd39f7 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 9 Apr 2020 16:41:01 -0700 Subject: [PATCH 25/55] Removing tracing for fixed bug Bug: 152658211 Change-Id: Idc1643a879fca47a50bd58090bbb72a284fd8d59 --- .../com/android/quickstep/BaseSwipeUpHandler.java | 15 --------------- .../android/quickstep/LauncherSwipeHandler.java | 6 ------ .../quickstep/RecentsAnimationCallbacks.java | 3 --- .../android/quickstep/TaskAnimationManager.java | 3 --- .../android/launcher3/testing/TestProtocol.java | 1 - 5 files changed, 28 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 85741eda86..70b139d0ad 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -197,33 +197,18 @@ public abstract class BaseSwipeUpHandler resultCallback) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "startNewTask1"); - } // Launch the task user scrolled to (mRecentsView.getNextPage()). if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { // We finish recents animation inside launchTask() when live tile is enabled. mRecentsView.getNextPageTaskView().launchTask(false /* animate */, true /* freezeTaskList */); } else { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "startNewTask2"); - } int taskId = mRecentsView.getNextPageTaskView().getTask().key.id; mFinishingRecentsAnimationForNewTaskId = taskId; mRecentsAnimationController.finish(true /* toRecents */, () -> { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "onFinishComplete1"); - } if (!mCanceled) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "onFinishComplete2"); - } TaskView nextTask = mRecentsView.getTaskView(taskId); if (nextTask != null) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "onFinishComplete3"); - } nextTask.launchTask(false /* animate */, true /* freezeTaskList */, success -> { resultCallback.accept(success); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java index 1bd03330fe..8574cf1952 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java @@ -965,9 +965,6 @@ public class LauncherSwipeHandler windowAnim.addListener(new AnimationSuccessListener() { @Override public void onAnimationSuccess(Animator animator) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "onAnimationSuccess"); - } if (mRecentsAnimationController == null) { // If the recents animation is interrupted, we still end the running // animation (not canceled) so this is still called. In that case, we can @@ -1191,9 +1188,6 @@ public class LauncherSwipeHandler } private void switchToScreenshot() { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "switchToScreenshot"); - } final int runningTaskId = mGestureState.getRunningTaskId(); if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { if (mRecentsAnimationController != null) { diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java index 783978d6a8..d1dbcfb12b 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java @@ -91,9 +91,6 @@ public class RecentsAnimationCallbacks implements RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, Rect homeContentInsets, Rect minimizedHomeBounds) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "onAnimationStart"); - } RecentsAnimationTargets targets = new RecentsAnimationTargets(appTargets, wallpaperTargets, homeContentInsets, minimizedHomeBounds); mController = new RecentsAnimationController(animationController, diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index b04a1ae8d1..bbca568472 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -53,9 +53,6 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn @UiThread public RecentsAnimationCallbacks startRecentsAnimation(GestureState gestureState, Intent intent, RecentsAnimationCallbacks.RecentsAnimationListener listener) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_START_FROM_RECENTS, "startRecentsAnimation"); - } // Notify if recents animation is still running if (mController != null) { String msg = "New recents animation started before old animation completed"; diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 3181752883..015de59db1 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -100,5 +100,4 @@ public final class TestProtocol { public static final String NO_BACKGROUND_TO_OVERVIEW_TAG = "b/138251824"; public static final String APP_NOT_DISABLED = "b/139891609"; public static final String NO_SCROLL_END_WIDGETS = "b/152354290"; - public static final String NO_START_FROM_RECENTS = "b/152658211"; } From c101e1c5de030be880b7566e7bb4aba195c6fb57 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 9 Apr 2020 17:37:19 -0700 Subject: [PATCH 26/55] Fix curve properties not applying when dismissing task - ag/10936255 replaced getViewCenterPosition() with getChildStart(), meaning getTranslationX() was no longer included. - This change goes back to using getViewCenterPosition() and renames it to getChildStartWithTranslation(). - Update typo with parameter in getCurveProperties being mInsets instead of insets. Bug: 153574162 Change-Id: I9b46daecf3ee6dbefe0270e70fdc5e6d9d0b0c00 --- .../com/android/quickstep/views/RecentsView.java | 5 +++-- .../launcher3/touch/LandscapePagedViewHandler.java | 14 +++++++------- .../launcher3/touch/PagedOrientationHandler.java | 4 ++-- .../launcher3/touch/PortraitPagedViewHandler.java | 14 +++++++------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index b46d6f6491..a18f7bae05 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -849,7 +849,8 @@ public abstract class RecentsView extends PagedView impl final int pageCount = getPageCount(); for (int i = 0; i < pageCount; i++) { View page = getPageAt(i); - mScrollState.updateInterpolation(mOrientationHandler.getChildStart(page), mPageSpacing); + mScrollState.updateInterpolation(mOrientationHandler.getChildStartWithTranslation(page), + mPageSpacing); ((PageCallbacks) page).onPageScroll(mScrollState); } } @@ -1236,7 +1237,7 @@ public abstract class RecentsView extends PagedView impl /** * Updates linearInterpolation for the provided child position */ - public void updateInterpolation(int childStart, int pageSpacing) { + public void updateInterpolation(float childStart, int pageSpacing) { float pageCenter = childStart + halfPageSize; float distanceFromScreenCenter = screenCenter - pageCenter; float distanceToReachEdge = halfScreenSize + halfPageSize + pageSpacing; diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 6715bc1a0b..bab574774a 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -65,11 +65,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { } @Override - public void getCurveProperties(PagedView view, Rect mInsets, CurveProperties out) { + public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) { out.scroll = view.getScrollY(); out.halfPageSize = view.getNormalChildHeight() / 2; out.halfScreenSize = view.getMeasuredHeight() / 2; - out.screenCenter = mInsets.top + view.getPaddingTop() + out.scroll + out.halfPageSize; + out.screenCenter = insets.top + view.getPaddingTop() + out.scroll + out.halfPageSize; } @Override @@ -156,11 +156,6 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { view.setTranslationY(translation); } - @Override - public float getViewCenterPosition(View view) { - return view.getTop() + view.getTranslationY(); - } - @Override public int getPrimaryScroll(View view) { return view.getScrollY(); @@ -204,6 +199,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { return view.getTop(); } + @Override + public float getChildStartWithTranslation(View view) { + return view.getTop() + view.getTranslationY(); + } + @Override public int getCenterForPage(View view, Rect insets) { return (view.getPaddingLeft() + view.getMeasuredWidth() + insets.left diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index 974e3f3d31..50606ec8ae 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -65,10 +65,10 @@ public interface PagedOrientationHandler { FloatProperty getPrimaryViewTranslate(); FloatProperty getSecondaryViewTranslate(); void setPrimaryAndResetSecondaryTranslate(View view, float translation); - float getViewCenterPosition(View view); int getPrimaryScroll(View view); float getPrimaryScale(View view); int getChildStart(View view); + float getChildStartWithTranslation(View view); int getCenterForPage(View view, Rect insets); int getScrollOffsetStart(View view, Rect insets); int getScrollOffsetEnd(View view, Rect insets); @@ -87,7 +87,7 @@ public interface PagedOrientationHandler { void delegateScrollTo(PagedView pagedView, int primaryScroll); void delegateScrollBy(PagedView pagedView, int unboundedScroll, int x, int y); void scrollerStartScroll(OverScroller scroller, int newPosition); - void getCurveProperties(PagedView view, Rect mInsets, CurveProperties out); + void getCurveProperties(PagedView view, Rect insets, CurveProperties out); boolean isGoingUp(float displacement); /** diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 6d903b3882..245138f7a1 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -65,11 +65,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { } @Override - public void getCurveProperties(PagedView view, Rect mInsets, CurveProperties out) { + public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) { out.scroll = view.getScrollX(); out.halfPageSize = view.getNormalChildWidth() / 2; out.halfScreenSize = view.getMeasuredWidth() / 2; - out.screenCenter = mInsets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize; + out.screenCenter = insets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize; } @Override @@ -154,11 +154,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { view.setTranslationY(0); } - @Override - public float getViewCenterPosition(View view) { - return view.getLeft() + view.getTranslationX(); - } - @Override public int getPrimaryScroll(View view) { return view.getScrollX(); @@ -202,6 +197,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { return view.getLeft(); } + @Override + public float getChildStartWithTranslation(View view) { + return view.getLeft() + view.getTranslationX(); + } + @Override public int getCenterForPage(View view, Rect insets) { return (view.getPaddingTop() + view.getMeasuredHeight() + insets.top From b214bd0cb1841f70e40e838f70e0f8291b6c5c9c Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 9 Apr 2020 17:55:39 -0700 Subject: [PATCH 27/55] Revert regression where we no longer reverse translation for RTL Change-Id: I6de15c983eaf7ece244f2b2ba7e9f9c80bdab92b --- .../BaseRecentsViewStateController.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index 123c988a04..0f45196ec4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -62,10 +62,13 @@ public abstract class BaseRecentsViewStateController @Override public void setState(@NonNull LauncherState state) { - ScaleAndTranslation scaleAndTranslation = state - .getOverviewScaleAndTranslation(mLauncher); + ScaleAndTranslation scaleAndTranslation = state.getOverviewScaleAndTranslation(mLauncher); + float translationX = scaleAndTranslation.translationX; + if (mRecentsView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { + translationX = -translationX; + } SCALE_PROPERTY.set(mRecentsView, scaleAndTranslation.scale); - mRecentsView.setTranslationX(scaleAndTranslation.translationX); + mRecentsView.setTranslationX(translationX); mRecentsView.setTranslationY(scaleAndTranslation.translationY); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); @@ -96,9 +99,13 @@ public abstract class BaseRecentsViewStateController void setStateWithAnimationInternal(@NonNull final LauncherState toState, @NonNull StateAnimationConfig config, @NonNull PendingAnimation setter) { ScaleAndTranslation scaleAndTranslation = toState.getOverviewScaleAndTranslation(mLauncher); + float translationX = scaleAndTranslation.translationX; + if (mRecentsView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { + translationX = -translationX; + } setter.setFloat(mRecentsView, SCALE_PROPERTY, scaleAndTranslation.scale, config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR)); - setter.setFloat(mRecentsView, VIEW_TRANSLATE_X, scaleAndTranslation.translationX, + setter.setFloat(mRecentsView, VIEW_TRANSLATE_X, translationX, config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR)); setter.setFloat(mRecentsView, VIEW_TRANSLATE_Y, scaleAndTranslation.translationY, config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR)); From 646e4486bea83db9853810219d9ac9dadcc0663d Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 6 Apr 2020 17:25:53 -0700 Subject: [PATCH 28/55] Dump notification dot counts This could help us determine whether our data model or UI is wrong if dots aren't appearing. Bug: 152435463 Change-Id: I46065b130b6b1cbb3b2d1db471654b3959332ff5 --- src/com/android/launcher3/Launcher.java | 3 ++- src/com/android/launcher3/dot/DotInfo.java | 8 ++++++++ src/com/android/launcher3/popup/PopupDataProvider.java | 6 ++++++ src/com/android/launcher3/util/PackageUserKey.java | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 14638a1dda..48db5eaa32 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2565,9 +2565,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, writer.println(prefix + "\tmRotationHelper: " + mRotationHelper); writer.println(prefix + "\tmAppWidgetHost.isListening: " + mAppWidgetHost.isListening()); - // Extra logging for b/116853349 + // Extra logging for general debugging mDragLayer.dump(prefix, writer); mStateManager.dump(prefix, writer); + mPopupDataProvider.dump(prefix, writer); try { FileLog.flushAll(writer); diff --git a/src/com/android/launcher3/dot/DotInfo.java b/src/com/android/launcher3/dot/DotInfo.java index 4ff0539b6c..fc180d1c17 100644 --- a/src/com/android/launcher3/dot/DotInfo.java +++ b/src/com/android/launcher3/dot/DotInfo.java @@ -16,6 +16,8 @@ package com.android.launcher3.dot; +import androidx.annotation.NonNull; + import com.android.launcher3.notification.NotificationInfo; import com.android.launcher3.notification.NotificationKeyData; @@ -83,4 +85,10 @@ public class DotInfo { public int getNotificationCount() { return Math.min(mTotalCount, MAX_COUNT); } + + @NonNull + @Override + public String toString() { + return Integer.toString(mTotalCount); + } } diff --git a/src/com/android/launcher3/popup/PopupDataProvider.java b/src/com/android/launcher3/popup/PopupDataProvider.java index a6b9356c95..5a5f66832d 100644 --- a/src/com/android/launcher3/popup/PopupDataProvider.java +++ b/src/com/android/launcher3/popup/PopupDataProvider.java @@ -33,6 +33,7 @@ import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.ShortcutUtil; import com.android.launcher3.widget.WidgetListRowEntry; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -238,6 +239,11 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan }).collect(Collectors.toList()); } + public void dump(String prefix, PrintWriter writer) { + writer.println(prefix + "PopupDataProvider:"); + writer.println(prefix + "\tmPackageUserToDotInfos:" + mPackageUserToDotInfos); + } + public interface PopupDataChangeListener { PopupDataChangeListener INSTANCE = new PopupDataChangeListener() { }; diff --git a/src/com/android/launcher3/util/PackageUserKey.java b/src/com/android/launcher3/util/PackageUserKey.java index 46e7070ed5..3a3b5a261e 100644 --- a/src/com/android/launcher3/util/PackageUserKey.java +++ b/src/com/android/launcher3/util/PackageUserKey.java @@ -3,6 +3,7 @@ package com.android.launcher3.util; import android.os.UserHandle; import android.service.notification.StatusBarNotification; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.model.data.ItemInfo; @@ -60,4 +61,10 @@ public class PackageUserKey { PackageUserKey otherKey = (PackageUserKey) obj; return mPackageName.equals(otherKey.mPackageName) && mUser.equals(otherKey.mUser); } + + @NonNull + @Override + public String toString() { + return mPackageName + "#" + mUser; + } } From cf7552af3fff622c4ed693de6dadc21164692f43 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 10 Apr 2020 13:28:53 -0700 Subject: [PATCH 29/55] Add tooltip when long pressing system shortcut icon If we only show the icon view (rather than icon + label), show the label on long press. Bug: 148707493 Change-Id: I14ab45b43203375b573e5e5d937ad5ebfb016d83 --- src/com/android/launcher3/popup/PopupContainerWithArrow.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index 36c8ee2337..331298f414 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -51,6 +51,7 @@ import com.android.launcher3.DropTarget; import com.android.launcher3.DropTarget.DragObject; import com.android.launcher3.Launcher; import com.android.launcher3.R; +import com.android.launcher3.Utilities; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate; import com.android.launcher3.dot.DotInfo; @@ -397,6 +398,9 @@ public class PopupContainerWithArrow extends Arr } else if (view instanceof ImageView) { // Only the system shortcut icon shows on a gray background header. info.setIconAndContentDescriptionFor((ImageView) view); + if (Utilities.ATLEAST_OREO) { + view.setTooltipText(view.getContentDescription()); + } } view.setTag(info); view.setOnClickListener(info); From f52af437b23969d836356d1b717ef708fbba081a Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Fri, 10 Apr 2020 17:25:57 -0700 Subject: [PATCH 30/55] Fix bug where it is hard to swipe to work profile tab. Bug: 151739025 Change-Id: I1ba731b4c5ce3a8d88fb14cc4dea2e2410538e6f --- src/com/android/launcher3/PagedView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index e36ae94648..7474613a18 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -917,7 +917,7 @@ public abstract class PagedView extends ViewGrou // Remember location of down touch mDownMotionX = x; mDownMotionY = y; - mLastMotion = mOrientationHandler.getPrimaryDirection(ev, 0); + mDownMotionPrimary = mLastMotion = mOrientationHandler.getPrimaryDirection(ev, 0); mLastMotionRemainder = 0; mTotalMotion = 0; mActivePointerId = ev.getPointerId(0); From 133cd5447430c7d31d82314a80e02b8a0bb639e7 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 8 Apr 2020 17:48:41 -0700 Subject: [PATCH 31/55] Refactor some onboarding-related shared prefs into a class Bug: 151768994 Change-Id: I938e23af8c1874714e02fe34d0f9f82bb21d00a2 --- .../quickstep/TouchInteractionService.java | 4 +- .../launcher3/BaseQuickstepLauncher.java | 55 ++------- .../util/QuickstepOnboardingPrefs.java | 79 +++++++++++++ src/com/android/launcher3/Launcher.java | 13 +++ .../launcher3/allapps/DiscoveryBounce.java | 37 ++---- .../launcher3/util/OnboardingPrefs.java | 110 ++++++++++++++++++ .../uioverrides/states/AllAppsState.java | 2 +- 7 files changed, 221 insertions(+), 79 deletions(-) create mode 100644 quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java create mode 100644 src/com/android/launcher3/util/OnboardingPrefs.java diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 79796010fd..bc799f529b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -58,7 +58,6 @@ import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.model.AppLaunchTracker; @@ -68,6 +67,7 @@ import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.tracing.nano.LauncherTraceProto; import com.android.launcher3.tracing.nano.TouchInteractionServiceProto; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; +import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.TraceHelper; import com.android.quickstep.inputconsumers.AccessibilityInputConsumer; import com.android.quickstep.inputconsumers.AssistantInputConsumer; @@ -378,7 +378,7 @@ public class TouchInteractionService extends Service implements PluginListener { + + public QuickstepOnboardingPrefs(BaseQuickstepLauncher launcher, SharedPreferences sharedPrefs, + LauncherStateManager stateManager) { + super(launcher, sharedPrefs, stateManager); + + if (!getBoolean(HOME_BOUNCE_SEEN)) { + mStateManager.addStateListener(new StateListener() { + @Override + public void onStateTransitionStart(LauncherState toState) { } + + @Override + public void onStateTransitionComplete(LauncherState finalState) { + boolean swipeUpEnabled = SysUINavigationMode.INSTANCE + .get(mLauncher).getMode().hasGestures; + LauncherState prevState = mStateManager.getLastState(); + + if (((swipeUpEnabled && finalState == OVERVIEW) || (!swipeUpEnabled + && finalState == ALL_APPS && prevState == NORMAL) || + hasReachedMaxCount(HOME_BOUNCE_COUNT))) { + mSharedPrefs.edit().putBoolean(HOME_BOUNCE_SEEN, true).apply(); + mStateManager.removeStateListener(this); + } + } + }); + } + + if (!getBoolean(SHELF_BOUNCE_SEEN)) { + mStateManager.addStateListener(new StateListener() { + @Override + public void onStateTransitionStart(LauncherState toState) { } + + @Override + public void onStateTransitionComplete(LauncherState finalState) { + LauncherState prevState = mStateManager.getLastState(); + + if ((finalState == ALL_APPS && prevState == OVERVIEW) || + hasReachedMaxCount(SHELF_BOUNCE_COUNT)) { + mSharedPrefs.edit().putBoolean(SHELF_BOUNCE_SEEN, true).apply(); + mStateManager.removeStateListener(this); + } + } + }); + } + } +} diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 48db5eaa32..f69940b92e 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -139,6 +139,7 @@ import com.android.launcher3.util.IntArray; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; +import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.PendingRequestArgs; @@ -300,6 +301,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, // We only want to get the SharedPreferences once since it does an FS stat each time we get // it from the context. private SharedPreferences mSharedPrefs; + private OnboardingPrefs mOnboardingPrefs; // Activity result which needs to be processed after workspace has loaded. private ActivityResultInfo mPendingActivityResult; @@ -367,6 +369,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, mAllAppsController = new AllAppsTransitionController(this); mStateManager = new LauncherStateManager(this); + mOnboardingPrefs = createOnboardingPrefs(mSharedPrefs, mStateManager); + mAppWidgetManager = new WidgetManagerHelper(this); mAppWidgetHost = new LauncherAppWidgetHost(this, appWidgetId -> getWorkspace().removeWidget(appWidgetId)); @@ -458,6 +462,15 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, return new LauncherOverlayManager() { }; } + protected OnboardingPrefs createOnboardingPrefs(SharedPreferences sharedPrefs, + LauncherStateManager stateManager) { + return new OnboardingPrefs<>(this, sharedPrefs, stateManager); + } + + public OnboardingPrefs getOnboardingPrefs() { + return mOnboardingPrefs; + } + @Override public void onPluginConnected(OverlayPlugin overlayManager, Context context) { switchOverlay(() -> overlayManager.createOverlayManager(this, this)); diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index 0f0fc3a249..fc29a30d74 100644 --- a/src/com/android/launcher3/allapps/DiscoveryBounce.java +++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java @@ -24,7 +24,6 @@ import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerTyp import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; -import android.content.SharedPreferences; import android.os.Handler; import android.os.UserManager; import android.view.MotionEvent; @@ -35,6 +34,7 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.StateListener; import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.util.OnboardingPrefs; /** * Abstract base class of floating view responsible for showing discovery bounce animation @@ -43,13 +43,6 @@ public class DiscoveryBounce extends AbstractFloatingView { private static final long DELAY_MS = 450; - public static final String HOME_BOUNCE_SEEN = "launcher.apps_view_shown"; - public static final String SHELF_BOUNCE_SEEN = "launcher.shelf_bounce_seen"; - public static final String HOME_BOUNCE_COUNT = "launcher.home_bounce_count"; - public static final String SHELF_BOUNCE_COUNT = "launcher.shelf_bounce_count"; - - public static final int BOUNCE_MAX_COUNT = 3; - private final Launcher mLauncher; private final Animator mDiscoBounceAnimation; @@ -142,8 +135,9 @@ public class DiscoveryBounce extends AbstractFloatingView { } private static void showForHomeIfNeeded(Launcher launcher, boolean withDelay) { + OnboardingPrefs onboardingPrefs = launcher.getOnboardingPrefs(); if (!launcher.isInState(NORMAL) - || launcher.getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false) + || onboardingPrefs.getBoolean(OnboardingPrefs.HOME_BOUNCE_SEEN) || AbstractFloatingView.getTopOpenView(launcher) != null || launcher.getSystemService(UserManager.class).isDemoUser() || Utilities.IS_RUNNING_IN_TEST_HARNESS) { @@ -154,7 +148,7 @@ public class DiscoveryBounce extends AbstractFloatingView { new Handler().postDelayed(() -> showForHomeIfNeeded(launcher, false), DELAY_MS); return; } - incrementHomeBounceCount(launcher); + onboardingPrefs.incrementEventCount(OnboardingPrefs.HOME_BOUNCE_COUNT); new DiscoveryBounce(launcher, 0).show(HOTSEAT); } @@ -164,11 +158,12 @@ public class DiscoveryBounce extends AbstractFloatingView { } private static void showForOverviewIfNeeded(Launcher launcher, boolean withDelay) { + OnboardingPrefs onboardingPrefs = launcher.getOnboardingPrefs(); if (!launcher.isInState(OVERVIEW) || !launcher.hasBeenResumed() || launcher.isForceInvisible() || launcher.getDeviceProfile().isVerticalBarLayout() - || launcher.getSharedPrefs().getBoolean(SHELF_BOUNCE_SEEN, false) + || onboardingPrefs.getBoolean(OnboardingPrefs.SHELF_BOUNCE_SEEN) || launcher.getSystemService(UserManager.class).isDemoUser() || Utilities.IS_RUNNING_IN_TEST_HARNESS) { return; @@ -182,7 +177,7 @@ public class DiscoveryBounce extends AbstractFloatingView { // TODO: Move these checks to the top and call this method after invalidate handler. return; } - incrementShelfBounceCount(launcher); + onboardingPrefs.incrementEventCount(OnboardingPrefs.SHELF_BOUNCE_COUNT); new DiscoveryBounce(launcher, (1 - OVERVIEW.getVerticalProgress(launcher))) .show(PREDICTION); @@ -209,22 +204,4 @@ public class DiscoveryBounce extends AbstractFloatingView { mController.setProgress(progress - mDelta); } } - - private static void incrementShelfBounceCount(Launcher launcher) { - SharedPreferences sharedPrefs = launcher.getSharedPrefs(); - int count = sharedPrefs.getInt(SHELF_BOUNCE_COUNT, 0); - if (count > BOUNCE_MAX_COUNT) { - return; - } - sharedPrefs.edit().putInt(SHELF_BOUNCE_COUNT, count + 1).apply(); - } - - private static void incrementHomeBounceCount(Launcher launcher) { - SharedPreferences sharedPrefs = launcher.getSharedPrefs(); - int count = sharedPrefs.getInt(HOME_BOUNCE_COUNT, 0); - if (count > BOUNCE_MAX_COUNT) { - return; - } - sharedPrefs.edit().putInt(HOME_BOUNCE_COUNT, count + 1).apply(); - } } diff --git a/src/com/android/launcher3/util/OnboardingPrefs.java b/src/com/android/launcher3/util/OnboardingPrefs.java new file mode 100644 index 0000000000..cdb60e9b63 --- /dev/null +++ b/src/com/android/launcher3/util/OnboardingPrefs.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2020 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.util; + +import android.content.SharedPreferences; +import android.util.ArrayMap; + +import androidx.annotation.StringDef; + +import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherStateManager; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.Collections; +import java.util.Map; + +/** + * Stores and retrieves onboarding-related data via SharedPreferences. + */ +public class OnboardingPrefs { + + public static final String HOME_BOUNCE_SEEN = "launcher.apps_view_shown"; + public static final String SHELF_BOUNCE_SEEN = "launcher.shelf_bounce_seen"; + public static final String HOME_BOUNCE_COUNT = "launcher.home_bounce_count"; + public static final String SHELF_BOUNCE_COUNT = "launcher.shelf_bounce_count"; + + /** + * Events that either have happened or have not (booleans). + */ + @StringDef(value = { + HOME_BOUNCE_SEEN, + SHELF_BOUNCE_SEEN, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface EventBoolKey {} + + /** + * Events that occur multiple times, which we count up to a max defined in {@link #MAX_COUNTS}. + */ + @StringDef(value = { + HOME_BOUNCE_COUNT, + SHELF_BOUNCE_COUNT, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface EventCountKey {} + + private static final Map MAX_COUNTS; + static { + Map maxCounts = new ArrayMap<>(2); + maxCounts.put(HOME_BOUNCE_COUNT, 3); + maxCounts.put(SHELF_BOUNCE_COUNT, 3); + MAX_COUNTS = Collections.unmodifiableMap(maxCounts); + } + + protected final T mLauncher; + protected final SharedPreferences mSharedPrefs; + protected final LauncherStateManager mStateManager; + + public OnboardingPrefs(T launcher, SharedPreferences sharedPrefs, + LauncherStateManager stateManager) { + mLauncher = launcher; + mSharedPrefs = sharedPrefs; + mStateManager = stateManager; + } + + /** @return The number of times we have seen the given event. */ + public int getCount(@EventCountKey String key) { + return mSharedPrefs.getInt(key, 0); + } + + /** @return Whether we have seen this event enough times, as defined by {@link #MAX_COUNTS}. */ + public boolean hasReachedMaxCount(@EventCountKey String eventKey) { + return hasReachedMaxCount(getCount(eventKey), eventKey); + } + + private boolean hasReachedMaxCount(int count, @EventCountKey String eventKey) { + return count >= MAX_COUNTS.get(eventKey); + } + + /** @return Whether we have seen the given event. */ + public boolean getBoolean(@EventBoolKey String key) { + return mSharedPrefs.getBoolean(key, false); + } + + /** + * Add 1 to the given event count, if we haven't already reached the max count. + */ + public void incrementEventCount(@EventCountKey String eventKey) { + int count = getCount(eventKey); + if (hasReachedMaxCount(count, eventKey)) { + return; + } + count++; + mSharedPrefs.edit().putInt(eventKey, count).apply(); + } +} diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java index a56801fa1c..313ea05a1f 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -15,8 +15,8 @@ */ package com.android.launcher3.uioverrides.states; -import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; +import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_SEEN; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; From 6322000721f82dac91092ddc9d573bd602c815a8 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 6 Apr 2020 14:39:22 -0700 Subject: [PATCH 32/55] Remove all apps arrow after getting to all apps 5 times - Instead of ScrimView implementing StateListener, added mAccessibilityLauncherStateListener. - Added allAppsStateListener to determine whether we reached all apps 5 times. Bug: 151768994 Change-Id: I01790ce577879eab2e4568fcda19d0245b256d13 --- .../util/QuickstepOnboardingPrefs.java | 17 ++++++++ .../quickstep/views/ShelfScrimView.java | 12 ++++-- .../launcher3/util/OnboardingPrefs.java | 11 +++-- .../android/launcher3/views/ScrimView.java | 42 ++++++++++--------- 4 files changed, 56 insertions(+), 26 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java index f21eb03ae0..ab2484d733 100644 --- a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java +++ b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java @@ -75,5 +75,22 @@ public class QuickstepOnboardingPrefs extends OnboardingPrefs private final float mRadius; private final int mMaxScrimAlpha; private final Paint mPaint; + private final OnboardingPrefs mOnboardingPrefs; // Mid point where the alpha changes private int mMidAlpha; @@ -100,6 +102,7 @@ public class ShelfScrimView extends ScrimView private boolean mRemainingScreenPathValid = false; private Mode mSysUINavigationMode; + private boolean mIsTwoZoneSwipeModel; public ShelfScrimView(Context context, AttributeSet attrs) { super(context, attrs); @@ -108,6 +111,7 @@ public class ShelfScrimView extends ScrimView mEndAlpha = Color.alpha(mEndScrim); mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + mOnboardingPrefs = mLauncher.getOnboardingPrefs(); // Just assume the easiest UI for now, until we have the proper layout information. mDrawingFlatColor = true; @@ -140,9 +144,11 @@ public class ShelfScrimView extends ScrimView // Show the shelf more quickly before reaching overview progress. mBeforeMidProgressColorInterpolator = ACCEL_2; mAfterMidProgressColorInterpolator = ACCEL; + mIsTwoZoneSwipeModel = FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get(); } else { mBeforeMidProgressColorInterpolator = ACCEL; mAfterMidProgressColorInterpolator = Interpolators.clampToProgress(ACCEL, 0.5f, 1f); + mIsTwoZoneSwipeModel = false; } } @@ -236,9 +242,9 @@ public class ShelfScrimView extends ScrimView @Override protected boolean shouldDragHandleBeVisible() { - boolean twoZoneSwipeModel = FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() - && SysUINavigationMode.removeShelfFromOverview(mLauncher); - return twoZoneSwipeModel || super.shouldDragHandleBeVisible(); + boolean needsAllAppsEdu = mIsTwoZoneSwipeModel + && !mOnboardingPrefs.hasReachedMaxCount(OnboardingPrefs.ALL_APPS_COUNT); + return needsAllAppsEdu || super.shouldDragHandleBeVisible(); } @Override diff --git a/src/com/android/launcher3/util/OnboardingPrefs.java b/src/com/android/launcher3/util/OnboardingPrefs.java index cdb60e9b63..baa1eeefcd 100644 --- a/src/com/android/launcher3/util/OnboardingPrefs.java +++ b/src/com/android/launcher3/util/OnboardingPrefs.java @@ -37,6 +37,7 @@ public class OnboardingPrefs { public static final String SHELF_BOUNCE_SEEN = "launcher.shelf_bounce_seen"; public static final String HOME_BOUNCE_COUNT = "launcher.home_bounce_count"; public static final String SHELF_BOUNCE_COUNT = "launcher.shelf_bounce_count"; + public static final String ALL_APPS_COUNT = "launcher.all_apps_count"; /** * Events that either have happened or have not (booleans). @@ -54,15 +55,17 @@ public class OnboardingPrefs { @StringDef(value = { HOME_BOUNCE_COUNT, SHELF_BOUNCE_COUNT, + ALL_APPS_COUNT, }) @Retention(RetentionPolicy.SOURCE) public @interface EventCountKey {} private static final Map MAX_COUNTS; static { - Map maxCounts = new ArrayMap<>(2); + Map maxCounts = new ArrayMap<>(3); maxCounts.put(HOME_BOUNCE_COUNT, 3); maxCounts.put(SHELF_BOUNCE_COUNT, 3); + maxCounts.put(ALL_APPS_COUNT, 5); MAX_COUNTS = Collections.unmodifiableMap(maxCounts); } @@ -98,13 +101,15 @@ public class OnboardingPrefs { /** * Add 1 to the given event count, if we haven't already reached the max count. + * @return Whether we have now reached the max count. */ - public void incrementEventCount(@EventCountKey String eventKey) { + public boolean incrementEventCount(@EventCountKey String eventKey) { int count = getCount(eventKey); if (hasReachedMaxCount(count, eventKey)) { - return; + return true; } count++; mSharedPrefs.edit().putInt(eventKey, count).apply(); + return hasReachedMaxCount(count, eventKey); } } diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java index 39e1eac758..442c5fd4c8 100644 --- a/src/com/android/launcher3/views/ScrimView.java +++ b/src/com/android/launcher3/views/ScrimView.java @@ -82,7 +82,7 @@ import java.util.List; * Simple scrim which draws a flat color */ public class ScrimView extends View implements Insettable, OnChangeListener, - AccessibilityStateChangeListener, StateListener { + AccessibilityStateChangeListener { public static final IntProperty DRAG_HANDLE_ALPHA = new IntProperty("dragHandleAlpha") { @@ -116,6 +116,18 @@ public class ScrimView extends View implements Insettable, O private final AccessibilityManager mAM; protected final int mEndScrim; + private final StateListener mAccessibilityLauncherStateListener = new StateListener() { + @Override + public void onStateTransitionStart(LauncherState toState) {} + + @Override + public void onStateTransitionComplete(LauncherState finalState) { + setImportantForAccessibility(finalState == ALL_APPS + ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + : IMPORTANT_FOR_ACCESSIBILITY_AUTO); + } + }; + protected float mMaxScrimAlpha; protected float mProgress = 1; @@ -177,7 +189,7 @@ public class ScrimView extends View implements Insettable, O @Override public void setInsets(Rect insets) { updateDragHandleBounds(); - updateDragHandleVisibility(null); + updateDragHandleVisibility(); } @Override @@ -375,18 +387,22 @@ public class ScrimView extends View implements Insettable, O @Override public void onAccessibilityStateChanged(boolean enabled) { LauncherStateManager stateManager = mLauncher.getStateManager(); - stateManager.removeStateListener(this); + stateManager.removeStateListener(mAccessibilityLauncherStateListener); if (enabled) { - stateManager.addStateListener(this); - handleStateChangedComplete(stateManager.getState()); + stateManager.addStateListener(mAccessibilityLauncherStateListener); + mAccessibilityLauncherStateListener.onStateTransitionComplete(stateManager.getState()); } else { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); } + updateDragHandleVisibility(); + } + + public void updateDragHandleVisibility() { updateDragHandleVisibility(null); } - private void updateDragHandleVisibility(Drawable recycle) { + private void updateDragHandleVisibility(@Nullable Drawable recycle) { boolean visible = shouldDragHandleBeVisible(); boolean wasVisible = mDragHandle != null; if (visible != wasVisible) { @@ -424,20 +440,6 @@ public class ScrimView extends View implements Insettable, O mAccessibilityHelper.onFocusChanged(gainFocus, direction, previouslyFocusedRect); } - @Override - public void onStateTransitionStart(LauncherState toState) {} - - @Override - public void onStateTransitionComplete(LauncherState finalState) { - handleStateChangedComplete(finalState); - } - - private void handleStateChangedComplete(LauncherState finalState) { - setImportantForAccessibility(finalState == ALL_APPS - ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - : IMPORTANT_FOR_ACCESSIBILITY_AUTO); - } - protected class AccessibilityHelper extends ExploreByTouchHelper { private static final int DRAG_HANDLE_ID = 1; From 57dab6fa29d28c0ff6ebdb2ee5b31b0a098ec332 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Fri, 10 Apr 2020 13:38:14 -0700 Subject: [PATCH 33/55] Let spring take over the overscroll amount when swiping to first/last page. Bug: 153747836 Change-Id: I8a883f648587b0cb4008df3b8176c9341162b8d1 --- res/values/config.xml | 4 ++-- src/com/android/launcher3/PagedView.java | 18 +++++++++++++++--- .../android/launcher3/util/OverScroller.java | 9 +++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/res/values/config.xml b/res/values/config.xml index ef6761387c..0657b86a6c 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -131,8 +131,8 @@ 0.5 1500 - 0.75 - 200 + 0.8 + 400 0.75 200 diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 7474613a18..5343424dfc 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -1069,16 +1069,28 @@ public abstract class PagedView extends ViewGrou } } + /** + * Returns the amount of overscroll caused by the spring in {@link OverScroller}. + */ + private int getSpringOverScroll(int amount) { + if (mScroller.isSpringing()) { + return amount < 0 + ? mScroller.getCurrPos() + : Math.max(0, mScroller.getCurrPos() - mMaxScroll); + } else { + return 0; + } + } + protected void dampedOverScroll(int amount) { - mSpringOverScroll = amount; if (amount == 0) { return; } int size = mOrientationHandler.getMeasuredSize(this); int overScrollAmount = OverScroll.dampedScroll(amount, size); - mSpringOverScroll = overScrollAmount; if (mScroller.isSpringing()) { + mSpringOverScroll = getSpringOverScroll(amount); invalidate(); return; } @@ -1090,8 +1102,8 @@ public abstract class PagedView extends ViewGrou } protected void overScroll(int amount) { - mSpringOverScroll = amount; if (mScroller.isSpringing()) { + mSpringOverScroll = getSpringOverScroll(amount); invalidate(); return; } diff --git a/src/com/android/launcher3/util/OverScroller.java b/src/com/android/launcher3/util/OverScroller.java index 34efb12e01..87e698626d 100644 --- a/src/com/android/launcher3/util/OverScroller.java +++ b/src/com/android/launcher3/util/OverScroller.java @@ -561,10 +561,11 @@ public class OverScroller { mStartTime = AnimationUtils.currentAnimationTimeMillis(); mDuration = duration; + if (mSpring != null) { + mSpring.cancel(); + } + if (mState == SPRING) { - if (mSpring != null) { - mSpring.cancel(); - } mSpring = new SpringAnimation(this, SPRING_PROPERTY); ResourceProvider rp = DynamicResource.provider(mContext); @@ -576,9 +577,9 @@ public class OverScroller { mSpring.setStartVelocity(velocity); mSpring.animateToFinalPosition(mFinal); mSpring.addEndListener((animation, canceled, value, velocity1) -> { + mSpring = null; finish(); mState = SPLINE; - mSpring = null; }); } // Unused From 22557d7a8bbd00b8d1d3c769d105433ea9494b11 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Sun, 12 Apr 2020 17:23:51 -0700 Subject: [PATCH 34/55] Resolve work switch drawable RTL issue Bug: 153680914 Test: Manual Change-Id: I54f0240b8845c89f96bf61705fea0dff74c68668 --- src/com/android/launcher3/allapps/WorkModeSwitch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java index 05db18e91f..c1621b04b6 100644 --- a/src/com/android/launcher3/allapps/WorkModeSwitch.java +++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java @@ -73,7 +73,7 @@ public class WorkModeSwitch extends Switch implements Insettable { private void setCheckedInternal(boolean checked) { super.setChecked(checked); - setCompoundDrawablesWithIntrinsicBounds( + setCompoundDrawablesRelativeWithIntrinsicBounds( checked ? R.drawable.ic_corp : R.drawable.ic_corp_off, 0, 0, 0); } From 6c00f16d671789b7b5c8cfa75900374431249031 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Sun, 12 Apr 2020 17:38:14 -0700 Subject: [PATCH 35/55] Define a11y content description for work paused list Bug: 151803591 Test: Manual Change-Id: I2b592189d784010f09fcd54378f2b34bd2d6c6e3 --- res/values/strings.xml | 4 ++++ src/com/android/launcher3/allapps/AllAppsContainerView.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index ac04262ae8..a9ce24c320 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -343,6 +343,10 @@ Work profile is paused Work apps can\’t send you notifications, use your battery, or access your location + + Work profile is paused. Work apps can\’t send you notifications, use your battery, or access your location + + Pause work apps and notifications diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 69faa498bd..a45c96c44b 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -645,8 +645,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo if (!mIsWork || recyclerView == null) return; boolean workDisabled = UserCache.INSTANCE.get(mLauncher).isAnyProfileQuietModeEnabled(); if (mWorkDisabled == workDisabled) return; - recyclerView.setContentDescription( - workDisabled ? mLauncher.getString(R.string.work_apps_paused_title) : null); + recyclerView.setContentDescription(workDisabled ? mLauncher.getString( + R.string.work_apps_paused_content_description) : null); View overlayView = getOverlayView(); recyclerView.setItemAnimator(new DefaultItemAnimator()); if (workDisabled) { From 3119c1a6b5a3a3b7fd240b2767e079555794eb14 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Sun, 12 Apr 2020 17:44:09 -0700 Subject: [PATCH 36/55] Remove pin a11y option for pinned hotseat items Bug: 152374583 Test: Manual Change-Id: I7af75204fd89fd2afe3f2b3c7733db10b4b14d6f --- .../android/launcher3/uioverrides/PredictedAppIcon.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java index 70880ebdba..8af26c6e8b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java @@ -136,9 +136,11 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView implements @Override public void addSupportedAccessibilityActions(AccessibilityNodeInfo accessibilityNodeInfo) { - accessibilityNodeInfo.addAction( - new AccessibilityNodeInfo.AccessibilityAction(PIN_PREDICTION, - getContext().getText(R.string.pin_prediction))); + if (!mIsPinned) { + accessibilityNodeInfo.addAction( + new AccessibilityNodeInfo.AccessibilityAction(PIN_PREDICTION, + getContext().getText(R.string.pin_prediction))); + } } @Override From e54410afc3d71be5fdba2461731586352c6b8731 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Sun, 12 Apr 2020 18:14:43 -0700 Subject: [PATCH 37/55] Change work paused text style Bug: 152665605 Test: Manual Change-Id: I9ecd4ca512117328870c8a08efbdd0e3f6860235 --- res/layout/work_apps_paused.xml | 2 +- res/values/styles.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/res/layout/work_apps_paused.xml b/res/layout/work_apps_paused.xml index f64b2d9cd7..08e1c981ff 100644 --- a/res/layout/work_apps_paused.xml +++ b/res/layout/work_apps_paused.xml @@ -20,7 +20,7 @@ android:gravity="center">