Make smart idle maint update write amount record every period

Now, when the condition doesn't meet, smart idle maintenance service
doesn't update write amount record. Fixed it, since it should be updated
every period.

Test: check smart idle maint log of StorageManagerService
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: I339109fcaa821620a3b9b4b8c49e25fd18d03cf3
This commit is contained in:
Daeho Jeong
2022-06-23 11:32:41 -07:00
parent a3a88b5d2b
commit a31a605797

View File

@@ -2728,6 +2728,14 @@ class StorageManagerService extends IStorageManager.Stub
enforcePermission(android.Manifest.permission.MOUNT_FORMAT_FILESYSTEMS);
try {
int latestWrite = mVold.getWriteAmount();
if (latestWrite == -1) {
Slog.w(TAG, "Failed to get storage write record");
return;
}
updateStorageWriteRecords(latestWrite);
// Block based checkpoint process runs fstrim. So, if checkpoint is in progress
// (first boot after OTA), We skip the smart idle maintenance
if (!needsCheckpoint() || !supportsBlockCheckpoint()) {
@@ -2735,13 +2743,6 @@ class StorageManagerService extends IStorageManager.Stub
return;
}
int latestWrite = mVold.getWriteAmount();
if (latestWrite == -1) {
Slog.w(TAG, "Failed to get storage write record");
return;
}
updateStorageWriteRecords(latestWrite);
int avgWriteAmount = getAverageWriteAmount();
Slog.i(TAG, "Set smart idle maintenance: " + "latest write amount: " +