Merge "Get rid of some animation flickers and other bad things."
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 9678d48..684c4fe 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -191,12 +191,6 @@
private static final long SYNC_ALARM_TIMEOUT_MIN = 30 * 1000; // 30 seconds
private static final long SYNC_ALARM_TIMEOUT_MAX = 2 * 60 * 60 * 1000; // two hours
- /**
- * The amount of time (in milliseconds) to wait after attempting a bind
- * before canceling a sync and disabling the sync adapter
- */
- public static final long BIND_TIMEOUT_MS = 5 * 60 * 1000;
-
public void onAccountsUpdated(Account[] accounts) {
// remember if this was the first time this was called after an update
final boolean justBootedUp = mAccounts == INITIAL_ACCOUNTS_ARRAY;
@@ -1074,9 +1068,6 @@
pw.print(" - ");
pw.print(activeSyncContext.mSyncOperation.dump(false));
pw.println();
- if (activeSyncContext.mSyncAdapter == null) {
- pw.println(" **** Waiting for onServiceConnected ****");
- }
}
synchronized (mSyncQueue) {
@@ -1433,7 +1424,6 @@
public void handleMessage(Message msg) {
long earliestFuturePollTime = Long.MAX_VALUE;
long nextPendingSyncTime = Long.MAX_VALUE;
- long nextBindTimeoutTime = Long.MAX_VALUE;
// Setting the value here instead of a method because we want the dumpsys logs
// to have the most recent value used.
@@ -1441,7 +1431,6 @@
waitUntilReadyToRun();
mDataConnectionIsConnected = readDataConnectionState();
mSyncManagerWakeLock.acquire();
- nextBindTimeoutTime = auditRunningSyncsForStuckBindsLocked();
// Always do this first so that we be sure that any periodic syncs that
// are ready to run have been converted into pending syncs. This allows the
// logic that considers the next steps to take based on the set of pending syncs
@@ -1543,7 +1532,6 @@
break;
}
} finally {
- nextPendingSyncTime = Math.min(nextBindTimeoutTime, nextPendingSyncTime);
manageSyncNotificationLocked();
manageSyncAlarmLocked(earliestFuturePollTime, nextPendingSyncTime);
mSyncTimeTracker.update();
@@ -1552,36 +1540,6 @@
}
/**
- * Looks to see if any of the active syncs have been waiting for a bind for too long,
- * and if so the sync is canceled and the sync adapter is disabled for that account.
- * @return the earliest time that an active sync can have waited too long to bind,
- * relative to {@link android.os.SystemClock#elapsedRealtime()}.
- */
- private long auditRunningSyncsForStuckBindsLocked() {
- final long now = SystemClock.elapsedRealtime();
- long oldest = Long.MAX_VALUE;
- for (ActiveSyncContext active : mActiveSyncContexts) {
- if (active.mSyncAdapter == null) {
- final long timeoutTime = active.mStartTime + BIND_TIMEOUT_MS;
- if (timeoutTime < now) {
- Log.w(TAG, "canceling long-running bind and disabling sync for "
- + active.mSyncOperation.account + ", authority "
- + active.mSyncOperation.authority);
- runSyncFinishedOrCanceledLocked(null, active);
- ContentResolver.setIsSyncable(active.mSyncOperation.account,
- active.mSyncOperation.authority, 0);
- } else {
- if (oldest > timeoutTime) {
- oldest = timeoutTime;
- }
- }
- }
- }
-
- return oldest;
- }
-
- /**
* Turn any periodic sync operations that are ready to run into pending sync operations.
* @return the desired start time of the earliest future periodic sync operation,
* in milliseconds since boot
@@ -1861,17 +1819,13 @@
synchronized (mSyncQueue){
mSyncQueue.remove(candidate);
}
- ActiveSyncContext newSyncContext = dispatchSyncOperation(candidate);
- if (newSyncContext != null) {
- nextReadyToRunTime = Math.min(nextReadyToRunTime,
- newSyncContext.mStartTime + BIND_TIMEOUT_MS);
- }
+ dispatchSyncOperation(candidate);
}
return nextReadyToRunTime;
}
- private ActiveSyncContext dispatchSyncOperation(SyncOperation op) {
+ private boolean dispatchSyncOperation(SyncOperation op) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "dispatchSyncOperation: we are going to sync " + op);
Log.v(TAG, "num active syncs: " + mActiveSyncContexts.size());
@@ -1888,7 +1842,7 @@
Log.d(TAG, "can't find a sync adapter for " + syncAdapterType
+ ", removing settings for it");
mSyncStorageEngine.removeAuthority(op.account, op.authority);
- return null;
+ return false;
}
ActiveSyncContext activeSyncContext =
@@ -1901,10 +1855,10 @@
if (!activeSyncContext.bindToSyncAdapter(syncAdapterInfo)) {
Log.e(TAG, "Bind attempt failed to " + syncAdapterInfo);
closeActiveSyncContext(activeSyncContext);
- return null;
+ return false;
}
- return activeSyncContext;
+ return true;
}
private void runBoundToSyncAdapter(final ActiveSyncContext activeSyncContext,
diff --git a/core/java/android/inputmethodservice/ExtractEditLayout.java b/core/java/android/inputmethodservice/ExtractEditLayout.java
index 5cfa998..25c0c99 100644
--- a/core/java/android/inputmethodservice/ExtractEditLayout.java
+++ b/core/java/android/inputmethodservice/ExtractEditLayout.java
@@ -16,9 +16,6 @@
package android.inputmethodservice;
-import com.android.internal.view.menu.MenuBuilder;
-import com.android.internal.view.menu.MenuPopupHelper;
-
import android.content.Context;
import android.util.AttributeSet;
import android.view.ActionMode;
@@ -29,6 +26,9 @@
import android.widget.Button;
import android.widget.LinearLayout;
+import com.android.internal.view.menu.MenuBuilder;
+import com.android.internal.view.menu.MenuPopupHelper;
+
/**
* ExtractEditLayout provides an ActionMode presentation for the
* limited screen real estate in extract mode.
@@ -61,6 +61,22 @@
return null;
}
+ /**
+ * @return true if an action mode is currently active.
+ */
+ public boolean isActionModeStarted() {
+ return mActionMode != null;
+ }
+
+ /**
+ * Finishes a possibly started action mode.
+ */
+ public void finishActionMode() {
+ if (mActionMode != null) {
+ mActionMode.finish();
+ }
+ }
+
@Override
public void onFinishInflate() {
super.onFinishInflate();
@@ -92,7 +108,7 @@
@Override
public void setTitle(int resId) {
- // Title will nor be shown.
+ // Title will not be shown.
}
@Override
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 7d3cd92..440d649 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -637,6 +637,7 @@
* configuration change happens.
*/
public void onInitializeInterface() {
+ // Intentionally empty
}
void initialize() {
@@ -876,8 +877,7 @@
}
if (changed) {
- onConfigureWindow(mWindow.getWindow(), isFullscreen,
- !mShowInputRequested);
+ onConfigureWindow(mWindow.getWindow(), isFullscreen, !mShowInputRequested);
mLastShowInputRequested = mShowInputRequested;
}
}
@@ -935,7 +935,7 @@
}
return true;
}
-
+
/**
* Controls the visibility of the extracted text area. This only applies
* when the input method is in fullscreen mode, and thus showing extracted
@@ -1242,6 +1242,7 @@
* same text field as before.
*/
public void onStartInputView(EditorInfo info, boolean restarting) {
+ // Intentionally empty
}
/**
@@ -1286,6 +1287,7 @@
* same text field as before.
*/
public void onStartCandidatesView(EditorInfo info, boolean restarting) {
+ // Intentionally empty
}
/**
@@ -1455,6 +1457,7 @@
* for the window has occurred (creating its views etc).
*/
public void onWindowShown() {
+ // Intentionally empty
}
/**
@@ -1462,6 +1465,7 @@
* after previously being visible.
*/
public void onWindowHidden() {
+ // Intentionally empty
}
/**
@@ -1472,6 +1476,7 @@
* and {@link #getCurrentInputConnection} return valid objects.
*/
public void onBindInput() {
+ // Intentionally empty
}
/**
@@ -1481,6 +1486,7 @@
* valid objects.
*/
public void onUnbindInput() {
+ // Intentionally empty
}
/**
@@ -1496,6 +1502,7 @@
* session with the editor.
*/
public void onStartInput(EditorInfo attribute, boolean restarting) {
+ // Intentionally empty
}
void doFinishInput() {
@@ -1570,6 +1577,7 @@
* <p>The default implementation here does nothing.
*/
public void onDisplayCompletions(CompletionInfo[] completions) {
+ // Intentionally empty
}
/**
@@ -1626,6 +1634,7 @@
* @param focusChanged true if the user changed the focused view by this click.
*/
public void onViewClicked(boolean focusChanged) {
+ // Intentionally empty
}
/**
@@ -1634,6 +1643,7 @@
* The default implementation does nothing.
*/
public void onUpdateCursor(Rect newCursor) {
+ // Intentionally empty
}
/**
@@ -1664,6 +1674,13 @@
private boolean handleBack(boolean doIt) {
if (mShowInputRequested) {
+ if (isExtractViewShown() && mExtractView instanceof ExtractEditLayout) {
+ ExtractEditLayout extractEditLayout = (ExtractEditLayout) mExtractView;
+ if (extractEditLayout.isActionModeStarted()) {
+ if (doIt) extractEditLayout.finishActionMode();
+ return true;
+ }
+ }
// If the soft input area is shown, back closes it and we
// consume the back key.
if (doIt) requestHideSelf(0);
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 05d4f05..d7fb7a0 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2771,15 +2771,21 @@
}
}
- private boolean startScrollIfNeeded(int deltaY) {
+ private boolean startScrollIfNeeded(int y) {
// Check if we have moved far enough that it looks more like a
// scroll than a tap
+ final int deltaY = y - mMotionY;
final int distance = Math.abs(deltaY);
final boolean overscroll = mScrollY != 0;
if (overscroll || distance > mTouchSlop) {
createScrollingCache();
- mTouchMode = overscroll ? TOUCH_MODE_OVERSCROLL : TOUCH_MODE_SCROLL;
- mMotionCorrection = deltaY;
+ if (overscroll) {
+ mTouchMode = TOUCH_MODE_OVERSCROLL;
+ mMotionCorrection = 0;
+ } else {
+ mTouchMode = TOUCH_MODE_SCROLL;
+ mMotionCorrection = deltaY > 0 ? mTouchSlop : -mTouchSlop;
+ }
final Handler handler = getHandler();
// Handler should not be null unless the AbsListView is not attached to a
// window, which would make it very hard to scroll it... but the monkeys
@@ -2799,12 +2805,176 @@
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
+ scrollIfNeeded(y);
return true;
}
return false;
}
+ private void scrollIfNeeded(int y) {
+ final int rawDeltaY = y - mMotionY;
+ final int deltaY = rawDeltaY - mMotionCorrection;
+ int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
+
+ if (mTouchMode == TOUCH_MODE_SCROLL) {
+ if (PROFILE_SCROLLING) {
+ if (!mScrollProfilingStarted) {
+ Debug.startMethodTracing("AbsListViewScroll");
+ mScrollProfilingStarted = true;
+ }
+ }
+
+ if (mScrollStrictSpan == null) {
+ // If it's non-null, we're already in a scroll.
+ mScrollStrictSpan = StrictMode.enterCriticalSpan("AbsListView-scroll");
+ }
+
+ if (y != mLastY) {
+ // We may be here after stopping a fling and continuing to scroll.
+ // If so, we haven't disallowed intercepting touch events yet.
+ // Make sure that we do so in case we're in a parent that can intercept.
+ if ((mGroupFlags & FLAG_DISALLOW_INTERCEPT) == 0 &&
+ Math.abs(rawDeltaY) > mTouchSlop) {
+ final ViewParent parent = getParent();
+ if (parent != null) {
+ parent.requestDisallowInterceptTouchEvent(true);
+ }
+ }
+
+ final int motionIndex;
+ if (mMotionPosition >= 0) {
+ motionIndex = mMotionPosition - mFirstPosition;
+ } else {
+ // If we don't have a motion position that we can reliably track,
+ // pick something in the middle to make a best guess at things below.
+ motionIndex = getChildCount() / 2;
+ }
+
+ int motionViewPrevTop = 0;
+ View motionView = this.getChildAt(motionIndex);
+ if (motionView != null) {
+ motionViewPrevTop = motionView.getTop();
+ }
+
+ // No need to do all this work if we're not going to move anyway
+ boolean atEdge = false;
+ if (incrementalDeltaY != 0) {
+ atEdge = trackMotionScroll(deltaY, incrementalDeltaY);
+ }
+
+ // Check to see if we have bumped into the scroll limit
+ motionView = this.getChildAt(motionIndex);
+ if (motionView != null) {
+ // Check if the top of the motion view is where it is
+ // supposed to be
+ final int motionViewRealTop = motionView.getTop();
+ if (atEdge) {
+ // Apply overscroll
+
+ int overscroll = -incrementalDeltaY -
+ (motionViewRealTop - motionViewPrevTop);
+ overScrollBy(0, overscroll, 0, mScrollY, 0, 0,
+ 0, mOverscrollDistance, true);
+ if (Math.abs(mOverscrollDistance) == Math.abs(mScrollY)) {
+ // Don't allow overfling if we're at the edge.
+ if (mVelocityTracker != null) {
+ mVelocityTracker.clear();
+ }
+ }
+
+ final int overscrollMode = getOverScrollMode();
+ if (overscrollMode == OVER_SCROLL_ALWAYS ||
+ (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS &&
+ !contentFits())) {
+ mDirection = 0; // Reset when entering overscroll.
+ mTouchMode = TOUCH_MODE_OVERSCROLL;
+ if (rawDeltaY > 0) {
+ mEdgeGlowTop.onPull((float) overscroll / getHeight());
+ if (!mEdgeGlowBottom.isFinished()) {
+ mEdgeGlowBottom.onRelease();
+ }
+ } else if (rawDeltaY < 0) {
+ mEdgeGlowBottom.onPull((float) overscroll / getHeight());
+ if (!mEdgeGlowTop.isFinished()) {
+ mEdgeGlowTop.onRelease();
+ }
+ }
+ }
+ }
+ mMotionY = y;
+ invalidate();
+ }
+ mLastY = y;
+ }
+ } else if (mTouchMode == TOUCH_MODE_OVERSCROLL) {
+ if (y != mLastY) {
+ final int oldScroll = mScrollY;
+ final int newScroll = oldScroll - incrementalDeltaY;
+ int newDirection = y > mLastY ? 1 : -1;
+
+ if (mDirection == 0) {
+ mDirection = newDirection;
+ }
+
+ int overScrollDistance = -incrementalDeltaY;
+ if ((newScroll < 0 && oldScroll >= 0) || (newScroll > 0 && oldScroll <= 0)) {
+ overScrollDistance = -oldScroll;
+ incrementalDeltaY += overScrollDistance;
+ } else {
+ incrementalDeltaY = 0;
+ }
+
+ if (overScrollDistance != 0) {
+ overScrollBy(0, overScrollDistance, 0, mScrollY, 0, 0,
+ 0, mOverscrollDistance, true);
+ final int overscrollMode = getOverScrollMode();
+ if (overscrollMode == OVER_SCROLL_ALWAYS ||
+ (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS &&
+ !contentFits())) {
+ if (rawDeltaY > 0) {
+ mEdgeGlowTop.onPull((float) overScrollDistance / getHeight());
+ if (!mEdgeGlowBottom.isFinished()) {
+ mEdgeGlowBottom.onRelease();
+ }
+ } else if (rawDeltaY < 0) {
+ mEdgeGlowBottom.onPull((float) overScrollDistance / getHeight());
+ if (!mEdgeGlowTop.isFinished()) {
+ mEdgeGlowTop.onRelease();
+ }
+ }
+ invalidate();
+ }
+ }
+
+ if (incrementalDeltaY != 0) {
+ // Coming back to 'real' list scrolling
+ mScrollY = 0;
+ invalidateParentIfNeeded();
+
+ // No need to do all this work if we're not going to move anyway
+ if (incrementalDeltaY != 0) {
+ trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
+ }
+
+ mTouchMode = TOUCH_MODE_SCROLL;
+
+ // We did not scroll the full amount. Treat this essentially like the
+ // start of a new touch scroll
+ final int motionPosition = findClosestMotionRow(y);
+
+ mMotionCorrection = 0;
+ View motionView = getChildAt(motionPosition - mFirstPosition);
+ mMotionViewOriginalTop = motionView != null ? motionView.getTop() : 0;
+ mMotionY = y;
+ mMotionPosition = motionPosition;
+ }
+ mLastY = y;
+ mDirection = newDirection;
+ }
+ }
+ }
+
public void onTouchModeChanged(boolean isInTouchMode) {
if (isInTouchMode) {
// Get rid of the selection when we enter touch mode
@@ -2856,7 +3026,6 @@
final int action = ev.getAction();
View v;
- int deltaY;
initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
@@ -2935,183 +3104,19 @@
mActivePointerId = ev.getPointerId(pointerIndex);
}
final int y = (int) ev.getY(pointerIndex);
- deltaY = y - mMotionY;
switch (mTouchMode) {
case TOUCH_MODE_DOWN:
case TOUCH_MODE_TAP:
case TOUCH_MODE_DONE_WAITING:
// Check if we have moved far enough that it looks more like a
// scroll than a tap
- startScrollIfNeeded(deltaY);
+ startScrollIfNeeded(y);
break;
case TOUCH_MODE_SCROLL:
- if (PROFILE_SCROLLING) {
- if (!mScrollProfilingStarted) {
- Debug.startMethodTracing("AbsListViewScroll");
- mScrollProfilingStarted = true;
- }
- }
-
- if (mScrollStrictSpan == null) {
- // If it's non-null, we're already in a scroll.
- mScrollStrictSpan = StrictMode.enterCriticalSpan("AbsListView-scroll");
- }
-
- if (y != mLastY) {
- // We may be here after stopping a fling and continuing to scroll.
- // If so, we haven't disallowed intercepting touch events yet.
- // Make sure that we do so in case we're in a parent that can intercept.
- if ((mGroupFlags & FLAG_DISALLOW_INTERCEPT) == 0 &&
- Math.abs(deltaY) > mTouchSlop) {
- final ViewParent parent = getParent();
- if (parent != null) {
- parent.requestDisallowInterceptTouchEvent(true);
- }
- }
-
- final int rawDeltaY = deltaY;
- deltaY -= mMotionCorrection;
- int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
-
- final int motionIndex;
- if (mMotionPosition >= 0) {
- motionIndex = mMotionPosition - mFirstPosition;
- } else {
- // If we don't have a motion position that we can reliably track,
- // pick something in the middle to make a best guess at things below.
- motionIndex = getChildCount() / 2;
- }
-
- int motionViewPrevTop = 0;
- View motionView = this.getChildAt(motionIndex);
- if (motionView != null) {
- motionViewPrevTop = motionView.getTop();
- }
-
- // No need to do all this work if we're not going to move anyway
- boolean atEdge = false;
- if (incrementalDeltaY != 0) {
- atEdge = trackMotionScroll(deltaY, incrementalDeltaY);
- }
-
- // Check to see if we have bumped into the scroll limit
- motionView = this.getChildAt(motionIndex);
- if (motionView != null) {
- // Check if the top of the motion view is where it is
- // supposed to be
- final int motionViewRealTop = motionView.getTop();
- if (atEdge) {
- // Apply overscroll
-
- int overscroll = -incrementalDeltaY -
- (motionViewRealTop - motionViewPrevTop);
- overScrollBy(0, overscroll, 0, mScrollY, 0, 0,
- 0, mOverscrollDistance, true);
- if (Math.abs(mOverscrollDistance) == Math.abs(mScrollY)) {
- // Don't allow overfling if we're at the edge.
- if (mVelocityTracker != null) {
- mVelocityTracker.clear();
- }
- }
-
- final int overscrollMode = getOverScrollMode();
- if (overscrollMode == OVER_SCROLL_ALWAYS ||
- (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS &&
- !contentFits())) {
- mDirection = 0; // Reset when entering overscroll.
- mTouchMode = TOUCH_MODE_OVERSCROLL;
- if (rawDeltaY > 0) {
- mEdgeGlowTop.onPull((float) overscroll / getHeight());
- if (!mEdgeGlowBottom.isFinished()) {
- mEdgeGlowBottom.onRelease();
- }
- } else if (rawDeltaY < 0) {
- mEdgeGlowBottom.onPull((float) overscroll / getHeight());
- if (!mEdgeGlowTop.isFinished()) {
- mEdgeGlowTop.onRelease();
- }
- }
- }
- }
- mMotionY = y;
- invalidate();
- }
- mLastY = y;
- }
- break;
-
case TOUCH_MODE_OVERSCROLL:
- if (y != mLastY) {
- final int rawDeltaY = deltaY;
- deltaY -= mMotionCorrection;
- int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
-
- final int oldScroll = mScrollY;
- final int newScroll = oldScroll - incrementalDeltaY;
- int newDirection = y > mLastY ? 1 : -1;
-
- if (mDirection == 0) {
- mDirection = newDirection;
- }
-
- int overScrollDistance = -incrementalDeltaY;
- if ((newScroll < 0 && oldScroll >= 0) || (newScroll > 0 && oldScroll <= 0)) {
- overScrollDistance = -oldScroll;
- incrementalDeltaY += overScrollDistance;
- } else {
- incrementalDeltaY = 0;
- }
-
- if (overScrollDistance != 0) {
- overScrollBy(0, overScrollDistance, 0, mScrollY, 0, 0,
- 0, mOverscrollDistance, true);
- final int overscrollMode = getOverScrollMode();
- if (overscrollMode == OVER_SCROLL_ALWAYS ||
- (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS &&
- !contentFits())) {
- if (rawDeltaY > 0) {
- mEdgeGlowTop.onPull((float) overScrollDistance / getHeight());
- if (!mEdgeGlowBottom.isFinished()) {
- mEdgeGlowBottom.onRelease();
- }
- } else if (rawDeltaY < 0) {
- mEdgeGlowBottom.onPull((float) overScrollDistance / getHeight());
- if (!mEdgeGlowTop.isFinished()) {
- mEdgeGlowTop.onRelease();
- }
- }
- invalidate();
- }
- }
-
- if (incrementalDeltaY != 0) {
- // Coming back to 'real' list scrolling
- mScrollY = 0;
- invalidateParentIfNeeded();
-
- // No need to do all this work if we're not going to move anyway
- if (incrementalDeltaY != 0) {
- trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
- }
-
- mTouchMode = TOUCH_MODE_SCROLL;
-
- // We did not scroll the full amount. Treat this essentially like the
- // start of a new touch scroll
- final int motionPosition = findClosestMotionRow(y);
-
- mMotionCorrection = 0;
- View motionView = getChildAt(motionPosition - mFirstPosition);
- mMotionViewOriginalTop = motionView != null ? motionView.getTop() : 0;
- mMotionY = y;
- mMotionPosition = motionPosition;
- }
- mLastY = y;
- mDirection = newDirection;
- }
+ scrollIfNeeded(y);
break;
}
-
break;
}
@@ -3542,7 +3547,7 @@
final int y = (int) ev.getY(pointerIndex);
initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
- if (startScrollIfNeeded(y - mMotionY)) {
+ if (startScrollIfNeeded(y)) {
return true;
}
break;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index b948114..40d85d8 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -3102,6 +3102,11 @@
text = "";
}
+ // If suggestions are not enabled, remove the suggestion spans from the text
+ if (!isSuggestionsEnabled()) {
+ text = removeSuggestionSpans(text);
+ }
+
if (!mUserSetTextScaleX) mTextPaint.setTextScaleX(1.0f);
if (text instanceof Spanned &&
@@ -3503,6 +3508,10 @@
applySingleLine(singleLine, !isPassword, true);
}
+ if (!isSuggestionsEnabled()) {
+ mText = removeSuggestionSpans(mText);
+ }
+
InputMethodManager imm = InputMethodManager.peekInstance();
if (imm != null) imm.restartInput(this);
}
@@ -9923,9 +9932,28 @@
}
}
- void showSuggestions() {
- if (!isSuggestionsEnabled() || !isTextEditable()) return;
+ /**
+ * Removes the suggestion spans.
+ */
+ CharSequence removeSuggestionSpans(CharSequence text) {
+ if (text instanceof Spanned) {
+ Spannable spannable;
+ if (text instanceof Spannable) {
+ spannable = (Spannable) text;
+ } else {
+ spannable = new SpannableString(text);
+ text = spannable;
+ }
+ SuggestionSpan[] spans = spannable.getSpans(0, text.length(), SuggestionSpan.class);
+ for (int i = 0; i < spans.length; i++) {
+ spannable.removeSpan(spans[i]);
+ }
+ }
+ return text;
+ }
+
+ void showSuggestions() {
if (mSuggestionsPopupWindow == null) {
mSuggestionsPopupWindow = new SuggestionsPopupWindow();
}
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index ee65223..ce42612 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -20,7 +20,6 @@
import android.text.SpannableString;
import android.text.SpannedString;
import android.text.TextUtils;
-import android.util.DisplayMetrics;
/**
* The Paint class holds the style and color information about how to draw
@@ -344,8 +343,10 @@
public Paint(int flags) {
mNativePaint = native_init();
setFlags(flags | DEFAULT_PAINT_FLAGS);
- setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV
- ? HINTING_OFF : HINTING_ON);
+ // TODO: Turning off hinting has undesirable side effects, we need to
+ // revisit hinting once we add support for subpixel positioning
+ // setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV
+ // ? HINTING_OFF : HINTING_ON);
mCompatScaling = mInvCompatScaling = 1;
}
@@ -365,8 +366,10 @@
public void reset() {
native_reset(mNativePaint);
setFlags(DEFAULT_PAINT_FLAGS);
- setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV
- ? HINTING_OFF : HINTING_ON);
+ // TODO: Turning off hinting has undesirable side effects, we need to
+ // revisit hinting once we add support for subpixel positioning
+ // setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV
+ // ? HINTING_OFF : HINTING_ON);
mHasCompatScaling = false;
mCompatScaling = mInvCompatScaling = 1;
mBidiFlags = BIDI_DEFAULT_LTR;
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index e965f14..b7286e5 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -164,6 +164,8 @@
void sendFormatChange();
+ void signalError(OMX_ERRORTYPE error = OMX_ErrorUndefined);
+
DISALLOW_EVIL_CONSTRUCTORS(ACodec);
};
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index e9dc61c..2ba2273 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1131,6 +1131,13 @@
mSentFormat = true;
}
+void ACodec::signalError(OMX_ERRORTYPE error) {
+ sp<AMessage> notify = mNotify->dup();
+ notify->setInt32("what", ACodec::kWhatError);
+ notify->setInt32("omx-error", error);
+ notify->post();
+}
+
////////////////////////////////////////////////////////////////////////////////
ACodec::BaseState::BaseState(ACodec *codec, const sp<AState> &parentState)
@@ -1252,10 +1259,7 @@
LOGE("[%s] ERROR(0x%08lx)", mCodec->mComponentName.c_str(), data1);
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", data1);
- notify->post();
+ mCodec->signalError((OMX_ERRORTYPE)data1);
return true;
}
@@ -1548,12 +1552,14 @@
&& msg->findInt32("render", &render) && render != 0) {
// The client wants this buffer to be rendered.
- CHECK_EQ(mCodec->mNativeWindow->queueBuffer(
+ if (mCodec->mNativeWindow->queueBuffer(
mCodec->mNativeWindow.get(),
- info->mGraphicBuffer.get()),
- 0);
-
- info->mStatus = BufferInfo::OWNED_BY_NATIVE_WINDOW;
+ info->mGraphicBuffer.get()) == OK) {
+ info->mStatus = BufferInfo::OWNED_BY_NATIVE_WINDOW;
+ } else {
+ mCodec->signalError();
+ info->mStatus = BufferInfo::OWNED_BY_US;
+ }
} else {
info->mStatus = BufferInfo::OWNED_BY_US;
}
@@ -1692,11 +1698,7 @@
if (node == NULL) {
LOGE("Unable to instantiate a decoder for type '%s'.", mime.c_str());
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorComponentNotFound);
- notify->post();
-
+ mCodec->signalError(OMX_ErrorComponentNotFound);
return;
}
@@ -1744,10 +1746,7 @@
"(error 0x%08x)",
err);
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorUndefined);
- notify->post();
+ mCodec->signalError();
}
}
@@ -2063,10 +2062,7 @@
"port reconfiguration (error 0x%08x)",
err);
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorUndefined);
- notify->post();
+ mCodec->signalError();
}
return true;
diff --git a/media/libstagefright/AVIExtractor.cpp b/media/libstagefright/AVIExtractor.cpp
index 6313ca3..62d17da 100644
--- a/media/libstagefright/AVIExtractor.cpp
+++ b/media/libstagefright/AVIExtractor.cpp
@@ -911,7 +911,11 @@
if (!memcmp(tmp, "RIFF", 4) && !memcmp(&tmp[8], "AVI ", 4)) {
mimeType->setTo(MEDIA_MIMETYPE_CONTAINER_AVI);
- *confidence = 0.2;
+
+ // Just a tad over the mp3 extractor's confidence, since
+ // these .avi files may contain .mp3 content that otherwise would
+ // mistakenly lead to us identifying the entire file as a .mp3 file.
+ *confidence = 0.21;
return true;
}
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index be2ef82..2938c45 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -497,10 +497,14 @@
case MSG_RUN_FULL_BACKUP:
{
+ // TODO: refactor full backup to be a looper-based state machine
+ // similar to normal backup/restore.
FullBackupParams params = (FullBackupParams)msg.obj;
- (new PerformFullBackupTask(params.fd, params.observer, params.includeApks,
+ PerformFullBackupTask task = new PerformFullBackupTask(params.fd,
+ params.observer, params.includeApks,
params.includeShared, params.curPassword, params.encryptPassword,
- params.allApps, params.packages, params.latch)).run();
+ params.allApps, params.packages, params.latch);
+ (new Thread(task)).start();
break;
}
@@ -519,9 +523,13 @@
case MSG_RUN_FULL_RESTORE:
{
+ // TODO: refactor full restore to be a looper-based state machine
+ // similar to normal backup/restore.
FullRestoreParams params = (FullRestoreParams)msg.obj;
- (new PerformFullRestoreTask(params.fd, params.curPassword, params.encryptPassword,
- params.observer, params.latch)).run();
+ PerformFullRestoreTask task = new PerformFullRestoreTask(params.fd,
+ params.curPassword, params.encryptPassword,
+ params.observer, params.latch);
+ (new Thread(task)).start();
break;
}
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index e6b5898..4b1a4e6 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -69,6 +69,7 @@
import java.io.PrintWriter;
import com.android.internal.app.IBatteryStats;
+import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.util.AsyncChannel;
import com.android.server.am.BatteryStatsService;
import com.android.internal.R;
@@ -96,6 +97,7 @@
private static final int IDLE_REQUEST = 0;
private boolean mScreenOff;
private boolean mDeviceIdle;
+ private boolean mEmergencyCallbackMode = false;
private int mPluggedType;
/* Chipset supports background scan */
@@ -996,6 +998,9 @@
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE,
BluetoothAdapter.STATE_DISCONNECTED);
mWifiStateMachine.sendBluetoothAdapterStateChange(state);
+ } else if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) {
+ mEmergencyCallbackMode = intent.getBooleanExtra("phoneinECMState", false);
+ updateWifiState();
}
}
@@ -1057,7 +1062,13 @@
private void updateWifiState() {
boolean lockHeld = mLocks.hasLocks();
int strongestLockMode = WifiManager.WIFI_MODE_FULL;
- boolean wifiShouldBeStarted = !mDeviceIdle || lockHeld;
+ boolean wifiShouldBeStarted;
+
+ if (mEmergencyCallbackMode) {
+ wifiShouldBeStarted = false;
+ } else {
+ wifiShouldBeStarted = !mDeviceIdle || lockHeld;
+ }
if (lockHeld) {
strongestLockMode = mLocks.getStrongestLockMode();
@@ -1097,6 +1108,7 @@
intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
intentFilter.addAction(ACTION_DEVICE_IDLE);
intentFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
+ intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
mContext.registerReceiver(mReceiver, intentFilter);
}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs
index 8cad82b..aae29a4 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs
@@ -37,162 +37,6 @@
volatile uchar3 uc3;
volatile uchar4 uc4;
-#define TEST_FN_FUNC_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1); \
- f2 = fnc(f2); \
- f3 = fnc(f3); \
- f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, (float*) &f1); \
- f2 = fnc(f2, (float2*) &f2); \
- f3 = fnc(f3, (float3*) &f3); \
- f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1); \
- f2 = fnc(f2, f2); \
- f3 = fnc(f3, f3); \
- f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1); \
- f2 = fnc(f2, f1); \
- f3 = fnc(f3, f1); \
- f4 = fnc(f4, f1);
-
-#define TEST_FN_FUNC_FN_IN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, i1); \
- f2 = fnc(f2, i2); \
- f3 = fnc(f3, i3); \
- f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, i1); \
- f2 = fnc(f2, i1); \
- f3 = fnc(f3, i1); \
- f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1, f1); \
- f2 = fnc(f2, f2, f2); \
- f3 = fnc(f3, f3, f3); \
- f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_PIN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, (int*) &i1); \
- f2 = fnc(f2, (int2*) &i2); \
- f3 = fnc(f3, (int3*) &i3); \
- f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- f1 = fnc(f1, f1, (int*) &i1); \
- f2 = fnc(f2, f2, (int2*) &i2); \
- f3 = fnc(f3, f3, (int3*) &i3); \
- f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc) \
- rsDebug("Testing " #fnc, 0); \
- i1 = fnc(f1); \
- i2 = fnc(f2); \
- i3 = fnc(f3); \
- i4 = fnc(f4);
-
-
-static bool test_fp_math(uint32_t index) {
- bool failed = false;
- start();
-
- TEST_FN_FUNC_FN(acos);
- TEST_FN_FUNC_FN(acosh);
- TEST_FN_FUNC_FN(acospi);
- TEST_FN_FUNC_FN(asin);
- TEST_FN_FUNC_FN(asinh);
- TEST_FN_FUNC_FN(asinpi);
- TEST_FN_FUNC_FN(atan);
- TEST_FN_FUNC_FN_FN(atan2);
- TEST_FN_FUNC_FN(atanh);
- TEST_FN_FUNC_FN(atanpi);
- TEST_FN_FUNC_FN_FN(atan2pi);
- TEST_FN_FUNC_FN(cbrt);
- TEST_FN_FUNC_FN(ceil);
- TEST_FN_FUNC_FN_FN(copysign);
- TEST_FN_FUNC_FN(cos);
- TEST_FN_FUNC_FN(cosh);
- TEST_FN_FUNC_FN(cospi);
- TEST_FN_FUNC_FN(erfc);
- TEST_FN_FUNC_FN(erf);
- TEST_FN_FUNC_FN(exp);
- TEST_FN_FUNC_FN(exp2);
- TEST_FN_FUNC_FN(exp10);
- TEST_FN_FUNC_FN(expm1);
- TEST_FN_FUNC_FN(fabs);
- TEST_FN_FUNC_FN_FN(fdim);
- TEST_FN_FUNC_FN(floor);
- TEST_FN_FUNC_FN_FN_FN(fma);
- TEST_FN_FUNC_FN_FN(fmax);
- TEST_FN_FUNC_FN_F(fmax);
- TEST_FN_FUNC_FN_FN(fmin);
- TEST_FN_FUNC_FN_F(fmin);
- TEST_FN_FUNC_FN_FN(fmod);
- TEST_FN_FUNC_FN_PFN(fract);
- TEST_FN_FUNC_FN_PIN(frexp);
- TEST_FN_FUNC_FN_FN(hypot);
- TEST_IN_FUNC_FN(ilogb);
- TEST_FN_FUNC_FN_IN(ldexp);
- TEST_FN_FUNC_FN_I(ldexp);
- TEST_FN_FUNC_FN(lgamma);
- TEST_FN_FUNC_FN_PIN(lgamma);
- TEST_FN_FUNC_FN(log);
- TEST_FN_FUNC_FN(log2);
- TEST_FN_FUNC_FN(log10);
- TEST_FN_FUNC_FN(log1p);
- TEST_FN_FUNC_FN(logb);
- TEST_FN_FUNC_FN_FN_FN(mad);
- TEST_FN_FUNC_FN_PFN(modf);
- // nan
- TEST_FN_FUNC_FN_FN(nextafter);
- TEST_FN_FUNC_FN_FN(pow);
- TEST_FN_FUNC_FN_IN(pown);
- TEST_FN_FUNC_FN_FN(powr);
- TEST_FN_FUNC_FN_FN(remainder);
- TEST_FN_FUNC_FN_FN_PIN(remquo);
- TEST_FN_FUNC_FN(rint);
- TEST_FN_FUNC_FN_IN(rootn);
- TEST_FN_FUNC_FN(round);
- TEST_FN_FUNC_FN(rsqrt);
- TEST_FN_FUNC_FN(sin);
- TEST_FN_FUNC_FN_PFN(sincos);
- TEST_FN_FUNC_FN(sinh);
- TEST_FN_FUNC_FN(sinpi);
- TEST_FN_FUNC_FN(sqrt);
- TEST_FN_FUNC_FN(tan);
- TEST_FN_FUNC_FN(tanh);
- TEST_FN_FUNC_FN(tanpi);
- TEST_FN_FUNC_FN(tgamma);
- TEST_FN_FUNC_FN(trunc);
-
- float time = end(index);
-
- if (failed) {
- rsDebug("test_fp_math FAILED", time);
- }
- else {
- rsDebug("test_fp_math PASSED", time);
- }
-
- return failed;
-}
-
#define DECL_INT(prefix) \
volatile char prefix##_c_1 = 1; \
volatile char2 prefix##_c_2 = 1; \
@@ -221,6 +65,10 @@
volatile long prefix##_l_1 = 1; \
volatile ulong prefix##_ul_1 = 1;
+DECL_INT(res)
+DECL_INT(src1)
+DECL_INT(src2)
+
#define TEST_INT_OP_TYPE(op, type) \
rsDebug("Testing " #op " for " #type "1", i++); \
res_##type##_1 = src1_##type##_1 op src2_##type##_1; \
@@ -243,9 +91,274 @@
rsDebug("Testing " #op " for ul1", i++); \
res_ul_1 = src1_ul_1 op src2_ul_1;
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
+#define TEST_XN_FUNC_YN(typeout, fnc, typein) \
+ res_##typeout##_1 = fnc(src1_##typein##_1); \
+ res_##typeout##_2 = fnc(src1_##typein##_2); \
+ res_##typeout##_3 = fnc(src1_##typein##_3); \
+ res_##typeout##_4 = fnc(src1_##typein##_4);
+
+#define TEST_XN_FUNC_XN_XN(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
+ res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
+ res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
+ res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
+
+#define TEST_X_FUNC_X_X_X(type, fnc) \
+ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
+
+#define TEST_IN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, uc) \
+ TEST_XN_FUNC_YN(c, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, us) \
+ TEST_XN_FUNC_YN(s, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, ui) \
+ TEST_XN_FUNC_YN(i, fnc, i)
+
+#define TEST_UIN_FUNC_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_YN(uc, fnc, c) \
+ TEST_XN_FUNC_YN(us, fnc, s) \
+ TEST_XN_FUNC_YN(ui, fnc, i) \
+
+#define TEST_IN_FUNC_IN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_XN_FUNC_XN_XN(uc, fnc) \
+ TEST_XN_FUNC_XN_XN(c, fnc) \
+ TEST_XN_FUNC_XN_XN(us, fnc) \
+ TEST_XN_FUNC_XN_XN(s, fnc) \
+ TEST_XN_FUNC_XN_XN(ui, fnc) \
+ TEST_XN_FUNC_XN_XN(i, fnc)
+
+#define TEST_I_FUNC_I_I_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ TEST_X_FUNC_X_X_X(uc, fnc) \
+ TEST_X_FUNC_X_X_X(c, fnc) \
+ TEST_X_FUNC_X_X_X(us, fnc) \
+ TEST_X_FUNC_X_X_X(s, fnc) \
+ TEST_X_FUNC_X_X_X(ui, fnc) \
+ TEST_X_FUNC_X_X_X(i, fnc)
+
+#define TEST_FN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f2 = fnc(f2); \
+ f3 = fnc(f3); \
+ f4 = fnc(f4);
+
+#define TEST_FN_FUNC_FN_PFN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (float*) &f1); \
+ f2 = fnc(f2, (float2*) &f2); \
+ f3 = fnc(f3, (float3*) &f3); \
+ f4 = fnc(f4, (float4*) &f4);
+
+#define TEST_FN_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f2); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_F34_FUNC_F34_F34(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f3 = fnc(f3, f3); \
+ f4 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f2 = fnc(f2, f1); \
+ f3 = fnc(f3, f1); \
+ f4 = fnc(f4, f1);
+
+#define TEST_F_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1); \
+ f1 = fnc(f2); \
+ f1 = fnc(f3); \
+ f1 = fnc(f4);
+
+#define TEST_F_FUNC_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1); \
+ f1 = fnc(f2, f2); \
+ f1 = fnc(f3, f3); \
+ f1 = fnc(f4, f4);
+
+#define TEST_FN_FUNC_FN_IN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i2); \
+ f3 = fnc(f3, i3); \
+ f4 = fnc(f4, i4);
+
+#define TEST_FN_FUNC_FN_I(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, i1); \
+ f2 = fnc(f2, i1); \
+ f3 = fnc(f3, i1); \
+ f4 = fnc(f4, i1);
+
+#define TEST_FN_FUNC_FN_FN_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f2, f2); \
+ f3 = fnc(f3, f3, f3); \
+ f4 = fnc(f4, f4, f4);
+
+#define TEST_FN_FUNC_FN_FN_F(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, f1); \
+ f2 = fnc(f2, f1, f1); \
+ f3 = fnc(f3, f1, f1); \
+ f4 = fnc(f4, f1, f1);
+
+#define TEST_FN_FUNC_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, (int*) &i1); \
+ f2 = fnc(f2, (int2*) &i2); \
+ f3 = fnc(f3, (int3*) &i3); \
+ f4 = fnc(f4, (int4*) &i4);
+
+#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ f1 = fnc(f1, f1, (int*) &i1); \
+ f2 = fnc(f2, f2, (int2*) &i2); \
+ f3 = fnc(f3, f3, (int3*) &i3); \
+ f4 = fnc(f4, f4, (int4*) &i4);
+
+#define TEST_IN_FUNC_FN(fnc) \
+ rsDebug("Testing " #fnc, 0); \
+ i1 = fnc(f1); \
+ i2 = fnc(f2); \
+ i3 = fnc(f3); \
+ i4 = fnc(f4);
+
+static bool test_fp_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_FN_FUNC_FN(acos);
+ TEST_FN_FUNC_FN(acosh);
+ TEST_FN_FUNC_FN(acospi);
+ TEST_FN_FUNC_FN(asin);
+ TEST_FN_FUNC_FN(asinh);
+ TEST_FN_FUNC_FN(asinpi);
+ TEST_FN_FUNC_FN(atan);
+ TEST_FN_FUNC_FN_FN(atan2);
+ TEST_FN_FUNC_FN(atanh);
+ TEST_FN_FUNC_FN(atanpi);
+ TEST_FN_FUNC_FN_FN(atan2pi);
+ TEST_FN_FUNC_FN(cbrt);
+ TEST_FN_FUNC_FN(ceil);
+ TEST_FN_FUNC_FN_FN_FN(clamp);
+ TEST_FN_FUNC_FN_FN_F(clamp);
+ TEST_FN_FUNC_FN_FN(copysign);
+ TEST_FN_FUNC_FN(cos);
+ TEST_FN_FUNC_FN(cosh);
+ TEST_FN_FUNC_FN(cospi);
+ TEST_F34_FUNC_F34_F34(cross);
+ TEST_FN_FUNC_FN(degrees);
+ TEST_F_FUNC_FN_FN(distance);
+ TEST_F_FUNC_FN_FN(dot);
+ TEST_FN_FUNC_FN(erfc);
+ TEST_FN_FUNC_FN(erf);
+ TEST_FN_FUNC_FN(exp);
+ TEST_FN_FUNC_FN(exp2);
+ TEST_FN_FUNC_FN(exp10);
+ TEST_FN_FUNC_FN(expm1);
+ TEST_FN_FUNC_FN(fabs);
+ TEST_FN_FUNC_FN_FN(fdim);
+ TEST_FN_FUNC_FN(floor);
+ TEST_FN_FUNC_FN_FN_FN(fma);
+ TEST_FN_FUNC_FN_FN(fmax);
+ TEST_FN_FUNC_FN_F(fmax);
+ TEST_FN_FUNC_FN_FN(fmin);
+ TEST_FN_FUNC_FN_F(fmin);
+ TEST_FN_FUNC_FN_FN(fmod);
+ TEST_FN_FUNC_FN_PFN(fract);
+ TEST_FN_FUNC_FN_PIN(frexp);
+ TEST_FN_FUNC_FN_FN(hypot);
+ TEST_IN_FUNC_FN(ilogb);
+ TEST_FN_FUNC_FN_IN(ldexp);
+ TEST_FN_FUNC_FN_I(ldexp);
+ TEST_F_FUNC_FN(length);
+ TEST_FN_FUNC_FN(lgamma);
+ TEST_FN_FUNC_FN_PIN(lgamma);
+ TEST_FN_FUNC_FN(log);
+ TEST_FN_FUNC_FN(log2);
+ TEST_FN_FUNC_FN(log10);
+ TEST_FN_FUNC_FN(log1p);
+ TEST_FN_FUNC_FN(logb);
+ TEST_FN_FUNC_FN_FN_FN(mad);
+ TEST_FN_FUNC_FN_FN(max);
+ TEST_FN_FUNC_FN_F(max);
+ TEST_FN_FUNC_FN_FN(min);
+ TEST_FN_FUNC_FN_F(min);
+ TEST_FN_FUNC_FN_FN_FN(mix);
+ TEST_FN_FUNC_FN_FN_F(mix);
+ TEST_FN_FUNC_FN_PFN(modf);
+ // nan
+ TEST_FN_FUNC_FN_FN(nextafter);
+ TEST_FN_FUNC_FN(normalize);
+ TEST_FN_FUNC_FN_FN(pow);
+ TEST_FN_FUNC_FN_IN(pown);
+ TEST_FN_FUNC_FN_FN(powr);
+ TEST_FN_FUNC_FN(radians);
+ TEST_FN_FUNC_FN_FN(remainder);
+ TEST_FN_FUNC_FN_FN_PIN(remquo);
+ TEST_FN_FUNC_FN(rint);
+ TEST_FN_FUNC_FN_IN(rootn);
+ TEST_FN_FUNC_FN(round);
+ TEST_FN_FUNC_FN(rsqrt);
+ TEST_FN_FUNC_FN(sign);
+ TEST_FN_FUNC_FN(sin);
+ TEST_FN_FUNC_FN_PFN(sincos);
+ TEST_FN_FUNC_FN(sinh);
+ TEST_FN_FUNC_FN(sinpi);
+ TEST_FN_FUNC_FN(sqrt);
+ TEST_FN_FUNC_FN_FN(step);
+ TEST_FN_FUNC_FN_F(step);
+ TEST_FN_FUNC_FN(tan);
+ TEST_FN_FUNC_FN(tanh);
+ TEST_FN_FUNC_FN(tanpi);
+ TEST_FN_FUNC_FN(tgamma);
+ TEST_FN_FUNC_FN(trunc);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_fp_math FAILED", time);
+ }
+ else {
+ rsDebug("test_fp_math PASSED", time);
+ }
+
+ return failed;
+}
+
+static bool test_int_math(uint32_t index) {
+ bool failed = false;
+ start();
+
+ TEST_UIN_FUNC_IN(abs);
+ TEST_IN_FUNC_IN(clz);
+ TEST_IN_FUNC_IN_IN(min);
+ TEST_IN_FUNC_IN_IN(max);
+ TEST_I_FUNC_I_I_I(rsClamp);
+
+ float time = end(index);
+
+ if (failed) {
+ rsDebug("test_int_math FAILED", time);
+ }
+ else {
+ rsDebug("test_int_math PASSED", time);
+ }
+
+ return failed;
+}
static bool test_basic_operators() {
bool failed = false;
@@ -310,6 +423,7 @@
bool failed = false;
failed |= test_convert();
failed |= test_fp_math(index);
+ failed |= test_int_math(index);
failed |= test_basic_operators();
if (failed) {
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index 2f7b927..fb2c134 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -61,6 +61,7 @@
import android.widget.EditText;
import com.android.internal.R;
+import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.util.AsyncChannel;
import com.android.internal.util.Protocol;
import com.android.internal.util.State;
@@ -134,6 +135,8 @@
/* Airplane mode changed */
private static final int AIRPLANE_MODE_CHANGED = BASE + 6;
+ /* Emergency callback mode */
+ private static final int EMERGENCY_CALLBACK_MODE = BASE + 7;
private final boolean mP2pSupported;
private final String mDeviceType;
@@ -172,6 +175,7 @@
IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+ filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
filter.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
mContext.registerReceiver(new WifiStateReceiver(), filter);
@@ -185,14 +189,19 @@
private class WifiStateReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
+ String action = intent.getAction();
+ if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
mWifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
WifiManager.WIFI_STATE_DISABLED);
- } else if (intent.getAction().equals(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)) {
+ } else if (action.equals(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)) {
mWifiApState = intent.getIntExtra(WifiManager.EXTRA_WIFI_AP_STATE,
WifiManager.WIFI_AP_STATE_DISABLED);
- } else if (intent.getAction().equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
+ } else if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
mP2pStateMachine.sendMessage(AIRPLANE_MODE_CHANGED);
+ } else if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) {
+ if (intent.getBooleanExtra("phoneinECMState", false) == true) {
+ mP2pStateMachine.sendMessage(EMERGENCY_CALLBACK_MODE);
+ }
}
}
}
@@ -361,6 +370,9 @@
case AIRPLANE_MODE_CHANGED:
if (isAirplaneModeOn()) sendMessage(WifiP2pManager.DISABLE_P2P);
break;
+ case EMERGENCY_CALLBACK_MODE:
+ sendMessage(WifiP2pManager.DISABLE_P2P);
+ break;
// Ignore
case WIFI_DISABLE_USER_ACCEPT:
case WIFI_DISABLE_USER_REJECT: