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

Commit c272c4d9 authored by Chandru S's avatar Chandru S Committed by Android (Google) Code Review
Browse files

Merge "Add isPresent check before invoking optional.get()" into main

parents e60636fe 8e57f861
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -469,9 +469,8 @@ public class DozeScreenBrightness extends BroadcastReceiver implements DozeMachi
                    || posture >= mLightSensorOptional.length) {
                return;
            }

            final Sensor oldSensor = mLightSensorOptional[mDevicePosture].get();
            final Sensor newSensor = mLightSensorOptional[posture].get();
            Sensor oldSensor = mLightSensorOptional[mDevicePosture].orElse(null);
            Sensor newSensor = mLightSensorOptional[posture].orElse(null);
            if (Objects.equals(oldSensor, newSensor)) {
                mDevicePosture = posture;
                // uses the same sensor for the new posture