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

Commit bb766995 authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "Fix race+logging issue in SystemStateHelper" into sc-dev

parents 3c5eace8 edf37479
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public class SystemStateHelper implements UiModeManager.OnProjectionStateChangeL
    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Log.startSession("SSP.oR");
            Log.startSession("SSH.oR");
            try {
                synchronized (mLock) {
                    String action = intent.getAction();
@@ -120,12 +120,20 @@ public class SystemStateHelper implements UiModeManager.OnProjectionStateChangeL
    @Override
    public void onProjectionStateChanged(int activeProjectionTypes,
            @NonNull Set<String> projectingPackages) {
        Log.startSession("SSH.oPSC");
        try {
            synchronized (mLock) {
                if (projectingPackages.isEmpty()) {
                    onReleaseAutomotiveProjection();
                } else {
                    onSetAutomotiveProjection(projectingPackages.iterator().next());
                }
            }
        } finally {
            Log.endSession();
        }

    }

    private Set<SystemStateListener> mListeners = new CopyOnWriteArraySet<>();
    private boolean mIsCarModeOrProjectionActive;