Merge "Annotate com.android.systemui.qs with @Nullable"

This commit is contained in:
Fedor Kudasov
2022-01-07 16:19:38 +00:00
committed by Android (Google) Code Review
43 changed files with 176 additions and 32 deletions

View File

@@ -159,9 +159,9 @@ public interface QSTile {
public Supplier<Icon> 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;

View File

@@ -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;

View File

@@ -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<TileRecord> mTiles = new ArrayList<>();
private final ArrayList<TileLayout> 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;

View File

@@ -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);
}

View File

@@ -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() {

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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(

View File

@@ -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

View File

@@ -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;

View File

@@ -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<QSFactory>, D
private final CustomTileStatePersister mCustomTileStatePersister;
private final List<Callback> mCallbacks = new ArrayList<>();
@Nullable
private AutoTileManager mAutoTiles;
private final StatusBarIconController mIconController;
private final ArrayList<QSFactory> mQsFactories = new ArrayList<>();
@@ -472,6 +475,8 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, 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);

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -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<QSCustomizer> {
}
/** */
public void setQs(QSFragment qsFragment) {
public void setQs(@Nullable QSFragment qsFragment) {
mView.setQs(qsFragment);
}

View File

@@ -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<QSTile> 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;
}

View File

@@ -89,7 +89,9 @@ public class CustomTile extends QSTileImpl<State> 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<State> 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<State> 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)

View File

@@ -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<Integer> 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;

View File

@@ -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);

View File

@@ -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) {

View File

@@ -116,6 +116,7 @@ public abstract class QSTileImpl<TState extends State> 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<TState extends State> 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<TState extends State> 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<TState extends State> 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) {

View File

@@ -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);

View File

@@ -320,6 +320,7 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
// 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

View File

