diff options
author | Svetoslav <svetoslavganov@google.com> | 2013-04-25 14:45:54 -0700 |
---|---|---|
committer | Svetoslav <svetoslavganov@google.com> | 2013-04-30 10:19:53 -0700 |
commit | f23b64df94bbff9ac8c87832dea9c1bc0ae9a950 (patch) | |
tree | deb5feb6d7ba0791b4cbc7be5b2896fb343703a2 /services/java/com/android/server/MountService.java | |
parent | 7c98c196282629fc7a842e67ceca3d9686f3f23a (diff) |
Perform idle maintenance when the device is charging.
Added the precondition that the device should be charging to the
existing ones of the device not being used for awhile and the
battery level being high enough. Note that even if the device is
charging, we have to check the battery level since the user can
unplug it at any time.
bug:8688454
Change-Id: I709b1620571301743dc3504a6a625e2018951bfa
Diffstat (limited to 'services/java/com/android/server/MountService.java')
-rw-r--r-- | services/java/com/android/server/MountService.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java index e8d788201765..82f8d434e01a 100644 --- a/services/java/com/android/server/MountService.java +++ b/services/java/com/android/server/MountService.java @@ -36,6 +36,7 @@ import android.net.Uri; import android.os.Binder; import android.os.Environment; import android.os.Environment.UserEnvironment; +import android.os.Build; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; @@ -43,6 +44,7 @@ import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.os.storage.IMountService; @@ -173,6 +175,11 @@ class MountService extends IMountService.Stub public static final int VolumeDiskInserted = 630; public static final int VolumeDiskRemoved = 631; public static final int VolumeBadRemoval = 632; + + /* + * 700 series - fstrim + */ + public static final int FstrimCompleted = 700; } private Context mContext; @@ -609,6 +616,7 @@ class MountService extends IMountService.Stub // This method runs on the handler thread, // so it is safe to directly call into vold. mConnector.execute("fstrim", "dotrim"); + EventLogTags.writeFstrimStart(SystemClock.elapsedRealtime()); } catch (NativeDaemonConnectorException ndce) { Slog.e(TAG, "Failed to run fstrim!"); } @@ -857,6 +865,10 @@ class MountService extends IMountService.Stub if (DEBUG_EVENTS) Slog.i(TAG, "Sending media bad removal"); updatePublicVolumeState(volume, Environment.MEDIA_BAD_REMOVAL); action = Intent.ACTION_MEDIA_BAD_REMOVAL; + } else if (code == VoldResponseCode.FstrimCompleted) { + if (Build.IS_DEBUGGABLE) { + EventLogTags.writeFstrimFinish(SystemClock.elapsedRealtime()); + } } else { Slog.e(TAG, String.format("Unknown code {%d}", code)); } |