use of android.app.usage.UsageStatsManagerInternal in project android_frameworks_base by DirtyUnicorns.
the class UsageStatsBackupHelper method getBackupPayload.
@Override
protected byte[] getBackupPayload(String key) {
if (KEY_USAGE_STATS.equals(key)) {
UsageStatsManagerInternal localUsageStatsManager = LocalServices.getService(UsageStatsManagerInternal.class);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
try {
out.writeInt(UserHandle.USER_SYSTEM);
out.write(localUsageStatsManager.getBackupPayload(UserHandle.USER_SYSTEM, key));
} catch (IOException ioe) {
if (DEBUG)
Log.e(TAG, "Failed to backup Usage Stats", ioe);
baos.reset();
}
return baos.toByteArray();
}
return null;
}
Aggregations