Misc memory stuff.
- New Activity.reportFullyDrawn() method that applicatins can call
when they know they are fully drawn, allowing us to have better
app launch time info. This data is also included in usage stats.
- Added total and free memory data "dumpsys meminfo".
- Tuned the moderate memory levels to be more aggressive about
considering the device getting low on RAM, and thus starting
to prune RAM from processes.
- Fixed issues in processstats when reading old data as well as
resetting and other various fixes.
Change-Id: I20efe7451afb4edfa1aeec448328ba601c24d869
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 8e8bb55..9013b4a 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -205,7 +205,8 @@
*/
boolean mConfigWillChange;
- long mInitialStartTime = 0;
+ long mLaunchStartTime = 0;
+ long mFullyDrawnStartTime = 0;
/**
* Save the most recent screenshot for reuse. This keeps Recents from taking two identical
@@ -595,16 +596,20 @@
}
void setLaunchTime(ActivityRecord r) {
- if (r.launchTime == 0) {
- r.launchTime = SystemClock.uptimeMillis();
- if (mInitialStartTime == 0) {
- mInitialStartTime = r.launchTime;
+ if (r.displayStartTime == 0) {
+ r.fullyDrawnStartTime = r.displayStartTime = SystemClock.uptimeMillis();
+ if (mLaunchStartTime == 0) {
+ mLaunchStartTime = mFullyDrawnStartTime = r.displayStartTime;
}
- } else if (mInitialStartTime == 0) {
- mInitialStartTime = SystemClock.uptimeMillis();
+ } else if (mLaunchStartTime == 0) {
+ mLaunchStartTime = mFullyDrawnStartTime = SystemClock.uptimeMillis();
}
}
+ void clearLaunchTime(ActivityRecord r) {
+ r.displayStartTime = r.fullyDrawnStartTime = 0;
+ }
+
void stopIfSleepingLocked() {
if (mLaunchingActivity.isHeld()) {
if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) {
@@ -710,6 +715,7 @@
mLastPausedActivity = prev;
prev.state = ActivityState.PAUSING;
prev.task.touchActiveTime();
+ clearLaunchTime(prev);
prev.updateThumbnail(screenshotActivities(prev), null);
mService.updateCpuStats();