Fix issue #23270878: NPE in UsageStatsService while running UserManagementTest

Change-Id: I34d4fcdc103b3a6ea5c4ed78895f2fe18597237a
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 85f0665..4146c1c 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -848,6 +848,9 @@
         try {
             ParceledListSlice<ApplicationInfo> slice
                     = AppGlobals.getPackageManager().getInstalledApplications(0, userId);
+            if (slice == null) {
+                return new int[0];
+            }
             apps = slice.getList();
         } catch (RemoteException e) {
             return new int[0];