From 85a7a4c3cf90377a3a55874438e206f0c809b2c2 Mon Sep 17 00:00:00 2001 From: Fedor Kudasov Date: Tue, 11 Jan 2022 11:16:02 +0000 Subject: [PATCH] Add more annotations Bug: 209459024 Test: m SystemUI-core Change-Id: Ic3ac681a1cbf744d3592f1fa9dd164b60c0bfdc4 --- .../systemui/qs/AlphaControlledSignalTileView.java | 3 ++- .../src/com/android/systemui/qs/QSDualTileLabel.java | 4 ++++ .../src/com/android/systemui/qs/QSPanel.java | 12 +++++++++--- .../android/systemui/qs/QSPanelControllerBase.java | 5 +++++ .../qs/carrier/QSCarrierGroupController.java | 5 ++++- .../android/systemui/qs/customize/TileAdapter.java | 8 +++++++- .../android/systemui/qs/tileimpl/QSIconViewImpl.java | 2 ++ .../src/com/android/systemui/qs/tiles/CastTile.java | 2 +- 8 files changed, 34 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/AlphaControlledSignalTileView.java b/packages/SystemUI/src/com/android/systemui/qs/AlphaControlledSignalTileView.java index 6a6f5728fc5b7..e473dd22a09a6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/AlphaControlledSignalTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/AlphaControlledSignalTileView.java @@ -16,6 +16,7 @@ package com.android.systemui.qs; +import android.annotation.Nullable; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; @@ -73,7 +74,7 @@ public class AlphaControlledSignalTileView extends SignalTileView { } @Override - protected void setDrawableTintList(ColorStateList tint) { + protected void setDrawableTintList(@Nullable ColorStateList tint) { } /** diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java b/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java index 67cfc597d7e53..26399d8789aad 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java @@ -27,6 +27,8 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; + import com.android.systemui.R; import java.util.Objects; @@ -48,6 +50,7 @@ public class QSDualTileLabel extends LinearLayout { private final TextView mSecondLine; private final int mHorizontalPaddingPx; + @Nullable private String mText; public QSDualTileLabel(Context context) { @@ -122,6 +125,7 @@ public class QSDualTileLabel extends LinearLayout { rescheduleUpdateText(); } + @Nullable public String getText() { return mText; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 0c854df4a8378..5126fcb4c34db 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -48,6 +48,7 @@ import com.android.systemui.tuner.TunerService.Tunable; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** View that represents the quick settings tile panel (when expanded/pulled down). **/ public class QSPanel extends LinearLayout implements Tunable { @@ -78,7 +79,7 @@ public class QSPanel extends LinearLayout implements Tunable { protected boolean mExpanded; protected boolean mListening; - protected QSTileHost mHost; + @Nullable protected QSTileHost mHost; private final List mOnConfigurationChangedListeners = new ArrayList<>(); @@ -92,14 +93,18 @@ public class QSPanel extends LinearLayout implements Tunable { @Nullable private ViewGroup mHeaderContainer; + @Nullable private PageIndicator mFooterPageIndicator; private int mContentMarginStart; private int mContentMarginEnd; private boolean mUsingHorizontalLayout; + @Nullable private LinearLayout mHorizontalLinearLayout; + @Nullable protected LinearLayout mHorizontalContentContainer; + @Nullable protected QSTileLayout mTileLayout; private float mSquishinessFraction = 1f; private final ArrayMap mChildrenLayoutTop = new ArrayMap<>(); @@ -284,7 +289,7 @@ public class QSPanel extends LinearLayout implements Tunable { for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (move) { - int top = mChildrenLayoutTop.get(child); + int top = Objects.requireNonNull(mChildrenLayoutTop.get(child)); child.setLeftTopRightBottom(child.getLeft(), top + tileHeightOffset, child.getRight(), top + tileHeightOffset + child.getHeight()); } @@ -337,6 +342,7 @@ public class QSPanel extends LinearLayout implements Tunable { } } + @Nullable public QSTileHost getHost() { return mHost; } @@ -501,7 +507,6 @@ public class QSPanel extends LinearLayout implements Tunable { mListening = listening; } - protected void drawTile(QSPanelControllerBase.TileRecord r, QSTile.State state) { r.tileView.onStateChanged(state); } @@ -548,6 +553,7 @@ public class QSPanel extends LinearLayout implements Tunable { return getMeasuredHeight(); } + @Nullable QSTileLayout getTileLayout() { return mTileLayout; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java index 0bff72286008b..3172aa9592dd2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java @@ -76,6 +76,7 @@ public abstract class QSPanelControllerBase extends ViewContr private Consumer mMediaVisibilityChangedListener; private int mLastOrientation; private String mCachedSpecs = ""; + @Nullable private QSTileRevealController mQsTileRevealController; private float mRevealExpansion; @@ -185,6 +186,7 @@ public abstract class QSPanelControllerBase extends ViewContr mDumpManager.unregisterDumpable(mView.getDumpableTag()); } + @Nullable protected QSTileRevealController createTileRevealController() { return null; } @@ -250,6 +252,7 @@ public abstract class QSPanelControllerBase extends ViewContr return !mRecords.isEmpty(); } + @Nullable QSTileView getTileView(QSTile tile) { for (QSPanelControllerBase.TileRecord r : mRecords) { if (r.tile == tile) { @@ -411,6 +414,7 @@ public abstract class QSPanelControllerBase extends ViewContr mUsingHorizontalLayoutChangedListener = listener; } + @Nullable public View getBrightnessView() { return mView.getBrightnessView(); } @@ -425,6 +429,7 @@ public abstract class QSPanelControllerBase extends ViewContr public QSTile tile; public com.android.systemui.plugins.qs.QSTileView tileView; public boolean scanState; + @Nullable public QSTile.Callback callback; } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java index 4b705adf1d112..6908e5ab49e6a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java @@ -20,6 +20,7 @@ import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES; import android.annotation.MainThread; import android.annotation.NonNull; +import android.annotation.Nullable; import android.content.Context; import android.content.Intent; import android.os.Handler; @@ -81,6 +82,7 @@ public class QSCarrierGroupController { private final CarrierConfigTracker mCarrierConfigTracker; private boolean mIsSingleCarrier; + @Nullable private OnSingleCarrierChangedListener mOnSingleCarrierChangedListener; private final SlotIndexResolver mSlotIndexResolver; @@ -294,7 +296,8 @@ public class QSCarrierGroupController { * This will get notified when the number of carriers changes between 1 and "not one". * @param listener */ - public void setOnSingleCarrierChangedListener(OnSingleCarrierChangedListener listener) { + public void setOnSingleCarrierChangedListener( + @Nullable OnSingleCarrierChangedListener listener) { mOnSingleCarrierChangedListener = listener; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java index 90cf92a6543dc..c1970b962d2e4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java @@ -96,15 +96,20 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta private int mFocusIndex; private boolean mNeedsFocus; + @Nullable private List mCurrentSpecs; + @Nullable private List mOtherTiles; + @Nullable private List mAllTiles; + @Nullable private Holder mCurrentDrag; private int mAccessibilityAction = ACTION_NONE; private int mAccessibilityFromIndex; private final UiEventLogger mUiEventLogger; private final AccessibilityDelegateCompat mAccessibilityDelegate; + @Nullable private RecyclerView mRecyclerView; private int mNumColumns; @@ -240,6 +245,7 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta notifyDataSetChanged(); } + @Nullable private TileInfo getAndRemoveOther(String s) { for (int i = 0; i < mOtherTiles.size(); i++) { if (mOtherTiles.get(i).spec.equals(s)) { @@ -555,7 +561,7 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta } public class Holder extends ViewHolder { - private QSTileViewImpl mTileView; + @Nullable private QSTileViewImpl mTileView; public Holder(View itemView) { super(itemView); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java index 106a1b60a7a80..7fb9ef34cfd1d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java @@ -17,6 +17,7 @@ package com.android.systemui.qs.tileimpl; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; +import android.annotation.Nullable; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; @@ -49,6 +50,7 @@ public class QSIconViewImpl extends QSIconView { private boolean mAnimationEnabled = true; private int mState = -1; private int mTint; + @Nullable private QSTile.Icon mLastIcon; public QSIconViewImpl(Context context) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index e8d27eccc8232..a70f534c8f0a7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -316,5 +316,5 @@ public class CastTile extends QSTileImpl { public void onKeyguardShowingChanged() { refreshState(); } - }; + } }