Add API to get remaining lifetime as a percentage.
This differs slightly from the previous API, which exists for idle
maintenance, whereas this value is intended to be displayed to users.
First, it returns remaining lifetime, rather than used lifetime. Second,
it rounds up the returned value for usabilty purposes. This isn't an
issue on Pixel (which reports at 1% granularity), but devices which
report at 10% granularity should show 100% out-of-box, which is not
possible to distinguish in the old API.
Bug: 309886423
Test: StorageManager.getRemainingStorageLifetime
Change-Id: Ic5f6ec9969667302ba8bad95b2765e2cc740bed4
diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl
index 229f173..d121dee 100644
--- a/binder/android/os/IVold.aidl
+++ b/binder/android/os/IVold.aidl
@@ -66,6 +66,8 @@
void fstrim(int fstrimFlags, IVoldTaskListener listener);
void runIdleMaint(boolean needGC, IVoldTaskListener listener);
void abortIdleMaint(IVoldTaskListener listener);
+ // Returns the amount of storage lifetime used, as a percentage.
+ // (eg, 10 indicates 10% of lifetime used), or -1 on failure.
int getStorageLifeTime();
void setGCUrgentPace(int neededSegments, int minSegmentThreshold,
float dirtyReclaimRate, float reclaimWeight,
@@ -135,6 +137,11 @@
long getStorageSize();
+ // Returns the remaining storage lifetime as a percentage, rounded up as
+ // needed when the underlying hardware reports low precision. Returns -1
+ // on failure.
+ int getStorageRemainingLifetime();
+
const int FSTRIM_FLAG_DEEP_TRIM = 1;
const int MOUNT_FLAG_PRIMARY = 1;