[MS82.2] Add a rewriteSingle method that takes two timestamps am: 807a7f37f0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2063311 Change-Id: I0eef3ba0f1385fabfbf9d60349ed2ba8787e9e4a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -161,7 +161,7 @@ public class NetworkStatsDataMigrationUtils {
|
|||||||
@NonNull
|
@NonNull
|
||||||
private static ArrayList<File> getPlatformFileListForPrefix(@NonNull @Prefix String prefix) {
|
private static ArrayList<File> getPlatformFileListForPrefix(@NonNull @Prefix String prefix) {
|
||||||
final ArrayList<File> list = new ArrayList<>();
|
final ArrayList<File> list = new ArrayList<>();
|
||||||
final File platformFiles = new File(getPlatformBaseDir(), "netstats");
|
final File platformFiles = getPlatformBaseDir();
|
||||||
if (platformFiles.exists()) {
|
if (platformFiles.exists()) {
|
||||||
for (String name : platformFiles.list()) {
|
for (String name : platformFiles.list()) {
|
||||||
// Skip when prefix doesn't match.
|
// Skip when prefix doesn't match.
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.internal.util;
|
package com.android.internal.util;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.os.FileUtils;
|
import android.os.FileUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -281,6 +282,20 @@ public class FileRotator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process a single file atomically, with the given start and end timestamps.
|
||||||
|
* If a file with these exact start and end timestamps does not exist, a new
|
||||||
|
* empty file will be written.
|
||||||
|
*/
|
||||||
|
public void rewriteSingle(@NonNull Rewriter rewriter, long startTimeMillis, long endTimeMillis)
|
||||||
|
throws IOException {
|
||||||
|
final FileInfo info = new FileInfo(mPrefix);
|
||||||
|
|
||||||
|
info.startMillis = startTimeMillis;
|
||||||
|
info.endMillis = endTimeMillis;
|
||||||
|
rewriteSingle(rewriter, info.build());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read any rotated data that overlap the requested time range.
|
* Read any rotated data that overlap the requested time range.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user