diff --git a/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java b/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java index 492611fab9..d4eca2fd40 100644 --- a/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java +++ b/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java @@ -35,6 +35,7 @@ import com.android.quickstep.util.RecentsOrientedState; */ public class GoOverviewActionsView extends OverviewActionsView { + @Nullable private ArrowTipView mArrowTipView; public GoOverviewActionsView(Context context) { diff --git a/quickstep/src/com/android/quickstep/views/AllAppsEduView.java b/quickstep/src/com/android/quickstep/views/AllAppsEduView.java index e9d7c3cb31..d79b318023 100644 --- a/quickstep/src/com/android/quickstep/views/AllAppsEduView.java +++ b/quickstep/src/com/android/quickstep/views/AllAppsEduView.java @@ -35,6 +35,7 @@ import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; +import androidx.annotation.Nullable; import androidx.core.graphics.ColorUtils; import com.android.launcher3.AbstractFloatingView; @@ -58,6 +59,7 @@ public class AllAppsEduView extends AbstractFloatingView { private Launcher mLauncher; private AllAppsEduTouchController mTouchController; + @Nullable private AnimatorSet mAnimation; private GradientDrawable mCircle; diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java index 7c8041c992..dbdcf19d84 100644 --- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java @@ -44,6 +44,7 @@ import android.view.ViewOutlineProvider; import android.widget.FrameLayout; import android.widget.TextView; +import androidx.annotation.Nullable; import androidx.annotation.StringRes; import com.android.launcher3.BaseActivity; @@ -69,6 +70,7 @@ public final class DigitalWellBeingToast { private Task mTask; private boolean mHasLimit; private long mAppRemainingTimeMs; + @Nullable private View mBanner; private ViewOutlineProvider mOldBannerOutlineProvider; private float mBannerOffsetPercentage; @@ -234,7 +236,7 @@ public final class DigitalWellBeingToast { task.titleDescription; } - private void replaceBanner(View view) { + private void replaceBanner(@Nullable View view) { resetOldBanner(); setBanner(view); } @@ -248,7 +250,7 @@ public final class DigitalWellBeingToast { } } - private void setBanner(View view) { + private void setBanner(@Nullable View view) { mBanner = view; if (view != null) { setupAndAddBanner(); diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java index 1548268891..c3b166fada 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetBackgroundView.java @@ -27,6 +27,8 @@ import android.view.View; import android.view.ViewOutlineProvider; import android.widget.RemoteViews.RemoteViewOutlineProvider; +import androidx.annotation.Nullable; + import com.android.launcher3.widget.LauncherAppWidgetHostView; import com.android.launcher3.widget.RoundedCornerEnforcement; @@ -42,7 +44,9 @@ final class FloatingWidgetBackgroundView extends View { private final DrawableProperties mForegroundProperties = new DrawableProperties(); private final DrawableProperties mBackgroundProperties = new DrawableProperties(); + @Nullable private Drawable mOriginalForeground; + @Nullable private Drawable mOriginalBackground; private float mFinalRadius; private float mInitialOutlineRadius; @@ -50,7 +54,7 @@ final class FloatingWidgetBackgroundView extends View { private boolean mIsUsingFallback; private View mSourceView; - FloatingWidgetBackgroundView(Context context, AttributeSet attrs, int defStyleAttr) { + FloatingWidgetBackgroundView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOutlineProvider(new ViewOutlineProvider() { @Override @@ -161,8 +165,10 @@ final class FloatingWidgetBackgroundView extends View { /** Stores and modifies a drawable's properties through an animation. */ private static class DrawableProperties { + @Nullable private Drawable mDrawable; private float mOriginalRadius; + @Nullable private float[] mOriginalRadii; private final float[] mTmpRadii = new float[8]; diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java index 463ed4bd9c..8a5f42afaf 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java @@ -57,10 +57,14 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, private LauncherAppWidgetHostView mAppWidgetView; private View mAppWidgetBackgroundView; private RectF mBackgroundPosition; + @Nullable private GhostView mForegroundOverlayView; + @Nullable private Runnable mEndRunnable; + @Nullable private Runnable mFastFinishRunnable; + @Nullable private Runnable mOnTargetChangeRunnable; private boolean mAppTargetIsTranslucent; diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index ebc6cc4b0f..30b55a896f 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -39,10 +39,13 @@ import java.util.function.Consumer; */ public class GroupedTaskView extends TaskView { + @Nullable private Task mSecondaryTask; private TaskThumbnailView mSnapshotView2; private IconView mIconView2; + @Nullable private CancellableTask mThumbnailLoadRequest2; + @Nullable private CancellableTask mIconLoadRequest2; private final float[] mIcon2CenterCoords = new float[2]; private TransformingTouchDelegate mIcon2TouchDelegate; @@ -153,6 +156,7 @@ public class GroupedTaskView extends TaskView { } } + @Nullable @Override public RunnableList launchTaskAnimated() { getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask, @@ -168,7 +172,7 @@ public class GroupedTaskView extends TaskView { } @Override - void refreshThumbnails(HashMap thumbnailDatas) { + void refreshThumbnails(@Nullable HashMap thumbnailDatas) { super.refreshThumbnails(thumbnailDatas); if (mSecondaryTask != null && thumbnailDatas != null) { final ThumbnailData thumbnailData = thumbnailDatas.get(mSecondaryTask.key.id); diff --git a/quickstep/src/com/android/quickstep/views/IconView.java b/quickstep/src/com/android/quickstep/views/IconView.java index 813e653c85..ccb1a991ea 100644 --- a/quickstep/src/com/android/quickstep/views/IconView.java +++ b/quickstep/src/com/android/quickstep/views/IconView.java @@ -23,6 +23,8 @@ import android.util.AttributeSet; import android.view.Gravity; import android.view.View; +import androidx.annotation.Nullable; + import com.android.launcher3.Utilities; /** @@ -31,6 +33,7 @@ import com.android.launcher3.Utilities; */ public class IconView extends View { + @Nullable private Drawable mDrawable; private int mDrawableWidth, mDrawableHeight; @@ -46,7 +49,10 @@ public class IconView extends View { super(context, attrs, defStyleAttr); } - public void setDrawable(Drawable d) { + /** + * Sets a {@link Drawable} to be displayed. + */ + public void setDrawable(@Nullable Drawable d) { if (mDrawable != null) { mDrawable.setCallback(null); } @@ -76,6 +82,7 @@ public class IconView extends View { mDrawable.setBounds(drawableRect); } + @Nullable public Drawable getDrawable() { return mDrawable; } diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java index 5c0b50c3aa..f3b6a63306 100644 --- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java @@ -90,8 +90,10 @@ public class OverviewActionsView extends FrameLayo @ActionsDisabledFlags protected int mDisabledFlags; + @Nullable protected T mCallbacks; + @Nullable protected DeviceProfile mDp; public OverviewActionsView(Context context) { diff --git a/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java b/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java index 845e13eecc..04a5761fdc 100644 --- a/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java +++ b/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java @@ -40,6 +40,7 @@ public class SplitPlaceholderView extends FrameLayout { } }; + @Nullable private IconView mIconView; public SplitPlaceholderView(Context context, AttributeSet attrs) { diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java index d55b89c5a1..853a02343f 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java @@ -39,6 +39,8 @@ import android.view.ViewTreeObserver.OnScrollChangedListener; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; + import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; @@ -67,6 +69,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange private BaseDraggingActivity mActivity; private TextView mTaskName; + @Nullable private AnimatorSet mOpenCloseAnimator; private TaskView mTaskView; private TaskIdAttributeContainer mTaskContainer; diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java index d498428076..c960f88437 100644 --- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java @@ -78,6 +78,7 @@ public class TaskThumbnailView extends View { }; private final BaseActivity mActivity; + @Nullable private TaskOverlay mOverlay; private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); @@ -90,8 +91,11 @@ public class TaskThumbnailView extends View { private final PreviewPositionHelper mPreviewPositionHelper = new PreviewPositionHelper(); private TaskView.FullscreenDrawParams mFullscreenParams; + @Nullable private Task mTask; + @Nullable private ThumbnailData mThumbnailData; + @Nullable protected BitmapShader mBitmapShader; /** How much this thumbnail is dimmed, 0 not dimmed at all, 1 totally dimmed. */ @@ -141,7 +145,8 @@ public class TaskThumbnailView extends View { * upon swipe up so that a usable screenshot is accessible immediately when * recents animation needs to be finished / cancelled. */ - public void setThumbnail(Task task, ThumbnailData thumbnailData, boolean refreshNow) { + public void setThumbnail(@Nullable Task task, @Nullable ThumbnailData thumbnailData, + boolean refreshNow) { mTask = task; mThumbnailData = (thumbnailData != null && thumbnailData.thumbnail != null) ? thumbnailData : null; @@ -151,7 +156,7 @@ public class TaskThumbnailView extends View { } /** See {@link #setThumbnail(Task, ThumbnailData, boolean)} */ - public void setThumbnail(Task task, ThumbnailData thumbnailData) { + public void setThumbnail(@Nullable Task task, @Nullable ThumbnailData thumbnailData) { setThumbnail(task, thumbnailData, true /* refreshNow */); } @@ -366,6 +371,10 @@ public class TaskThumbnailView extends View { return Utilities.makeColorTintingColorFilter(mDimColor, dimAmount); } + /** + * Returns current thumbnail or null if none is set. + */ + @Nullable public Bitmap getThumbnail() { if (mThumbnailData == null) { return null; diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 9f961c9353..3da789352a 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -360,6 +360,7 @@ public class TaskView extends FrameLayout implements Reusable { private final TaskOutlineProvider mOutlineProvider; + @Nullable protected Task mTask; protected TaskThumbnailView mSnapshotView; protected IconView mIconView; @@ -394,6 +395,7 @@ public class TaskView extends FrameLayout implements Reusable { private float mSplitSelectTranslationX; private float mSplitSelectScrollOffsetPrimary; + @Nullable private ObjectAnimator mIconAndDimAnimator; private float mIconScaleAnimStartProgress = 0; private float mFocusTransitionProgress = 1; @@ -411,7 +413,9 @@ public class TaskView extends FrameLayout implements Reusable { private boolean mShowScreenshot; // The current background requests to load the task thumbnail and icon + @Nullable private CancellableTask mThumbnailLoadRequest; + @Nullable private CancellableTask mIconLoadRequest; private boolean mEndQuickswitchCuj; @@ -544,6 +548,7 @@ public class TaskView extends FrameLayout implements Reusable { return mTaskIdAttributeContainer; } + @Nullable public Task getTask() { return mTask; } @@ -686,6 +691,7 @@ public class TaskView extends FrameLayout implements Reusable { * Starts the task associated with this view and animates the startup. * @return CompletionStage to indicate the animation completion or null if the launch failed. */ + @Nullable public RunnableList launchTaskAnimated() { if (mTask != null) { TestLogging.recordEvent( @@ -843,7 +849,7 @@ public class TaskView extends FrameLayout implements Reusable { } } - protected void setIcon(IconView iconView, Drawable icon) { + protected void setIcon(IconView iconView, @Nullable Drawable icon) { if (icon != null) { iconView.setDrawable(icon); iconView.setOnClickListener(v -> { diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index e24ea6623f..e253505426 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -157,15 +157,6 @@ public final class FeatureFlags { "ENABLE_DATABASE_RESTORE", false, "Enable database restore when new restore session is created"); - public static final BooleanFlag ENABLE_SMARTSPACE_UNIVERSAL = getDebugFlag( - "ENABLE_SMARTSPACE_UNIVERSAL", false, - "Replace Smartspace with a version rendered by System UI."); - - public static final BooleanFlag ENABLE_SMARTSPACE_ENHANCED = getDebugFlag( - "ENABLE_SMARTSPACE_ENHANCED", true, - "Replace Smartspace with the enhanced version. " - + "Ignored if ENABLE_SMARTSPACE_UNIVERSAL is enabled."); - public static final BooleanFlag ENABLE_SMARTSPACE_DISMISS = getDebugFlag( "ENABLE_SMARTSPACE_DISMISS", true, "Adds a menu option to dismiss the current Enhanced Smartspace card."); diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index a9bcd67d66..c90d283ae8 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -107,14 +107,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { mLauncher.pressHome(); } - @Ignore - public void testOpenHomeSettingsFromWorkspace() { - mDevice.pressMenu(); - mDevice.waitForIdle(); - mLauncher.getOptionsPopupMenu().getMenuItem("Home settings") - .launch(mDevice.getLauncherPackageName()); - } - @Test public void testPressHomeOnAllAppsContextMenu() throws Exception { final AllApps allApps = mLauncher.getWorkspace().switchToAllApps(); diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index f3e3ec5252..2fbe460658 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -1025,20 +1025,6 @@ public final class LauncherInstrumentation { } } - /** - * Gets the Options Popup Menu object if the current state is showing the popup menu. Fails if - * the launcher is not in that state. - * - * @return Options Popup Menu object. - */ - @NonNull - public OptionsPopupMenu getOptionsPopupMenu() { - try (LauncherInstrumentation.Closable c = addContextLayer( - "want to get context menu object")) { - return new OptionsPopupMenu(this); - } - } - void waitUntilLauncherObjectGone(String resId) { waitUntilGoneBySelector(getLauncherObjectSelector(resId)); } diff --git a/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenu.java b/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenu.java deleted file mode 100644 index 787dc70063..0000000000 --- a/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenu.java +++ /dev/null @@ -1,41 +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.tapl; - -import androidx.annotation.NonNull; -import androidx.test.uiautomator.By; -import androidx.test.uiautomator.UiObject2; - -public class OptionsPopupMenu { - - private final LauncherInstrumentation mLauncher; - private final UiObject2 mDeepShortcutsContainer; - - OptionsPopupMenu(LauncherInstrumentation launcher) { - mLauncher = launcher; - mDeepShortcutsContainer = launcher.waitForLauncherObject("popup_container"); - } - - /** - * Returns a menu item with a given label. Fails if it doesn't exist. - */ - @NonNull - public OptionsPopupMenuItem getMenuItem(@NonNull final String label) { - final UiObject2 menuItem = mLauncher.waitForObjectInContainer(mDeepShortcutsContainer, - By.text(label)); - return new OptionsPopupMenuItem(mLauncher, menuItem); - } -}