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

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

Merge "Assert add/removeCallbacks are from main thread in DevicePostureControllerImpl"

parents 99deef06 5763f3a1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import androidx.annotation.NonNull;
import com.android.internal.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.util.Assert;

import java.util.ArrayList;
import java.util.List;
@@ -70,6 +71,7 @@ public class DevicePostureControllerImpl implements DevicePostureController {
        }

        deviceStateManager.registerCallback(executor, state -> {
            Assert.isMainThread();
            mCurrentDevicePosture =
                    mDeviceStateToPostureMap.get(state, DEVICE_POSTURE_UNKNOWN);

@@ -79,11 +81,13 @@ public class DevicePostureControllerImpl implements DevicePostureController {

    @Override
    public void addCallback(@NonNull Callback listener) {
        Assert.isMainThread();
        mListeners.add(listener);
    }

    @Override
    public void removeCallback(@NonNull Callback listener) {
        Assert.isMainThread();
        mListeners.remove(listener);
    }