summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-08-15 13:04:34 -0700
committerDianne Hackborn <hackbod@google.com>2010-08-15 17:27:29 -0700
commit1ebccf531d1049853b3b0630035434619682c016 (patch)
tree92e426918dc4dd2068fba01e69797113b59eb63c /core/java/com
parenta8d9291d7f93d1aa0d24d71d65c7de2894812177 (diff)
downloadframeworks_base-1ebccf531d1049853b3b0630035434619682c016.zip
frameworks_base-1ebccf531d1049853b3b0630035434619682c016.tar.gz
frameworks_base-1ebccf531d1049853b3b0630035434619682c016.tar.bz2
Fix problems with determining when to kill apps for wake usage.
Also improve debug printing of various times. Change-Id: Ifcc288fd1bcbf44c069875ba97925b9e7ffe9a48
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/app/PlatLogoActivity.java14
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java39
2 files changed, 36 insertions, 17 deletions
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java
index ce5959d..e1c5564 100644
--- a/core/java/com/android/internal/app/PlatLogoActivity.java
+++ b/core/java/com/android/internal/app/PlatLogoActivity.java
@@ -18,17 +18,31 @@ package com.android.internal.app;
import android.app.Activity;
import android.os.Bundle;
+import android.view.MotionEvent;
import android.widget.ImageView;
+import android.widget.Toast;
public class PlatLogoActivity extends Activity {
+ Toast mToast;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mToast = Toast.makeText(this, "Zombie art by Jack Larson", Toast.LENGTH_SHORT);
+
ImageView content = new ImageView(this);
content.setImageResource(com.android.internal.R.drawable.platlogo);
content.setScaleType(ImageView.ScaleType.FIT_CENTER);
setContentView(content);
}
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_UP) {
+ mToast.show();
+ }
+ return super.dispatchTouchEvent(ev);
+ }
}
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 2f26135..2a5b944 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -27,7 +27,6 @@ import android.os.ParcelFormatException;
import android.os.Parcelable;
import android.os.Process;
import android.os.SystemClock;
-import android.os.BatteryStats.Uid.Proc.ExcessiveWake;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
@@ -1241,25 +1240,31 @@ public final class BatteryStatsImpl extends BatteryStats {
int mWakeLockNesting;
public void noteStartWakeLocked(int uid, int pid, String name, int type) {
- if (mWakeLockNesting == 0) {
- mHistoryCur.states |= HistoryItem.STATE_WAKE_LOCK_FLAG;
- if (DEBUG_HISTORY) Slog.v(TAG, "Start wake lock to: "
- + Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ if (type == WAKE_TYPE_PARTIAL) {
+ // Only care about partial wake locks, since full wake locks
+ // will be canceled when the user puts the screen to sleep.
+ if (mWakeLockNesting == 0) {
+ mHistoryCur.states |= HistoryItem.STATE_WAKE_LOCK_FLAG;
+ if (DEBUG_HISTORY) Slog.v(TAG, "Start wake lock to: "
+ + Integer.toHexString(mHistoryCur.states));
+ addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ }
+ mWakeLockNesting++;
}
- mWakeLockNesting++;
if (uid >= 0) {
getUidStatsLocked(uid).noteStartWakeLocked(pid, name, type);
}
}
public void noteStopWakeLocked(int uid, int pid, String name, int type) {
- mWakeLockNesting--;
- if (mWakeLockNesting == 0) {
- mHistoryCur.states &= ~HistoryItem.STATE_WAKE_LOCK_FLAG;
- if (DEBUG_HISTORY) Slog.v(TAG, "Stop wake lock to: "
- + Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ if (type == WAKE_TYPE_PARTIAL) {
+ mWakeLockNesting--;
+ if (mWakeLockNesting == 0) {
+ mHistoryCur.states &= ~HistoryItem.STATE_WAKE_LOCK_FLAG;
+ if (DEBUG_HISTORY) Slog.v(TAG, "Stop wake lock to: "
+ + Integer.toHexString(mHistoryCur.states));
+ addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ }
}
if (uid >= 0) {
getUidStatsLocked(uid).noteStopWakeLocked(pid, name, type);
@@ -1353,7 +1358,7 @@ public final class BatteryStatsImpl extends BatteryStats {
// Fake a wake lock, so we consider the device waked as long
// as the screen is on.
- noteStartWakeLocked(-1, -1, "dummy", 0);
+ noteStartWakeLocked(-1, -1, "dummy", WAKE_TYPE_PARTIAL);
}
}
@@ -1369,7 +1374,7 @@ public final class BatteryStatsImpl extends BatteryStats {
mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
}
- noteStopWakeLocked(-1, -1, "dummy", 0);
+ noteStopWakeLocked(-1, -1, "dummy", WAKE_TYPE_PARTIAL);
}
}
@@ -3463,7 +3468,7 @@ public final class BatteryStatsImpl extends BatteryStats {
if (t != null) {
t.startRunningLocked(BatteryStatsImpl.this);
}
- if (pid >= 0) {
+ if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = getPidStatsLocked(pid);
p.mWakeStart = SystemClock.elapsedRealtime();
}
@@ -3474,7 +3479,7 @@ public final class BatteryStatsImpl extends BatteryStats {
if (t != null) {
t.stopRunningLocked(BatteryStatsImpl.this);
}
- if (pid >= 0) {
+ if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = mPids.get(pid);
if (p != null) {
p.mWakeSum += SystemClock.elapsedRealtime() - p.mWakeStart;