Merge "ParceledListSlice shouldn't be created with null" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-08 15:28:11 +00:00
committed by Android (Google) Code Review

View File

@@ -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;
@@ -657,7 +658,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.