Merge "Don't call back into AM to get current user."
diff --git a/api/current.txt b/api/current.txt
index b55c1c7..7bd2e8a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7614,6 +7614,7 @@
field public static final java.lang.String EXTRA_VERIFICATION_RESULT = "android.content.pm.extra.VERIFICATION_RESULT";
field public static final java.lang.String FEATURE_APP_WIDGETS = "android.software.app_widgets";
field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
+ field public static final java.lang.String FEATURE_BACKUP = "android.software.backup";
field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
field public static final java.lang.String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera";
@@ -7635,6 +7636,7 @@
field public static final java.lang.String FEATURE_MICROPHONE = "android.hardware.microphone";
field public static final java.lang.String FEATURE_NFC = "android.hardware.nfc";
field public static final java.lang.String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
+ field public static final java.lang.String FEATURE_PRINTING = "android.software.print";
field public static final java.lang.String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
field public static final java.lang.String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
field public static final java.lang.String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index ee8d457..bf2a629 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -972,7 +972,7 @@
if (fragment.mAnimatingAway != null) {
fragment.mAnimatingAway = null;
moveToState(fragment, fragment.mStateAfterAnimating,
- 0, 0, true);
+ 0, 0, false);
}
}
});
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index d3b0763..d4de112 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -231,7 +231,7 @@
* <p class="note">For security reasons, the {@link android.content.Intent}
* you supply here should almost always be an <em>explicit intent</em>,
* that is specify an explicit component to be delivered to through
- * {@link Intent#setClass(android.content.Context, Class)} Intent.setClass</p>
+ * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p>
*
* @param context The Context in which this PendingIntent should start
* the activity.
@@ -262,7 +262,7 @@
* <p class="note">For security reasons, the {@link android.content.Intent}
* you supply here should almost always be an <em>explicit intent</em>,
* that is specify an explicit component to be delivered to through
- * {@link Intent#setClass(android.content.Context, Class)} Intent.setClass</p>
+ * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p>
*
* @param context The Context in which this PendingIntent should start
* the activity.
@@ -354,7 +354,7 @@
* <p class="note">For security reasons, the {@link android.content.Intent} objects
* you supply here should almost always be <em>explicit intents</em>,
* that is specify an explicit component to be delivered to through
- * {@link Intent#setClass(android.content.Context, Class)} Intent.setClass</p>
+ * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p>
*
* @param context The Context in which this PendingIntent should start
* the activity.
@@ -404,7 +404,7 @@
* <p class="note">For security reasons, the {@link android.content.Intent} objects
* you supply here should almost always be <em>explicit intents</em>,
* that is specify an explicit component to be delivered to through
- * {@link Intent#setClass(android.content.Context, Class)} Intent.setClass</p>
+ * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p>
*
* @param context The Context in which this PendingIntent should start
* the activity.
@@ -474,7 +474,7 @@
* <p class="note">For security reasons, the {@link android.content.Intent}
* you supply here should almost always be an <em>explicit intent</em>,
* that is specify an explicit component to be delivered to through
- * {@link Intent#setClass(android.content.Context, Class)} Intent.setClass</p>
+ * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p>
*
* @param context The Context in which this PendingIntent should perform
* the broadcast.
@@ -528,7 +528,7 @@
* <p class="note">For security reasons, the {@link android.content.Intent}
* you supply here should almost always be an <em>explicit intent</em>,
* that is specify an explicit component to be delivered to through
- * {@link Intent#setClass(android.content.Context, Class)} Intent.setClass</p>
+ * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p>
*
* @param context The Context in which this PendingIntent should start
* the service.
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 40bdb73..0cc878e 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1690,16 +1690,16 @@
* user. Also, this method must be called before the user has been used for the first time.
* @param packageName the package name of the application to be registered as profile owner.
* @param ownerName the human readable name of the organisation associated with this DPM.
+ * @param userHandle the userId to set the profile owner for.
* @return whether the package was successfully registered as the profile owner.
* @throws IllegalArgumentException if packageName is null, the package isn't installed, or
* the user has already been set up.
*/
- public boolean setProfileOwner(String packageName, String ownerName)
+ public boolean setProfileOwner(String packageName, String ownerName, int userHandle)
throws IllegalArgumentException {
if (mService != null) {
try {
- return mService.setProfileOwner(packageName, ownerName,
- Process.myUserHandle().getIdentifier());
+ return mService.setProfileOwner(packageName, ownerName, userHandle);
} catch (RemoteException re) {
Log.w(TAG, "Failed to set profile owner", re);
throw new IllegalArgumentException("Couldn't set profile owner.", re);
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 0192a30..40d9606 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1257,6 +1257,20 @@
public static final String FEATURE_TELEVISION = "android.hardware.type.television";
/**
+ * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
+ * The device supports printing.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_PRINTING = "android.software.print";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
+ * The device can perform backup and restore operations on installed applications.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_BACKUP = "android.software.backup";
+
+ /**
* Action to external storage service to clean out removed apps.
* @hide
*/
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 408e532..dfde11b 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -1329,7 +1329,7 @@
* <p>Each channel's curve is defined by an array of control points:</p>
* <pre><code>{@link CaptureRequest#TONEMAP_CURVE_RED android.tonemap.curveRed} =
* [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
- * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
+ * 2 <= N <= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
* <p>These are sorted in order of increasing <code>Pin</code>; it is always
* guaranteed that input values 0.0 and 1.0 are included in the list to
* define a complete mapping. For input values between control points,
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 345b52c..32526bd 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -1788,7 +1788,7 @@
* <p>Each channel's curve is defined by an array of control points:</p>
* <pre><code>{@link CaptureRequest#TONEMAP_CURVE_RED android.tonemap.curveRed} =
* [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
- * 2 &lt;= N &lt;= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
+ * 2 <= N <= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre>
* <p>These are sorted in order of increasing <code>Pin</code>; it is always
* guaranteed that input values 0.0 and 1.0 are included in the list to
* define a complete mapping. For input values between control points,
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index a9b6073..dfba208 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -171,6 +171,10 @@
private static final String SIGNAL_STRENGTH_COUNT_DATA = "sgc";
private static final String DATA_CONNECTION_TIME_DATA = "dct";
private static final String DATA_CONNECTION_COUNT_DATA = "dcc";
+ private static final String WIFI_STATE_TIME_DATA = "wst";
+ private static final String WIFI_STATE_COUNT_DATA = "wsc";
+ private static final String BLUETOOTH_STATE_TIME_DATA = "bst";
+ private static final String BLUETOOTH_STATE_COUNT_DATA = "bsc";
private static final String POWER_USE_SUMMARY_DATA = "pws";
private static final String POWER_USE_ITEM_DATA = "pwi";
@@ -275,22 +279,22 @@
*/
public abstract int getUid();
- public abstract void noteWifiRunningLocked();
- public abstract void noteWifiStoppedLocked();
- public abstract void noteFullWifiLockAcquiredLocked();
- public abstract void noteFullWifiLockReleasedLocked();
- public abstract void noteWifiScanStartedLocked();
- public abstract void noteWifiScanStoppedLocked();
- public abstract void noteWifiBatchedScanStartedLocked(int csph);
- public abstract void noteWifiBatchedScanStoppedLocked();
- public abstract void noteWifiMulticastEnabledLocked();
- public abstract void noteWifiMulticastDisabledLocked();
- public abstract void noteAudioTurnedOnLocked();
- public abstract void noteAudioTurnedOffLocked();
- public abstract void noteVideoTurnedOnLocked();
- public abstract void noteVideoTurnedOffLocked();
- public abstract void noteActivityResumedLocked();
- public abstract void noteActivityPausedLocked();
+ public abstract void noteWifiRunningLocked(long elapsedRealtime);
+ public abstract void noteWifiStoppedLocked(long elapsedRealtime);
+ public abstract void noteFullWifiLockAcquiredLocked(long elapsedRealtime);
+ public abstract void noteFullWifiLockReleasedLocked(long elapsedRealtime);
+ public abstract void noteWifiScanStartedLocked(long elapsedRealtime);
+ public abstract void noteWifiScanStoppedLocked(long elapsedRealtime);
+ public abstract void noteWifiBatchedScanStartedLocked(int csph, long elapsedRealtime);
+ public abstract void noteWifiBatchedScanStoppedLocked(long elapsedRealtime);
+ public abstract void noteWifiMulticastEnabledLocked(long elapsedRealtime);
+ public abstract void noteWifiMulticastDisabledLocked(long elapsedRealtime);
+ public abstract void noteAudioTurnedOnLocked(long elapsedRealtime);
+ public abstract void noteAudioTurnedOffLocked(long elapsedRealtime);
+ public abstract void noteVideoTurnedOnLocked(long elapsedRealtime);
+ public abstract void noteVideoTurnedOffLocked(long elapsedRealtime);
+ public abstract void noteActivityResumedLocked(long elapsedRealtime);
+ public abstract void noteActivityPausedLocked(long elapsedRealtime);
public abstract long getWifiRunningTime(long batteryRealtime, int which);
public abstract long getFullWifiLockTime(long batteryRealtime, int which);
public abstract long getWifiScanTime(long batteryRealtime, int which);
@@ -994,6 +998,37 @@
*/
public abstract long getGlobalWifiRunningTime(long batteryRealtime, int which);
+ public static final int WIFI_STATE_OFF = 0;
+ public static final int WIFI_STATE_OFF_SCANNING = 1;
+ public static final int WIFI_STATE_ON_NO_NETWORKS = 2;
+ public static final int WIFI_STATE_ON_DISCONNECTED = 3;
+ public static final int WIFI_STATE_ON_CONNECTED_STA = 4;
+ public static final int WIFI_STATE_ON_CONNECTED_P2P = 5;
+ public static final int WIFI_STATE_ON_CONNECTED_STA_P2P = 6;
+ public static final int WIFI_STATE_SOFT_AP = 7;
+
+ static final String[] WIFI_STATE_NAMES = {
+ "off", "scanning", "no_net", "disconn",
+ "sta", "p2p", "sta_p2p", "soft_ap"
+ };
+
+ public static final int NUM_WIFI_STATES = WIFI_STATE_SOFT_AP+1;
+
+ /**
+ * Returns the time in microseconds that WiFi has been running in the given state.
+ *
+ * {@hide}
+ */
+ public abstract long getWifiStateTime(int wifiState,
+ long batteryRealtime, int which);
+
+ /**
+ * Returns the number of times that WiFi has entered the given state.
+ *
+ * {@hide}
+ */
+ public abstract int getWifiStateCount(int wifiState, int which);
+
/**
* Returns the time in microseconds that bluetooth has been on while the device was
* running on battery.
@@ -1004,16 +1039,16 @@
public abstract int getBluetoothPingCount();
- public static final int BLUETOOTH_INACTIVE = 0;
- public static final int BLUETOOTH_ACTIVE_LOW = 1;
- public static final int BLUETOOTH_ACTIVE_MEDIUM = 2;
- public static final int BLUETOOTH_ACTIVE_HIGH = 3;
+ public static final int BLUETOOTH_STATE_INACTIVE = 0;
+ public static final int BLUETOOTH_STATE_LOW = 1;
+ public static final int BLUETOOTH_STATE_MEDIUM = 2;
+ public static final int BLUETOOTH_STATE_HIGH = 3;
- static final String[] BLUETOOTH_ACTIVE_NAMES = {
- "none", "low", "med", "high"
+ static final String[] BLUETOOTH_STATE_NAMES = {
+ "inactive", "low", "med", "high"
};
- public static final int NUM_BLUETOOTH_ACTIVE_TYPES = BLUETOOTH_ACTIVE_HIGH+1;
+ public static final int NUM_BLUETOOTH_STATES = BLUETOOTH_STATE_HIGH +1;
/**
* Returns the time in microseconds that Bluetooth has been running in the
@@ -1021,15 +1056,15 @@
*
* {@hide}
*/
- public abstract long getBluetoothActiveTime(int activeType,
+ public abstract long getBluetoothStateTime(int bluetoothState,
long batteryRealtime, int which);
/**
- * Returns the number of times the Bluetooth has entered the given active state.
+ * Returns the number of times that Bluetooth has entered the given active state.
*
* {@hide}
*/
- public abstract int getBluetoothActiveCount(int activeType, int which);
+ public abstract int getBluetoothStateCount(int bluetoothState, int which);
public static final int NETWORK_MOBILE_RX_DATA = 0;
public static final int NETWORK_MOBILE_TX_DATA = 1;
@@ -1431,7 +1466,29 @@
args[i] = getPhoneDataConnectionCount(i, which);
}
dumpLine(pw, 0 /* uid */, category, DATA_CONNECTION_COUNT_DATA, args);
-
+
+ // Dump wifi state stats
+ args = new Object[NUM_WIFI_STATES];
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ args[i] = getWifiStateTime(i, batteryRealtime, which) / 1000;
+ }
+ dumpLine(pw, 0 /* uid */, category, WIFI_STATE_TIME_DATA, args);
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ args[i] = getWifiStateCount(i, which);
+ }
+ dumpLine(pw, 0 /* uid */, category, WIFI_STATE_COUNT_DATA, args);
+
+ // Dump bluetooth state stats
+ args = new Object[NUM_BLUETOOTH_STATES];
+ for (int i=0; i<NUM_BLUETOOTH_STATES; i++) {
+ args[i] = getBluetoothStateTime(i, batteryRealtime, which) / 1000;
+ }
+ dumpLine(pw, 0 /* uid */, category, BLUETOOTH_STATE_TIME_DATA, args);
+ for (int i=0; i<NUM_BLUETOOTH_STATES; i++) {
+ args[i] = getBluetoothStateCount(i, which);
+ }
+ dumpLine(pw, 0 /* uid */, category, BLUETOOTH_STATE_COUNT_DATA, args);
+
if (which == STATS_SINCE_UNPLUGGED) {
dumpLine(pw, 0 /* uid */, category, BATTERY_LEVEL_DATA, getDischargeStartLevel(),
getDischargeCurrentLevel());
@@ -1941,12 +1998,63 @@
sb.append("("); sb.append(formatRatioLocked(wifiOnTime, whichBatteryRealtime));
sb.append("), Wifi running: "); formatTimeMs(sb, wifiRunningTime / 1000);
sb.append("("); sb.append(formatRatioLocked(wifiRunningTime, whichBatteryRealtime));
- sb.append("), Bluetooth on: "); formatTimeMs(sb, bluetoothOnTime / 1000);
+ sb.append(")");
+ pw.println(sb.toString());
+
+ sb.setLength(0);
+ sb.append(prefix);
+ sb.append(" Wifi states:");
+ didOne = false;
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ final long time = getWifiStateTime(i, batteryRealtime, which);
+ if (time == 0) {
+ continue;
+ }
+ sb.append("\n ");
+ didOne = true;
+ sb.append(WIFI_STATE_NAMES[i]);
+ sb.append(" ");
+ formatTimeMs(sb, time/1000);
+ sb.append("(");
+ sb.append(formatRatioLocked(time, whichBatteryRealtime));
+ sb.append(") ");
+ sb.append(getPhoneDataConnectionCount(i, which));
+ sb.append("x");
+ }
+ if (!didOne) sb.append(" (no activity)");
+ pw.println(sb.toString());
+
+ sb.setLength(0);
+ sb.append(prefix);
+ sb.append(" Bluetooth on: "); formatTimeMs(sb, bluetoothOnTime / 1000);
sb.append("("); sb.append(formatRatioLocked(bluetoothOnTime, whichBatteryRealtime));
sb.append(")");
pw.println(sb.toString());
-
- pw.println(" ");
+
+ sb.setLength(0);
+ sb.append(prefix);
+ sb.append(" Bluetooth states:");
+ didOne = false;
+ for (int i=0; i<NUM_BLUETOOTH_STATES; i++) {
+ final long time = getBluetoothStateTime(i, batteryRealtime, which);
+ if (time == 0) {
+ continue;
+ }
+ sb.append("\n ");
+ didOne = true;
+ sb.append(BLUETOOTH_STATE_NAMES[i]);
+ sb.append(" ");
+ formatTimeMs(sb, time/1000);
+ sb.append("(");
+ sb.append(formatRatioLocked(time, whichBatteryRealtime));
+ sb.append(") ");
+ sb.append(getPhoneDataConnectionCount(i, which));
+ sb.append("x");
+ }
+ if (!didOne) sb.append(" (no activity)");
+ pw.println(sb.toString());
+
+ pw.println();
if (which == STATS_SINCE_UNPLUGGED) {
if (getIsOnBattery()) {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 9332578..76ada09 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3468,12 +3468,12 @@
"lock_screen_owner_info_enabled";
/**
- * This preference enables expanding the notification panel even over a securely
- * locked screen, showing only "public" notifications in this case.
+ * When set by a user, allows notifications to be shown atop a securely locked screen
+ * in their full "private" form (same as when the device is unlocked).
* @hide
*/
- public static final String LOCK_SCREEN_ALLOW_NOTIFICATIONS =
- "lock_screen_allow_notifications";
+ public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
+ "lock_screen_allow_private_notifications";
/**
* The Logging ID (a unique 64-bit value) as a hex string.
@@ -6066,6 +6066,15 @@
*/
public static final String POLICY_CONTROL = "policy_control";
+
+ /**
+ * This preference enables notification display even over a securely
+ * locked screen.
+ * @hide
+ */
+ public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
+ "lock_screen_show_notifications";
+
/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
diff --git a/core/java/android/text/SpannableStringBuilder.java b/core/java/android/text/SpannableStringBuilder.java
index 34274a6..b55cd6a 100644
--- a/core/java/android/text/SpannableStringBuilder.java
+++ b/core/java/android/text/SpannableStringBuilder.java
@@ -29,6 +29,7 @@
*/
public class SpannableStringBuilder implements CharSequence, GetChars, Spannable, Editable,
Appendable, GraphicsOperations {
+ private final static String TAG = "SpannableStringBuilder";
/**
* Create a new SpannableStringBuilder with empty contents
*/
@@ -436,10 +437,26 @@
}
// Documentation from interface
- public SpannableStringBuilder replace(final int start, final int end,
+ public SpannableStringBuilder replace(int start, int end,
CharSequence tb, int tbstart, int tbend) {
checkRange("replace", start, end);
+ // Sanity check
+ if (start > end) {
+ Log.w(TAG, "Bad arguments to #replace : "
+ + "start = " + start + ", end = " + end);
+ final int tmp = start;
+ start = end;
+ end = tmp;
+ }
+ if (tbstart > tbend) {
+ Log.w(TAG, "Bad arguments to #replace : "
+ + "tbstart = " + tbstart + ", tbend = " + tbend);
+ final int tmp = tbstart;
+ tbstart = tbend;
+ tbend = tmp;
+ }
+
int filtercount = mFilters.length;
for (int i = 0; i < filtercount; i++) {
CharSequence repl = mFilters[i].filter(tb, tbstart, tbend, this, start, end);
@@ -613,8 +630,9 @@
// 0-length Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
if (flagsStart == POINT && flagsEnd == MARK && start == end) {
- if (send) Log.e("SpannableStringBuilder",
- "SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length");
+ if (send) {
+ Log.e(TAG, "SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length");
+ }
// Silently ignore invalid spans when they are created from this class.
// This avoids the duplication of the above test code before all the
// calls to setSpan that are done in this class
diff --git a/core/java/android/util/JsonReader.java b/core/java/android/util/JsonReader.java
index f2a86c9..7d1c6c4 100644
--- a/core/java/android/util/JsonReader.java
+++ b/core/java/android/util/JsonReader.java
@@ -546,6 +546,9 @@
public void skipValue() throws IOException {
skipping = true;
try {
+ if (!hasNext() || peek() == JsonToken.END_DOCUMENT) {
+ throw new IllegalStateException("No element left to skip");
+ }
int count = 0;
do {
JsonToken token = advance();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 63ce5a3..93b95bf6e 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -7155,7 +7155,7 @@
float endSubRow = targetRow;
if (boundPosition != INVALID_POSITION) {
final int boundRow = getRowForPosition(boundPosition);
- if (boundRow >= firstRow && boundRow < lastRow) {
+ if (boundRow >= firstRow && boundRow < lastRow && boundRow != targetRow) {
endSubRow = computeBoundSubRow(targetRow, boundRow);
}
}
@@ -7185,15 +7185,18 @@
}
private float computeBoundSubRow(int targetRow, int boundRow) {
- // Compute the target and offset as a sub-position.
+ // If the final offset is greater than 0, we're aiming above the
+ // suggested target row. Compute the actual target row and offset
+ // within that row by subtracting the height of each preceeding row.
int remainingOffset = mOffset;
- int targetHeight = getHeightForRow(targetRow - 1);
- while (remainingOffset > 0) {
- remainingOffset -= targetHeight;
+ int targetHeight = getHeightForRow(targetRow);
+ while (targetRow > 0 && remainingOffset > targetHeight) {
targetRow--;
- targetHeight = getHeightForRow(targetRow - 1);
+ remainingOffset -= targetHeight;
+ targetHeight = getHeightForRow(targetRow);
}
+ // Compute the offset within the actual target row.
final float targetOffsetRatio;
if (targetHeight == 0) {
targetOffsetRatio = 1;
@@ -7201,6 +7204,7 @@
targetOffsetRatio = remainingOffset / (float) targetHeight;
}
+ // The final offset has been accounted for, reset it.
final float targetSubRow = targetRow - targetOffsetRatio;
mOffset = 0;
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index b204dfd..1cda631 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -731,10 +731,14 @@
}
}
- if (scheduleOtherSpellCheck) {
+ if (scheduleOtherSpellCheck && wordStart <= end) {
// Update range span: start new spell check from last wordStart
setRangeSpan(editable, wordStart, end);
} else {
+ if (DBG && scheduleOtherSpellCheck) {
+ Log.w(TAG, "Trying to schedule spellcheck for invalid region, from "
+ + wordStart + " to " + end);
+ }
removeRangeSpan(editable);
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 65b79fc..e5cb16f 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -5809,6 +5809,7 @@
int end = text.partialEndOffset;
if (end > N) end = N;
removeParcelableSpans(content, start, end);
+ // If start > end, content.replace will swap them before using them.
content.replace(start, end, text.text);
}
}
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index 18d5668..1155cbb 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -62,9 +62,10 @@
void noteWifiRunning(in WorkSource ws);
void noteWifiRunningChanged(in WorkSource oldWs, in WorkSource newWs);
void noteWifiStopped(in WorkSource ws);
+ void noteWifiState(int wifiState, String accessPoint);
void noteBluetoothOn();
void noteBluetoothOff();
- void noteBluetoothActiveState(int actType);
+ void noteBluetoothState(int bluetoothState);
void noteFullWifiLockAcquired(int uid);
void noteFullWifiLockReleased(int uid);
void noteWifiScanStarted(int uid);
diff --git a/core/java/com/android/internal/app/ProcessStats.java b/core/java/com/android/internal/app/ProcessStats.java
index 4dd4a45..b1535e3 100644
--- a/core/java/com/android/internal/app/ProcessStats.java
+++ b/core/java/com/android/internal/app/ProcessStats.java
@@ -1018,7 +1018,7 @@
for (int iproc=pkgState.mProcesses.size()-1; iproc>=0; iproc--) {
final ProcessState ps = pkgState.mProcesses.valueAt(iproc);
if (ps.isInUse()) {
- pkgState.mProcesses.valueAt(iproc).resetSafely(now);
+ ps.resetSafely(now);
ps.mCommonProcess.mTmpNumInUse++;
ps.mCommonProcess.mTmpFoundSubProc = ps;
} else {
@@ -1029,7 +1029,7 @@
for (int isvc=pkgState.mServices.size()-1; isvc>=0; isvc--) {
final ServiceState ss = pkgState.mServices.valueAt(isvc);
if (ss.isInUse()) {
- pkgState.mServices.valueAt(isvc).resetSafely(now);
+ ss.resetSafely(now);
} else {
pkgState.mServices.removeAt(isvc);
}
@@ -3142,7 +3142,7 @@
}
public boolean isInUse() {
- return mOwner != null;
+ return mOwner != null || mRestarting;
}
void add(ServiceState other) {
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index e50e281..155f062 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -271,12 +271,14 @@
boolean mGlobalWifiRunning;
StopwatchTimer mGlobalWifiRunningTimer;
+ int mWifiState = -1;
+ final StopwatchTimer[] mWifiStateTimer = new StopwatchTimer[NUM_WIFI_STATES];
+
boolean mBluetoothOn;
StopwatchTimer mBluetoothOnTimer;
- int mBluetoothActiveType = -1;
- final StopwatchTimer[] mBluetoothActiveTimer =
- new StopwatchTimer[NUM_BLUETOOTH_ACTIVE_TYPES];
+ int mBluetoothState = -1;
+ final StopwatchTimer[] mBluetoothStateTimer = new StopwatchTimer[NUM_BLUETOOTH_STATES];
boolean mMobileRadioActive;
StopwatchTimer mMobileRadioActiveTimer;
@@ -1166,10 +1168,9 @@
+ " mAcquireTime=" + mAcquireTime);
}
- void startRunningLocked(BatteryStatsImpl stats) {
+ void startRunningLocked(BatteryStatsImpl stats, long elapsedRealtime) {
if (mNesting++ == 0) {
- mUpdateTime = stats.getBatteryRealtimeLocked(
- SystemClock.elapsedRealtime() * 1000);
+ mUpdateTime = stats.getBatteryRealtimeLocked(elapsedRealtime * 1000);
if (mTimerPool != null) {
// Accumulate time to all currently active timers before adding
// this new one to the pool.
@@ -1192,7 +1193,7 @@
return mNesting > 0;
}
- void stopRunningLocked(BatteryStatsImpl stats) {
+ void stopRunningLocked(BatteryStatsImpl stats, long elapsedRealtime) {
// Ignore attempt to stop a timer that isn't running
if (mNesting == 0) {
return;
@@ -1205,8 +1206,8 @@
// Remove this timer from the active pool
mTimerPool.remove(this);
} else {
- final long realtime = SystemClock.elapsedRealtime() * 1000;
- final long batteryRealtime = stats.getBatteryRealtimeLocked(realtime);
+ final long batteryRealtime = stats.getBatteryRealtimeLocked(
+ elapsedRealtime * 1000);
mNesting = 1;
mTotalTime = computeRunTimeLocked(batteryRealtime);
mNesting = 0;
@@ -2007,6 +2008,7 @@
public void noteStartWakeLocked(int uid, int pid, String name, int type,
boolean unimportantForLogging) {
uid = mapUid(uid);
+ final long elapsedRealtime = 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.
@@ -2018,7 +2020,7 @@
mHistoryCur.wakelockTag.string = name;
mHistoryCur.wakelockTag.uid = uid;
mWakeLockImportant = !unimportantForLogging;
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
} else if (!mWakeLockImportant && !unimportantForLogging) {
if (mHistoryLastWritten.wakelockTag != null) {
// We'll try to update the last tag.
@@ -2026,7 +2028,7 @@
mHistoryCur.wakelockTag = mHistoryCur.localWakelockTag;
mHistoryCur.wakelockTag.string = name;
mHistoryCur.wakelockTag.uid = uid;
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
mWakeLockImportant = true;
}
@@ -2037,19 +2039,20 @@
Message m = mHandler.obtainMessage(MSG_UPDATE_WAKELOCKS);
mHandler.sendMessageDelayed(m, DELAY_UPDATE_WAKELOCKS);
}
- getUidStatsLocked(uid).noteStartWakeLocked(pid, name, type);
+ getUidStatsLocked(uid).noteStartWakeLocked(pid, name, type, elapsedRealtime);
}
}
public void noteStopWakeLocked(int uid, int pid, String name, int type) {
uid = mapUid(uid);
+ final long elapsedRealtime = 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());
+ addHistoryRecordLocked(elapsedRealtime);
}
}
if (uid >= 0) {
@@ -2057,7 +2060,7 @@
Message m = mHandler.obtainMessage(MSG_UPDATE_WAKELOCKS);
mHandler.sendMessageDelayed(m, DELAY_UPDATE_WAKELOCKS);
}
- getUidStatsLocked(uid).noteStopWakeLocked(pid, name, type);
+ getUidStatsLocked(uid).noteStopWakeLocked(pid, name, type, elapsedRealtime);
}
}
@@ -2214,64 +2217,70 @@
public void noteStartSensorLocked(int uid, int sensor) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mSensorNesting == 0) {
mHistoryCur.states |= HistoryItem.STATE_SENSOR_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Start sensor to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
mSensorNesting++;
- getUidStatsLocked(uid).noteStartSensor(sensor);
+ getUidStatsLocked(uid).noteStartSensor(sensor, elapsedRealtime);
}
public void noteStopSensorLocked(int uid, int sensor) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mSensorNesting--;
if (mSensorNesting == 0) {
mHistoryCur.states &= ~HistoryItem.STATE_SENSOR_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Stop sensor to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
- getUidStatsLocked(uid).noteStopSensor(sensor);
+ getUidStatsLocked(uid).noteStopSensor(sensor, elapsedRealtime);
}
int mGpsNesting;
public void noteStartGpsLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mGpsNesting == 0) {
mHistoryCur.states |= HistoryItem.STATE_GPS_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Start GPS to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
mGpsNesting++;
- getUidStatsLocked(uid).noteStartGps();
+ getUidStatsLocked(uid).noteStartGps(elapsedRealtime);
}
public void noteStopGpsLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mGpsNesting--;
if (mGpsNesting == 0) {
mHistoryCur.states &= ~HistoryItem.STATE_GPS_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Stop GPS to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
- getUidStatsLocked(uid).noteStopGps();
+ getUidStatsLocked(uid).noteStopGps(elapsedRealtime);
}
public void noteScreenOnLocked() {
if (!mScreenOn) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states |= HistoryItem.STATE_SCREEN_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Screen on to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mScreenOn = true;
- mScreenOnTimer.startRunningLocked(this);
+ mScreenOnTimer.startRunningLocked(this, elapsedRealtime);
if (mScreenBrightnessBin >= 0) {
- mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this);
+ mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this,
+ elapsedRealtime);
}
// Fake a wake lock, so we consider the device waked as long
@@ -2287,14 +2296,16 @@
public void noteScreenOffLocked() {
if (mScreenOn) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states &= ~HistoryItem.STATE_SCREEN_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Screen off to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mScreenOn = false;
- mScreenOnTimer.stopRunningLocked(this);
+ mScreenOnTimer.stopRunningLocked(this, elapsedRealtime);
if (mScreenBrightnessBin >= 0) {
- mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
+ mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this,
+ elapsedRealtime);
}
noteStopWakeLocked(-1, -1, "dummy", WAKE_TYPE_PARTIAL);
@@ -2312,16 +2323,18 @@
if (bin < 0) bin = 0;
else if (bin >= NUM_SCREEN_BRIGHTNESS_BINS) bin = NUM_SCREEN_BRIGHTNESS_BINS-1;
if (mScreenBrightnessBin != bin) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states = (mHistoryCur.states&~HistoryItem.STATE_BRIGHTNESS_MASK)
| (bin << HistoryItem.STATE_BRIGHTNESS_SHIFT);
if (DEBUG_HISTORY) Slog.v(TAG, "Screen brightness " + bin + " to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
if (mScreenOn) {
if (mScreenBrightnessBin >= 0) {
- mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
+ mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this,
+ elapsedRealtime);
}
- mScreenBrightnessTimer[bin].startRunningLocked(this);
+ mScreenBrightnessTimer[bin].startRunningLocked(this, elapsedRealtime);
}
mScreenBrightnessBin = bin;
}
@@ -2340,15 +2353,16 @@
try {
int type = Integer.parseInt(label);
if (ConnectivityManager.isNetworkTypeMobile(type)) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mMobileRadioActive != active) {
if (active) mHistoryCur.states |= HistoryItem.STATE_MOBILE_RADIO_ACTIVE_FLAG;
else mHistoryCur.states &= ~HistoryItem.STATE_MOBILE_RADIO_ACTIVE_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Mobile network active " + active + " to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mMobileRadioActive = active;
- if (active) mMobileRadioActiveTimer.startRunningLocked(this);
- else mMobileRadioActiveTimer.stopRunningLocked(this);
+ if (active) mMobileRadioActiveTimer.startRunningLocked(this, elapsedRealtime);
+ else mMobileRadioActiveTimer.stopRunningLocked(this, elapsedRealtime);
}
}
} catch (NumberFormatException e) {
@@ -2359,33 +2373,36 @@
public void notePhoneOnLocked() {
if (!mPhoneOn) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states |= HistoryItem.STATE_PHONE_IN_CALL_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Phone on to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mPhoneOn = true;
- mPhoneOnTimer.startRunningLocked(this);
+ mPhoneOnTimer.startRunningLocked(this, elapsedRealtime);
}
}
public void notePhoneOffLocked() {
if (mPhoneOn) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states &= ~HistoryItem.STATE_PHONE_IN_CALL_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Phone off to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mPhoneOn = false;
- mPhoneOnTimer.stopRunningLocked(this);
+ mPhoneOnTimer.stopRunningLocked(this, elapsedRealtime);
}
}
void stopAllSignalStrengthTimersLocked(int except) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
for (int i = 0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
if (i == except) {
continue;
}
while (mPhoneSignalStrengthsTimer[i].isRunningLocked()) {
- mPhoneSignalStrengthsTimer[i].stopRunningLocked(this);
+ mPhoneSignalStrengthsTimer[i].stopRunningLocked(this, elapsedRealtime);
}
}
}
@@ -2403,26 +2420,28 @@
return state;
}
- private void updateAllPhoneStateLocked(int state, int simState, int bin) {
+ private void updateAllPhoneStateLocked(int state, int simState, int strengthBin) {
boolean scanning = false;
boolean newHistory = false;
mPhoneServiceStateRaw = state;
mPhoneSimStateRaw = simState;
- mPhoneSignalStrengthBinRaw = bin;
+ mPhoneSignalStrengthBinRaw = strengthBin;
+
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (simState == TelephonyManager.SIM_STATE_ABSENT) {
// In this case we will always be STATE_OUT_OF_SERVICE, so need
// to infer that we are scanning from other data.
if (state == ServiceState.STATE_OUT_OF_SERVICE
- && bin > SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ && strengthBin > SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
state = ServiceState.STATE_IN_SERVICE;
}
}
// If the phone is powered off, stop all timers.
if (state == ServiceState.STATE_POWER_OFF) {
- bin = -1;
+ strengthBin = -1;
// If we are in service, make sure the correct signal string timer is running.
} else if (state == ServiceState.STATE_IN_SERVICE) {
@@ -2432,13 +2451,13 @@
// bin and have the scanning bit set.
} else if (state == ServiceState.STATE_OUT_OF_SERVICE) {
scanning = true;
- bin = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ strengthBin = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
if (!mPhoneSignalScanningTimer.isRunningLocked()) {
mHistoryCur.states |= HistoryItem.STATE_PHONE_SCANNING_FLAG;
newHistory = true;
if (DEBUG_HISTORY) Slog.v(TAG, "Phone started scanning to: "
+ Integer.toHexString(mHistoryCur.states));
- mPhoneSignalScanningTimer.startRunningLocked(this);
+ mPhoneSignalScanningTimer.startRunningLocked(this, elapsedRealtime);
}
}
@@ -2449,7 +2468,7 @@
if (DEBUG_HISTORY) Slog.v(TAG, "Phone stopped scanning to: "
+ Integer.toHexString(mHistoryCur.states));
newHistory = true;
- mPhoneSignalScanningTimer.stopRunningLocked(this);
+ mPhoneSignalScanningTimer.stopRunningLocked(this, elapsedRealtime);
}
}
@@ -2462,27 +2481,29 @@
mPhoneServiceState = state;
}
- if (mPhoneSignalStrengthBin != bin) {
+ if (mPhoneSignalStrengthBin != strengthBin) {
if (mPhoneSignalStrengthBin >= 0) {
- mPhoneSignalStrengthsTimer[mPhoneSignalStrengthBin].stopRunningLocked(this);
+ mPhoneSignalStrengthsTimer[mPhoneSignalStrengthBin].stopRunningLocked(this,
+ elapsedRealtime);
}
- if (bin >= 0) {
- if (!mPhoneSignalStrengthsTimer[bin].isRunningLocked()) {
- mPhoneSignalStrengthsTimer[bin].startRunningLocked(this);
+ if (strengthBin >= 0) {
+ if (!mPhoneSignalStrengthsTimer[strengthBin].isRunningLocked()) {
+ mPhoneSignalStrengthsTimer[strengthBin].startRunningLocked(this,
+ elapsedRealtime);
}
mHistoryCur.states = (mHistoryCur.states&~HistoryItem.STATE_SIGNAL_STRENGTH_MASK)
- | (bin << HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT);
- if (DEBUG_HISTORY) Slog.v(TAG, "Signal strength " + bin + " to: "
+ | (strengthBin << HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT);
+ if (DEBUG_HISTORY) Slog.v(TAG, "Signal strength " + strengthBin + " to: "
+ Integer.toHexString(mHistoryCur.states));
newHistory = true;
} else {
stopAllSignalStrengthTimersLocked(-1);
}
- mPhoneSignalStrengthBin = bin;
+ mPhoneSignalStrengthBin = strengthBin;
}
if (newHistory) {
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
}
@@ -2556,105 +2577,113 @@
}
if (DEBUG) Log.i(TAG, "Phone Data Connection -> " + dataType + " = " + hasData);
if (mPhoneDataConnectionType != bin) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states = (mHistoryCur.states&~HistoryItem.STATE_DATA_CONNECTION_MASK)
| (bin << HistoryItem.STATE_DATA_CONNECTION_SHIFT);
if (DEBUG_HISTORY) Slog.v(TAG, "Data connection " + bin + " to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
if (mPhoneDataConnectionType >= 0) {
- mPhoneDataConnectionsTimer[mPhoneDataConnectionType].stopRunningLocked(this);
+ mPhoneDataConnectionsTimer[mPhoneDataConnectionType].stopRunningLocked(this,
+ elapsedRealtime);
}
mPhoneDataConnectionType = bin;
- mPhoneDataConnectionsTimer[bin].startRunningLocked(this);
+ mPhoneDataConnectionsTimer[bin].startRunningLocked(this, elapsedRealtime);
}
}
public void noteWifiOnLocked() {
if (!mWifiOn) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states |= HistoryItem.STATE_WIFI_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI on to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mWifiOn = true;
- mWifiOnTimer.startRunningLocked(this);
+ mWifiOnTimer.startRunningLocked(this, elapsedRealtime);
}
}
public void noteWifiOffLocked() {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mWifiOn) {
mHistoryCur.states &= ~HistoryItem.STATE_WIFI_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI off to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mWifiOn = false;
- mWifiOnTimer.stopRunningLocked(this);
+ mWifiOnTimer.stopRunningLocked(this, elapsedRealtime);
}
if (mWifiOnUid >= 0) {
- getUidStatsLocked(mWifiOnUid).noteWifiStoppedLocked();
+ getUidStatsLocked(mWifiOnUid).noteWifiStoppedLocked(elapsedRealtime);
mWifiOnUid = -1;
}
}
public void noteAudioOnLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (!mAudioOn) {
mHistoryCur.states |= HistoryItem.STATE_AUDIO_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Audio on to: "
+ Integer.toHexString(mHistoryCur.states));
addHistoryRecordLocked(SystemClock.elapsedRealtime());
mAudioOn = true;
- mAudioOnTimer.startRunningLocked(this);
+ mAudioOnTimer.startRunningLocked(this, elapsedRealtime);
}
- getUidStatsLocked(uid).noteAudioTurnedOnLocked();
+ getUidStatsLocked(uid).noteAudioTurnedOnLocked(elapsedRealtime);
}
public void noteAudioOffLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mAudioOn) {
mHistoryCur.states &= ~HistoryItem.STATE_AUDIO_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Audio off to: "
+ Integer.toHexString(mHistoryCur.states));
addHistoryRecordLocked(SystemClock.elapsedRealtime());
mAudioOn = false;
- mAudioOnTimer.stopRunningLocked(this);
+ mAudioOnTimer.stopRunningLocked(this, elapsedRealtime);
}
- getUidStatsLocked(uid).noteAudioTurnedOffLocked();
+ getUidStatsLocked(uid).noteAudioTurnedOffLocked(elapsedRealtime);
}
public void noteVideoOnLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (!mVideoOn) {
mHistoryCur.states |= HistoryItem.STATE_VIDEO_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Video on to: "
+ Integer.toHexString(mHistoryCur.states));
addHistoryRecordLocked(SystemClock.elapsedRealtime());
mVideoOn = true;
- mVideoOnTimer.startRunningLocked(this);
+ mVideoOnTimer.startRunningLocked(this, elapsedRealtime);
}
- getUidStatsLocked(uid).noteVideoTurnedOnLocked();
+ getUidStatsLocked(uid).noteVideoTurnedOnLocked(elapsedRealtime);
}
public void noteVideoOffLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mVideoOn) {
mHistoryCur.states &= ~HistoryItem.STATE_VIDEO_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Video off to: "
+ Integer.toHexString(mHistoryCur.states));
addHistoryRecordLocked(SystemClock.elapsedRealtime());
mVideoOn = false;
- mVideoOnTimer.stopRunningLocked(this);
+ mVideoOnTimer.stopRunningLocked(this, elapsedRealtime);
}
- getUidStatsLocked(uid).noteVideoTurnedOffLocked();
+ getUidStatsLocked(uid).noteVideoTurnedOffLocked(elapsedRealtime);
}
public void noteActivityResumedLocked(int uid) {
uid = mapUid(uid);
- getUidStatsLocked(uid).noteActivityResumedLocked();
+ getUidStatsLocked(uid).noteActivityResumedLocked(SystemClock.elapsedRealtime());
}
public void noteActivityPausedLocked(int uid) {
uid = mapUid(uid);
- getUidStatsLocked(uid).noteActivityPausedLocked();
+ getUidStatsLocked(uid).noteActivityPausedLocked(SystemClock.elapsedRealtime());
}
public void noteVibratorOnLocked(int uid, long durationMillis) {
@@ -2669,16 +2698,17 @@
public void noteWifiRunningLocked(WorkSource ws) {
if (!mGlobalWifiRunning) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states |= HistoryItem.STATE_WIFI_RUNNING_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI running to: "
+ Integer.toHexString(mHistoryCur.states));
addHistoryRecordLocked(SystemClock.elapsedRealtime());
mGlobalWifiRunning = true;
- mGlobalWifiRunningTimer.startRunningLocked(this);
+ mGlobalWifiRunningTimer.startRunningLocked(this, elapsedRealtime);
int N = ws.size();
for (int i=0; i<N; i++) {
int uid = mapUid(ws.get(i));
- getUidStatsLocked(uid).noteWifiRunningLocked();
+ getUidStatsLocked(uid).noteWifiRunningLocked(elapsedRealtime);
}
} else {
Log.w(TAG, "noteWifiRunningLocked -- called while WIFI running");
@@ -2687,15 +2717,16 @@
public void noteWifiRunningChangedLocked(WorkSource oldWs, WorkSource newWs) {
if (mGlobalWifiRunning) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
int N = oldWs.size();
for (int i=0; i<N; i++) {
int uid = mapUid(oldWs.get(i));
- getUidStatsLocked(uid).noteWifiStoppedLocked();
+ getUidStatsLocked(uid).noteWifiStoppedLocked(elapsedRealtime);
}
N = newWs.size();
for (int i=0; i<N; i++) {
int uid = mapUid(newWs.get(i));
- getUidStatsLocked(uid).noteWifiRunningLocked();
+ getUidStatsLocked(uid).noteWifiRunningLocked(elapsedRealtime);
}
} else {
Log.w(TAG, "noteWifiRunningChangedLocked -- called while WIFI not running");
@@ -2704,52 +2735,69 @@
public void noteWifiStoppedLocked(WorkSource ws) {
if (mGlobalWifiRunning) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states &= ~HistoryItem.STATE_WIFI_RUNNING_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI stopped to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mGlobalWifiRunning = false;
- mGlobalWifiRunningTimer.stopRunningLocked(this);
+ mGlobalWifiRunningTimer.stopRunningLocked(this, elapsedRealtime);
int N = ws.size();
for (int i=0; i<N; i++) {
int uid = mapUid(ws.get(i));
- getUidStatsLocked(uid).noteWifiStoppedLocked();
+ getUidStatsLocked(uid).noteWifiStoppedLocked(elapsedRealtime);
}
} else {
Log.w(TAG, "noteWifiStoppedLocked -- called while WIFI not running");
}
}
+ public void noteWifiStateLocked(int wifiState, String accessPoint) {
+ if (DEBUG) Log.i(TAG, "WiFi state -> " + wifiState);
+ if (mWifiState != wifiState) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
+ if (mWifiState >= 0) {
+ mWifiStateTimer[mWifiState].stopRunningLocked(this, elapsedRealtime);
+ }
+ mWifiState = wifiState;
+ mWifiStateTimer[wifiState].startRunningLocked(this, elapsedRealtime);
+ }
+ }
+
public void noteBluetoothOnLocked() {
if (!mBluetoothOn) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states |= HistoryItem.STATE_BLUETOOTH_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Bluetooth on to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mBluetoothOn = true;
- mBluetoothOnTimer.startRunningLocked(this);
+ mBluetoothOnTimer.startRunningLocked(this, elapsedRealtime);
}
}
public void noteBluetoothOffLocked() {
if (mBluetoothOn) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mHistoryCur.states &= ~HistoryItem.STATE_BLUETOOTH_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Bluetooth off to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
mBluetoothOn = false;
- mBluetoothOnTimer.stopRunningLocked(this);
+ mBluetoothOnTimer.stopRunningLocked(this, elapsedRealtime);
}
}
- public void noteBluetoothActiveStateLocked(int actType) {
- if (DEBUG) Log.i(TAG, "Bluetooth active -> " + actType);
- if (mBluetoothActiveType != actType) {
- if (mBluetoothActiveType >= 0) {
- mBluetoothActiveTimer[mBluetoothActiveType].stopRunningLocked(this);
+ public void noteBluetoothStateLocked(int bluetoothState) {
+ if (DEBUG) Log.i(TAG, "Bluetooth state -> " + bluetoothState);
+ if (mBluetoothState != bluetoothState) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
+ if (mBluetoothState >= 0) {
+ mBluetoothStateTimer[mBluetoothState].stopRunningLocked(this,
+ elapsedRealtime);
}
- mBluetoothActiveType = actType;
- mBluetoothActiveTimer[actType].startRunningLocked(this);
+ mBluetoothState = bluetoothState;
+ mBluetoothStateTimer[bluetoothState].startRunningLocked(this, elapsedRealtime);
}
}
@@ -2757,88 +2805,96 @@
public void noteFullWifiLockAcquiredLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mWifiFullLockNesting == 0) {
mHistoryCur.states |= HistoryItem.STATE_WIFI_FULL_LOCK_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI full lock on to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
mWifiFullLockNesting++;
- getUidStatsLocked(uid).noteFullWifiLockAcquiredLocked();
+ getUidStatsLocked(uid).noteFullWifiLockAcquiredLocked(elapsedRealtime);
}
public void noteFullWifiLockReleasedLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mWifiFullLockNesting--;
if (mWifiFullLockNesting == 0) {
mHistoryCur.states &= ~HistoryItem.STATE_WIFI_FULL_LOCK_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI full lock off to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
- getUidStatsLocked(uid).noteFullWifiLockReleasedLocked();
+ getUidStatsLocked(uid).noteFullWifiLockReleasedLocked(elapsedRealtime);
}
int mWifiScanNesting = 0;
public void noteWifiScanStartedLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mWifiScanNesting == 0) {
mHistoryCur.states |= HistoryItem.STATE_WIFI_SCAN_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI scan started for: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
mWifiScanNesting++;
- getUidStatsLocked(uid).noteWifiScanStartedLocked();
+ getUidStatsLocked(uid).noteWifiScanStartedLocked(elapsedRealtime);
}
public void noteWifiScanStoppedLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mWifiScanNesting--;
if (mWifiScanNesting == 0) {
mHistoryCur.states &= ~HistoryItem.STATE_WIFI_SCAN_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI scan stopped for: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
- getUidStatsLocked(uid).noteWifiScanStoppedLocked();
+ getUidStatsLocked(uid).noteWifiScanStoppedLocked(elapsedRealtime);
}
public void noteWifiBatchedScanStartedLocked(int uid, int csph) {
uid = mapUid(uid);
- getUidStatsLocked(uid).noteWifiBatchedScanStartedLocked(csph);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
+ getUidStatsLocked(uid).noteWifiBatchedScanStartedLocked(csph, elapsedRealtime);
}
public void noteWifiBatchedScanStoppedLocked(int uid) {
uid = mapUid(uid);
- getUidStatsLocked(uid).noteWifiBatchedScanStoppedLocked();
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
+ getUidStatsLocked(uid).noteWifiBatchedScanStoppedLocked(elapsedRealtime);
}
int mWifiMulticastNesting = 0;
public void noteWifiMulticastEnabledLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
if (mWifiMulticastNesting == 0) {
mHistoryCur.states |= HistoryItem.STATE_WIFI_MULTICAST_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI multicast on to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
mWifiMulticastNesting++;
- getUidStatsLocked(uid).noteWifiMulticastEnabledLocked();
+ getUidStatsLocked(uid).noteWifiMulticastEnabledLocked(elapsedRealtime);
}
public void noteWifiMulticastDisabledLocked(int uid) {
uid = mapUid(uid);
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
mWifiMulticastNesting--;
if (mWifiMulticastNesting == 0) {
mHistoryCur.states &= ~HistoryItem.STATE_WIFI_MULTICAST_ON_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "WIFI multicast off to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ addHistoryRecordLocked(elapsedRealtime);
}
- getUidStatsLocked(uid).noteWifiMulticastDisabledLocked();
+ getUidStatsLocked(uid).noteWifiMulticastDisabledLocked(elapsedRealtime);
}
public void noteFullWifiLockAcquiredFromSourceLocked(WorkSource ws) {
@@ -2973,18 +3029,28 @@
return mGlobalWifiRunningTimer.getTotalTimeLocked(batteryRealtime, which);
}
+ @Override public long getWifiStateTime(int wifiState,
+ long batteryRealtime, int which) {
+ return mWifiStateTimer[wifiState].getTotalTimeLocked(
+ batteryRealtime, which);
+ }
+
+ @Override public int getWifiStateCount(int wifiState, int which) {
+ return mWifiStateTimer[wifiState].getCountLocked(which);
+ }
+
@Override public long getBluetoothOnTime(long batteryRealtime, int which) {
return mBluetoothOnTimer.getTotalTimeLocked(batteryRealtime, which);
}
- @Override public long getBluetoothActiveTime(int actType,
+ @Override public long getBluetoothStateTime(int bluetoothState,
long batteryRealtime, int which) {
- return mBluetoothActiveTimer[actType].getTotalTimeLocked(
+ return mBluetoothStateTimer[bluetoothState].getTotalTimeLocked(
batteryRealtime, which);
}
- @Override public int getBluetoothActiveCount(int actType, int which) {
- return mBluetoothActiveTimer[actType].getCountLocked(which);
+ @Override public int getBluetoothStateCount(int bluetoothState, int which) {
+ return mBluetoothStateTimer[bluetoothState].getCountLocked(which);
}
@Override
@@ -3119,67 +3185,67 @@
}
@Override
- public void noteWifiRunningLocked() {
+ public void noteWifiRunningLocked(long elapsedRealtime) {
if (!mWifiRunning) {
mWifiRunning = true;
if (mWifiRunningTimer == null) {
mWifiRunningTimer = new StopwatchTimer(Uid.this, WIFI_RUNNING,
mWifiRunningTimers, mUnpluggables);
}
- mWifiRunningTimer.startRunningLocked(BatteryStatsImpl.this);
+ mWifiRunningTimer.startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@Override
- public void noteWifiStoppedLocked() {
+ public void noteWifiStoppedLocked(long elapsedRealtime) {
if (mWifiRunning) {
mWifiRunning = false;
- mWifiRunningTimer.stopRunningLocked(BatteryStatsImpl.this);
+ mWifiRunningTimer.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@Override
- public void noteFullWifiLockAcquiredLocked() {
+ public void noteFullWifiLockAcquiredLocked(long elapsedRealtime) {
if (!mFullWifiLockOut) {
mFullWifiLockOut = true;
if (mFullWifiLockTimer == null) {
mFullWifiLockTimer = new StopwatchTimer(Uid.this, FULL_WIFI_LOCK,
mFullWifiLockTimers, mUnpluggables);
}
- mFullWifiLockTimer.startRunningLocked(BatteryStatsImpl.this);
+ mFullWifiLockTimer.startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@Override
- public void noteFullWifiLockReleasedLocked() {
+ public void noteFullWifiLockReleasedLocked(long elapsedRealtime) {
if (mFullWifiLockOut) {
mFullWifiLockOut = false;
- mFullWifiLockTimer.stopRunningLocked(BatteryStatsImpl.this);
+ mFullWifiLockTimer.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@Override
- public void noteWifiScanStartedLocked() {
+ public void noteWifiScanStartedLocked(long elapsedRealtime) {
if (!mWifiScanStarted) {
mWifiScanStarted = true;
if (mWifiScanTimer == null) {
mWifiScanTimer = new StopwatchTimer(Uid.this, WIFI_SCAN,
mWifiScanTimers, mUnpluggables);
}
- mWifiScanTimer.startRunningLocked(BatteryStatsImpl.this);
+ mWifiScanTimer.startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@Override
- public void noteWifiScanStoppedLocked() {
+ public void noteWifiScanStoppedLocked(long elapsedRealtime) {
if (mWifiScanStarted) {
mWifiScanStarted = false;
- mWifiScanTimer.stopRunningLocked(BatteryStatsImpl.this);
+ mWifiScanTimer.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@Override
- public void noteWifiBatchedScanStartedLocked(int csph) {
+ public void noteWifiBatchedScanStartedLocked(int csph, long elapsedRealtime) {
int bin = 0;
while (csph > 8 && bin < NUM_WIFI_BATCHED_SCAN_BINS) {
csph = csph >> 3;
@@ -3190,41 +3256,41 @@
if (mWifiBatchedScanBinStarted != NO_BATCHED_SCAN_STARTED) {
mWifiBatchedScanTimer[mWifiBatchedScanBinStarted].
- stopRunningLocked(BatteryStatsImpl.this);
+ stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
mWifiBatchedScanBinStarted = bin;
if (mWifiBatchedScanTimer[bin] == null) {
makeWifiBatchedScanBin(bin, null);
}
- mWifiBatchedScanTimer[bin].startRunningLocked(BatteryStatsImpl.this);
+ mWifiBatchedScanTimer[bin].startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
@Override
- public void noteWifiBatchedScanStoppedLocked() {
+ public void noteWifiBatchedScanStoppedLocked(long elapsedRealtime) {
if (mWifiBatchedScanBinStarted != NO_BATCHED_SCAN_STARTED) {
mWifiBatchedScanTimer[mWifiBatchedScanBinStarted].
- stopRunningLocked(BatteryStatsImpl.this);
+ stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
mWifiBatchedScanBinStarted = NO_BATCHED_SCAN_STARTED;
}
}
@Override
- public void noteWifiMulticastEnabledLocked() {
+ public void noteWifiMulticastEnabledLocked(long elapsedRealtime) {
if (!mWifiMulticastEnabled) {
mWifiMulticastEnabled = true;
if (mWifiMulticastTimer == null) {
mWifiMulticastTimer = new StopwatchTimer(Uid.this, WIFI_MULTICAST_ENABLED,
mWifiMulticastTimers, mUnpluggables);
}
- mWifiMulticastTimer.startRunningLocked(BatteryStatsImpl.this);
+ mWifiMulticastTimer.startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@Override
- public void noteWifiMulticastDisabledLocked() {
+ public void noteWifiMulticastDisabledLocked(long elapsedRealtime) {
if (mWifiMulticastEnabled) {
mWifiMulticastEnabled = false;
- mWifiMulticastTimer.stopRunningLocked(BatteryStatsImpl.this);
+ mWifiMulticastTimer.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@@ -3237,19 +3303,20 @@
}
@Override
- public void noteAudioTurnedOnLocked() {
+ public void noteAudioTurnedOnLocked(long elapsedRealtime) {
if (!mAudioTurnedOn) {
mAudioTurnedOn = true;
- createAudioTurnedOnTimerLocked().startRunningLocked(BatteryStatsImpl.this);
+ createAudioTurnedOnTimerLocked().startRunningLocked(BatteryStatsImpl.this,
+ elapsedRealtime);
}
}
@Override
- public void noteAudioTurnedOffLocked() {
+ public void noteAudioTurnedOffLocked(long elapsedRealtime) {
if (mAudioTurnedOn) {
mAudioTurnedOn = false;
if (mAudioTurnedOnTimer != null) {
- mAudioTurnedOnTimer.stopRunningLocked(BatteryStatsImpl.this);
+ mAudioTurnedOnTimer.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
}
@@ -3263,19 +3330,20 @@
}
@Override
- public void noteVideoTurnedOnLocked() {
+ public void noteVideoTurnedOnLocked(long elapsedRealtime) {
if (!mVideoTurnedOn) {
mVideoTurnedOn = true;
- createVideoTurnedOnTimerLocked().startRunningLocked(BatteryStatsImpl.this);
+ createVideoTurnedOnTimerLocked().startRunningLocked(BatteryStatsImpl.this,
+ elapsedRealtime);
}
}
@Override
- public void noteVideoTurnedOffLocked() {
+ public void noteVideoTurnedOffLocked(long elapsedRealtime) {
if (mVideoTurnedOn) {
mVideoTurnedOn = false;
if (mVideoTurnedOnTimer != null) {
- mVideoTurnedOnTimer.stopRunningLocked(BatteryStatsImpl.this);
+ mVideoTurnedOnTimer.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
}
@@ -3289,15 +3357,16 @@
}
@Override
- public void noteActivityResumedLocked() {
+ public void noteActivityResumedLocked(long elapsedRealtime) {
// We always start, since we want multiple foreground PIDs to nest
- createForegroundActivityTimerLocked().startRunningLocked(BatteryStatsImpl.this);
+ createForegroundActivityTimerLocked().startRunningLocked(BatteryStatsImpl.this,
+ elapsedRealtime);
}
@Override
- public void noteActivityPausedLocked() {
+ public void noteActivityPausedLocked(long elapsedRealtime) {
if (mForegroundActivityTimer != null) {
- mForegroundActivityTimer.stopRunningLocked(BatteryStatsImpl.this);
+ mForegroundActivityTimer.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@@ -4874,28 +4943,28 @@
return t;
}
- public void noteStartWakeLocked(int pid, String name, int type) {
+ public void noteStartWakeLocked(int pid, String name, int type, long elapsedRealtime) {
StopwatchTimer t = getWakeTimerLocked(name, type);
if (t != null) {
- t.startRunningLocked(BatteryStatsImpl.this);
+ t.startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = getPidStatsLocked(pid);
if (p.mWakeStart == 0) {
- p.mWakeStart = SystemClock.elapsedRealtime();
+ p.mWakeStart = elapsedRealtime;
}
}
}
- public void noteStopWakeLocked(int pid, String name, int type) {
+ public void noteStopWakeLocked(int pid, String name, int type, long elapsedRealtime) {
StopwatchTimer t = getWakeTimerLocked(name, type);
if (t != null) {
- t.stopRunningLocked(BatteryStatsImpl.this);
+ t.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = mPids.get(pid);
if (p != null && p.mWakeStart != 0) {
- p.mWakeSum += SystemClock.elapsedRealtime() - p.mWakeStart;
+ p.mWakeSum += elapsedRealtime - p.mWakeStart;
p.mWakeStart = 0;
}
}
@@ -4915,32 +4984,32 @@
}
}
- public void noteStartSensor(int sensor) {
+ public void noteStartSensor(int sensor, long elapsedRealtime) {
StopwatchTimer t = getSensorTimerLocked(sensor, true);
if (t != null) {
- t.startRunningLocked(BatteryStatsImpl.this);
+ t.startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
- public void noteStopSensor(int sensor) {
+ public void noteStopSensor(int sensor, long elapsedRealtime) {
// Don't create a timer if one doesn't already exist
StopwatchTimer t = getSensorTimerLocked(sensor, false);
if (t != null) {
- t.stopRunningLocked(BatteryStatsImpl.this);
+ t.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
- public void noteStartGps() {
+ public void noteStartGps(long elapsedRealtime) {
StopwatchTimer t = getSensorTimerLocked(Sensor.GPS, true);
if (t != null) {
- t.startRunningLocked(BatteryStatsImpl.this);
+ t.startRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
- public void noteStopGps() {
+ public void noteStopGps(long elapsedRealtime) {
StopwatchTimer t = getSensorTimerLocked(Sensor.GPS, false);
if (t != null) {
- t.stopRunningLocked(BatteryStatsImpl.this);
+ t.stopRunningLocked(BatteryStatsImpl.this, elapsedRealtime);
}
}
@@ -4973,9 +5042,12 @@
mMobileRadioActiveTimer = new StopwatchTimer(null, -400, null, mUnpluggables);
mWifiOnTimer = new StopwatchTimer(null, -3, null, mUnpluggables);
mGlobalWifiRunningTimer = new StopwatchTimer(null, -4, null, mUnpluggables);
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ mWifiStateTimer[i] = new StopwatchTimer(null, -600-i, null, mUnpluggables);
+ }
mBluetoothOnTimer = new StopwatchTimer(null, -5, null, mUnpluggables);
- for (int i=0; i<NUM_BLUETOOTH_ACTIVE_TYPES; i++) {
- mBluetoothActiveTimer[i] = new StopwatchTimer(null, -500-i, null, mUnpluggables);
+ for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
+ mBluetoothStateTimer[i] = new StopwatchTimer(null, -500-i, null, mUnpluggables);
}
mAudioOnTimer = new StopwatchTimer(null, -6, null, mUnpluggables);
mVideoOnTimer = new StopwatchTimer(null, -7, null, mUnpluggables);
@@ -5236,9 +5308,12 @@
mMobileRadioActiveTimer.reset(this, false);
mWifiOnTimer.reset(this, false);
mGlobalWifiRunningTimer.reset(this, false);
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ mWifiStateTimer[i].reset(this, false);
+ }
mBluetoothOnTimer.reset(this, false);
- for (int i=0; i<NUM_BLUETOOTH_ACTIVE_TYPES; i++) {
- mBluetoothActiveTimer[i].reset(this, false);
+ for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
+ mBluetoothStateTimer[i].reset(this, false);
}
for (int i=0; i<mUidStats.size(); i++) {
@@ -6137,10 +6212,13 @@
mWifiOnTimer.readSummaryFromParcelLocked(in);
mGlobalWifiRunning = false;
mGlobalWifiRunningTimer.readSummaryFromParcelLocked(in);
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ mWifiStateTimer[i].readSummaryFromParcelLocked(in);
+ }
mBluetoothOn = false;
mBluetoothOnTimer.readSummaryFromParcelLocked(in);
- for (int i=0; i<NUM_BLUETOOTH_ACTIVE_TYPES; i++) {
- mBluetoothActiveTimer[i].readSummaryFromParcelLocked(in);
+ for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
+ mBluetoothStateTimer[i].readSummaryFromParcelLocked(in);
}
int NKW = in.readInt();
@@ -6360,9 +6438,12 @@
mMobileRadioActiveTimer.writeSummaryFromParcelLocked(out, NOWREAL);
mWifiOnTimer.writeSummaryFromParcelLocked(out, NOWREAL);
mGlobalWifiRunningTimer.writeSummaryFromParcelLocked(out, NOWREAL);
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ mWifiStateTimer[i].writeSummaryFromParcelLocked(out, NOWREAL);
+ }
mBluetoothOnTimer.writeSummaryFromParcelLocked(out, NOWREAL);
- for (int i=0; i<NUM_BLUETOOTH_ACTIVE_TYPES; i++) {
- mBluetoothActiveTimer[i].writeSummaryFromParcelLocked(out, NOWREAL);
+ for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
+ mBluetoothStateTimer[i].writeSummaryFromParcelLocked(out, NOWREAL);
}
out.writeInt(mKernelWakelockStats.size());
@@ -6601,10 +6682,14 @@
mWifiOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in);
mGlobalWifiRunning = false;
mGlobalWifiRunningTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in);
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ mWifiStateTimer[i] = new StopwatchTimer(null, -600-i,
+ null, mUnpluggables, in);
+ }
mBluetoothOn = false;
mBluetoothOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in);
- for (int i=0; i<NUM_BLUETOOTH_ACTIVE_TYPES; i++) {
- mBluetoothActiveTimer[i] = new StopwatchTimer(null, -500-i,
+ for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
+ mBluetoothStateTimer[i] = new StopwatchTimer(null, -500-i,
null, mUnpluggables, in);
}
mUptime = in.readLong();
@@ -6712,9 +6797,12 @@
mMobileRadioActiveTimer.writeToParcel(out, batteryRealtime);
mWifiOnTimer.writeToParcel(out, batteryRealtime);
mGlobalWifiRunningTimer.writeToParcel(out, batteryRealtime);
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ mWifiStateTimer[i].writeToParcel(out, batteryRealtime);
+ }
mBluetoothOnTimer.writeToParcel(out, batteryRealtime);
- for (int i=0; i<NUM_BLUETOOTH_ACTIVE_TYPES; i++) {
- mBluetoothActiveTimer[i].writeToParcel(out, batteryRealtime);
+ for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
+ mBluetoothStateTimer[i].writeToParcel(out, batteryRealtime);
}
out.writeLong(mUptime);
out.writeLong(mUptimeStart);
@@ -6817,11 +6905,15 @@
mWifiOnTimer.logState(pr, " ");
pr.println("*** WifiRunning timer:");
mGlobalWifiRunningTimer.logState(pr, " ");
+ for (int i=0; i<NUM_WIFI_STATES; i++) {
+ pr.println("*** Wifi state #" + i + ":");
+ mWifiStateTimer[i].logState(pr, " ");
+ }
pr.println("*** Bluetooth timer:");
mBluetoothOnTimer.logState(pr, " ");
- for (int i=0; i<NUM_BLUETOOTH_ACTIVE_TYPES; i++) {
+ for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
pr.println("*** Bluetooth active type #" + i + ":");
- mBluetoothActiveTimer[i].logState(pr, " ");
+ mBluetoothStateTimer[i].logState(pr, " ");
}
}
super.dumpLocked(context, pw, isUnpluggedOnly, reqUid, historyOnly);
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 943cbfe..30e6161 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1214,7 +1214,7 @@
android:permissionGroup="android.permission-group.STORAGE"
android:label="@string/permlab_manageDocs"
android:description="@string/permdesc_manageDocs"
- android:protectionLevel="signature|system" />
+ android:protectionLevel="signature" />
<!-- ================================== -->
<!-- Permissions for screenlock -->
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 8bd9de0..21cf658 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -685,7 +685,8 @@
propertyDirtyViewport = false;
propertyEnable3d = false;
propertyCameraDistance = 1.0f;
- propertyShadowStrength = 0x3f;
+ propertyAmbientShadowStrength = 0x3f;
+ propertySpotShadowStrength = 0x3f;
propertyLightPosXScale = 0.5f;
propertyLightPosYScale = 0.0f;
@@ -704,9 +705,13 @@
propertyDirtyViewport = true;
ALOGD("camera dist multiplier = %.2f", propertyCameraDistance);
return;
- } else if (!strcmp(name, "shadowStrength")) {
- propertyShadowStrength = atoi(value);
- ALOGD("shadow strength = 0x%x out of 0xff", propertyShadowStrength);
+ } else if (!strcmp(name, "ambientShadowStrength")) {
+ propertyAmbientShadowStrength = atoi(value);
+ ALOGD("ambient shadow strength = 0x%x out of 0xff", propertyAmbientShadowStrength);
+ return;
+ } else if (!strcmp(name, "spotShadowStrength")) {
+ propertySpotShadowStrength = atoi(value);
+ ALOGD("spot shadow strength = 0x%x out of 0xff", propertySpotShadowStrength);
return;
} else if (!strcmp(name, "lightPosXScale")) {
propertyLightPosXScale = fmin(fmax(atof(value), 0.0), 1.0);
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index e7ba9ac..2cc15cc 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -367,7 +367,8 @@
float propertyLightPosXScale;
float propertyLightPosYScale;
float propertyLightPosZScale;
- int propertyShadowStrength;
+ int propertyAmbientShadowStrength;
+ int propertySpotShadowStrength;
private:
enum OverdrawColorSet {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index fee916b..9b253a6 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -3214,7 +3214,6 @@
mCaches.enableScissor();
SkPaint paint;
- paint.setARGB(mCaches.propertyShadowStrength, 0, 0, 0);
paint.setAntiAlias(true); // want to use AlphaVertex
// tessellate caster outline into a 2d polygon
@@ -3238,19 +3237,25 @@
}
// draw caster's shadows
- VertexBuffer ambientShadowVertexBuffer;
- ShadowTessellator::tessellateAmbientShadow(casterPolygon, casterVertexCount,
- ambientShadowVertexBuffer);
- drawVertexBuffer(ambientShadowVertexBuffer, &paint);
+ if (mCaches.propertyAmbientShadowStrength > 0) {
+ paint.setARGB(mCaches.propertyAmbientShadowStrength, 0, 0, 0);
+ VertexBuffer ambientShadowVertexBuffer;
+ ShadowTessellator::tessellateAmbientShadow(casterPolygon, casterVertexCount,
+ ambientShadowVertexBuffer);
+ drawVertexBuffer(ambientShadowVertexBuffer, &paint);
+ }
- VertexBuffer spotShadowVertexBuffer;
- Vector3 lightPosScale(mCaches.propertyLightPosXScale,
- mCaches.propertyLightPosYScale, mCaches.propertyLightPosZScale);
- ShadowTessellator::tessellateSpotShadow(casterPolygon, casterVertexCount,
- lightPosScale, *currentTransform(), getWidth(), getHeight(),
- spotShadowVertexBuffer);
+ if (mCaches.propertySpotShadowStrength > 0) {
+ paint.setARGB(mCaches.propertySpotShadowStrength, 0, 0, 0);
+ VertexBuffer spotShadowVertexBuffer;
+ Vector3 lightPosScale(mCaches.propertyLightPosXScale,
+ mCaches.propertyLightPosYScale, mCaches.propertyLightPosZScale);
+ ShadowTessellator::tessellateSpotShadow(casterPolygon, casterVertexCount,
+ lightPosScale, *currentTransform(), getWidth(), getHeight(),
+ spotShadowVertexBuffer);
- drawVertexBuffer(spotShadowVertexBuffer, &paint);
+ drawVertexBuffer(spotShadowVertexBuffer, &paint);
+ }
return DrawGlInfo::kStatusDrew;
}
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 01485b8..72f3e1a 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1426,7 +1426,7 @@
}
int firstSlash = path.lastIndexOf('/');
- if (firstSlash == 0) {
+ if (firstSlash <= 0) {
return false;
}
String parent = path.substring(0, firstSlash);
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java
index baf520e..43165eb 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java
@@ -330,7 +330,7 @@
private boolean allowNotificationsOnSecureKeyguard() {
ContentResolver cr = mContext.getContentResolver();
- return Settings.Secure.getInt(cr, Settings.Secure.LOCK_SCREEN_ALLOW_NOTIFICATIONS, 0) == 1;
+ return Settings.Global.getInt(cr, Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) == 1;
}
private KeyguardViewBase inflateKeyguardView(Bundle options, int layoutId) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java
index 914fdc4..e0ee4e0 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java
@@ -151,13 +151,13 @@
/**
* Allow the user to expand the status bar when a SECURE keyguard is engaged
- * and {@link Settings.Secure#LOCK_SCREEN_ALLOW_NOTIFICATIONS} is set
+ * and {@link Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS} is set
* (private notifications will be masked).
*/
private static final boolean ENABLE_SECURE_STATUS_BAR_EXPAND = true;
/**
- * Default value of {@link Settings.Secure#LOCK_SCREEN_ALLOW_NOTIFICATIONS}.
+ * Default value of {@link Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
*/
private static final boolean ALLOW_NOTIFICATIONS_DEFAULT = false;
@@ -258,7 +258,7 @@
private int mLockSoundStreamId;
/**
- * Tracks value of {@link Settings.Secure#LOCK_SCREEN_ALLOW_NOTIFICATIONS}.
+ * Tracks value of {@link Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
*/
private boolean mAllowNotificationsWhenSecure;
@@ -913,9 +913,9 @@
// note whether notification access should be allowed
mAllowNotificationsWhenSecure = ENABLE_SECURE_STATUS_BAR_EXPAND
- && 0 != Settings.Secure.getInt(
+ && 0 != Settings.Global.getInt(
mContext.getContentResolver(),
- Settings.Secure.LOCK_SCREEN_ALLOW_NOTIFICATIONS,
+ Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS,
ALLOW_NOTIFICATIONS_DEFAULT ? 1 : 0);
// if the keyguard is already showing, don't bother
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 649b51b..7ff52de 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -46,6 +46,7 @@
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;
+import android.util.SparseBooleanArray;
import android.view.Display;
import android.view.IWindowManager;
import android.view.LayoutInflater;
@@ -131,7 +132,10 @@
protected IDreamManager mDreamManager;
PowerManager mPowerManager;
protected int mRowHeight;
- private boolean mPublicMode = false;
+
+ // public mode, private notifications, etc
+ private boolean mLockscreenPublicMode = false;
+ private final SparseBooleanArray mUsersAllowingPrivateNotifications = new SparseBooleanArray();
// UI-specific methods
@@ -159,7 +163,7 @@
return mDeviceProvisioned;
}
- private ContentObserver mProvisioningObserver = new ContentObserver(new Handler()) {
+ private final ContentObserver mProvisioningObserver = new ContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange) {
final boolean provisioned = 0 != Settings.Global.getInt(
@@ -171,6 +175,17 @@
}
};
+ private final ContentObserver mLockscreenSettingsObserver = new ContentObserver(mHandler) {
+ @Override
+ public void onChange(boolean selfChange) {
+ // We don't know which user changed LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
+ // so we just dump our cache ...
+ mUsersAllowingPrivateNotifications.clear();
+ // ... and refresh all the notifications
+ updateNotificationIcons();
+ }
+ };
+
private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() {
@Override
public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) {
@@ -229,6 +244,12 @@
Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), true,
mProvisioningObserver);
+ mContext.getContentResolver().registerContentObserver(
+ Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS),
+ true,
+ mLockscreenSettingsObserver,
+ UserHandle.USER_ALL);
+
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
@@ -550,12 +571,35 @@
public abstract void resetHeadsUpDecayTimer();
- public void setPublicMode(boolean publicMode) {
- mPublicMode = publicMode;
+ /**
+ * Save the current "public" (locked and secure) state of the lockscreen.
+ */
+ public void setLockscreenPublicMode(boolean publicMode) {
+ mLockscreenPublicMode = publicMode;
}
- public boolean isPublicMode() {
- return mPublicMode;
+ public boolean isLockscreenPublicMode() {
+ return mLockscreenPublicMode;
+ }
+
+ /**
+ * Has the given user chosen to allow their private (full) notifications to be shown even
+ * when the lockscreen is in "public" (secure & locked) mode?
+ */
+ public boolean userAllowsPrivateNotificationsInPublic(int userHandle) {
+ if (userHandle == UserHandle.USER_ALL) {
+ return true;
+ }
+
+ if (mUsersAllowingPrivateNotifications.indexOfKey(userHandle) < 0) {
+ final boolean allowed = 0 != Settings.Secure.getIntForUser(
+ mContext.getContentResolver(),
+ Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0, userHandle);
+ mUsersAllowingPrivateNotifications.append(userHandle, allowed);
+ return allowed;
+ }
+
+ return mUsersAllowingPrivateNotifications.get(userHandle);
}
protected class H extends Handler {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index e5bdd59..2114991 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1033,8 +1033,10 @@
if (!notificationIsForCurrentUser(ent.notification)) continue;
final int vis = ent.notification.getNotification().visibility;
if (vis != Notification.VISIBILITY_SECRET) {
- // when isPublicMode() we show the public form of VISIBILITY_PRIVATE notifications
- ent.row.setShowingPublic(isPublicMode() && vis == Notification.VISIBILITY_PRIVATE);
+ // when isLockscreenPublicMode() we show the public form of VISIBILITY_PRIVATE notifications
+ ent.row.setShowingPublic(isLockscreenPublicMode()
+ && vis == Notification.VISIBILITY_PRIVATE
+ && !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId()));
toShow.add(ent.row);
}
}
@@ -1087,9 +1089,10 @@
if (!((provisioned && ent.notification.getScore() >= HIDE_ICONS_BELOW_SCORE)
|| showNotificationEvenIfUnprovisioned(ent.notification))) continue;
if (!notificationIsForCurrentUser(ent.notification)) continue;
- if (isPublicMode()
+ if (isLockscreenPublicMode()
&& ent.notification.getNotification().visibility
- == Notification.VISIBILITY_SECRET) {
+ == Notification.VISIBILITY_SECRET
+ && !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId())) {
// in "public" mode (atop a secure keyguard), secret notifs are totally hidden
continue;
}
@@ -1343,10 +1346,10 @@
} else if ((diff & StatusBarManager.DISABLE_PRIVATE_NOTIFICATIONS) != 0) {
if ((state & StatusBarManager.DISABLE_PRIVATE_NOTIFICATIONS) != 0) {
// we are outside a secure keyguard, so we need to switch to "public" mode
- setPublicMode(true);
+ setLockscreenPublicMode(true);
} else {
// user has authenticated the device; full notifications may be shown
- setPublicMode(false);
+ setLockscreenPublicMode(false);
}
updateNotificationIcons();
}
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 2c36ab7..0adb32f 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -311,6 +311,8 @@
}
mUsbStorageNotification.setLatestEventInfo(mContext, title, message, pi);
+ mUsbStorageNotification.visibility = Notification.VISIBILITY_PUBLIC;
+
final boolean adbOn = 1 == Settings.Global.getInt(
mContext.getContentResolver(),
Settings.Global.ADB_ENABLED,
@@ -401,6 +403,7 @@
mMediaStorageNotification.icon = icon;
mMediaStorageNotification.setLatestEventInfo(mContext, title, message, pi);
+ mMediaStorageNotification.visibility = Notification.VISIBILITY_PUBLIC;
}
final int notificationId = mMediaStorageNotification.icon;
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index c0f8414..ada649d 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -2569,7 +2569,8 @@
@Override
public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset) {
final int fl = PolicyControl.getWindowFlags(null, attrs);
- final int systemUiVisibility = (attrs.systemUiVisibility|attrs.subtreeSystemUiVisibility);
+ final int sysuiVis = PolicyControl.getSystemUiVisibility(null, attrs);
+ final int systemUiVisibility = (sysuiVis | attrs.subtreeSystemUiVisibility);
if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR))
== (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) {
@@ -2953,7 +2954,7 @@
final int fl = PolicyControl.getWindowFlags(win, attrs);
final int sim = attrs.softInputMode;
- final int sysUiFl = PolicyControl.getSystemUiVisibility(win);
+ final int sysUiFl = PolicyControl.getSystemUiVisibility(win, null);
final Rect pf = mTmpParentFrame;
final Rect df = mTmpDisplayFrame;
@@ -5078,7 +5079,7 @@
return 0;
}
- int tmpVisibility = PolicyControl.getSystemUiVisibility(win)
+ int tmpVisibility = PolicyControl.getSystemUiVisibility(win, null)
& ~mResettingSystemUiFlags
& ~mForceClearedSystemUiFlags;
if (mForcingShowNavBar && win.getSurfaceLayer() < mForcingShowNavBarLayer) {
diff --git a/policy/src/com/android/internal/policy/impl/PolicyControl.java b/policy/src/com/android/internal/policy/impl/PolicyControl.java
index 4f355dd..ffdb520 100644
--- a/policy/src/com/android/internal/policy/impl/PolicyControl.java
+++ b/policy/src/com/android/internal/policy/impl/PolicyControl.java
@@ -61,16 +61,17 @@
private static Filter sImmersiveStatusFilter;
private static Filter sImmersiveNavigationFilter;
- public static int getSystemUiVisibility(WindowState win) {
- int vis = win.getSystemUiVisibility();
- if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(win)) {
+ public static int getSystemUiVisibility(WindowState win, LayoutParams attrs) {
+ attrs = attrs != null ? attrs : win.getAttrs();
+ int vis = win != null ? win.getSystemUiVisibility() : attrs.systemUiVisibility;
+ if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(attrs)) {
vis |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
vis &= ~(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.STATUS_BAR_TRANSLUCENT);
}
- if (sImmersiveNavigationFilter != null && sImmersiveNavigationFilter.matches(win)) {
+ if (sImmersiveNavigationFilter != null && sImmersiveNavigationFilter.matches(attrs)) {
vis |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
@@ -81,20 +82,22 @@
}
public static int getWindowFlags(WindowState win, LayoutParams attrs) {
- int flags = (attrs != null ? attrs : win.getAttrs()).flags;
- if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(win)) {
+ attrs = attrs != null ? attrs : win.getAttrs();
+ int flags = attrs.flags;
+ if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(attrs)) {
flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
flags &= ~(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
- if (sImmersiveNavigationFilter != null && sImmersiveNavigationFilter.matches(win)) {
+ if (sImmersiveNavigationFilter != null && sImmersiveNavigationFilter.matches(attrs)) {
flags &= ~WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
}
return flags;
}
public static int adjustClearableFlags(WindowState win, int clearableFlags) {
- if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(win)) {
+ final LayoutParams attrs = win != null ? win.getAttrs() : null;
+ if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(attrs)) {
clearableFlags &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
}
return clearableFlags;
@@ -187,9 +190,7 @@
mBlacklist = blacklist;
}
- boolean matches(WindowState win) {
- if (win == null) return false;
- LayoutParams attrs = win.getAttrs();
+ boolean matches(LayoutParams attrs) {
if (attrs == null) return false;
boolean isApp = attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW
&& attrs.type <= WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index 0f2e56c..607def6 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -94,6 +94,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -397,18 +398,37 @@
}
class ShutdownCallBack extends UnmountCallBack {
- IMountShutdownObserver observer;
- ShutdownCallBack(String path, IMountShutdownObserver observer) {
+ MountShutdownLatch mMountShutdownLatch;
+ ShutdownCallBack(String path, final MountShutdownLatch mountShutdownLatch) {
super(path, true, false);
- this.observer = observer;
+ mMountShutdownLatch = mountShutdownLatch;
}
@Override
void handleFinished() {
int ret = doUnmountVolume(path, true, removeEncryption);
- if (observer != null) {
+ Slog.i(TAG, "Unmount completed: " + path + ", result code: " + ret);
+ mMountShutdownLatch.countDown();
+ }
+ }
+
+ static class MountShutdownLatch {
+ private IMountShutdownObserver mObserver;
+ private AtomicInteger mCount;
+
+ MountShutdownLatch(final IMountShutdownObserver observer, int count) {
+ mObserver = observer;
+ mCount = new AtomicInteger(count);
+ }
+
+ void countDown() {
+ boolean sendShutdown = false;
+ if (mCount.decrementAndGet() == 0) {
+ sendShutdown = true;
+ }
+ if (sendShutdown && mObserver != null) {
try {
- observer.onShutDownComplete(ret);
+ mObserver.onShutDownComplete(StorageResultCode.OperationSucceeded);
} catch (RemoteException e) {
Slog.w(TAG, "RemoteException when shutting down");
}
@@ -1436,6 +1456,10 @@
Slog.i(TAG, "Shutting down");
synchronized (mVolumesLock) {
+ // Get all volumes to be unmounted.
+ MountShutdownLatch mountShutdownLatch = new MountShutdownLatch(observer,
+ mVolumeStates.size());
+
for (String path : mVolumeStates.keySet()) {
String state = mVolumeStates.get(path);
@@ -1471,19 +1495,16 @@
if (state.equals(Environment.MEDIA_MOUNTED)) {
// Post a unmount message.
- ShutdownCallBack ucb = new ShutdownCallBack(path, observer);
+ ShutdownCallBack ucb = new ShutdownCallBack(path, mountShutdownLatch);
mHandler.sendMessage(mHandler.obtainMessage(H_UNMOUNT_PM_UPDATE, ucb));
} else if (observer != null) {
/*
- * Observer is waiting for onShutDownComplete when we are done.
- * Since nothing will be done send notification directly so shutdown
- * sequence can continue.
+ * Count down, since nothing will be done. The observer will be
+ * notified when we are done so shutdown sequence can continue.
*/
- try {
- observer.onShutDownComplete(StorageResultCode.OperationSucceeded);
- } catch (RemoteException e) {
- Slog.w(TAG, "RemoteException when shutting down");
- }
+ mountShutdownLatch.countDown();
+ Slog.i(TAG, "Unmount completed: " + path +
+ ", result code: " + StorageResultCode.OperationSucceeded);
}
}
}
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index f1a3ba5..3924fe8 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -82,6 +82,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
@@ -1038,6 +1039,15 @@
}
}
+ private List<InterfaceAddress> excludeLinkLocal(List<InterfaceAddress> addresses) {
+ ArrayList<InterfaceAddress> filtered = new ArrayList<InterfaceAddress>(addresses.size());
+ for (InterfaceAddress ia : addresses) {
+ if (!ia.getAddress().isLinkLocalAddress())
+ filtered.add(ia);
+ }
+ return filtered;
+ }
+
private void modifyNat(String action, String internalInterface, String externalInterface)
throws SocketException {
final Command cmd = new Command("nat", action, internalInterface, externalInterface);
@@ -1047,8 +1057,10 @@
if (internalNetworkInterface == null) {
cmd.appendArg("0");
} else {
- Collection<InterfaceAddress> interfaceAddresses = internalNetworkInterface
- .getInterfaceAddresses();
+ // Don't touch link-local routes, as link-local addresses aren't routable,
+ // kernel creates link-local routes on all interfaces automatically
+ List<InterfaceAddress> interfaceAddresses = excludeLinkLocal(
+ internalNetworkInterface.getInterfaceAddresses());
cmd.appendArg(interfaceAddresses.size());
for (InterfaceAddress ia : interfaceAddresses) {
InetAddress addr = NetworkUtils.getNetworkPart(
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index 2941a18..059aa2b 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -337,6 +337,13 @@
}
}
+ public void noteWifiState(int wifiState, String accessPoint) {
+ enforceCallingPermission();
+ synchronized (mStats) {
+ mStats.noteWifiStateLocked(wifiState, accessPoint);
+ }
+ }
+
public void noteBluetoothOn() {
enforceCallingPermission();
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
@@ -380,10 +387,10 @@
}
}
- public void noteBluetoothActiveState(int actType) {
+ public void noteBluetoothState(int bluetoothState) {
enforceCallingPermission();
synchronized (mStats) {
- mStats.noteBluetoothActiveStateLocked(actType);
+ mStats.noteBluetoothStateLocked(bluetoothState);
}
}
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index 5971737..b233943 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -470,6 +470,7 @@
mTetheredNotification.defaults &= ~Notification.DEFAULT_SOUND;
mTetheredNotification.flags = Notification.FLAG_ONGOING_EVENT;
mTetheredNotification.tickerText = title;
+ mTetheredNotification.visibility = Notification.VISIBILITY_PUBLIC;
mTetheredNotification.setLatestEventInfo(mContext, title, message, pi);
notificationManager.notifyAsUser(null, mTetheredNotification.icon,
diff --git a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
index 43a99e0..260e97a 100644
--- a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
+++ b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
@@ -454,6 +454,7 @@
notification.tickerText = title;
notification.flags |= Notification.FLAG_NO_CLEAR;
notification.setLatestEventInfo(context, title, details, intent);
+ notification.visibility = Notification.VISIBILITY_PUBLIC;
mNotificationMgr.notifyAsUser(null, LOW_MEMORY_NOTIFICATION_ID, notification,
UserHandle.ALL);
context.sendStickyBroadcastAsUser(mStorageLowIntent, UserHandle.ALL);
diff --git a/services/core/java/com/android/server/usb/UsbDeviceManager.java b/services/core/java/com/android/server/usb/UsbDeviceManager.java
index c1a3646..2312288 100644
--- a/services/core/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/core/java/com/android/server/usb/UsbDeviceManager.java
@@ -697,6 +697,7 @@
PendingIntent pi = PendingIntent.getActivityAsUser(mContext, 0,
intent, 0, null, UserHandle.CURRENT);
notification.setLatestEventInfo(mContext, title, message, pi);
+ notification.visibility = Notification.VISIBILITY_PUBLIC;
mNotificationManager.notifyAsUser(null, id, notification,
UserHandle.ALL);
mUsbNotificationId = id;
@@ -732,6 +733,7 @@
PendingIntent pi = PendingIntent.getActivityAsUser(mContext, 0,
intent, 0, null, UserHandle.CURRENT);
notification.setLatestEventInfo(mContext, title, message, pi);
+ notification.visibility = Notification.VISIBILITY_PUBLIC;
mAdbNotificationShown = true;
mNotificationManager.notifyAsUser(null, id, notification,
UserHandle.ALL);
diff --git a/services/core/jni/com_android_server_UsbHostManager.cpp b/services/core/jni/com_android_server_UsbHostManager.cpp
index f1fa6cf..fc6de60 100644
--- a/services/core/jni/com_android_server_UsbHostManager.cpp
+++ b/services/core/jni/com_android_server_UsbHostManager.cpp
@@ -163,8 +163,10 @@
return NULL;
int fd = usb_device_get_fd(device);
- if (fd < 0)
+ if (fd < 0) {
+ usb_device_close(device);
return NULL;
+ }
int newFD = dup(fd);
usb_device_close(device);
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index bb96544..12f0114 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -2830,6 +2830,14 @@
return false;
}
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null);
+
+ UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+ if (um.getUserInfo(userHandle) == null) {
+ // User doesn't exist.
+ throw new IllegalArgumentException(
+ "Attempted to set profile owner for invalid userId: " + userHandle);
+ }
+
if (packageName == null
|| !DeviceOwner.isInstalledForUser(packageName, userHandle)) {
throw new IllegalArgumentException("Package name " + packageName
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 943471a..5221f1f 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -529,7 +529,7 @@
}
try {
- if (pm.hasSystemFeature("android.software.device_admin")) {
+ if (pm.hasSystemFeature(PackageManager.FEATURE_DEVICE_ADMIN)) {
mSystemServiceManager.startServiceIfExists(
DEVICE_POLICY_MANAGER_SERVICE_CLASS);
}
@@ -778,7 +778,7 @@
if (!disableNonCoreServices) {
try {
- if (pm.hasSystemFeature("android.software.backup")) {
+ if (pm.hasSystemFeature(PackageManager.FEATURE_BACKUP)) {
mSystemServiceManager.startServiceIfExists(BACKUP_MANAGER_SERVICE_CLASS);
}
} catch (Throwable e) {
@@ -786,7 +786,7 @@
}
try {
- if (pm.hasSystemFeature("android.software.app_widgets")) {
+ if (pm.hasSystemFeature(PackageManager.FEATURE_APP_WIDGETS)) {
mSystemServiceManager.startServiceIfExists(APPWIDGET_SERVICE_CLASS);
}
} catch (Throwable e) {
@@ -872,7 +872,7 @@
}
try {
- if (pm.hasSystemFeature("android.software.print")) {
+ if (pm.hasSystemFeature(PackageManager.FEATURE_PRINTING)) {
mSystemServiceManager.startServiceIfExists(PRINT_MANAGER_SERVICE_CLASS);
}
} catch (Throwable e) {
diff --git a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
index 38174f1..bf03a5e 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
@@ -56,7 +56,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void destroyFilter(long native_instance, long nativeColorFilter) {
+ /*package*/ static void destroyFilter(long native_instance) {
sManager.removeJavaReferenceFor(native_instance);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
index ca8f450..9aac2bd 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
@@ -60,11 +60,5 @@
return sManager.addNewDelegate(newDelegate);
}
- @LayoutlibDelegate
- /*package*/ static long nColorMatrixFilter(long nativeFilter, float[] array) {
- // pass
- return 0;
- }
-
// ---- Private delegate/helper methods ----
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
index defaac3..501d55c 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
@@ -60,11 +60,5 @@
return sManager.addNewDelegate(newDelegate);
}
- @LayoutlibDelegate
- /*package*/ static int nCreateLightingFilter(long nativeFilter, int mul, int add) {
- // pass
- return 0;
- }
-
// ---- Private delegate/helper methods ----
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
index 49f314c..77468ec 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
@@ -490,20 +490,6 @@
return new float[0];
}
- @LayoutlibDelegate
- /*package*/ static long native_trim(long nPath, long nTargetPath, long nPathMeasure,
- float trimStart, float trimEnd, float trimOffset) {
- // TODO: add trim.
- Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Path.trim() not supported", null);
- return nPathMeasure;
-
- }
-
- @LayoutlibDelegate
- private static void native_destroyMeasure(long nPathMeasure) {
- // Do nothing.
- }
-
// ---- Private helper methods ----
private void set(Path_Delegate delegate) {
diff --git a/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
index 6049919..1bc3033 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
@@ -60,12 +60,5 @@
return sManager.addNewDelegate(newDelegate);
}
- @LayoutlibDelegate
- /*package*/ static long nCreatePorterDuffFilter(long nativeFilter, int srcColor,
- int porterDuffMode) {
- // pass
- return 0;
- }
-
// ---- Private delegate/helper methods ----
}