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

Commit d9c6a0e9 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Add nullability and type guarantees" into main

parents 8526fd94 3d8a5de4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.testing.TestableLooper;
import android.text.TextUtils;
import android.util.ArraySet;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
@@ -384,6 +385,7 @@ public class TileQueryHelperTest extends SysuiTestCase {
            return mSpec;
        }

        @NonNull
        @Override
        public State getState() {
            return mState;
+5 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@

package com.android.systemui.plugins.qs;

import android.annotation.NonNull;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@@ -22,6 +21,7 @@ import android.metrics.LogMaker;
import android.service.quicksettings.Tile;
import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.internal.logging.InstanceId;
@@ -92,6 +92,7 @@ public interface QSTile {

    CharSequence getTileLabel();

    @NonNull
    State getState();

    default LogMaker populate(LogMaker logMaker) {
@@ -269,6 +270,7 @@ public interface QSTile {
            return sb.append(']');
        }

        @NonNull
        public State copy() {
            State state = new State();
            copyTo(state);
@@ -304,6 +306,7 @@ public interface QSTile {
            return rt;
        }

        @androidx.annotation.NonNull
        @Override
        public State copy() {
            AdapterState state = new AdapterState();
@@ -316,6 +319,7 @@ public interface QSTile {
    class BooleanState extends AdapterState {
        public static final int VERSION = 1;

        @androidx.annotation.NonNull
        @Override
        public State copy() {
            BooleanState state = new BooleanState();
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ fun Tile(
    modifier: Modifier = Modifier,
    detailsViewModel: DetailsViewModel?,
) {
    val state by tile.state.collectAsStateWithLifecycle(tile.currentState)
    val state: QSTile.State by tile.state.collectAsStateWithLifecycle(tile.currentState)
    val currentBounceableInfo by rememberUpdatedState(bounceableInfo)
    val resources = resources()
    val uiState = remember(state, resources) { state.toUiState(resources) }
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.onStart

@Immutable
@@ -37,6 +38,7 @@ class TileViewModel(private val tile: QSTile, val spec: TileSpec) {
                awaitClose { tile.removeCallback(callback) }
            }
            .onStart { emit(tile.state) }
            .filterNotNull()
            .distinctUntilChanged()

    val currentState: QSTile.State
+1 −0
Original line number Diff line number Diff line
@@ -369,6 +369,7 @@ public abstract class QSTileImpl<TState extends State> implements QSTile, Lifecy
        mHandler.sendEmptyMessage(H.INITIALIZE);
    }

    @androidx.annotation.NonNull
    public TState getState() {
        return mState;
    }
Loading