Merge "UsageStatsService: ignore removed users in persistPendingEventsLocked()"
This commit is contained in:
@@ -787,11 +787,16 @@ public class UsageStatsService extends SystemService implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final File usageStatsDeDir = new File(Environment.getDataSystemDeDirectory(userId),
|
final File deDir = Environment.getDataSystemDeDirectory(userId);
|
||||||
"usagestats");
|
final File usageStatsDeDir = new File(deDir, "usagestats");
|
||||||
if (!usageStatsDeDir.mkdirs() && !usageStatsDeDir.exists()) {
|
if (!usageStatsDeDir.mkdir() && !usageStatsDeDir.exists()) {
|
||||||
throw new IllegalStateException("Usage stats DE directory does not exist: "
|
if (deDir.exists()) {
|
||||||
+ usageStatsDeDir.getAbsolutePath());
|
Slog.e(TAG, "Failed to create " + usageStatsDeDir);
|
||||||
|
} else {
|
||||||
|
Slog.w(TAG, "User " + userId + " was already removed! Discarding pending events");
|
||||||
|
pendingEvents.clear();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
final File pendingEventsFile = new File(usageStatsDeDir,
|
final File pendingEventsFile = new File(usageStatsDeDir,
|
||||||
"pendingevents_" + System.currentTimeMillis());
|
"pendingevents_" + System.currentTimeMillis());
|
||||||
|
|||||||
Reference in New Issue
Block a user