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

Commit db860eb1 authored by Peeyush Agarwal's avatar Peeyush Agarwal
Browse files

ParceledListSlice shouldn't be created with null

Bug: 74242190
Change-Id: Ia539efb46bba0bab7a0bfdb0c9b4b2b09116acbf
Test: Reproduced the issue, then verified that this fixes it.
parent 20ebb0a6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;

import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
@@ -649,7 +650,10 @@ public class BrightnessTracker {
    }

    public ParceledListSlice<AmbientBrightnessDayStats> getAmbientBrightnessStats(int userId) {
        return new ParceledListSlice<>(mAmbientBrightnessStatsTracker.getUserStats(userId));
        ArrayList<AmbientBrightnessDayStats> stats = mAmbientBrightnessStatsTracker.getUserStats(
                userId);
        return (stats != null) ? new ParceledListSlice<>(stats) : new ParceledListSlice<>(
                Collections.EMPTY_LIST);
    }

    // Not allowed to keep the SensorEvent so used to copy the data we care about.