diff options
| -rw-r--r-- | core/java/android/bluetooth/BluetoothUuid.java | 18 | ||||
| -rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 7 | ||||
| -rw-r--r-- | core/java/android/webkit/WebView.java | 16 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewCore.java | 13 | ||||
| -rw-r--r-- | libs/rs/rsScriptC_Lib.cpp | 185 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java | 21 |
6 files changed, 238 insertions, 22 deletions
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java index f8316a5bac9a..1ec7fb38b447 100644 --- a/core/java/android/bluetooth/BluetoothUuid.java +++ b/core/java/android/bluetooth/BluetoothUuid.java @@ -30,14 +30,13 @@ public final class BluetoothUuid { * The following 128 bit values are calculated as: * uuid * 2^96 + BASE_UUID */ - public static final UUID AudioSink = UUID.fromString("0000110A-0000-1000-8000-00805F9B34FB"); - public static final UUID AudioSource = UUID.fromString("0000110B-0000-1000-8000-00805F9B34FB"); + public static final UUID AudioSink = UUID.fromString("0000110B-0000-1000-8000-00805F9B34FB"); + public static final UUID AudioSource = UUID.fromString("0000110A-0000-1000-8000-00805F9B34FB"); public static final UUID AdvAudioDist = UUID.fromString("0000110D-0000-1000-8000-00805F9B34FB"); public static final UUID HSP = UUID.fromString("00001108-0000-1000-8000-00805F9B34FB"); - public static final UUID HeadsetHS = UUID.fromString("00001131-0000-1000-8000-00805F9B34FB"); - public static final UUID Handsfree = UUID.fromString("0000111e-0000-1000-8000-00805F9B34FB"); - public static final UUID HandsfreeAudioGateway - = UUID.fromString("0000111f-0000-1000-8000-00805F9B34FB"); + public static final UUID Handsfree = UUID.fromString("0000111E-0000-1000-8000-00805F9B34FB"); + public static final UUID AvrcpController = + UUID.fromString("0000110E-0000-1000-8000-00805F9B34FB"); public static boolean isAudioSource(UUID uuid) { return uuid.equals(AudioSource); @@ -56,7 +55,10 @@ public final class BluetoothUuid { } public static boolean isHeadset(UUID uuid) { - return uuid.equals(HSP) || uuid.equals(HeadsetHS); + return uuid.equals(HSP); } -} + public static boolean isAvrcpController(UUID uuid) { + return uuid.equals(AvrcpController); + } +} diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index dc84d1f376c9..d98277703d0e 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -402,13 +402,14 @@ class BluetoothEventLoop { boolean authorized = false; UUID uuid = UUID.fromString(deviceUuid); - if (mBluetoothService.isEnabled() && BluetoothUuid.isAudioSink(uuid)) { + if (mBluetoothService.isEnabled() && + (BluetoothUuid.isAudioSink(uuid) || BluetoothUuid.isAvrcpController(uuid))) { BluetoothA2dp a2dp = new BluetoothA2dp(mContext); authorized = a2dp.getSinkPriority(address) > BluetoothA2dp.PRIORITY_OFF; if (authorized) { - Log.i(TAG, "Allowing incoming A2DP connection from " + address); + Log.i(TAG, "Allowing incoming A2DP / AVRCP connection from " + address); } else { - Log.i(TAG, "Rejecting incoming A2DP connection from " + address); + Log.i(TAG, "Rejecting incoming A2DP / AVRCP connection from " + address); } } else { Log.i(TAG, "Rejecting incoming " + deviceUuid + " connection from " + address); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index adb585d64aab..16cbede3e4a5 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2292,13 +2292,13 @@ public class WebView extends AbsoluteLayout // Scale from content to view coordinates, and pin. // Also called by jni webview.cpp - private void setContentScrollBy(int cx, int cy, boolean animate) { + private boolean setContentScrollBy(int cx, int cy, boolean animate) { if (mDrawHistory) { // disallow WebView to change the scroll position as History Picture // is used in the view system. // TODO: as we switchOutDrawHistory when trackball or navigation // keys are hit, this should be safe. Right? - return; + return false; } cx = contentToView(cx); cy = contentToView(cy); @@ -2315,11 +2315,9 @@ public class WebView extends AbsoluteLayout // FIXME: Why do we only scroll horizontally if there is no // vertical scroll? // Log.d(LOGTAG, "setContentScrollBy cy=" + cy); - if (cy == 0 && cx != 0) { - pinScrollBy(cx, 0, animate, 0); - } + return cy == 0 && cx != 0 && pinScrollBy(cx, 0, animate, 0); } else { - pinScrollBy(cx, cy, animate, 0); + return pinScrollBy(cx, cy, animate, 0); } } @@ -3814,6 +3812,8 @@ public class WebView extends AbsoluteLayout } else { mTouchMode = TOUCH_INIT_MODE; mPreventDrag = mForwardTouchEvents; + mWebViewCore.sendMessage( + EventHub.UPDATE_FRAME_CACHE_IF_LOADING); if (mLogEvent && eventTime - mLastTouchUpTime < 1000) { EventLog.writeEvent(EVENT_LOG_DOUBLE_TAP_DURATION, (eventTime - mLastTouchUpTime), eventTime); @@ -4681,7 +4681,7 @@ public class WebView extends AbsoluteLayout // mLastTouchX and mLastTouchY are the point in the current viewport int contentX = viewToContent((int) mLastTouchX + mScrollX); int contentY = viewToContent((int) mLastTouchY + mScrollY); - int left = nativeGetBlockLeftEdge(contentX, contentY); + int left = nativeGetBlockLeftEdge(contentX, contentY, mActualScale); if (left != NO_LEFTEDGE) { // add a 5pt padding to the left edge. Re-calculate the zoom // center so that the new scroll x will be on the left edge. @@ -5656,5 +5656,5 @@ public class WebView extends AbsoluteLayout private native void nativeUpdatePluginReceivesEvents(); // return NO_LEFTEDGE means failure. private static final int NO_LEFTEDGE = -1; - private native int nativeGetBlockLeftEdge(int x, int y); + private native int nativeGetBlockLeftEdge(int x, int y, float scale); } diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 8ec8174a7970..2f9e1530cff1 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -648,6 +648,7 @@ final class WebViewCore { } static final String[] HandlerDebugString = { + "UPDATE_FRAME_CACHE_IF_LOADING", // = 98 "SCROLL_TEXT_INPUT", // = 99 "LOAD_URL", // = 100; "STOP_LOADING", // = 101; @@ -699,6 +700,7 @@ final class WebViewCore { class EventHub { // Message Ids + static final int UPDATE_FRAME_CACHE_IF_LOADING = 98; static final int SCROLL_TEXT_INPUT = 99; static final int LOAD_URL = 100; static final int STOP_LOADING = 101; @@ -805,10 +807,11 @@ final class WebViewCore { @Override public void handleMessage(Message msg) { if (DebugFlags.WEB_VIEW_CORE) { - Log.v(LOGTAG, (msg.what < SCROLL_TEXT_INPUT || msg.what + Log.v(LOGTAG, (msg.what < UPDATE_FRAME_CACHE_IF_LOADING + || msg.what > FREE_MEMORY ? Integer.toString(msg.what) : HandlerDebugString[msg.what - - SCROLL_TEXT_INPUT]) + - UPDATE_FRAME_CACHE_IF_LOADING]) + " arg1=" + msg.arg1 + " arg2=" + msg.arg2 + " obj=" + msg.obj); } @@ -825,6 +828,10 @@ final class WebViewCore { mNativeClass = 0; break; + case UPDATE_FRAME_CACHE_IF_LOADING: + nativeUpdateFrameCacheIfLoading(); + break; + case SCROLL_TEXT_INPUT: nativeScrollFocusedTextInput(msg.arg1, msg.arg2); break; @@ -1938,6 +1945,8 @@ final class WebViewCore { WebView.CLEAR_TEXT_ENTRY).sendToTarget(); } + private native void nativeUpdateFrameCacheIfLoading(); + /** * Scroll the focused textfield to (x, y) in document space */ diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp index ca0511401e92..21c975383c7c 100644 --- a/libs/rs/rsScriptC_Lib.cpp +++ b/libs/rs/rsScriptC_Lib.cpp @@ -129,12 +129,91 @@ static void SC_storeMatrix(uint32_t bank, uint32_t offset, const rsc_Matrix *m) // Math routines ////////////////////////////////////////////////////////////////////////////// +#define PI 3.1415926f +#define DEG_TO_RAD PI / 180.0f +#define RAD_TO_DEG 180.0f / PI + static float SC_randf(float max) { float r = (float)rand(); return r / RAND_MAX * max; } +static float SC_randf2(float min, float max) +{ + float r = (float)rand(); + return r / RAND_MAX * (max - min) + min; +} + +static float SC_clampf(float amount, float low, float high) +{ + return amount < low ? low : (amount > high ? high : amount); +} + +static float SC_maxf(float a, float b) +{ + return a > b ? a : b; +} + +static float SC_minf(float a, float b) +{ + return a < b ? a : b; +} + +static float SC_sqrf(float v) +{ + return v * v; +} + +static float SC_distf2(float x1, float y1, float x2, float y2) +{ + float x = x2 - x1; + float y = y2 - y1; + return sqrtf(x * x + y * y); +} + +static float SC_distf3(float x1, float y1, float z1, float x2, float y2, float z2) +{ + float x = x2 - x1; + float y = y2 - y1; + float z = z2 - z1; + return sqrtf(x * x + y * y + z * z); +} + +static float SC_magf2(float a, float b) +{ + return sqrtf(a * a + b * b); +} + +static float SC_magf3(float a, float b, float c) +{ + return sqrtf(a * a + b * b + c * c); +} + +static float SC_radf(float degrees) +{ + return degrees * DEG_TO_RAD; +} + +static float SC_degf(float radians) +{ + return radians * RAD_TO_DEG; +} + +static float SC_lerpf(float start, float stop, float amount) +{ + return start + (stop - start) * amount; +} + +static float SC_normf(float start, float stop, float value) +{ + return (value - start) / (stop - start); +} + +static float SC_mapf(float minStart, float minStop, float maxStart, float maxStop, float value) +{ + return maxStart + (maxStart - maxStop) * ((value - minStart) / (minStop - minStart)); +} ////////////////////////////////////////////////////////////////////////////// // Time routines @@ -176,7 +255,7 @@ static uint32_t SC_minute() } } -static uint32_t SC_hour() +static uint32_t SC_hour() { GET_TLS(); @@ -192,8 +271,62 @@ static uint32_t SC_hour() timeinfo = localtime(&rawtime); return timeinfo->tm_hour; } +} + +static uint32_t SC_day() +{ + GET_TLS(); + + time_t rawtime; + time(&rawtime); + + if (sc->mEnviroment.mTimeZone) { + struct tm timeinfo; + localtime_tz(&rawtime, &timeinfo, sc->mEnviroment.mTimeZone); + return timeinfo.tm_mday; + } else { + struct tm *timeinfo; + timeinfo = localtime(&rawtime); + return timeinfo->tm_mday; + } } +static uint32_t SC_month() +{ + GET_TLS(); + + time_t rawtime; + time(&rawtime); + + if (sc->mEnviroment.mTimeZone) { + struct tm timeinfo; + localtime_tz(&rawtime, &timeinfo, sc->mEnviroment.mTimeZone); + return timeinfo.tm_mon; + } else { + struct tm *timeinfo; + timeinfo = localtime(&rawtime); + return timeinfo->tm_mon; + } +} + +static uint32_t SC_year() +{ + GET_TLS(); + + time_t rawtime; + time(&rawtime); + + if (sc->mEnviroment.mTimeZone) { + struct tm timeinfo; + localtime_tz(&rawtime, &timeinfo, sc->mEnviroment.mTimeZone); + return timeinfo.tm_year; + } else { + struct tm *timeinfo; + timeinfo = localtime(&rawtime); + return timeinfo->tm_year; + } +} + ////////////////////////////////////////////////////////////////////////////// // Matrix routines ////////////////////////////////////////////////////////////////////////////// @@ -510,14 +643,58 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = { "float", "(float)" }, { "cosf", (void *)&cosf, "float", "(float)" }, + { "asinf", (void *)&asinf, + "float", "(float)" }, + { "acosf", (void *)&acosf, + "float", "(float)" }, + { "atanf", (void *)&atanf, + "float", "(float)" }, + { "atan2f", (void *)&atan2f, + "float", "(floatm float)" }, { "fabsf", (void *)&fabsf, "float", "(float)" }, { "randf", (void *)&SC_randf, "float", "(float)" }, + { "randf2", (void *)&SC_randf2, + "float", "(float, float)" }, { "floorf", (void *)&floorf, "float", "(float)" }, { "ceilf", (void *)&ceilf, "float", "(float)" }, + { "expf", (void *)&expf, + "float", "(float)" }, + { "logf", (void *)&logf, + "float", "(float)" }, + { "powf", (void *)&powf, + "float", "(float, float)" }, + { "maxf", (void *)&SC_maxf, + "float", "(float, float)" }, + { "minf", (void *)&SC_minf, + "float", "(float, float)" }, + { "sqrtf", (void *)&sqrtf, + "float", "(float)" }, + { "sqrf", (void *)&SC_sqrf, + "float", "(float)" }, + { "clampf", (void *)&SC_clampf, + "float", "(float, float, float)" }, + { "distf2", (void *)&SC_distf2, + "float", "(float, float, float, float)" }, + { "distf3", (void *)&SC_distf3, + "float", "(float, float, float, float, float, float)" }, + { "magf2", (void *)&SC_magf2, + "float", "(float, float)" }, + { "magf3", (void *)&SC_magf3, + "float", "(float, float, float)" }, + { "radf", (void *)&SC_radf, + "float", "(float)" }, + { "degf", (void *)&SC_degf, + "float", "(float)" }, + { "lerpf", (void *)&SC_lerpf, + "float", "(float, float, float)" }, + { "normf", (void *)&SC_normf, + "float", "(float, float, float)" }, + { "mapf", (void *)&SC_mapf, + "float", "(float, float, float, float, float)" }, // time { "second", (void *)&SC_second, @@ -526,6 +703,12 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = { "int", "()" }, { "hour", (void *)&SC_hour, "int", "()" }, + { "day", (void *)&SC_day, + "int", "()" }, + { "month", (void *)&SC_month, + "int", "()" }, + { "year", (void *)&SC_year, + "int", "()" }, // matrix { "matrixLoadIdentity", (void *)&SC_matrixLoadIdentity, diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java index 3ab1f7769fac..1f1f7c14fc17 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java @@ -19,6 +19,7 @@ package com.android.internal.telephony.cdma; import android.app.Activity; import android.app.PendingIntent; +import android.app.PendingIntent.CanceledException; import android.content.ContentValues; import android.content.SharedPreferences; import android.database.Cursor; @@ -31,6 +32,7 @@ import android.provider.Telephony.Sms.Intents; import android.preference.PreferenceManager; import android.util.Config; import android.util.Log; +import android.telephony.SmsManager; import com.android.internal.telephony.TelephonyProperties; import com.android.internal.telephony.CommandsInterface; @@ -45,6 +47,7 @@ import com.android.internal.util.HexDump; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.HashMap; +import java.lang.Boolean; final class CdmaSMSDispatcher extends SMSDispatcher { @@ -331,6 +334,24 @@ final class CdmaSMSDispatcher extends SMSDispatcher { sentIntent, deliveryIntent); } + protected void sendRawPdu(byte[] smsc, byte[] pdu, PendingIntent sentIntent, + PendingIntent deliveryIntent) { + String inEcm = SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE); + if (Boolean.parseBoolean(inEcm)) { + if (sentIntent != null) { + try { + sentIntent.send(SmsManager.RESULT_ERROR_NO_SERVICE); + } catch (CanceledException ex) {} + } + if (Config.LOGD) { + Log.d(TAG, "Block SMS in Emergency Callback mode"); + } + return; + } + + super.sendRawPdu(smsc, pdu, sentIntent, deliveryIntent); + } + /** {@inheritDoc} */ protected void sendSms(SmsTracker tracker) { HashMap map = tracker.mData; |