Fetch today's I/O usage stats collected during previous boot.

Watchdog daemon fetches today's I/O usage stat, that were collected
during the previous boot, from CarWatchdogService, so the daemon can the
have the aggregated view of the total bytes written to disk since the
beginning of the day.

Test: atest CarWatchdogServiceUnitTest WatchdogStorageUnitTest
libwatchdog_test
Bug: 192665981

Change-Id: Ieb3f3ba27d4d94f68f94788a364007fbc022a872
Merged-In: Ieb3f3ba27d4d94f68f94788a364007fbc022a872
(cherry picked from commit 766a91829ffdb341a6d59ed65e7e0d2f38273357)
diff --git a/service/src/com/android/car/watchdog/CarWatchdogService.java b/service/src/com/android/car/watchdog/CarWatchdogService.java
index 360a559..6353958 100644
--- a/service/src/com/android/car/watchdog/CarWatchdogService.java
+++ b/service/src/com/android/car/watchdog/CarWatchdogService.java
@@ -28,6 +28,7 @@
 import android.automotive.watchdog.internal.PackageIoOveruseStats;
 import android.automotive.watchdog.internal.PowerCycle;
 import android.automotive.watchdog.internal.StateType;
+import android.automotive.watchdog.internal.UserPackageIoUsageStats;
 import android.automotive.watchdog.internal.UserState;
 import android.car.Car;
 import android.car.hardware.power.CarPowerManager.CarPowerStateListener;
@@ -626,5 +627,15 @@
             }
             service.mWatchdogPerfHandler.resetResourceOveruseStats(new ArraySet<>(packageNames));
         }
+
+        @Override
+        public List<UserPackageIoUsageStats> getTodayIoUsageStats() {
+            CarWatchdogService service = mService.get();
+            if (service == null) {
+                Slogf.w(TAG, "CarWatchdogService is not available");
+                return null;
+            }
+            return service.mWatchdogPerfHandler.getTodayIoUsageStats();
+        }
     }
 }