Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a501257e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix QSTileImpl NPE on startup." into pi-dev

parents 51d2cc45 8c4a19c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -348,7 +348,7 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener
        return ComponentName.unflattenFromString(action);
    }

    public static QSTile create(QSTileHost host, String spec) {
    public static CustomTile create(QSTileHost host, String spec) {
        if (spec == null || !spec.startsWith(PREFIX) || !spec.endsWith(")")) {
            throw new IllegalArgumentException("Bad custom tile spec: " + spec);
        }
+8 −0
Original line number Diff line number Diff line
@@ -52,6 +52,14 @@ public class QSFactoryImpl implements QSFactory {
    }

    public QSTile createTile(String tileSpec) {
        QSTileImpl tile = createTileInternal(tileSpec);
        if (tile != null) {
            tile.handleStale(); // Tile was just created, must be stale.
        }
        return tile;
    }

    private QSTileImpl createTileInternal(String tileSpec) {
        if (tileSpec.equals("wifi")) return new WifiTile(mHost);
        else if (tileSpec.equals("bt")) return new BluetoothTile(mHost);
        else if (tileSpec.equals("cell")) return new CellularTile(mHost);
+0 −1
Original line number Diff line number Diff line
@@ -103,7 +103,6 @@ public abstract class QSTileImpl<TState extends State> implements QSTile {
    protected QSTileImpl(QSHost host) {
        mHost = host;
        mContext = host.getContext();
        handleStale(); // Tile was just created, must be stale.
    }

    /**
+0 −1
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {

    @Override
    public void handleSetListening(boolean listening) {
        if (mController == null) return;
        if (listening) {
            mController.addCallback(mCallback);
        } else {
+0 −2
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ public class CastTile extends QSTileImpl<BooleanState> {

    @Override
    public void handleSetListening(boolean listening) {
        if (mController == null) return;
        if (DEBUG) Log.d(TAG, "handleSetListening " + listening);
        if (listening) {
            mController.addCallback(mCallback);
@@ -98,7 +97,6 @@ public class CastTile extends QSTileImpl<BooleanState> {
    @Override
    protected void handleUserSwitch(int newUserId) {
        super.handleUserSwitch(newUserId);
        if (mController == null) return;
        mController.setCurrentUserId(newUserId);
    }

Loading