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

Commit 02fc1761 authored by Michal Brzezinski's avatar Michal Brzezinski
Browse files

NPE fix: log sensor timestamp only when sensor is not empty

I tried writing test for it but the problem is making `Trace.isTagEnabled` return true.
And anyway this is easy fix so hopefully test is just nice to have.

Test: manual
Fixes: 401728609
Flag: EXEMPT trivial fix
Change-Id: Ib4f8b962d05aff9eaaf23fc865bf53e30a4231ba
parent 95c0236c
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -325,7 +325,8 @@ public final class FoldableDeviceStateProvider implements DeviceStateProvider,
            }
            }


            if (newState != INVALID_DEVICE_STATE_IDENTIFIER && newState != mLastReportedState) {
            if (newState != INVALID_DEVICE_STATE_IDENTIFIER && newState != mLastReportedState) {
                if (Trace.isTagEnabled(TRACE_TAG_SYSTEM_SERVER)) {
                if (mLastHingeAngleSensorEvent != null
                        && Trace.isTagEnabled(TRACE_TAG_SYSTEM_SERVER)) {
                    Trace.instant(TRACE_TAG_SYSTEM_SERVER,
                    Trace.instant(TRACE_TAG_SYSTEM_SERVER,
                            "[Device state changed] Last hinge sensor event timestamp: "
                            "[Device state changed] Last hinge sensor event timestamp: "
                                    + mLastHingeAngleSensorEvent.timestamp);
                                    + mLastHingeAngleSensorEvent.timestamp);