Merge "Various performance and other work." into ics-mr1
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 93a1b6c..48adfad 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1687,15 +1687,18 @@
* aggressive than {@link #FOCUS_MODE_CONTINUOUS_VIDEO}. Auto focus
* starts when the parameter is set.
*
- * <p>If applications call {@link #autoFocus(AutoFocusCallback)} in this
- * mode, the focus callback will immediately return with a boolean that
- * indicates whether the focus is sharp or not. The apps can then decide
- * if they want to take a picture immediately or to change the focus
- * mode to auto, and run a full autofocus cycle. The focus position is
- * locked after autoFocus call. If applications want to resume the
- * continuous focus, cancelAutoFocus must be called. Restarting the
- * preview will not resume the continuous autofocus. To stop continuous
- * focus, applications should change the focus mode to other modes.
+ * <p>Applications can call {@link #autoFocus(AutoFocusCallback)} in
+ * this mode. If the autofocus is in the middle of scanning, the focus
+ * callback will return when it completes. If the autofocus is not
+ * scanning, the focus callback will immediately return with a boolean
+ * that indicates whether the focus is sharp or not. The apps can then
+ * decide if they want to take a picture immediately or to change the
+ * focus mode to auto, and run a full autofocus cycle. The focus
+ * position is locked after autoFocus call. If applications want to
+ * resume the continuous focus, cancelAutoFocus must be called.
+ * Restarting the preview will not resume the continuous autofocus. To
+ * stop continuous focus, applications should change the focus mode to
+ * other modes.
*
* @see #FOCUS_MODE_CONTINUOUS_VIDEO
*/
diff --git a/core/java/android/nfc/NfcFragment.java b/core/java/android/nfc/NfcFragment.java
index 17278dc..d6b15ad 100644
--- a/core/java/android/nfc/NfcFragment.java
+++ b/core/java/android/nfc/NfcFragment.java
@@ -48,7 +48,10 @@
FragmentManager manager = activity.getFragmentManager();
Fragment fragment = manager.findFragmentByTag(FRAGMENT_TAG);
if (fragment != null) {
- manager.beginTransaction().remove(fragment).commit();
+ // We allow state loss at this point, because the state is only
+ // lost when activity is being paused *AND* subsequently destroyed.
+ // In that case, the app will setup foreground dispatch again anyway.
+ manager.beginTransaction().remove(fragment).commitAllowingStateLoss();
}
}
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index fb9047b..7cf5168 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -867,16 +867,18 @@
if (firstPass) {
measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, lp.height);
} else {
- Spec spec = (orientation == HORIZONTAL) ? lp.columnSpec : lp.rowSpec;
+ boolean horizontal = (orientation == HORIZONTAL);
+ Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
if (spec.alignment == FILL) {
Interval span = spec.span;
- Axis axis = (orientation == HORIZONTAL) ? horizontalAxis : verticalAxis;
+ Axis axis = horizontal ? horizontalAxis : verticalAxis;
int[] locations = axis.getLocations();
- int size = locations[span.max] - locations[span.min];
- if (orientation == HORIZONTAL) {
- measureChildWithMargins2(c, widthSpec, heightSpec, size, lp.height);
+ int cellSize = locations[span.max] - locations[span.min];
+ int viewSize = cellSize - getTotalMargin(c, horizontal);
+ if (horizontal) {
+ measureChildWithMargins2(c, widthSpec, heightSpec, viewSize, lp.height);
} else {
- measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, size);
+ measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, viewSize);
}
}
}
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 9ef1aa1..7f7a3a7 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -3361,6 +3361,7 @@
final ListAdapter adapter = mAdapter;
int closetChildIndex = -1;
+ int closestChildTop = 0;
if (adapter != null && gainFocus && previouslyFocusedRect != null) {
previouslyFocusedRect.offset(mScrollX, mScrollY);
@@ -3392,12 +3393,13 @@
if (distance < minDistance) {
minDistance = distance;
closetChildIndex = i;
+ closestChildTop = other.getTop();
}
}
}
if (closetChildIndex >= 0) {
- setSelection(closetChildIndex + mFirstPosition);
+ setSelectionFromTop(closetChildIndex + mFirstPosition, closestChildTop);
} else {
requestLayout();
}
diff --git a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png
index 2a23d3a..a76f4ab 100644
--- a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png
index 2a23d3a..ecfe9cc 100644
--- a/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/spinner_ab_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png
index 75815a6..09f8cef 100644
--- a/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png
index 75815a6..58c67a0 100644
--- a/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/spinner_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png
index bfe4da8..f3ef482 100644
--- a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png
index bfe4da8..d677278 100644
--- a/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/spinner_ab_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png
index 440ef6d..dc8f01e 100644
--- a/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png
index 440ef6d..7d3af87 100644
--- a/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/spinner_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png
index ed69545..edf2573 100644
--- a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png
index ed69545..3a16579 100644
--- a/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/spinner_ab_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png b/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png
index d80fa37..eb1e1b7 100644
--- a/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/spinner_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png b/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png
index d80fa37..00c440c 100644
--- a/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/spinner_focused_holo_light.9.png
Binary files differ
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
index ef4cf5c..7edf6b4 100644
--- a/include/camera/CameraParameters.h
+++ b/include/camera/CameraParameters.h
@@ -644,15 +644,17 @@
// than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is
// set.
//
- // If applications call CameraHardwareInterface.autoFocus in this mode, the
- // focus callback will immediately return with a boolean that indicates
- // whether the focus is sharp or not. The apps can then decide if they want
- // to take a picture immediately or to change the focus mode to auto, and
- // run a full autofocus cycle. The focus position is locked after autoFocus
- // call. If applications want to resume the continuous focus,
- // cancelAutoFocus must be called. Restarting the preview will not resume
- // the continuous autofocus. To stop continuous focus, applications should
- // change the focus mode to other modes.
+ // Applications can call CameraHardwareInterface.autoFocus in this mode. If
+ // the autofocus is in the middle of scanning, the focus callback will
+ // return when it completes. If the autofocus is not scanning, focus
+ // callback will immediately return with a boolean that indicates whether
+ // the focus is sharp or not. The apps can then decide if they want to take
+ // a picture immediately or to change the focus mode to auto, and run a full
+ // autofocus cycle. The focus position is locked after autoFocus call. If
+ // applications want to resume the continuous focus, cancelAutoFocus must be
+ // called. Restarting the preview will not resume the continuous autofocus.
+ // To stop continuous focus, applications should change the focus mode to
+ // other modes.
static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
private:
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 948ecf9..5291a1f 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -359,6 +359,7 @@
mTargetSdkVersion = 14;
mDPI = 96;
mIsContextLite = false;
+ memset(&watchdog, 0, sizeof(watchdog));
}
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc) {
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 25a3705..2f32bd8 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1635,8 +1635,10 @@
// "silent mode", but which one?
newRingerMode = vibeInSilent ? RINGER_MODE_VIBRATE : RINGER_MODE_SILENT;
}
- if (uiIndex == 0 || (mPrevVolDirection == AudioManager.ADJUST_LOWER &&
- mVoiceCapable && streamType == AudioSystem.STREAM_RING)) {
+ if (uiIndex == 0 ||
+ (!vibeInSilent &&
+ mPrevVolDirection == AudioManager.ADJUST_LOWER &&
+ mVoiceCapable && streamType == AudioSystem.STREAM_RING)) {
adjustVolumeIndex = false;
}
}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 0471dfe..c802bc1 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -616,8 +616,8 @@
final IccCard.State state = mUpdateMonitor.getSimState();
final boolean lockedOrMissing = state.isPinLocked()
|| ((state == IccCard.State.ABSENT
- || state == IccCard.State.PERM_DISABLED)
- && requireSim);
+ || state == IccCard.State.PERM_DISABLED)
+ && requireSim);
if (!lockedOrMissing && !provisioned) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned"
@@ -625,7 +625,7 @@
return;
}
- if (mLockPatternUtils.isLockScreenDisabled()) {
+ if (mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
return;
}
diff --git a/services/java/com/android/server/TextServicesManagerService.java b/services/java/com/android/server/TextServicesManagerService.java
index 1976eba..b042da6 100644
--- a/services/java/com/android/server/TextServicesManagerService.java
+++ b/services/java/com/android/server/TextServicesManagerService.java
@@ -635,7 +635,9 @@
if (DBG) {
Slog.w(TAG, "Remove " + removeList.get(i));
}
- mListeners.remove(removeList.get(i));
+ final InternalDeathRecipient idr = removeList.get(i);
+ idr.mScListener.asBinder().unlinkToDeath(idr, 0);
+ mListeners.remove(idr);
}
cleanLocked();
}
@@ -664,6 +666,11 @@
public void removeAll() {
Slog.e(TAG, "Remove the spell checker bind unexpectedly.");
synchronized(mSpellCheckerMap) {
+ final int size = mListeners.size();
+ for (int i = 0; i < size; ++i) {
+ final InternalDeathRecipient idr = mListeners.get(i);
+ idr.mScListener.asBinder().unlinkToDeath(idr, 0);
+ }
mListeners.clear();
cleanLocked();
}