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

Commit 9a0b289f authored by Adam Lesinski's avatar Adam Lesinski
Browse files

Fix NPE in UsageStats for new User

Bug:16946585

Change-Id: Ibd0d674681f3f49087305cea33ce7292f5d2229d
parent 02b25e9b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -311,11 +311,15 @@ public class UsageStatsService extends SystemService implements
            final int userId = UserHandle.getCallingUserId();
            final long token = Binder.clearCallingIdentity();
            try {
                return new ParceledListSlice<>(UsageStatsService.this.queryUsageStats(
                        userId, bucketType, beginTime, endTime));
                final List<UsageStats> results = UsageStatsService.this.queryUsageStats(
                        userId, bucketType, beginTime, endTime);
                if (results != null) {
                    return new ParceledListSlice<>(results);
                }
            } finally {
                Binder.restoreCallingIdentity(token);
            }
            return null;
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ class UserUsageStatsService {

        final List<UsageStats> results = mDatabase.queryUsageStats(bucketType, beginTime, endTime);
        if (DEBUG) {
            Slog.d(TAG, mLogPrefix + "Results: " + results.size());
            Slog.d(TAG, mLogPrefix + "Results: " + (results == null ? 0 : results.size()));
        }
        return results;
    }