diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/content/Intent.java | 24 | ||||
-rw-r--r-- | core/java/android/net/Proxy.java | 13 | ||||
-rw-r--r-- | core/java/android/net/ProxyProperties.java | 38 | ||||
-rw-r--r-- | core/java/android/os/BatteryStats.java | 6 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 19 | ||||
-rw-r--r-- | core/java/android/text/method/TextKeyListener.java | 6 | ||||
-rw-r--r-- | core/java/com/android/internal/os/BatteryStatsImpl.java | 266 | ||||
-rw-r--r-- | core/jni/android/graphics/Bitmap.cpp | 5 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | core/res/res/layout/recent_apps_activity.xml | 55 | ||||
-rw-r--r-- | core/res/res/values/strings.xml | 10 |
11 files changed, 304 insertions, 140 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 359eaaa..4d0b8b0 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1577,6 +1577,30 @@ public class Intent implements Parcelable, Cloneable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"; /** + * Broadcast Action: A sticky broadcast that indicates a memory full + * condition on the device. This is intended for activities that want + * to be able to fill the data partition completely, leaving only + * enough free space to prevent system-wide SQLite failures. + * + * <p class="note">This is a protected intent that can only be sent + * by the system. + * + * {@hide} + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_DEVICE_STORAGE_FULL = "android.intent.action.DEVICE_STORAGE_FULL"; + /** + * Broadcast Action: Indicates memory full condition on the device + * no longer exists. + * + * <p class="note">This is a protected intent that can only be sent + * by the system. + * + * {@hide} + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_DEVICE_STORAGE_NOT_FULL = "android.intent.action.DEVICE_STORAGE_NOT_FULL"; + /** * Broadcast Action: Indicates low memory condition notification acknowledged by user * and package management should be started. * This is triggered by the user from the ACTION_DEVICE_STORAGE_LOW diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java index e2e4d2c..9c63cd9 100644 --- a/core/java/android/net/Proxy.java +++ b/core/java/android/net/Proxy.java @@ -46,6 +46,8 @@ public final class Proxy { // Set to true to enable extra debugging. private static final boolean DEBUG = false; + // Used to notify an app that's caching the default connection proxy + // that either the default connection or its proxy has changed public static final String PROXY_CHANGE_ACTION = "android.intent.action.PROXY_CHANGE"; @@ -74,9 +76,10 @@ public final class Proxy { EXCLLIST_PATTERN = Pattern.compile(EXCLLIST_REGEXP); } + // useful because it holds the processed exclusion list - don't want to reparse it each time private static class ProxySpec { String[] exclusionList = null; - InetSocketAddress proxyAddress = null; + InetSocketAddress address = null; public ProxySpec() { }; } @@ -151,7 +154,7 @@ public final class Proxy { retval = java.net.Proxy.NO_PROXY; } else { retval = - new java.net.Proxy(java.net.Proxy.Type.HTTP, sGlobalProxySpec.proxyAddress); + new java.net.Proxy(java.net.Proxy.Type.HTTP, sGlobalProxySpec.address); } } else { // If network is WiFi, return no proxy. @@ -187,7 +190,7 @@ public final class Proxy { parseGlobalProxyInfoReadLocked(ctx); } if (sGlobalProxySpec != null) { - InetSocketAddress sa = sGlobalProxySpec.proxyAddress; + InetSocketAddress sa = sGlobalProxySpec.address; return sa.getHostName(); } return getDefaultHost(); @@ -210,7 +213,7 @@ public final class Proxy { parseGlobalProxyInfoReadLocked(ctx); } if (sGlobalProxySpec != null) { - InetSocketAddress sa = sGlobalProxySpec.proxyAddress; + InetSocketAddress sa = sGlobalProxySpec.address; return sa.getPort(); } return getDefaultPort(); @@ -389,7 +392,7 @@ public final class Proxy { int port = parsePort(proxyHost); if (proxyHost != null) { sGlobalProxySpec = new ProxySpec(); - sGlobalProxySpec.proxyAddress = new InetSocketAddress(host, port); + sGlobalProxySpec.address= new InetSocketAddress(host, port); if ((exclusionListSpec != null) && (exclusionListSpec.length() != 0)) { String[] exclusionListEntries = exclusionListSpec.toLowerCase().split(","); String[] processedEntries = new String[exclusionListEntries.length]; diff --git a/core/java/android/net/ProxyProperties.java b/core/java/android/net/ProxyProperties.java index bce7ec0..fb59fed 100644 --- a/core/java/android/net/ProxyProperties.java +++ b/core/java/android/net/ProxyProperties.java @@ -21,6 +21,7 @@ import android.os.Parcel; import android.os.Parcelable; import java.net.InetAddress; +import java.net.InetSocketAddress; import java.net.UnknownHostException; /** @@ -29,8 +30,7 @@ import java.net.UnknownHostException; */ public class ProxyProperties implements Parcelable { - private InetAddress mProxy; - private int mPort; + private InetSocketAddress mProxy; private String mExclusionList; public ProxyProperties() { @@ -39,8 +39,7 @@ public class ProxyProperties implements Parcelable { // copy constructor instead of clone public ProxyProperties(ProxyProperties source) { if (source != null) { - mProxy = source.getAddress(); - mPort = source.getPort(); + mProxy = source.getSocketAddress(); String exclusionList = source.getExclusionList(); if (exclusionList != null) { mExclusionList = new String(exclusionList); @@ -48,22 +47,14 @@ public class ProxyProperties implements Parcelable { } } - public InetAddress getAddress() { + public InetSocketAddress getSocketAddress() { return mProxy; } - public void setAddress(InetAddress proxy) { + public void setSocketAddress(InetSocketAddress proxy) { mProxy = proxy; } - public int getPort() { - return mPort; - } - - public void setPort(int port) { - mPort = port; - } - public String getExclusionList() { return mExclusionList; } @@ -76,7 +67,7 @@ public class ProxyProperties implements Parcelable { public String toString() { StringBuilder sb = new StringBuilder(); if (mProxy != null) { - sb.append(mProxy.getHostAddress()).append(":").append(mPort); + sb.append(mProxy.toString()); if (mExclusionList != null) { sb.append(" xl=").append(mExclusionList); } @@ -98,13 +89,15 @@ public class ProxyProperties implements Parcelable { */ public void writeToParcel(Parcel dest, int flags) { if (mProxy != null) { - dest.writeByte((byte)1); - dest.writeString(mProxy.getHostName()); - dest.writeByteArray(mProxy.getAddress()); + InetAddress addr = mProxy.getAddress(); + if (addr != null) { + dest.writeByte((byte)1); + dest.writeByteArray(addr.getAddress()); + dest.writeInt(mProxy.getPort()); + } } else { dest.writeByte((byte)0); } - dest.writeInt(mPort); dest.writeString(mExclusionList); } @@ -118,11 +111,10 @@ public class ProxyProperties implements Parcelable { ProxyProperties proxyProperties = new ProxyProperties(); if (in.readByte() == 1) { try { - proxyProperties.setAddress(InetAddress.getByAddress(in.readString(), - in.createByteArray())); - } catch (UnknownHostException e) {} + InetAddress addr = InetAddress.getByAddress(in.createByteArray()); + proxyProperties.setSocketAddress(new InetSocketAddress(addr, in.readInt())); + } catch (UnknownHostException e) { } } - proxyProperties.setPort(in.readInt()); proxyProperties.setExclusionList(in.readString()); return proxyProperties; } diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index a857e58..32fb108 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -1586,8 +1586,10 @@ public abstract class BatteryStats implements Parcelable { sb.append(prefix); sb.append(" CPU: "); formatTime(sb, userTime); sb.append("usr + "); formatTime(sb, systemTime); sb.append("krn\n"); - sb.append(prefix); sb.append(" "); sb.append(starts); - sb.append(" proc starts"); + if (starts != 0) { + sb.append(prefix); sb.append(" "); sb.append(starts); + sb.append(" proc starts"); + } pw.println(sb.toString()); for (int e=0; e<numExcessive; e++) { Uid.Proc.ExcessiveWake ew = ps.getExcessiveWake(e); diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index dcd1d94..567ee93 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3005,31 +3005,31 @@ public final class Settings { public static final String WTF_IS_FATAL = "wtf_is_fatal"; /** - * Maximum age of entries kept by {@link android.os.IDropBox}. + * Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}. * @hide */ public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; /** - * Maximum number of entry files which {@link android.os.IDropBox} will keep around. + * Maximum number of entry files which {@link com.android.internal.os.IDropBoxManagerService} will keep around. * @hide */ public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; /** - * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what. + * Maximum amount of disk space used by {@link com.android.internal.os.IDropBoxManagerService} no matter what. * @hide */ public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; /** - * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use. + * Percent of free disk (excluding reserve) which {@link com.android.internal.os.IDropBoxManagerService} will use. * @hide */ public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; /** - * Percent of total disk which {@link android.os.IDropBox} will never dip into. + * Percent of total disk which {@link com.android.internal.os.IDropBoxManagerService} will never dip into. * @hide */ public static final String DROPBOX_RESERVE_PERCENT = @@ -3089,6 +3089,15 @@ public final class Settings { "sys_storage_threshold_percentage"; /** + * Minimum bytes of free storage on the device before the data + * partition is considered full. By default, 1 MB is reserved + * to avoid system-wide SQLite disk full exceptions. + * @hide + */ + public static final String SYS_STORAGE_FULL_THRESHOLD_BYTES = + "sys_storage_full_threshold_bytes"; + + /** * The interval in milliseconds after which Wi-Fi is considered idle. * When idle, it is possible for the device to be switched from Wi-Fi to * the mobile data network. diff --git a/core/java/android/text/method/TextKeyListener.java b/core/java/android/text/method/TextKeyListener.java index 5be2a48..09cbbb8 100644 --- a/core/java/android/text/method/TextKeyListener.java +++ b/core/java/android/text/method/TextKeyListener.java @@ -246,8 +246,10 @@ public class TextKeyListener extends BaseKeyListener implements SpanWatcher { private void initPrefs(Context context) { final ContentResolver contentResolver = context.getContentResolver(); mResolver = new WeakReference<ContentResolver>(contentResolver); - mObserver = new SettingsObserver(); - contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, mObserver); + if (mObserver == null) { + mObserver = new SettingsObserver(); + contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, mObserver); + } updatePrefs(contentResolver); mPrefsInited = true; diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index a6a031a..9ed3658 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -22,6 +22,8 @@ import android.bluetooth.BluetoothHeadset; import android.net.TrafficStats; import android.os.BatteryManager; import android.os.BatteryStats; +import android.os.Handler; +import android.os.Message; import android.os.Parcel; import android.os.ParcelFormatException; import android.os.Parcelable; @@ -79,6 +81,38 @@ public final class BatteryStatsImpl extends BatteryStats { private final JournaledFile mFile; + static final int MSG_UPDATE_WAKELOCKS = 1; + static final int MSG_REPORT_POWER_CHANGE = 2; + static final long DELAY_UPDATE_WAKELOCKS = 15*1000; + + public interface BatteryCallback { + public void batteryNeedsCpuUpdate(); + public void batteryPowerChanged(boolean onBattery); + } + + final class MyHandler extends Handler { + @Override + public void handleMessage(Message msg) { + BatteryCallback cb = mCallback; + switch (msg.what) { + case MSG_UPDATE_WAKELOCKS: + if (cb != null) { + cb.batteryNeedsCpuUpdate(); + } + break; + case MSG_REPORT_POWER_CHANGE: + if (cb != null) { + cb.batteryPowerChanged(msg.arg1 != 0); + } + break; + } + } + } + + private final MyHandler mHandler; + + private BatteryCallback mCallback; + /** * The statistics we have collected organized by uids. */ @@ -95,6 +129,9 @@ public final class BatteryStatsImpl extends BatteryStats { final SparseArray<ArrayList<StopwatchTimer>> mSensorTimers = new SparseArray<ArrayList<StopwatchTimer>>(); + // Last partial timers we use for distributing CPU usage. + final ArrayList<StopwatchTimer> mLastPartialTimers = new ArrayList<StopwatchTimer>(); + // These are the objects that will want to do something when the device // is unplugged from power. final ArrayList<Unpluggable> mUnpluggables = new ArrayList<Unpluggable>(); @@ -240,6 +277,7 @@ public final class BatteryStatsImpl extends BatteryStats { // For debugging public BatteryStatsImpl() { mFile = null; + mHandler = null; } public static interface Unpluggable { @@ -739,7 +777,9 @@ public final class BatteryStatsImpl extends BatteryStats { * State for keeping track of timing information. */ public static final class StopwatchTimer extends Timer { + final Uid mUid; final ArrayList<StopwatchTimer> mTimerPool; + int mNesting; /** @@ -757,16 +797,24 @@ public final class BatteryStatsImpl extends BatteryStats { long mTimeout; - StopwatchTimer(int type, ArrayList<StopwatchTimer> timerPool, + /** + * For partial wake locks, keep track of whether we are in the list + * to consume CPU cycles. + */ + boolean mInList; + + StopwatchTimer(Uid uid, int type, ArrayList<StopwatchTimer> timerPool, ArrayList<Unpluggable> unpluggables, Parcel in) { super(type, unpluggables, in); + mUid = uid; mTimerPool = timerPool; mUpdateTime = in.readLong(); } - StopwatchTimer(int type, ArrayList<StopwatchTimer> timerPool, + StopwatchTimer(Uid uid, int type, ArrayList<StopwatchTimer> timerPool, ArrayList<Unpluggable> unpluggables) { super(type, unpluggables); + mUid = uid; mTimerPool = timerPool; } @@ -1254,6 +1302,10 @@ public final class BatteryStatsImpl extends BatteryStats { mWakeLockNesting++; } if (uid >= 0) { + if (!mHandler.hasMessages(MSG_UPDATE_WAKELOCKS)) { + Message m = mHandler.obtainMessage(MSG_UPDATE_WAKELOCKS); + mHandler.sendMessageDelayed(m, DELAY_UPDATE_WAKELOCKS); + } getUidStatsLocked(uid).noteStartWakeLocked(pid, name, type); } } @@ -1269,10 +1321,112 @@ public final class BatteryStatsImpl extends BatteryStats { } } if (uid >= 0) { + if (!mHandler.hasMessages(MSG_UPDATE_WAKELOCKS)) { + Message m = mHandler.obtainMessage(MSG_UPDATE_WAKELOCKS); + mHandler.sendMessageDelayed(m, DELAY_UPDATE_WAKELOCKS); + } getUidStatsLocked(uid).noteStopWakeLocked(pid, name, type); } } + public int startAddingCpuLocked() { + mHandler.removeMessages(MSG_UPDATE_WAKELOCKS); + + if (mScreenOn) { + return 0; + } + + final int N = mPartialTimers.size(); + if (N == 0) { + mLastPartialTimers.clear(); + return 0; + } + + // How many timers should consume CPU? Only want to include ones + // that have already been in the list. + for (int i=0; i<N; i++) { + StopwatchTimer st = mPartialTimers.get(i); + if (st.mInList) { + Uid uid = st.mUid; + // We don't include the system UID, because it so often + // holds wake locks at one request or another of an app. + if (uid != null && uid.mUid != Process.SYSTEM_UID) { + return 50; + } + } + } + + return 0; + } + + public void finishAddingCpuLocked(int perc, int utime, int stime, long[] cpuSpeedTimes) { + final int N = mPartialTimers.size(); + if (perc != 0) { + int num = 0; + for (int i=0; i<N; i++) { + StopwatchTimer st = mPartialTimers.get(i); + if (st.mInList) { + Uid uid = st.mUid; + // We don't include the system UID, because it so often + // holds wake locks at one request or another of an app. + if (uid != null && uid.mUid != Process.SYSTEM_UID) { + num++; + } + } + } + if (num != 0) { + for (int i=0; i<N; i++) { + StopwatchTimer st = mPartialTimers.get(i); + if (st.mInList) { + int myUTime = utime/num; + int mySTime = stime/num; + utime -= myUTime; + stime -= mySTime; + num--; + Uid uid = st.mUid; + if (uid != null && uid.mUid != Process.SYSTEM_UID) { + Uid.Proc proc = uid.getProcessStatsLocked("*wakelock*"); + proc.addCpuTimeLocked(myUTime, mySTime); + proc.addSpeedStepTimes(cpuSpeedTimes); + } + } + } + } + + // Just in case, collect any lost CPU time. + if (utime != 0 || stime != 0) { + Uid uid = getUidStatsLocked(Process.SYSTEM_UID); + if (uid != null) { + Uid.Proc proc = uid.getProcessStatsLocked("*lost*"); + proc.addCpuTimeLocked(utime, stime); + proc.addSpeedStepTimes(cpuSpeedTimes); + } + } + } + + final int NL = mLastPartialTimers.size(); + boolean diff = N != NL; + for (int i=0; i<NL && !diff; i++) { + diff |= mPartialTimers.get(i) != mLastPartialTimers.get(i); + } + if (!diff) { + for (int i=0; i<NL; i++) { + mPartialTimers.get(i).mInList = true; + } + return; + } + + for (int i=0; i<NL; i++) { + mLastPartialTimers.get(i).mInList = false; + } + mLastPartialTimers.clear(); + for (int i=0; i<N; i++) { + StopwatchTimer st = mPartialTimers.get(i); + st.mInList = true; + mLastPartialTimers.add(st); + } + } + public void noteProcessDiedLocked(int uid, int pid) { Uid u = mUidStats.get(uid); if (u != null) { @@ -1924,13 +2078,18 @@ public final class BatteryStatsImpl extends BatteryStats { public Uid(int uid) { mUid = uid; - mWifiTurnedOnTimer = new StopwatchTimer(WIFI_TURNED_ON, null, mUnpluggables); - mFullWifiLockTimer = new StopwatchTimer(FULL_WIFI_LOCK, null, mUnpluggables); - mScanWifiLockTimer = new StopwatchTimer(SCAN_WIFI_LOCK, null, mUnpluggables); - mWifiMulticastTimer = new StopwatchTimer(WIFI_MULTICAST_ENABLED, + mWifiTurnedOnTimer = new StopwatchTimer(Uid.this, WIFI_TURNED_ON, + null, mUnpluggables); + mFullWifiLockTimer = new StopwatchTimer(Uid.this, FULL_WIFI_LOCK, + null, mUnpluggables); + mScanWifiLockTimer = new StopwatchTimer(Uid.this, SCAN_WIFI_LOCK, + null, mUnpluggables); + mWifiMulticastTimer = new StopwatchTimer(Uid.this, WIFI_MULTICAST_ENABLED, + null, mUnpluggables); + mAudioTurnedOnTimer = new StopwatchTimer(Uid.this, AUDIO_TURNED_ON, + null, mUnpluggables); + mVideoTurnedOnTimer = new StopwatchTimer(Uid.this, VIDEO_TURNED_ON, null, mUnpluggables); - mAudioTurnedOnTimer = new StopwatchTimer(AUDIO_TURNED_ON, null, mUnpluggables); - mVideoTurnedOnTimer = new StopwatchTimer(VIDEO_TURNED_ON, null, mUnpluggables); } @Override @@ -1998,7 +2157,7 @@ public final class BatteryStatsImpl extends BatteryStats { if (!mWifiTurnedOn) { mWifiTurnedOn = true; if (mWifiTurnedOnTimer == null) { - mWifiTurnedOnTimer = new StopwatchTimer(WIFI_TURNED_ON, + mWifiTurnedOnTimer = new StopwatchTimer(Uid.this, WIFI_TURNED_ON, null, mUnpluggables); } mWifiTurnedOnTimer.startRunningLocked(BatteryStatsImpl.this); @@ -2018,7 +2177,7 @@ public final class BatteryStatsImpl extends BatteryStats { if (!mFullWifiLockOut) { mFullWifiLockOut = true; if (mFullWifiLockTimer == null) { - mFullWifiLockTimer = new StopwatchTimer(FULL_WIFI_LOCK, + mFullWifiLockTimer = new StopwatchTimer(Uid.this, FULL_WIFI_LOCK, null, mUnpluggables); } mFullWifiLockTimer.startRunningLocked(BatteryStatsImpl.this); @@ -2038,7 +2197,7 @@ public final class BatteryStatsImpl extends BatteryStats { if (!mScanWifiLockOut) { mScanWifiLockOut = true; if (mScanWifiLockTimer == null) { - mScanWifiLockTimer = new StopwatchTimer(SCAN_WIFI_LOCK, + mScanWifiLockTimer = new StopwatchTimer(Uid.this, SCAN_WIFI_LOCK, null, mUnpluggables); } mScanWifiLockTimer.startRunningLocked(BatteryStatsImpl.this); @@ -2058,7 +2217,7 @@ public final class BatteryStatsImpl extends BatteryStats { if (!mWifiMulticastEnabled) { mWifiMulticastEnabled = true; if (mWifiMulticastTimer == null) { - mWifiMulticastTimer = new StopwatchTimer(WIFI_MULTICAST_ENABLED, + mWifiMulticastTimer = new StopwatchTimer(Uid.this, WIFI_MULTICAST_ENABLED, null, mUnpluggables); } mWifiMulticastTimer.startRunningLocked(BatteryStatsImpl.this); @@ -2078,7 +2237,7 @@ public final class BatteryStatsImpl extends BatteryStats { if (!mAudioTurnedOn) { mAudioTurnedOn = true; if (mAudioTurnedOnTimer == null) { - mAudioTurnedOnTimer = new StopwatchTimer(AUDIO_TURNED_ON, + mAudioTurnedOnTimer = new StopwatchTimer(Uid.this, AUDIO_TURNED_ON, null, mUnpluggables); } mAudioTurnedOnTimer.startRunningLocked(BatteryStatsImpl.this); @@ -2098,7 +2257,7 @@ public final class BatteryStatsImpl extends BatteryStats { if (!mVideoTurnedOn) { mVideoTurnedOn = true; if (mVideoTurnedOnTimer == null) { - mVideoTurnedOnTimer = new StopwatchTimer(VIDEO_TURNED_ON, + mVideoTurnedOnTimer = new StopwatchTimer(Uid.this, VIDEO_TURNED_ON, null, mUnpluggables); } mVideoTurnedOnTimer.startRunningLocked(BatteryStatsImpl.this); @@ -2458,42 +2617,42 @@ public final class BatteryStatsImpl extends BatteryStats { mTcpBytesSentAtLastUnplug = in.readLong(); mWifiTurnedOn = false; if (in.readInt() != 0) { - mWifiTurnedOnTimer = new StopwatchTimer(WIFI_TURNED_ON, + mWifiTurnedOnTimer = new StopwatchTimer(Uid.this, WIFI_TURNED_ON, null, mUnpluggables, in); } else { mWifiTurnedOnTimer = null; } mFullWifiLockOut = false; if (in.readInt() != 0) { - mFullWifiLockTimer = new StopwatchTimer(FULL_WIFI_LOCK, + mFullWifiLockTimer = new StopwatchTimer(Uid.this, FULL_WIFI_LOCK, null, mUnpluggables, in); } else { mFullWifiLockTimer = null; } mScanWifiLockOut = false; if (in.readInt() != 0) { - mScanWifiLockTimer = new StopwatchTimer(SCAN_WIFI_LOCK, + mScanWifiLockTimer = new StopwatchTimer(Uid.this, SCAN_WIFI_LOCK, null, mUnpluggables, in); } else { mScanWifiLockTimer = null; } mWifiMulticastEnabled = false; if (in.readInt() != 0) { - mWifiMulticastTimer = new StopwatchTimer(WIFI_MULTICAST_ENABLED, + mWifiMulticastTimer = new StopwatchTimer(Uid.this, WIFI_MULTICAST_ENABLED, null, mUnpluggables, in); } else { mWifiMulticastTimer = null; } mAudioTurnedOn = false; if (in.readInt() != 0) { - mAudioTurnedOnTimer = new StopwatchTimer(AUDIO_TURNED_ON, + mAudioTurnedOnTimer = new StopwatchTimer(Uid.this, AUDIO_TURNED_ON, null, mUnpluggables, in); } else { mAudioTurnedOnTimer = null; } mVideoTurnedOn = false; if (in.readInt() != 0) { - mVideoTurnedOnTimer = new StopwatchTimer(VIDEO_TURNED_ON, + mVideoTurnedOnTimer = new StopwatchTimer(Uid.this, VIDEO_TURNED_ON, null, mUnpluggables, in); } else { mVideoTurnedOnTimer = null; @@ -2540,7 +2699,7 @@ public final class BatteryStatsImpl extends BatteryStats { return null; } - return new StopwatchTimer(type, pool, unpluggables, in); + return new StopwatchTimer(Uid.this, type, pool, unpluggables, in); } boolean reset() { @@ -2616,7 +2775,7 @@ public final class BatteryStatsImpl extends BatteryStats { pool = new ArrayList<StopwatchTimer>(); mSensorTimers.put(mHandle, pool); } - return new StopwatchTimer(0, pool, unpluggables, in); + return new StopwatchTimer(Uid.this, 0, pool, unpluggables, in); } boolean reset() { @@ -3418,21 +3577,24 @@ public final class BatteryStatsImpl extends BatteryStats { case WAKE_TYPE_PARTIAL: t = wl.mTimerPartial; if (t == null) { - t = new StopwatchTimer(WAKE_TYPE_PARTIAL, mPartialTimers, mUnpluggables); + t = new StopwatchTimer(Uid.this, WAKE_TYPE_PARTIAL, + mPartialTimers, mUnpluggables); wl.mTimerPartial = t; } return t; case WAKE_TYPE_FULL: t = wl.mTimerFull; if (t == null) { - t = new StopwatchTimer(WAKE_TYPE_FULL, mFullTimers, mUnpluggables); + t = new StopwatchTimer(Uid.this, WAKE_TYPE_FULL, + mFullTimers, mUnpluggables); wl.mTimerFull = t; } return t; case WAKE_TYPE_WINDOW: t = wl.mTimerWindow; if (t == null) { - t = new StopwatchTimer(WAKE_TYPE_WINDOW, mWindowTimers, mUnpluggables); + t = new StopwatchTimer(Uid.this, WAKE_TYPE_WINDOW, + mWindowTimers, mUnpluggables); wl.mTimerWindow = t; } return t; @@ -3459,7 +3621,7 @@ public final class BatteryStatsImpl extends BatteryStats { timers = new ArrayList<StopwatchTimer>(); mSensorTimers.put(sensor, timers); } - t = new StopwatchTimer(BatteryStats.SENSOR, timers, mUnpluggables); + t = new StopwatchTimer(Uid.this, BatteryStats.SENSOR, timers, mUnpluggables); se.mTimer = t; return t; } @@ -3532,25 +3694,26 @@ public final class BatteryStatsImpl extends BatteryStats { public BatteryStatsImpl(String filename) { mFile = new JournaledFile(new File(filename), new File(filename + ".tmp")); + mHandler = new MyHandler(); mStartCount++; - mScreenOnTimer = new StopwatchTimer(-1, null, mUnpluggables); + mScreenOnTimer = new StopwatchTimer(null, -1, null, mUnpluggables); for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) { - mScreenBrightnessTimer[i] = new StopwatchTimer(-100-i, null, mUnpluggables); + mScreenBrightnessTimer[i] = new StopwatchTimer(null, -100-i, null, mUnpluggables); } mInputEventCounter = new Counter(mUnpluggables); - mPhoneOnTimer = new StopwatchTimer(-2, null, mUnpluggables); + mPhoneOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables); for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) { - mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(-200-i, null, mUnpluggables); + mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(null, -200-i, null, mUnpluggables); } - mPhoneSignalScanningTimer = new StopwatchTimer(-200+1, null, mUnpluggables); + mPhoneSignalScanningTimer = new StopwatchTimer(null, -200+1, null, mUnpluggables); for (int i=0; i<NUM_DATA_CONNECTION_TYPES; i++) { - mPhoneDataConnectionsTimer[i] = new StopwatchTimer(-300-i, null, mUnpluggables); + mPhoneDataConnectionsTimer[i] = new StopwatchTimer(null, -300-i, null, mUnpluggables); } - mWifiOnTimer = new StopwatchTimer(-3, null, mUnpluggables); - mWifiRunningTimer = new StopwatchTimer(-4, null, mUnpluggables); - mBluetoothOnTimer = new StopwatchTimer(-5, null, mUnpluggables); - mAudioOnTimer = new StopwatchTimer(-6, null, mUnpluggables); - mVideoOnTimer = new StopwatchTimer(-7, null, mUnpluggables); + mWifiOnTimer = new StopwatchTimer(null, -3, null, mUnpluggables); + mWifiRunningTimer = new StopwatchTimer(null, -4, null, mUnpluggables); + mBluetoothOnTimer = new StopwatchTimer(null, -5, null, mUnpluggables); + mAudioOnTimer = new StopwatchTimer(null, -6, null, mUnpluggables); + mVideoOnTimer = new StopwatchTimer(null, -7, null, mUnpluggables); mOnBattery = mOnBatteryInternal = false; initTimes(); mTrackBatteryPastUptime = 0; @@ -3568,9 +3731,14 @@ public final class BatteryStatsImpl extends BatteryStats { public BatteryStatsImpl(Parcel p) { mFile = null; + mHandler = null; readFromParcel(p); } + public void setCallback(BatteryCallback cb) { + mCallback = cb; + } + public void setNumSpeedSteps(int steps) { if (sNumSpeedSteps == 0) sNumSpeedSteps = steps; } @@ -3655,6 +3823,9 @@ public final class BatteryStatsImpl extends BatteryStats { void setOnBattery(boolean onBattery, int oldStatus, int level) { synchronized(this) { boolean doWrite = false; + Message m = mHandler.obtainMessage(MSG_REPORT_POWER_CHANGE); + m.arg1 = onBattery ? 1 : 0; + mHandler.sendMessage(m); mOnBattery = mOnBatteryInternal = onBattery; long uptime = SystemClock.uptimeMillis() * 1000; @@ -4555,26 +4726,29 @@ public final class BatteryStatsImpl extends BatteryStats { mBatteryRealtime = in.readLong(); mBatteryLastRealtime = 0; mScreenOn = false; - mScreenOnTimer = new StopwatchTimer(-1, null, mUnpluggables, in); + mScreenOnTimer = new StopwatchTimer(null, -1, null, mUnpluggables, in); for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) { - mScreenBrightnessTimer[i] = new StopwatchTimer(-100-i, null, mUnpluggables, in); + mScreenBrightnessTimer[i] = new StopwatchTimer(null, -100-i, + null, mUnpluggables, in); } mInputEventCounter = new Counter(mUnpluggables, in); mPhoneOn = false; - mPhoneOnTimer = new StopwatchTimer(-2, null, mUnpluggables, in); + mPhoneOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in); for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) { - mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(-200-i, null, mUnpluggables, in); + mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(null, -200-i, + null, mUnpluggables, in); } - mPhoneSignalScanningTimer = new StopwatchTimer(-200+1, null, mUnpluggables, in); + mPhoneSignalScanningTimer = new StopwatchTimer(null, -200+1, null, mUnpluggables, in); for (int i=0; i<NUM_DATA_CONNECTION_TYPES; i++) { - mPhoneDataConnectionsTimer[i] = new StopwatchTimer(-300-i, null, mUnpluggables, in); + mPhoneDataConnectionsTimer[i] = new StopwatchTimer(null, -300-i, + null, mUnpluggables, in); } mWifiOn = false; - mWifiOnTimer = new StopwatchTimer(-2, null, mUnpluggables, in); + mWifiOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in); mWifiRunning = false; - mWifiRunningTimer = new StopwatchTimer(-2, null, mUnpluggables, in); + mWifiRunningTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in); mBluetoothOn = false; - mBluetoothOnTimer = new StopwatchTimer(-2, null, mUnpluggables, in); + mBluetoothOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in); mUptime = in.readLong(); mUptimeStart = in.readLong(); mLastUptime = 0; diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp index b062264..95bb24f 100644 --- a/core/jni/android/graphics/Bitmap.cpp +++ b/core/jni/android/graphics/Bitmap.cpp @@ -12,6 +12,8 @@ #include <jni.h>
+#include <Caches.h>
+
#if 0
#define TRACE_BITMAP(code) code
#else
@@ -251,6 +253,9 @@ static jobject Bitmap_copy(JNIEnv* env, jobject, const SkBitmap* src, }
static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) {
+#ifdef USE_OPENGL_RENDERER
+ android::uirenderer::Caches::getInstance().textureCache.remove(bitmap);
+#endif
delete bitmap;
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index c7c8ec1..89298ea 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -50,6 +50,8 @@ <protected-broadcast android:name="android.intent.action.ACTION_SHUTDOWN" /> <protected-broadcast android:name="android.intent.action.DEVICE_STORAGE_LOW" /> <protected-broadcast android:name="android.intent.action.DEVICE_STORAGE_OK" /> + <protected-broadcast android:name="android.intent.action.DEVICE_STORAGE_FULL" /> + <protected-broadcast android:name="android.intent.action.DEVICE_STORAGE_NOT_FULL" /> <protected-broadcast android:name="android.intent.action.NEW_OUTGOING_CALL" /> <protected-broadcast android:name="android.intent.action.REBOOT" /> <protected-broadcast android:name="android.intent.action.DOCK_EVENT" /> diff --git a/core/res/res/layout/recent_apps_activity.xml b/core/res/res/layout/recent_apps_activity.xml deleted file mode 100644 index 45a200e..0000000 --- a/core/res/res/layout/recent_apps_activity.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2008, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <!-- Title --> - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="#80FFFFFF" - android:textStyle="bold" - android:singleLine="true" - android:text="@android:string/recent_tasks_title" - android:visibility="gone"/> - - <!-- This is only intended to be visible when carousel is invisible --> - <TextView - android:id="@+id/no_applications_message" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:textAppearance="?android:attr/textAppearanceSmall" - android:text="@android:string/no_recent_tasks" - android:visibility="gone"/> - - <com.android.systemui.statusbar.RecentApplicationsCarouselView - android:id="@+id/carousel" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - </com.android.systemui.statusbar.RecentApplicationsCarouselView> - -</LinearLayout> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index e9d799b..1981ac0 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -283,9 +283,15 @@ <!-- Shutdown Confirmation Dialog. When the user chooses to power off the phone, there will be a confirmation dialog. This is the message. --> <string name="shutdown_confirm">Your phone will shut down.</string> - <!-- Recent Tasks dialog: title --> + <!-- Recent Tasks dialog: title + TODO: this should move to SystemUI.apk, but the code for the old + recent dialog is still in the framework + --> <string name="recent_tasks_title">Recent</string> - <!-- Recent Tasks dialog: message when there are no recent applications --> + <!-- Recent Tasks dialog: message when there are no recent applications + TODO: this should move to SystemUI.apk, but the code for the old + recent dialog is still in the framework + --> <string name="no_recent_tasks">No recent applications.</string> <!-- Title of the Global Actions Dialog --> |