@@ -257,7 +257,9 @@ public class CellularTile extends QSTileImpl<SignalState> {
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<SignalState> {
return mContext.getString(R.string.quick_settings_cellular_detail_title);
}
@Nullable
@Override
public Boolean getToggleState() {
return mDataController.isMobileDataSupported()

View File

@@ -360,6 +360,7 @@ public class DndTile extends QSTileImpl<BooleanState> {
private final class DndDetailAdapter implements DetailAdapter, OnAttachStateChangeListener {
@Nullable
private ZenModePanel mZenPanel;
private boolean mAuto;

View File

@@ -145,13 +145,15 @@ public class InternetTile extends QSTileImpl<SignalState> {
&& 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<SignalState> {
private static final class EthernetCallbackInfo {
boolean mConnected;
int mEthernetSignalIconId;
@Nullable
String mEthernetContentDescription;
@Override
@@ -180,11 +183,14 @@ public class InternetTile extends QSTileImpl<SignalState> {
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<SignalState> {
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<SignalState> {
}
}
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<SignalState> {
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);

View File

@@ -54,6 +54,7 @@ public class NfcTile extends QSTileImpl<BooleanState> {
private static final String NFC = "nfc";
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_nfc);
@Nullable
private NfcAdapter mAdapter;
private BroadcastDispatcher mBroadcastDispatcher;

View File

@@ -131,6 +131,7 @@ public class QRCodeScannerTile extends QSTileImpl<QSTile.State> {
return mQRCodeScannerController.isCameraAvailable();
}
@Nullable
@Override
public Intent getLongClickIntent() {
return null;

View File

@@ -72,8 +72,10 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {
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<QSTile.State> {
&& mSecureSettings.getString(NFC_PAYMENT_DEFAULT_COMPONENT) != null;
}
@Nullable
@Override
public Intent getLongClickIntent() {
return null;

View File

@@ -136,6 +136,7 @@ public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState>
return 0;
}
@Nullable
@Override
public Intent getLongClickIntent() {
return null;

View File

@@ -134,6 +134,7 @@ public abstract class SensorPrivacyToggleTile extends QSTileImpl<QSTile.BooleanS
return new Intent(Settings.ACTION_PRIVACY_SETTINGS);
}
@Nullable
@Override
public DetailAdapter getDetailAdapter() {
return super.getDetailAdapter();

View File

@@ -28,6 +28,8 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.android.internal.util.ArrayUtils;
import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
@@ -50,15 +52,15 @@ public class UserDetailItemView extends LinearLayout {
this(context, null);
}
public UserDetailItemView(Context context, AttributeSet attrs) {
public UserDetailItemView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public UserDetailItemView(Context context, AttributeSet attrs, int defStyleAttr) {
public UserDetailItemView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public UserDetailItemView(Context context, AttributeSet attrs, int defStyleAttr,
public UserDetailItemView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);

View File

@@ -77,6 +77,7 @@ public class UserDetailView extends PseudoGridView {
private final Context mContext;
protected UserSwitcherController mController;
@Nullable
private View mCurrentUserView;
private final UiEventLogger mUiEventLogger;
private final FalsingManager mFalsingManager;

View File

@@ -48,6 +48,7 @@ public class UserTile extends QSTileImpl<State> implements UserInfoController.On
private final UserSwitcherController mUserSwitcherController;
private final UserInfoController mUserInfoController;
@Nullable
private Pair<String, Drawable> mLastUpdate;
@Inject

View File

@@ -258,6 +258,7 @@ public class WifiTile extends QSTileImpl<SignalState> {
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<SignalState> {
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<SignalState> {
protected class WifiDetailAdapter implements DetailAdapter,
AccessPointController.AccessPointCallback, QSDetailItems.Callback {
@Nullable
private QSDetailItems mItems;
@Nullable
private WifiEntry[] mAccessPoints;
@Override

View File

@@ -52,6 +52,7 @@ public class InternetAdapter extends RecyclerView.Adapter<InternetAdapter.Intern
private static final String EXTRA_CONNECT_FOR_CALLER = "connect_for_caller";
private final InternetDialogController mInternetDialogController;
@Nullable
private List<WifiEntry> mWifiEntries;
@VisibleForTesting
protected int mWifiEntriesCount;
@@ -189,6 +190,7 @@ public class InternetAdapter extends RecyclerView.Adapter<InternetAdapter.Intern
mWifiSummaryText.setText(summary);
}
@Nullable
Drawable getWifiDrawable(int level, boolean hasNoInternet) {
// If the Wi-Fi level is equal to WIFI_LEVEL_UNREACHABLE(-1), then a null drawable
// will be returned.

View File

@@ -42,7 +42,6 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
@@ -98,6 +97,7 @@ public class InternetDialog extends SystemUIDialog implements
private InternetDialogFactory mInternetDialogFactory;
private SubscriptionManager mSubscriptionManager;
private TelephonyManager mTelephonyManager;
@Nullable
private AlertDialog mAlertDialog;
private UiEventLogger mUiEventLogger;
private Context mContext;
@@ -130,12 +130,14 @@ public class InternetDialog extends SystemUIDialog implements
private Button mDoneButton;
private Button mAirplaneModeButton;
private Drawable mBackgroundOn;
@Nullable
private Drawable mBackgroundOff = null;
private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
private boolean mCanConfigMobileData;
// Wi-Fi entries
private int mWifiNetworkHeight;
@Nullable
@VisibleForTesting
protected WifiEntry mConnectedWifiEntry;
@VisibleForTesting
@@ -536,6 +538,7 @@ public class InternetDialog extends SystemUIDialog implements
return mInternetDialogController.getDialogTitleText();
}
@Nullable
CharSequence getSubtitleText() {
return mInternetDialogController.getSubtitleText(
mIsProgressBarVisible && !mIsSearchingHidden);

View File

@@ -303,6 +303,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi
return new Intent(ACTION_NETWORK_PROVIDER_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
@Nullable
protected Intent getWifiDetailsSettingsIntent(String key) {
if (TextUtils.isEmpty(key)) {
if (DEBUG) {
@@ -320,6 +321,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi
return mContext.getText(R.string.quick_settings_internet_label);
}
@Nullable
CharSequence getSubtitleText(boolean isProgressBarVisible) {
if (mCanConfigWifi && !mWifiManager.isWifiEnabled()) {
// When Wi-Fi is disabled.
@@ -391,6 +393,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi
return null;
}
@Nullable
Drawable getInternetWifiDrawable(@NonNull WifiEntry wifiEntry) {
if (wifiEntry.getLevel() == WifiEntry.WIFI_LEVEL_UNREACHABLE) {
return null;