Merge "Fix NPE in usage stats manager (recent regression)" into oc-dev am: 091050e92a
am: 75f7c57aef

Change-Id: I98fd109be4e512aabcb0c8f4b030ed7a89a6a906
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 0de3c7c..912e7a8 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -831,6 +831,9 @@
             final UserUsageStatsService service =
                     getUserDataAndInitializeIfNeededLocked(userId, timeNow);
             List<UsageStats> list = service.queryUsageStats(bucketType, beginTime, endTime);
+            if (list == null) {
+                return null;
+            }
 
             // Mangle instant app names *using their current state (not whether they were ephemeral
             // when the data was recorded)*.