Merge "Add @Nullable annotations for simple cases" into sc-v2-dev
diff --git a/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java b/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java
index 492611f..d4eca2f 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 @@
*/
public class GoOverviewActionsView extends OverviewActionsView<OverlayUICallbacksGo> {
+ @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 e9d7c3c..d79b318 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.view.MotionEvent;
import android.view.View;
+import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.AbstractFloatingView;
@@ -58,6 +59,7 @@
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 7c8041c..dbdcf19 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.widget.FrameLayout;
import android.widget.TextView;
+import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.android.launcher3.BaseActivity;
@@ -69,6 +70,7 @@
private Task mTask;
private boolean mHasLimit;
private long mAppRemainingTimeMs;
+ @Nullable
private View mBanner;
private ViewOutlineProvider mOldBannerOutlineProvider;
private float mBannerOffsetPercentage;
@@ -234,7 +236,7 @@
task.titleDescription;
}
- private void replaceBanner(View view) {
+ private void replaceBanner(@Nullable View view) {
resetOldBanner();
setBanner(view);
}
@@ -248,7 +250,7 @@
}
}
- 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 1548268..c3b166f 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.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 @@
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 @@
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 @@
/** 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 463ed4b..8a5f42a 100644
--- a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
+++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
@@ -57,10 +57,14 @@
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 ebc6cc4..30b55a8 100644
--- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
+++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
@@ -39,10 +39,13 @@
*/
public class GroupedTaskView extends TaskView {
+ @Nullable
private Task mSecondaryTask;
private TaskThumbnailView mSnapshotView2;
private IconView mIconView2;
+ @Nullable
private CancellableTask<ThumbnailData> mThumbnailLoadRequest2;
+ @Nullable
private CancellableTask mIconLoadRequest2;
private final float[] mIcon2CenterCoords = new float[2];
private TransformingTouchDelegate mIcon2TouchDelegate;
@@ -153,6 +156,7 @@
}
}
+ @Nullable
@Override
public RunnableList launchTaskAnimated() {
getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask,
@@ -168,7 +172,7 @@
}
@Override
- void refreshThumbnails(HashMap<Integer, ThumbnailData> thumbnailDatas) {
+ void refreshThumbnails(@Nullable HashMap<Integer, ThumbnailData> 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 813e653..ccb1a99 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.view.Gravity;
import android.view.View;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.Utilities;
/**
@@ -31,6 +33,7 @@
*/
public class IconView extends View {
+ @Nullable
private Drawable mDrawable;
private int mDrawableWidth, mDrawableHeight;
@@ -46,7 +49,10 @@
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 @@
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 5c0b50c..f3b6a63 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -90,8 +90,10 @@
@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 845e13e..04a5761 100644
--- a/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java
+++ b/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java
@@ -40,6 +40,7 @@
}
};
+ @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 d55b89c..853a023 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.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 @@
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 d498428..c960f88 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -78,6 +78,7 @@
};
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 @@
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 @@
* 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 @@
}
/** 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 @@
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 9f961c9..3da7893 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -360,6 +360,7 @@
private final TaskOutlineProvider mOutlineProvider;
+ @Nullable
protected Task mTask;
protected TaskThumbnailView mSnapshotView;
protected IconView mIconView;
@@ -394,6 +395,7 @@
private float mSplitSelectTranslationX;
private float mSplitSelectScrollOffsetPrimary;
+ @Nullable
private ObjectAnimator mIconAndDimAnimator;
private float mIconScaleAnimStartProgress = 0;
private float mFocusTransitionProgress = 1;
@@ -411,7 +413,9 @@
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 @@
return mTaskIdAttributeContainer;
}
+ @Nullable
public Task getTask() {
return mTask;
}
@@ -686,6 +691,7 @@
* 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 @@
}
}
- protected void setIcon(IconView iconView, Drawable icon) {
+ protected void setIcon(IconView iconView, @Nullable Drawable icon) {
if (icon != null) {
iconView.setDrawable(icon);
iconView.setOnClickListener(v -> {