Merge "Turn hinting back on"
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/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/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: