diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 26 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 6 | ||||
-rw-r--r-- | core/java/android/app/PendingIntent.java | 14 | ||||
-rw-r--r-- | core/java/android/os/BatteryProperties.java | 19 | ||||
-rw-r--r-- | core/java/android/os/BatteryStats.java | 10 | ||||
-rw-r--r-- | core/java/android/os/IPowerManager.aidl | 6 | ||||
-rw-r--r-- | core/java/android/os/PowerManager.java | 9 | ||||
-rw-r--r-- | core/java/com/android/internal/app/IBatteryStats.aidl | 7 | ||||
-rw-r--r-- | core/java/com/android/internal/os/BatteryStatsImpl.java | 16 |
9 files changed, 93 insertions, 20 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 04155b5..ea0ddc1 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1843,6 +1843,17 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IIntentSender r = IIntentSender.Stub.asInterface( + data.readStrongBinder()); + String prefix = data.readString(); + String tag = getTagForIntentSender(r, prefix); + reply.writeNoException(); + reply.writeString(tag); + return true; + } + case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); Configuration config = Configuration.CREATOR.createFromParcel(data); @@ -4435,6 +4446,21 @@ class ActivityManagerProxy implements IActivityManager return res; } + public String getTagForIntentSender(IIntentSender sender, String prefix) + throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(sender.asBinder()); + data.writeString(prefix); + mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); + reply.readException(); + String res = reply.readString(); + data.recycle(); + reply.recycle(); + return res; + } + public void updatePersistentConfiguration(Configuration values) throws RemoteException { Parcel data = Parcel.obtain(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index bbf2ecc..4412261 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -367,6 +367,8 @@ public interface IActivityManager extends IInterface { public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException; + public String getTagForIntentSender(IIntentSender sender, String prefix) throws RemoteException; + public void updatePersistentConfiguration(Configuration values) throws RemoteException; public long[] getProcessPss(int[] pids) throws RemoteException; @@ -709,4 +711,8 @@ public interface IActivityManager extends IInterface { int GET_HOME_ACTIVITY_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+183; int GET_ACTIVITY_CONTAINER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+184; int DELETE_ACTIVITY_CONTAINER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+185; + + + // Start of L transactions + int GET_TAG_FOR_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+210; } diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index d4de112..8efc14f 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -889,6 +889,20 @@ public final class PendingIntent implements Parcelable { } /** + * @hide + * Return descriptive tag for this PendingIntent. + */ + public String getTag(String prefix) { + try { + return ActivityManagerNative.getDefault() + .getTagForIntentSender(mTarget, prefix); + } catch (RemoteException e) { + // Should never happen. + return null; + } + } + + /** * Comparison operator on two PendingIntent objects, such that true * is returned then they both represent the same operation from the * same package. This allows you to use {@link #getActivity}, diff --git a/core/java/android/os/BatteryProperties.java b/core/java/android/os/BatteryProperties.java index 2d67264..8f5cf8b 100644 --- a/core/java/android/os/BatteryProperties.java +++ b/core/java/android/os/BatteryProperties.java @@ -15,9 +15,6 @@ package android.os; -import android.os.Parcel; -import android.os.Parcelable; - /** * {@hide} */ @@ -33,6 +30,22 @@ public class BatteryProperties implements Parcelable { public int batteryTemperature; public String batteryTechnology; + public BatteryProperties() { + } + + public void set(BatteryProperties other) { + chargerAcOnline = other.chargerAcOnline; + chargerUsbOnline = other.chargerUsbOnline; + chargerWirelessOnline = other.chargerWirelessOnline; + batteryStatus = other.batteryStatus; + batteryHealth = other.batteryHealth; + batteryPresent = other.batteryPresent; + batteryLevel = other.batteryLevel; + batteryVoltage = other.batteryVoltage; + batteryTemperature = other.batteryTemperature; + batteryTechnology = other.batteryTechnology; + } + /* * Parcel read/write code must be kept in sync with * frameworks/native/services/batteryservice/BatteryProperties.cpp diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index dfba208..e91f7d7 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -588,8 +588,10 @@ public abstract class BatteryStats implements Parcelable { public static final int EVENT_FOREGROUND = 0x0002; // Event is about an application package that is at the top of the screen. public static final int EVENT_TOP = 0x0003; + // Event is about an application package that is at the top of the screen. + public static final int EVENT_SYNC = 0x0004; // Number of event types. - public static final int EVENT_COUNT = 0x0004; + public static final int EVENT_COUNT = 0x0005; public static final int EVENT_PROC_START = EVENT_PROC | EVENT_FLAG_START; public static final int EVENT_PROC_FINISH = EVENT_PROC | EVENT_FLAG_FINISH; @@ -597,6 +599,8 @@ public abstract class BatteryStats implements Parcelable { public static final int EVENT_FOREGROUND_FINISH = EVENT_FOREGROUND | EVENT_FLAG_FINISH; public static final int EVENT_TOP_START = EVENT_TOP | EVENT_FLAG_START; public static final int EVENT_TOP_FINISH = EVENT_TOP | EVENT_FLAG_FINISH; + public static final int EVENT_SYNC_START = EVENT_SYNC | EVENT_FLAG_START; + public static final int EVENT_SYNC_FINISH = EVENT_SYNC | EVENT_FLAG_FINISH; // For CMD_EVENT. public int eventCode; @@ -975,11 +979,11 @@ public abstract class BatteryStats implements Parcelable { }; public static final String[] HISTORY_EVENT_NAMES = new String[] { - "null", "proc", "fg", "top" + "null", "proc", "fg", "top", "sync" }; public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] { - "Nl", "Pr", "Fg", "Tp" + "Enl", "Epr", "Efg", "Etp", "Esy" }; /** diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 56176a4..069285a 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -25,8 +25,10 @@ interface IPowerManager { // WARNING: The first four methods must remain the first three methods because their // transaction numbers must not change unless IPowerManager.cpp is also updated. - void acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws); - void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName, int uidtoblame); + void acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws, + String historyTag); + void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName, + int uidtoblame); void releaseWakeLock(IBinder lock, int flags); void updateWakeLockUids(IBinder lock, in int[] uids); diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 4d4c337..74ca3bb 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -662,6 +662,7 @@ public final class PowerManager { private boolean mRefCounted = true; private boolean mHeld; private WorkSource mWorkSource; + private String mHistoryTag; private final Runnable mReleaser = new Runnable() { public void run() { @@ -748,7 +749,8 @@ public final class PowerManager { // been explicitly released by the keyguard. mHandler.removeCallbacks(mReleaser); try { - mService.acquireWakeLock(mToken, mFlags, mTag, mPackageName, mWorkSource); + mService.acquireWakeLock(mToken, mFlags, mTag, mPackageName, mWorkSource, + mHistoryTag); } catch (RemoteException e) { } mHeld = true; @@ -855,6 +857,11 @@ public final class PowerManager { } /** @hide */ + public void setHistoryTag(String tag) { + mHistoryTag = tag; + } + + /** @hide */ public void setUnimportantForLogging(boolean state) { if (state) mFlags |= UNIMPORTANT_FOR_LOGGING; else mFlags &= ~UNIMPORTANT_FOR_LOGGING; diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index 1155cbb..892ad68 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -35,11 +35,12 @@ interface IBatteryStats { void noteEvent(int code, String name, int uid); - void noteStartWakelock(int uid, int pid, String name, int type, boolean unimportantForLogging); + void noteStartWakelock(int uid, int pid, String name, String historyName, + int type, boolean unimportantForLogging); void noteStopWakelock(int uid, int pid, String name, int type); - void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, int type, - boolean unimportantForLogging); + void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, String historyName, + int type, boolean unimportantForLogging); void noteStopWakelockFromSource(in WorkSource ws, int pid, String name, int type); void noteVibratorOn(int uid, long durationMillis); diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 40e8727..8843500 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -2011,7 +2011,7 @@ public final class BatteryStatsImpl extends BatteryStats { addHistoryEventLocked(SystemClock.elapsedRealtime(), code, name, uid); } - public void noteStartWakeLocked(int uid, int pid, String name, int type, + public void noteStartWakeLocked(int uid, int pid, String name, String historyName, int type, boolean unimportantForLogging) { uid = mapUid(uid); final long elapsedRealtime = SystemClock.elapsedRealtime(); @@ -2023,7 +2023,7 @@ public final class BatteryStatsImpl extends BatteryStats { if (DEBUG_HISTORY) Slog.v(TAG, "Start wake lock to: " + Integer.toHexString(mHistoryCur.states)); mHistoryCur.wakelockTag = mHistoryCur.localWakelockTag; - mHistoryCur.wakelockTag.string = name; + mHistoryCur.wakelockTag.string = historyName != null ? historyName : name; mHistoryCur.wakelockTag.uid = uid; mWakeLockImportant = !unimportantForLogging; addHistoryRecordLocked(elapsedRealtime); @@ -2032,7 +2032,7 @@ public final class BatteryStatsImpl extends BatteryStats { // We'll try to update the last tag. mHistoryLastWritten.wakelockTag = null; mHistoryCur.wakelockTag = mHistoryCur.localWakelockTag; - mHistoryCur.wakelockTag.string = name; + mHistoryCur.wakelockTag.string = historyName != null ? historyName : name; mHistoryCur.wakelockTag.uid = uid; addHistoryRecordLocked(elapsedRealtime); } @@ -2070,11 +2070,11 @@ public final class BatteryStatsImpl extends BatteryStats { } } - public void noteStartWakeFromSourceLocked(WorkSource ws, int pid, String name, int type, - boolean unimportantForLogging) { + public void noteStartWakeFromSourceLocked(WorkSource ws, int pid, String name, + String historyName, int type, boolean unimportantForLogging) { int N = ws.size(); for (int i=0; i<N; i++) { - noteStartWakeLocked(ws.get(i), pid, name, type, unimportantForLogging); + noteStartWakeLocked(ws.get(i), pid, name, historyName, type, unimportantForLogging); } } @@ -2291,7 +2291,8 @@ 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, "screen", WAKE_TYPE_PARTIAL, false); + noteStartWakeLocked(Process.myUid(), Process.myPid(), "screen", null, + WAKE_TYPE_PARTIAL, false); // Update discharge amounts. if (mOnBatteryInternal) { @@ -5662,7 +5663,6 @@ public final class BatteryStatsImpl extends BatteryStats { final NetworkStats delta = NetworkStats.subtract(snapshot, last, null, null, mTmpNetworkStats); mTmpNetworkStats = delta; - mLastWifiSnapshot = snapshot; final int size = delta.size(); for (int i = 0; i < size; i++) { |