diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java index ffac26b2e2728..1ef5324077614 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java @@ -159,9 +159,9 @@ public interface QSTile { public Supplier iconSupplier; public int state = DEFAULT_STATE; public CharSequence label; - public CharSequence secondaryLabel; + @Nullable public CharSequence secondaryLabel; public CharSequence contentDescription; - public CharSequence stateDescription; + @Nullable public CharSequence stateDescription; public CharSequence dualLabelContentDescription; public boolean disabledByPolicy; public boolean dualTarget = false; @@ -170,6 +170,7 @@ public interface QSTile { public SlashState slash; public boolean handlesLongClick = true; public boolean showRippleEffect = true; + @Nullable public Drawable sideViewCustomDrawable; public String spec; diff --git a/packages/SystemUI/src/com/android/systemui/qs/AutoSizingList.java b/packages/SystemUI/src/com/android/systemui/qs/AutoSizingList.java index 1195184050e3d..18d28bf511bca 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/AutoSizingList.java +++ b/packages/SystemUI/src/com/android/systemui/qs/AutoSizingList.java @@ -36,6 +36,7 @@ public class AutoSizingList extends LinearLayout { private final int mItemSize; private final Handler mHandler; + @Nullable private ListAdapter mAdapter; private int mCount; private boolean mEnableAutoSizing; diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index 6d1f8f7d01b1c..d20141b338389 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java @@ -19,6 +19,7 @@ import android.view.animation.Interpolator; import android.view.animation.OvershootInterpolator; import android.widget.Scroller; +import androidx.annotation.Nullable; import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; @@ -51,14 +52,17 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { private final ArrayList mTiles = new ArrayList<>(); private final ArrayList mPages = new ArrayList<>(); + @Nullable private PageIndicator mPageIndicator; private float mPageIndicatorPosition; + @Nullable private PageListener mPageListener; private boolean mListening; private Scroller mScroller; + @Nullable private AnimatorSet mBounceAnimatorSet; private float mLastExpansion; private boolean mDistributeTiles = false; diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java index 6c7d6e01e9ec7..e06b768dbe6f8 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java @@ -26,6 +26,8 @@ import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.View.OnLayoutChangeListener; +import androidx.annotation.Nullable; + import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.qs.QS; import com.android.systemui.plugins.qs.QSTile; @@ -88,6 +90,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha private final View mQSFooterActions; private final View mQQSFooterActions; + @Nullable private PagedTileLayout mPagedLayout; private boolean mOnFirstPage = true; @@ -95,6 +98,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha private final QSExpansionPathInterpolator mQSExpansionPathInterpolator; // Animator for elements in the first page, including secondary labels and qqs brightness // slider, as well as animating the alpha of the QS tile layout (as we are tracking QQS tiles) + @Nullable private TouchAnimator mFirstPageAnimator; // TranslationX animator for QQS/QS tiles private TouchAnimator mTranslationXAnimator; @@ -109,13 +113,16 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha // This animates fading of SecurityFooter and media divider private TouchAnimator mAllPagesDelayedAnimator; // Animator for brightness slider(s) + @Nullable private TouchAnimator mBrightnessAnimator; // Animator for Footer actions in QQS private TouchAnimator mQQSFooterActionsAnimator; // Height animator for QQS tiles (height changing from QQS size to QS size) + @Nullable private HeightExpansionAnimator mQQSTileHeightAnimator; // Height animator for QS tile in first page but not in QQS, to present the illusion that they // are expanding alongside the QQS tiles + @Nullable private HeightExpansionAnimator mOtherFirstPageTilesHeightAnimator; // Pair of animators for each non first page. The creation is delayed until the user first // scrolls to that page, in order to get the proper measures and layout. @@ -215,7 +222,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha } @Override - public void onViewAttachedToWindow(View v) { + public void onViewAttachedToWindow(@Nullable View v) { mTunerService.addTunable(this, ALLOW_FANCY_ANIMATION, MOVE_FULL_ROWS); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java index d43404b8781c1..04e22522bcd0c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java @@ -64,15 +64,18 @@ public class QSDetail extends LinearLayout { protected TextView mDetailDoneButton; @VisibleForTesting QSDetailClipper mClipper; + @Nullable private DetailAdapter mDetailAdapter; private QSPanelController mQsPanelController; protected View mQsDetailHeader; protected TextView mQsDetailHeaderTitle; private ViewStub mQsDetailHeaderSwitchStub; + @Nullable private Switch mQsDetailHeaderSwitch; protected ImageView mQsDetailHeaderProgress; + @Nullable protected QSTileHost mHost; private boolean mScanState; @@ -87,6 +90,7 @@ public class QSDetail extends LinearLayout { private boolean mSwitchState; private QSFooter mFooter; + @Nullable private QSContainerController mQsContainerController; public QSDetail(Context context, @Nullable AttributeSet attrs) { @@ -183,12 +187,14 @@ public class QSDetail extends LinearLayout { } public interface Callback { - void onShowingDetail(DetailAdapter detail, int x, int y); + /** Handle an event of showing detail. */ + void onShowingDetail(@Nullable DetailAdapter detail, int x, int y); void onToggleStateChanged(boolean state); void onScanStateChanged(boolean state); } - public void handleShowingDetail(final DetailAdapter adapter, int x, int y, + /** Handle an event of showing detail. */ + public void handleShowingDetail(final @Nullable DetailAdapter adapter, int x, int y, boolean toggleQs) { final boolean showingDetail = adapter != null; final boolean wasShowingDetail = mDetailAdapter != null; @@ -378,7 +384,8 @@ public class QSDetail extends LinearLayout { } @Override - public void onShowingDetail(final DetailAdapter detail, final int x, final int y) { + public void onShowingDetail( + final @Nullable DetailAdapter detail, final int x, final int y) { post(new Runnable() { @Override public void run() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java index 63cedd081fb10..43136d32c68f5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java @@ -23,12 +23,15 @@ import android.graphics.drawable.TransitionDrawable; import android.view.View; import android.view.ViewAnimationUtils; +import androidx.annotation.Nullable; + /** Helper for quick settings detail panel clip animations. **/ public class QSDetailClipper { private final View mDetail; private final TransitionDrawable mBackground; + @Nullable private Animator mAnimator; public QSDetailClipper(View detail) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailDisplayer.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailDisplayer.java index b50af004aff95..afd4f0f7d1e29 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailDisplayer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailDisplayer.java @@ -16,6 +16,8 @@ package com.android.systemui.qs; +import androidx.annotation.Nullable; + import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.plugins.qs.DetailAdapter; @@ -26,13 +28,14 @@ import javax.inject.Inject; */ @SysUISingleton public class QSDetailDisplayer { + @Nullable private QSPanelController mQsPanelController; @Inject public QSDetailDisplayer() { } - public void setQsPanelController(QSPanelController qsPanelController) { + public void setQsPanelController(@Nullable QSPanelController qsPanelController) { mQsPanelController = qsPanelController; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java index e93c349ee41f5..eb3247b538237 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java @@ -33,6 +33,8 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.Nullable; + import com.android.systemui.FontSizeUtils; import com.android.systemui.R; import com.android.systemui.plugins.qs.QSTile; @@ -50,6 +52,7 @@ public class QSDetailItems extends FrameLayout { private final Adapter mAdapter = new Adapter(); private String mTag; + @Nullable private Callback mCallback; private boolean mItemsVisible = true; private AutoSizingList mItemList; @@ -130,7 +133,8 @@ public class QSDetailItems extends FrameLayout { mHandler.obtainMessage(H.SET_CALLBACK, callback).sendToTarget(); } - public void setItems(Item[] items) { + /** Set items. */ + public void setItems(@Nullable Item[] items) { mHandler.removeMessages(H.SET_ITEMS); mHandler.obtainMessage(H.SET_ITEMS, items).sendToTarget(); } @@ -266,9 +270,12 @@ public class QSDetailItems extends FrameLayout { } public int iconResId; + @Nullable public QSTile.Icon icon; + @Nullable public Drawable overlay; public CharSequence line1; + @Nullable public CharSequence line2; public Object tag; public boolean canDisconnect; diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java index 4d23958d56ab4..066a286b271d9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterView.java @@ -48,6 +48,7 @@ public class QSFooterView extends FrameLayout { private TextView mBuildText; private View mActionsContainer; + @Nullable protected TouchAnimator mFooterAnimator; private boolean mQsDisabled; @@ -56,6 +57,7 @@ public class QSFooterView extends FrameLayout { private boolean mShouldShowBuildText; + @Nullable private OnClickListener mExpandClickListener; private final ContentObserver mDeveloperSettingsObserver = new ContentObserver( diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index bb8a1e8e22a4b..41dced6bffebc 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -117,6 +117,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca private QSPanelController mQSPanelController; private QuickQSPanelController mQuickQSPanelController; private QSCustomizerController mQSCustomizerController; + @Nullable private ScrollListener mScrollListener; /** * When true, QS will translate from outside the screen. It will be clipped with parallax diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java index 7f19d0e6c25c8..878f7530fa8b5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java @@ -48,6 +48,7 @@ import android.view.Window; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.internal.util.FrameworkStatsLog; @@ -85,8 +86,10 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen protected H mHandler; private boolean mIsVisible; + @Nullable private CharSequence mFooterTextContent = null; private int mFooterIconId; + @Nullable private Drawable mPrimaryFooterIconDrawable; @Inject @@ -240,6 +243,7 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen mMainHandler.post(mUpdateDisplayState); } + @Nullable protected CharSequence getFooterText(boolean isDeviceManaged, boolean hasWorkProfile, boolean hasCACerts, boolean hasCACertsInWorkProfile, boolean isNetworkLoggingEnabled, String vpnName, String vpnNameWorkProfile, CharSequence organizationName, @@ -497,6 +501,7 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen return mContext.getString(R.string.ok); } + @Nullable private String getNegativeButton() { if (mSecurityController.isParentalControlsEnabled()) { return mContext.getString(R.string.monitoring_button_view_controls); @@ -504,6 +509,7 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen return null; } + @Nullable protected CharSequence getManagementMessage(boolean isDeviceManaged, CharSequence organizationName) { if (!isDeviceManaged) { @@ -521,6 +527,7 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen return mContext.getString(R.string.monitoring_description_management); } + @Nullable protected CharSequence getCaCertsMessage(boolean isDeviceManaged, boolean hasCACerts, boolean hasCACertsInWorkProfile) { if (!(hasCACerts || hasCACertsInWorkProfile)) return null; @@ -534,6 +541,7 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen return mContext.getString(R.string.monitoring_description_ca_certificate); } + @Nullable protected CharSequence getNetworkLoggingMessage(boolean isDeviceManaged, boolean isNetworkLoggingEnabled) { if (!isNetworkLoggingEnabled) return null; @@ -545,6 +553,7 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen } } + @Nullable protected CharSequence getVpnMessage(boolean isDeviceManaged, boolean hasWorkProfile, String vpnName, String vpnNameWorkProfile) { if (vpnName == null && vpnNameWorkProfile == null) return null; diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java index 1030c21ecc79b..cca491343f765 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java @@ -29,6 +29,8 @@ import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; +import androidx.annotation.Nullable; + import com.android.internal.logging.InstanceId; import com.android.internal.logging.InstanceIdSequence; import com.android.internal.logging.UiEventLogger; @@ -98,6 +100,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener, D private final CustomTileStatePersister mCustomTileStatePersister; private final List mCallbacks = new ArrayList<>(); + @Nullable private AutoTileManager mAutoTiles; private final StatusBarIconController mIconController; private final ArrayList mQsFactories = new ArrayList<>(); @@ -472,6 +475,8 @@ public class QSTileHost implements QSHost, Tunable, PluginListener, D saveTilesToSettings(newTiles); } + /** Create a {@link QSTile} of a {@code tileSpec} type. */ + @Nullable public QSTile createTile(String tileSpec) { for (int i = 0; i < mQsFactories.size(); i++) { QSTile t = mQsFactories.get(i).createTile(tileSpec); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index 8b94983943847..866b1b8cabb2f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -33,6 +33,7 @@ import android.widget.LinearLayout; import android.widget.Space; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.android.internal.policy.SystemBarUtils; import com.android.settingslib.Utils; @@ -44,7 +45,6 @@ import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconMa import com.android.systemui.statusbar.phone.StatusIconContainer; import com.android.systemui.statusbar.policy.Clock; import com.android.systemui.statusbar.policy.VariableDateView; -import com.android.systemui.statusbar.window.StatusBarWindowView; import java.util.List; @@ -57,8 +57,11 @@ public class QuickStatusBarHeader extends FrameLayout { private boolean mExpanded; private boolean mQsDisabled; + @Nullable private TouchAnimator mAlphaAnimator; + @Nullable private TouchAnimator mTranslationAnimator; + @Nullable private TouchAnimator mIconsAlphaAnimator; private TouchAnimator mIconsAlphaAnimatorFixed; @@ -85,7 +88,9 @@ public class QuickStatusBarHeader extends FrameLayout { private StatusIconContainer mIconContainer; private View mPrivacyChip; + @Nullable private TintedIconManager mTintedIconManager; + @Nullable private QSExpansionPathInterpolator mQSExpansionPathInterpolator; private StatusBarContentInsetsProvider mInsetsProvider; diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/QuickTileLayout.java index bb2340c2cad51..130bcab84f4ab 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickTileLayout.java @@ -7,13 +7,15 @@ import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; +import androidx.annotation.Nullable; + public class QuickTileLayout extends LinearLayout { public QuickTileLayout(Context context) { this(context, null); } - public QuickTileLayout(Context context, AttributeSet attrs) { + public QuickTileLayout(Context context, @Nullable AttributeSet attrs) { super(context, attrs); setGravity(Gravity.CENTER); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/SlashDrawable.java b/packages/SystemUI/src/com/android/systemui/qs/SlashDrawable.java index a9b2376e46e5d..90118539c9122 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/SlashDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/qs/SlashDrawable.java @@ -60,7 +60,9 @@ public class SlashDrawable extends Drawable { private final RectF mSlashRect = new RectF(0, 0, 0, 0); private float mRotation; private boolean mSlashed; + @Nullable private Mode mTintMode; + @Nullable private ColorStateList mTintList; private boolean mAnimationEnabled = true; diff --git a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java index bff318a6f44e4..da82d2cb7e8d1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java @@ -9,6 +9,8 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.Nullable; + import com.android.internal.logging.UiEventLogger; import com.android.systemui.R; import com.android.systemui.qs.QSPanel.QSTileLayout; @@ -49,7 +51,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout { this(context, null); } - public TileLayout(Context context, AttributeSet attrs) { + public TileLayout(Context context, @Nullable AttributeSet attrs) { super(context, attrs); setFocusableInTouchMode(true); mLessRows = ((Settings.System.getInt(context.getContentResolver(), "qs_less_rows", 0) != 0) @@ -67,7 +69,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout { } @Override - public void setListening(boolean listening, UiEventLogger uiEventLogger) { + public void setListening(boolean listening, @Nullable UiEventLogger uiEventLogger) { if (mListening == listening) return; mListening = listening; for (TileRecord record : mRecords) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java index ca8f681604542..bc62416ca3a3d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java @@ -20,6 +20,8 @@ import android.util.Property; import android.view.View; import android.view.animation.Interpolator; +import androidx.annotation.Nullable; + import java.util.ArrayList; import java.util.List; @@ -37,12 +39,19 @@ public class TouchAnimator { private final float mStartDelay; private final float mEndDelay; private final float mSpan; + @Nullable private final Interpolator mInterpolator; + @Nullable private final Listener mListener; private float mLastT = -1; - private TouchAnimator(Object[] targets, KeyframeSet[] keyframeSets, - float startDelay, float endDelay, Interpolator interpolator, Listener listener) { + private TouchAnimator( + Object[] targets, + KeyframeSet[] keyframeSets, + float startDelay, + float endDelay, + @Nullable Interpolator interpolator, + @Nullable Listener listener) { mTargets = targets; mKeyframeSets = keyframeSets; mStartDelay = startDelay; @@ -126,7 +135,9 @@ public class TouchAnimator { private float mStartDelay; private float mEndDelay; + @Nullable private Interpolator mInterpolator; + @Nullable private Listener mListener; public Builder addFloat(Object target, String property, float... values) { @@ -183,7 +194,8 @@ public class TouchAnimator { return this; } - public Builder setInterpolator(Interpolator intepolator) { + /** Sets interpolator. */ + public Builder setInterpolator(@Nullable Interpolator intepolator) { mInterpolator = intepolator; return this; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java index 32ac73375f1d9..2959c3b30eec4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java +++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java @@ -25,6 +25,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.settingslib.Utils; @@ -40,6 +41,7 @@ public class QSCarrier extends LinearLayout { private ImageView mMobileSignal; private ImageView mMobileRoaming; private View mSpacer; + @Nullable private CellSignalState mLastSignalState; private boolean mProviderModelInitialized = false; private boolean mIsSingleCarrier; @@ -125,7 +127,7 @@ public class QSCarrier extends LinearLayout { return true; } - private boolean hasValidTypeContentDescription(String typeContentDescription) { + private boolean hasValidTypeContentDescription(@Nullable String typeContentDescription) { return TextUtils.equals(typeContentDescription, mContext.getString(R.string.data_connection_no_internet)) || TextUtils.equals(typeContentDescription, diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java index 9ebdb1cf35fe5..b59c0ccc510a1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java @@ -28,6 +28,7 @@ import android.view.View; import android.widget.LinearLayout; import android.widget.Toolbar; +import androidx.annotation.Nullable; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.RecyclerView; @@ -107,7 +108,7 @@ public class QSCustomizer extends LinearLayout { mQsContainerController = controller; } - public void setQs(QS qs) { + public void setQs(@Nullable QS qs) { mQs = qs; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizerController.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizerController.java index 618a429f6b516..97390112c3ed1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizerController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizerController.java @@ -28,6 +28,7 @@ import android.widget.TextView; import android.widget.Toolbar; import android.widget.Toolbar.OnMenuItemClickListener; +import androidx.annotation.Nullable; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -198,7 +199,7 @@ public class QSCustomizerController extends ViewController { } /** */ - public void setQs(QSFragment qsFragment) { + public void setQs(@Nullable QSFragment qsFragment) { mView.setQs(qsFragment); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java index eae256532c545..b29687fe74c3b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java @@ -31,6 +31,8 @@ import android.text.TextUtils; import android.util.ArraySet; import android.widget.Button; +import androidx.annotation.Nullable; + import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; @@ -79,7 +81,7 @@ public class TileQueryHelper { mUserTracker = userTracker; } - public void setListener(TileStateListener listener) { + public void setListener(@Nullable TileStateListener listener) { mListener = listener; } @@ -269,6 +271,7 @@ public class TileQueryHelper { }); } + @Nullable private State getState(Collection tiles, String spec) { for (QSTile tile : tiles) { if (spec.equals(tile.getTileSpec())) { @@ -278,7 +281,8 @@ public class TileQueryHelper { return null; } - private void addTile(String spec, CharSequence appLabel, State state, boolean isSystem) { + private void addTile( + String spec, @Nullable CharSequence appLabel, State state, boolean isSystem) { if (mSpecs.contains(spec)) { return; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java b/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java index 10efec309971c..4f15351322ee2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java @@ -89,7 +89,9 @@ public class CustomTile extends QSTileImpl implements TileChangeListener private final TileServiceManager mServiceManager; private final int mUser; private final CustomTileStatePersister mCustomTileStatePersister; + @Nullable private android.graphics.drawable.Icon mDefaultIcon; + @Nullable private CharSequence mDefaultLabel; private final Context mUserContext; @@ -197,8 +199,8 @@ public class CustomTile extends QSTileImpl implements TileChangeListener /** * Compare two icons, only works for resources. */ - private boolean iconEquals(android.graphics.drawable.Icon icon1, - android.graphics.drawable.Icon icon2) { + private boolean iconEquals(@Nullable android.graphics.drawable.Icon icon1, + @Nullable android.graphics.drawable.Icon icon2) { if (icon1 == icon2) { return true; } @@ -372,6 +374,7 @@ public class CustomTile extends QSTileImpl implements TileChangeListener Uri.fromParts("package", mComponent.getPackageName(), null)); } + @Nullable private Intent resolveIntent(Intent i) { ResolveInfo result = mContext.getPackageManager().resolveActivityAsUser(i, 0, mUser); return result != null ? new Intent(TileService.ACTION_QS_TILE_PREFERENCES) diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java index e6612fe8f08b7..17ae7ffa99805 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java @@ -36,6 +36,7 @@ import android.service.quicksettings.TileService; import android.util.ArraySet; import android.util.Log; +import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.systemui.broadcast.BroadcastDispatcher; @@ -85,6 +86,7 @@ public class TileLifecycleManager extends BroadcastReceiver implements private final BroadcastDispatcher mBroadcastDispatcher; private Set mQueuedMessages = new ArraySet<>(); + @Nullable private QSTileServiceWrapper mWrapper; private boolean mListening; private IBinder mClickBinder; @@ -95,6 +97,7 @@ public class TileLifecycleManager extends BroadcastReceiver implements private AtomicBoolean mPackageReceiverRegistered = new AtomicBoolean(false); private AtomicBoolean mUserReceiverRegistered = new AtomicBoolean(false); private boolean mUnbindImmediate; + @Nullable private TileChangeListener mChangeListener; // Return value from bindServiceAsUser, determines whether safe to call unbind. private boolean mIsBound; @@ -466,6 +469,7 @@ public class TileLifecycleManager extends BroadcastReceiver implements } } + @Nullable @Override public IBinder asBinder() { return mWrapper != null ? mWrapper.asBinder() : null; diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java index bfa2aaa4e785f..0a3c17c9045a6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java +++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java @@ -35,6 +35,8 @@ import android.service.quicksettings.TileService; import android.util.ArrayMap; import android.util.Log; +import androidx.annotation.Nullable; + import com.android.internal.statusbar.StatusBarIcon; import com.android.systemui.Dependency; import com.android.systemui.broadcast.BroadcastDispatcher; @@ -297,6 +299,7 @@ public class TileServices extends IQSService.Stub { } } + @Nullable @Override public Tile getTile(IBinder token) { CustomTile customTile = getTileForToken(token); @@ -330,12 +333,14 @@ public class TileServices extends IQSService.Stub { return keyguardStateController.isMethodSecure() && keyguardStateController.isShowing(); } + @Nullable private CustomTile getTileForToken(IBinder token) { synchronized (mServices) { return mTokenMap.get(token); } } + @Nullable private CustomTile getTileForComponent(ComponentName component) { synchronized (mServices) { return mTiles.get(component); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java index 76950d1448d66..5e68f611293ed 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java @@ -18,6 +18,8 @@ import android.content.Context; import android.os.Build; import android.util.Log; +import androidx.annotation.Nullable; + import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.plugins.qs.QSFactory; import com.android.systemui.plugins.qs.QSIconView; @@ -173,6 +175,8 @@ public class QSFactoryImpl implements QSFactory { mColorCorrectionTileProvider = colorCorrectionTileProvider; } + /** Creates a tile with a type based on {@code tileSpec} */ + @Nullable public final QSTile createTile(String tileSpec) { QSTileImpl tile = createTileInternal(tileSpec); if (tile != null) { @@ -182,6 +186,7 @@ public class QSFactoryImpl implements QSFactory { return tile; } + @Nullable protected QSTileImpl createTileInternal(String tileSpec) { // Stock tiles. switch (tileSpec) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java index b5f07d175274f..6d9d5b16fcabe 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java @@ -116,6 +116,7 @@ public abstract class QSTileImpl implements QSTile, Lifecy private boolean mAnnounceNextStateChange; private String mTileSpec; + @Nullable private EnforcedAdmin mEnforcedAdmin; private boolean mShowingDetail; private int mIsFullQs; @@ -260,6 +261,8 @@ public abstract class QSTileImpl implements QSTile, Lifecy return new QSIconViewImpl(context); } + /** Returns corresponding DetailAdapter. */ + @Nullable public DetailAdapter getDetailAdapter() { return null; // optional } @@ -342,7 +345,7 @@ public abstract class QSTileImpl implements QSTile, Lifecy refreshState(null); } - protected final void refreshState(Object arg) { + protected final void refreshState(@Nullable Object arg) { mHandler.obtainMessage(H.REFRESH_STATE, arg).sendToTarget(); } @@ -432,9 +435,10 @@ public abstract class QSTileImpl implements QSTile, Lifecy * * @return the intent to launch */ + @Nullable public abstract Intent getLongClickIntent(); - protected void handleRefreshState(Object arg) { + protected void handleRefreshState(@Nullable Object arg) { handleUpdateState(mTmpState, arg); boolean changed = mTmpState.copyTo(mState); if (mReadyState == READY_STATE_READYING) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java index 72c68ce12ca45..f1e82b6a18a4f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java @@ -27,6 +27,7 @@ import com.android.systemui.qs.SlashDrawable; public class SlashImageView extends ImageView { + @Nullable @VisibleForTesting protected SlashDrawable mSlash; private boolean mAnimationEnabled = true; @@ -35,6 +36,7 @@ public class SlashImageView extends ImageView { super(context); } + @Nullable protected SlashDrawable getSlash() { return mSlash; } @@ -52,7 +54,7 @@ public class SlashImageView extends ImageView { } @Override - public void setImageDrawable(Drawable drawable) { + public void setImageDrawable(@Nullable Drawable drawable) { if (drawable == null) { mSlash = null; super.setImageDrawable(null); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java index 5552105a77c0c..754f8e26ee873 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -320,6 +320,7 @@ public class BluetoothTile extends QSTileImpl { // We probably won't ever have space in the UI for more than 20 devices, so don't // get info for them. private static final int MAX_DEVICES = 20; + @Nullable private QSDetailItems mItems; @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index e5601f29af0bd..698a2538ee87e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -257,7 +257,9 @@ public class CellularTile extends QSTileImpl { private static final class CallbackInfo { boolean airplaneModeEnabled; + @Nullable CharSequence dataSubscriptionName; + @Nullable CharSequence dataContentDescription; boolean activityIn; boolean activityOut; @@ -320,6 +322,7 @@ public class CellularTile extends QSTileImpl { return mContext.getString(R.string.quick_settings_cellular_detail_title); } + @Nullable @Override public Boolean getToggleState() { return mDataController.isMobileDataSupported() diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index 49c548da63f54..a06dc8b2c19a9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -360,6 +360,7 @@ public class DndTile extends QSTileImpl { private final class DndDetailAdapter implements DetailAdapter, OnAttachStateChangeListener { + @Nullable private ZenModePanel mZenPanel; private boolean mAuto; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java index cd81b4a11703b..9df942d3260a6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java @@ -145,13 +145,15 @@ public class InternetTile extends QSTileImpl { && mHost.getUserContext().getUserId() == UserHandle.USER_SYSTEM); } - private CharSequence getSecondaryLabel(boolean isTransient, String statusLabel) { + @Nullable + private CharSequence getSecondaryLabel(boolean isTransient, @Nullable String statusLabel) { return isTransient ? mContext.getString(R.string.quick_settings_wifi_secondary_label_transient) : statusLabel; } - private static String removeDoubleQuotes(String string) { + @Nullable + private static String removeDoubleQuotes(@Nullable String string) { if (string == null) return null; final int length = string.length(); if ((length > 1) && (string.charAt(0) == '"') && (string.charAt(length - 1) == '"')) { @@ -163,6 +165,7 @@ public class InternetTile extends QSTileImpl { private static final class EthernetCallbackInfo { boolean mConnected; int mEthernetSignalIconId; + @Nullable String mEthernetContentDescription; @Override @@ -180,11 +183,14 @@ public class InternetTile extends QSTileImpl { boolean mEnabled; boolean mConnected; int mWifiSignalIconId; + @Nullable String mSsid; boolean mActivityIn; boolean mActivityOut; + @Nullable String mWifiSignalContentDescription; boolean mIsTransient; + @Nullable public String mStatusLabel; boolean mNoDefaultNetwork; boolean mNoValidatedNetwork; @@ -211,7 +217,9 @@ public class InternetTile extends QSTileImpl { private static final class CellularCallbackInfo { boolean mAirplaneModeEnabled; + @Nullable CharSequence mDataSubscriptionName; + @Nullable CharSequence mDataContentDescription; int mMobileSignalIconId; int mQsTypeIcon; @@ -540,7 +548,8 @@ public class InternetTile extends QSTileImpl { } } - private CharSequence appendMobileDataType(CharSequence current, CharSequence dataType) { + private CharSequence appendMobileDataType( + @Nullable CharSequence current, @Nullable CharSequence dataType) { if (TextUtils.isEmpty(dataType)) { return Html.fromHtml((current == null ? "" : current.toString()), 0); } @@ -551,6 +560,7 @@ public class InternetTile extends QSTileImpl { return Html.fromHtml(concat, 0); } + @Nullable private CharSequence getMobileDataContentName(CellularCallbackInfo cb) { if (cb.mRoaming && !TextUtils.isEmpty(cb.mDataContentDescription)) { String roaming = mContext.getString(R.string.data_connection_roaming); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java index 0886b46f9d2f2..a61f0ce0c8640 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java @@ -54,6 +54,7 @@ public class NfcTile extends QSTileImpl { private static final String NFC = "nfc"; private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_nfc); + @Nullable private NfcAdapter mAdapter; private BroadcastDispatcher mBroadcastDispatcher; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java index 9996ecd74fd23..b65802506cbf0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java @@ -131,6 +131,7 @@ public class QRCodeScannerTile extends QSTileImpl { return mQRCodeScannerController.isCameraAvailable(); } + @Nullable @Override public Intent getLongClickIntent() { return null; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java index d9919bdac889c..247f02b120db8 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java @@ -72,8 +72,10 @@ public class QuickAccessWalletTile extends QSTileImpl { private final SecureSettings mSecureSettings; private final QuickAccessWalletController mController; + @Nullable private WalletCard mSelectedCard; private boolean mIsWalletUpdating = true; + @Nullable @VisibleForTesting Drawable mCardViewDrawable; @Inject @@ -200,6 +202,7 @@ public class QuickAccessWalletTile extends QSTileImpl { && mSecureSettings.getString(NFC_PAYMENT_DEFAULT_COMPONENT) != null; } + @Nullable @Override public Intent getLongClickIntent() { return null; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java index 8ff75cb3662d4..45e43ee20d673 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java @@ -136,6 +136,7 @@ public class ScreenRecordTile extends QSTileImpl return 0; } + @Nullable @Override public Intent getLongClickIntent() { return null; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyToggleTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyToggleTile.java index b0a1b18a8cd51..0be0619145b3f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyToggleTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyToggleTile.java @@ -134,6 +134,7 @@ public abstract class SensorPrivacyToggleTile extends QSTileImpl implements UserInfoController.On private final UserSwitcherController mUserSwitcherController; private final UserInfoController mUserInfoController; + @Nullable private Pair mLastUpdate; @Inject diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 1608248f7c549..c82ff341bb123 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -258,6 +258,7 @@ public class WifiTile extends QSTileImpl { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI); } + @Nullable private static String removeDoubleQuotes(String string) { if (string == null) return null; final int length = string.length(); @@ -271,11 +272,14 @@ public class WifiTile extends QSTileImpl { boolean enabled; boolean connected; int wifiSignalIconId; + @Nullable String ssid; boolean activityIn; boolean activityOut; + @Nullable String wifiSignalContentDescription; boolean isTransient; + @Nullable public String statusLabel; @Override @@ -321,7 +325,9 @@ public class WifiTile extends QSTileImpl { protected class WifiDetailAdapter implements DetailAdapter, AccessPointController.AccessPointCallback, QSDetailItems.Callback { + @Nullable private QSDetailItems mItems; + @Nullable private WifiEntry[] mAccessPoints; @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetAdapter.java index 544246ee97aad..4fe155cfaeb97 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetAdapter.java @@ -52,6 +52,7 @@ public class InternetAdapter extends RecyclerView.Adapter mWifiEntries; @VisibleForTesting protected int mWifiEntriesCount; @@ -189,6 +190,7 @@ public class InternetAdapter extends RecyclerView.Adapter