diff options
65 files changed, 728 insertions, 153 deletions
diff --git a/core/java/android/content/ContentUris.java b/core/java/android/content/ContentUris.java index aa76034..dbe8a7c 100644 --- a/core/java/android/content/ContentUris.java +++ b/core/java/android/content/ContentUris.java @@ -19,9 +19,54 @@ package android.content; import android.net.Uri; /** - * Utility methods useful for working with content {@link android.net.Uri}s, - * those with a "content" scheme. - */ +* Utility methods useful for working with {@link android.net.Uri} objects +* that use the "content" (content://) scheme. +* +*<p> +* Content URIs have the syntax +*</p> +*<p> +* <code>content://<em>authority</em>/<em>path</em>/<em>id</em></code> +*</p> +*<dl> +* <dt> +* <code>content:</code> +* </dt> +* <dd> +* The scheme portion of the URI. This is always set to {@link +* android.content.ContentResolver#SCHEME_CONTENT ContentResolver.SCHEME_CONTENT} (value +* <code>content://</code>). +* </dd> +* <dt> +* <em>authority</em> +* </dt> +* <dd> +* A string that identifies the entire content provider. All the content URIs for the provider +* start with this string. To guarantee a unique authority, providers should consider +* using an authority that is the same as the provider class' package identifier. +* </dd> +* <dt> +* <em>path</em> +* </dt> +* <dd> +* Zero or more segments, separated by a forward slash (<code>/</code>), that identify +* some subset of the provider's data. Most providers use the path part to identify +* individual tables. Individual segments in the path are often called +* "directories" although they do not refer to file directories. The right-most +* segment in a path is often called a "twig" +* </dd> +* <dt> +* <em>id</em> +* </dt> +* <dd> +* A unique numeric identifier for a single row in the subset of data identified by the +* preceding path part. Most providers recognize content URIs that contain an id part +* and give them special handling. A table that contains a column named <code>_ID</code> +* often expects the id part to be a particular value for that column. +* </dd> +*</dl> +* +*/ public class ContentUris { /** diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java index e289fc1..d39e741 100644 --- a/core/java/android/net/NetworkUtils.java +++ b/core/java/android/net/NetworkUtils.java @@ -250,4 +250,32 @@ public class NetworkUtils { } return result; } + + /** + * Trim leading zeros from IPv4 address strings + * Our base libraries will interpret that as octel.. + * Must leave non v4 addresses and host names alone. + * For example, 192.168.000.010 -> 192.168.0.10 + * TODO - fix base libraries and remove this function + * @param addr a string representing an ip addr + * @return a string propertly trimmed + */ + public static String trimV4AddrZeros(String addr) { + if (addr == null) return null; + String[] octets = addr.split("\\."); + if (octets.length != 4) return addr; + StringBuilder builder = new StringBuilder(16); + String result = null; + for (int i = 0; i < 4; i++) { + try { + if (octets[i].length() > 3) return addr; + builder.append(Integer.parseInt(octets[i])); + } catch (NumberFormatException e) { + return addr; + } + if (i < 3) builder.append('.'); + } + result = builder.toString(); + return result; + } } diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 7d03494..88fea91 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -311,7 +311,7 @@ public class Build { public static final int ICE_CREAM_SANDWICH = 14; /** - * Android 4.1. + * Android 4.0.3. */ public static final int ICE_CREAM_SANDWICH_MR1 = 15; } diff --git a/core/java/android/os/storage/package.html b/core/java/android/os/storage/package.html new file mode 100644 index 0000000..a5f1e1c --- /dev/null +++ b/core/java/android/os/storage/package.html @@ -0,0 +1,8 @@ +<HTML> +<BODY> +<p> +Contains classes for the system storage service, which manages binary asset filesystems +known as Opaque Binary Blobs (OBBs). +</p> +</BODY> +</HTML> diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index caff53b..c44f23b 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2779,10 +2779,10 @@ public final class Settings { public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; /** - * If injection of accessibility enhancing JavaScript scripts + * If injection of accessibility enhancing JavaScript screen-reader * is enabled. * <p> - * Note: Accessibility injecting scripts are served by the + * Note: The JavaScript based screen-reader is served by the * Google infrastructure and enable users with disabilities to * efficiantly navigate in and explore web content. * </p> @@ -2795,6 +2795,22 @@ public final class Settings { "accessibility_script_injection"; /** + * The URL for the injected JavaScript based screen-reader used + * for providing accessiblity of content in WebView. + * <p> + * Note: The JavaScript based screen-reader is served by the + * Google infrastructure and enable users with disabilities to + * efficiently navigate in and explore web content. + * </p> + * <p> + * This property represents a string value. + * </p> + * @hide + */ + public static final String ACCESSIBILITY_SCREEN_READER_URL = + "accessibility_script_injection_url"; + + /** * Key bindings for navigation in built-in accessibility support for web content. * <p> * Note: These key bindings are for the built-in accessibility navigation for diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index af8f8cb..5c93a42 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -12220,13 +12220,16 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @param location an array of two integers in which to hold the coordinates */ public void getLocationInWindow(int[] location) { - // When the view is not attached to a window, this method does not make sense - if (mAttachInfo == null) return; - if (location == null || location.length < 2) { throw new IllegalArgumentException("location must be an array of two integers"); } + if (mAttachInfo == null) { + // When the view is not attached to a window, this method does not make sense + location[0] = location[1] = 0; + return; + } + float[] position = mAttachInfo.mTmpTransformLocation; position[0] = position[1] = 0.0f; diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index 05c5daa..b455ad5 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -149,7 +149,7 @@ public class ViewConfiguration { * It may be appropriate to tweak this on a device-specific basis in an overlay based on * the characteristics of the touch panel and firmware. */ - private static final int TOUCH_SLOP = 4; + private static final int TOUCH_SLOP = 8; /** * Distance the first touch can wander before we stop considering this event a double tap diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 5035cae..1102a47 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2719,13 +2719,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return more; } - float alpha = child.getAlpha(); - // Bail out early if the view does not need to be drawn - if (alpha <= ViewConfiguration.ALPHA_THRESHOLD && (child.mPrivateFlags & ALPHA_SET) == 0 && - !(child instanceof SurfaceView)) { - return more; - } - if (hardwareAccelerated) { // Clear INVALIDATED flag to allow invalidation to occur during rendering, but // retain the flag's value temporarily in the mRecreateDisplayList flag @@ -2779,6 +2772,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } + float alpha = child.getAlpha(); if (transformToApply != null || alpha < 1.0f || !child.hasIdentityMatrix()) { if (transformToApply != null || !childHasIdentityMatrix) { int transX = 0; diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 3574a0d..2b59b80 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -19,10 +19,13 @@ package android.webkit; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; +import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.Paint.Style; +import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -51,7 +54,6 @@ import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; -import android.widget.AbsoluteLayout; import android.widget.AbsoluteLayout.LayoutParams; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -74,7 +76,6 @@ import java.util.ArrayList; static final String LOGTAG = "webtextview"; - private Paint mRingPaint; private int mRingInset; private WebView mWebView; @@ -207,13 +208,51 @@ import java.util.ArrayList; } } }; - float ringWidth = 4f * context.getResources().getDisplayMetrics().density; mReceiver = new MyResultReceiver(mHandler); - mRingPaint = new Paint(); - mRingPaint.setColor(0x6633b5e5); - mRingPaint.setStrokeWidth(ringWidth); - mRingPaint.setStyle(Style.FILL); + float ringWidth = 2f * context.getResources().getDisplayMetrics().density; mRingInset = (int) ringWidth; + setBackgroundDrawable(new BackgroundDrawable(mRingInset)); + setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), + getPaddingBottom()); + } + + private static class BackgroundDrawable extends Drawable { + + private Paint mPaint = new Paint(); + private int mBorderWidth; + private Rect mInsetRect = new Rect(); + + public BackgroundDrawable(int width) { + mPaint = new Paint(); + mPaint.setStrokeWidth(width); + mBorderWidth = width; + } + + @Override + public void draw(Canvas canvas) { + mPaint.setColor(0x6633b5e5); + canvas.drawRect(getBounds(), mPaint); + mInsetRect.left = getBounds().left + mBorderWidth; + mInsetRect.top = getBounds().top + mBorderWidth; + mInsetRect.right = getBounds().right - mBorderWidth; + mInsetRect.bottom = getBounds().bottom - mBorderWidth; + mPaint.setColor(Color.WHITE); + canvas.drawRect(mInsetRect, mPaint); + } + + @Override + public void setAlpha(int alpha) { + } + + @Override + public void setColorFilter(ColorFilter cf) { + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSLUCENT; + } + } public void setAutoFillable(int queryId) { @@ -223,35 +262,9 @@ import java.util.ArrayList; } @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - if (isFocused()) { - final int ib = getHeight() - mRingInset; - canvas.drawRect(0, 0, getWidth(), mRingInset, mRingPaint); - canvas.drawRect(0, ib, getWidth(), getHeight(), mRingPaint); - canvas.drawRect(0, mRingInset, mRingInset, ib, mRingPaint); - canvas.drawRect(getWidth() - mRingInset, mRingInset, getWidth(), ib, mRingPaint); - } - } - - private void growOrShrink(boolean grow) { - AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) getLayoutParams(); - if (grow) { - lp.x -= mRingInset; - lp.y -= mRingInset; - lp.width += 2 * mRingInset; - lp.height += 2 * mRingInset; - setPadding(getPaddingLeft() + mRingInset, getPaddingTop() + mRingInset, - getPaddingRight() + mRingInset, getPaddingBottom() + mRingInset); - } else { - lp.x += mRingInset; - lp.y += mRingInset; - lp.width -= 2 * mRingInset; - lp.height -= 2 * mRingInset; - setPadding(getPaddingLeft() - mRingInset, getPaddingTop() - mRingInset, - getPaddingRight() - mRingInset, getPaddingBottom() - mRingInset); - } - setLayoutParams(lp); + public void setPadding(int left, int top, int right, int bottom) { + super.setPadding(left + mRingInset, top + mRingInset, + right + mRingInset, bottom + mRingInset); } @Override @@ -555,7 +568,6 @@ import java.util.ArrayList; } else if (!mInsideRemove) { mWebView.setActive(false); } - growOrShrink(focused); mFromFocusChange = false; } @@ -966,6 +978,10 @@ import java.util.ArrayList; */ /* package */ void setRect(int x, int y, int width, int height) { LayoutParams lp = (LayoutParams) getLayoutParams(); + x -= mRingInset; + y -= mRingInset; + width += 2 * mRingInset; + height += 2 * mRingInset; boolean needsUpdate = false; if (null == lp) { lp = new LayoutParams(width, height, x, y); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index b68dec9..40cb248 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -59,6 +59,7 @@ import android.os.Message; import android.os.StrictMode; import android.provider.Settings; import android.speech.tts.TextToSpeech; +import android.text.TextUtils; import android.util.AttributeSet; import android.util.EventLog; import android.util.Log; @@ -849,13 +850,12 @@ public class WebView extends AbsoluteLayout // the alias via which accessibility JavaScript interface is exposed private static final String ALIAS_ACCESSIBILITY_JS_INTERFACE = "accessibility"; - // JavaScript to inject the script chooser which will - // pick the right script for the current URL - private static final String ACCESSIBILITY_SCRIPT_CHOOSER_JAVASCRIPT = + // Template for JavaScript that injects a screen-reader. + private static final String ACCESSIBILITY_SCREEN_READER_JAVASCRIPT_TEMPLATE = "javascript:(function() {" + " var chooser = document.createElement('script');" + " chooser.type = 'text/javascript';" + - " chooser.src = 'https://ssl.gstatic.com/accessibility/javascript/android/AndroidScriptChooser.user.js';" + + " chooser.src = '%1s';" + " document.getElementsByTagName('head')[0].appendChild(chooser);" + " })();"; @@ -3818,7 +3818,7 @@ public class WebView extends AbsoluteLayout if (onDeviceScriptInjectionEnabled) { ensureAccessibilityScriptInjectorInstance(false); // neither script injected nor script injection opted out => we inject - loadUrl(ACCESSIBILITY_SCRIPT_CHOOSER_JAVASCRIPT); + loadUrl(getScreenReaderInjectingJs()); // TODO: Set this flag after successfull script injection. Maybe upon injection // the chooser should update the meta tag and we check it to declare success mAccessibilityScriptInjected = true; @@ -3832,7 +3832,7 @@ public class WebView extends AbsoluteLayout } else if (axsParameterValue == ACCESSIBILITY_SCRIPT_INJECTION_PROVIDED) { ensureAccessibilityScriptInjectorInstance(false); // the URL provides accessibility but we still need to add our generic script - loadUrl(ACCESSIBILITY_SCRIPT_CHOOSER_JAVASCRIPT); + loadUrl(getScreenReaderInjectingJs()); } else { Log.e(LOGTAG, "Unknown URL value for the \"axs\" URL parameter: " + axsParameterValue); } @@ -3854,6 +3854,17 @@ public class WebView extends AbsoluteLayout } /** + * Gets JavaScript that injects a screen-reader. + * + * @return The JavaScript snippet. + */ + private String getScreenReaderInjectingJs() { + String screenReaderUrl = Settings.Secure.getString(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_SCREEN_READER_URL); + return String.format(ACCESSIBILITY_SCREEN_READER_JAVASCRIPT_TEMPLATE, screenReaderUrl); + } + + /** * Gets the "axs" URL parameter value. * * @param url A url to fetch the paramter from. diff --git a/core/java/android/widget/RemoteViewsService.java b/core/java/android/widget/RemoteViewsService.java index 7ba4777..07bd918 100644 --- a/core/java/android/widget/RemoteViewsService.java +++ b/core/java/android/widget/RemoteViewsService.java @@ -145,6 +145,9 @@ public abstract class RemoteViewsService extends Service { Thread.getDefaultUncaughtExceptionHandler().uncaughtException(t, ex); } } + public synchronized void onDataSetChangedAsync() { + onDataSetChanged(); + } public synchronized int getCount() { int count = 0; try { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 82bcd3e..babd8e7 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -9931,6 +9931,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (suggestionInfo.suggestionIndex == ADD_TO_DICTIONARY) { Intent intent = new Intent(Settings.ACTION_USER_DICTIONARY_INSERT); intent.putExtra("word", originalText); + intent.putExtra("locale", getTextServicesLocale().toString()); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); // There is no way to know if the word was indeed added. Re-check. diff --git a/core/java/com/android/internal/util/StateMachine.java b/core/java/com/android/internal/util/StateMachine.java index 72489a2..61c0c8e 100644 --- a/core/java/com/android/internal/util/StateMachine.java +++ b/core/java/com/android/internal/util/StateMachine.java @@ -1367,10 +1367,12 @@ public class StateMachine { /** * Get a message and set Message.target = this. * - * @return message + * @return message or null if SM has quit */ public final Message obtainMessage() { + if (mSmHandler == null) return null; + return Message.obtain(mSmHandler); } @@ -1378,9 +1380,11 @@ public class StateMachine { * Get a message and set Message.target = this and what * * @param what is the assigned to Message.what. - * @return message + * @return message or null if SM has quit */ public final Message obtainMessage(int what) { + if (mSmHandler == null) return null; + return Message.obtain(mSmHandler, what); } @@ -1390,10 +1394,12 @@ public class StateMachine { * * @param what is the assigned to Message.what. * @param obj is assigned to Message.obj. - * @return message + * @return message or null if SM has quit */ public final Message obtainMessage(int what, Object obj) { + if (mSmHandler == null) return null; + return Message.obtain(mSmHandler, what, obj); } @@ -1404,10 +1410,13 @@ public class StateMachine { * @param what is assigned to Message.what * @param arg1 is assigned to Message.arg1 * @param arg2 is assigned to Message.arg2 - * @return A Message object from the global pool. + * @return A Message object from the global pool or null if + * SM has quit */ public final Message obtainMessage(int what, int arg1, int arg2) { + if (mSmHandler == null) return null; + return Message.obtain(mSmHandler, what, arg1, arg2); } @@ -1419,10 +1428,13 @@ public class StateMachine { * @param arg1 is assigned to Message.arg1 * @param arg2 is assigned to Message.arg2 * @param obj is assigned to Message.obj - * @return A Message object from the global pool. + * @return A Message object from the global pool or null if + * SM has quit */ public final Message obtainMessage(int what, int arg1, int arg2, Object obj) { + if (mSmHandler == null) return null; + return Message.obtain(mSmHandler, what, arg1, arg2, obj); } @@ -1430,6 +1442,9 @@ public class StateMachine { * Enqueue a message to this state machine. */ public final void sendMessage(int what) { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.sendMessage(obtainMessage(what)); } @@ -1437,6 +1452,9 @@ public class StateMachine { * Enqueue a message to this state machine. */ public final void sendMessage(int what, Object obj) { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.sendMessage(obtainMessage(what,obj)); } @@ -1444,6 +1462,9 @@ public class StateMachine { * Enqueue a message to this state machine. */ public final void sendMessage(Message msg) { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.sendMessage(msg); } @@ -1451,6 +1472,9 @@ public class StateMachine { * Enqueue a message to this state machine after a delay. */ public final void sendMessageDelayed(int what, long delayMillis) { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.sendMessageDelayed(obtainMessage(what), delayMillis); } @@ -1458,6 +1482,9 @@ public class StateMachine { * Enqueue a message to this state machine after a delay. */ public final void sendMessageDelayed(int what, Object obj, long delayMillis) { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.sendMessageDelayed(obtainMessage(what, obj), delayMillis); } @@ -1465,6 +1492,9 @@ public class StateMachine { * Enqueue a message to this state machine after a delay. */ public final void sendMessageDelayed(Message msg, long delayMillis) { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.sendMessageDelayed(msg, delayMillis); } @@ -1509,6 +1539,9 @@ public class StateMachine { * will be processed. */ public final void quit() { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.quit(); } @@ -1523,6 +1556,9 @@ public class StateMachine { * @return if debugging is enabled */ public boolean isDbg() { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return false; + return mSmHandler.isDbg(); } @@ -1532,6 +1568,9 @@ public class StateMachine { * @param dbg is true to enable debugging. */ public void setDbg(boolean dbg) { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + mSmHandler.setDbg(dbg); } @@ -1539,6 +1578,9 @@ public class StateMachine { * Start the state machine. */ public void start() { + // mSmHandler can be null if the state machine has quit. + if (mSmHandler == null) return; + /** Send the complete construction message */ mSmHandler.completeConstruction(); } diff --git a/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl b/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl index 18076c4..7317ecf 100644 --- a/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl +++ b/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl @@ -22,6 +22,7 @@ import android.widget.RemoteViews; /** {@hide} */ interface IRemoteViewsFactory { void onDataSetChanged(); + oneway void onDataSetChangedAsync(); oneway void onDestroy(in Intent intent); int getCount(); RemoteViews getViewAt(int position); diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp index 3b45ccd..f61795d 100644 --- a/core/jni/android_view_DisplayEventReceiver.cpp +++ b/core/jni/android_view_DisplayEventReceiver.cpp @@ -107,6 +107,12 @@ status_t NativeDisplayEventReceiver::scheduleVsync() { return status_t(n); } + status_t status = mReceiver.requestNextVsync(); + if (status) { + LOGW("Failed to request next vsync, status=%d", status); + return status; + } + if (!mFdCallbackRegistered) { int rc = mLooper->addFd(mReceiver.getFd(), 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this); diff --git a/core/res/res/layout/global_actions_silent_mode.xml b/core/res/res/layout/global_actions_silent_mode.xml index 09b4341..18b4715 100644 --- a/core/res/res/layout/global_actions_silent_mode.xml +++ b/core/res/res/layout/global_actions_silent_mode.xml @@ -26,6 +26,8 @@ android:layout_width="64dp" android:layout_height="match_parent" android:background="?android:attr/actionBarItemBackground" + android:contentDescription="@string/silent_mode_silent" + android:focusable="true" > <ImageView android:layout_width="48dp" @@ -52,6 +54,8 @@ android:layout_width="64dp" android:layout_height="match_parent" android:background="?android:attr/actionBarItemBackground" + android:contentDescription="@string/silent_mode_vibrate" + android:focusable="true" > <ImageView android:layout_width="48dp" @@ -79,6 +83,8 @@ android:layout_width="64dp" android:layout_height="match_parent" android:background="?android:attr/actionBarItemBackground" + android:contentDescription="@string/silent_mode_ring" + android:focusable="true" > <ImageView android:layout_width="48dp" diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index c342c20..3ab72f4 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -750,6 +750,6 @@ <!-- Base "touch slop" value used by ViewConfiguration as a movement threshold where scrolling should begin. --> - <dimen name="config_viewConfigurationTouchSlop">4dp</dimen> + <dimen name="config_viewConfigurationTouchSlop">8dp</dimen> </resources> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 7ad1d53..6f115b3 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -286,6 +286,12 @@ <string name="screen_lock">Screen lock</string> <!-- Button to turn off the phone, within the Phone Options dialog --> <string name="power_off">Power off</string> + <!-- Spoken description for ringer silent option. [CHAR LIMIT=NONE] --> + <string name="silent_mode_silent">Ringer off</string> + <!-- Spoken description for ringer vibrate option. [CHAR LIMIT=NONE] --> + <string name="silent_mode_vibrate">Ringer vibrate</string> + <!-- Spoken description for ringer normal option. [CHAR LIMIT=NONE] --> + <string name="silent_mode_ring">Ringer on</string> <!-- Shutdown Progress Dialog. This is shown if the user chooses to power off the phone. --> <string name="shutdown_progress">Shutting down\u2026</string> diff --git a/data/fonts/DroidSansArmenian.ttf b/data/fonts/DroidSansArmenian.ttf Binary files differindex 62f67e0..6fafa54 100644 --- a/data/fonts/DroidSansArmenian.ttf +++ b/data/fonts/DroidSansArmenian.ttf diff --git a/data/fonts/DroidSansGeorgian.ttf b/data/fonts/DroidSansGeorgian.ttf Binary files differindex 743ae66..3a2e9fb 100644 --- a/data/fonts/DroidSansGeorgian.ttf +++ b/data/fonts/DroidSansGeorgian.ttf diff --git a/docs/html/shareables/adl/2011Q3_Android_Market_for_Developers.pdf b/docs/html/shareables/adl/2011Q3_Android_Market_for_Developers.pdf Binary files differnew file mode 100644 index 0000000..598a27e --- /dev/null +++ b/docs/html/shareables/adl/2011Q3_Android_Market_for_Developers.pdf diff --git a/docs/html/shareables/adl/2011Q3_Designing_UIs_for_Phones_and_Tablets.pdf b/docs/html/shareables/adl/2011Q3_Designing_UIs_for_Phones_and_Tablets.pdf Binary files differnew file mode 100644 index 0000000..6ef41dd --- /dev/null +++ b/docs/html/shareables/adl/2011Q3_Designing_UIs_for_Phones_and_Tablets.pdf diff --git a/docs/html/shareables/adl/2011Q3_Introduction_to_Honeycomb_APIs.pdf b/docs/html/shareables/adl/2011Q3_Introduction_to_Honeycomb_APIs.pdf Binary files differnew file mode 100755 index 0000000..e56d237 --- /dev/null +++ b/docs/html/shareables/adl/2011Q3_Introduction_to_Honeycomb_APIs.pdf diff --git a/include/gui/DisplayEventReceiver.h b/include/gui/DisplayEventReceiver.h index 8d07c0e..dccc164 100644 --- a/include/gui/DisplayEventReceiver.h +++ b/include/gui/DisplayEventReceiver.h @@ -94,6 +94,20 @@ public: */ ssize_t getEvents(Event* events, size_t count); + /* + * setVsyncRate() sets the Event::VSync delivery rate. A value of + * 1 returns every Event::VSync. A value of 2 returns every other event, + * etc... a value of 0 returns no event unless requestNextVsync() has + * been called. + */ + status_t setVsyncRate(uint32_t count); + + /* + * requestNextVsync() schedules the next Event::VSync. It has no effect + * if the vsync rate is > 0. + */ + status_t requestNextVsync(); + private: sp<IDisplayEventConnection> mEventConnection; sp<BitTube> mDataChannel; diff --git a/include/gui/IDisplayEventConnection.h b/include/gui/IDisplayEventConnection.h index 8728bb5..86247de 100644 --- a/include/gui/IDisplayEventConnection.h +++ b/include/gui/IDisplayEventConnection.h @@ -33,9 +33,27 @@ class BitTube; class IDisplayEventConnection : public IInterface { public: + DECLARE_META_INTERFACE(DisplayEventConnection); + /* + * getDataChannel() returns a BitTube where to receive the events from + */ virtual sp<BitTube> getDataChannel() const = 0; + + /* + * setVsyncRate() sets the vsync event delivery rate. A value of + * 1 returns every vsync events. A value of 2 returns every other events, + * etc... a value of 0 returns no event unless requestNextVsync() has + * been called. + */ + virtual void setVsyncRate(uint32_t count) = 0; + + /* + * requestNextVsync() schedules the next vsync event. It has no effect + * if the vsync rate is > 0. + */ + virtual void requestNextVsync() = 0; // asynchronous }; // ---------------------------------------------------------------------------- diff --git a/libs/gui/DisplayEventReceiver.cpp b/libs/gui/DisplayEventReceiver.cpp index 3b29a11..fee1feb 100644 --- a/libs/gui/DisplayEventReceiver.cpp +++ b/libs/gui/DisplayEventReceiver.cpp @@ -58,6 +58,26 @@ int DisplayEventReceiver::getFd() const { return mDataChannel->getFd(); } +status_t DisplayEventReceiver::setVsyncRate(uint32_t count) { + if (int32_t(count) < 0) + return BAD_VALUE; + + if (mEventConnection != NULL) { + mEventConnection->setVsyncRate(count); + return NO_ERROR; + } + return NO_INIT; +} + +status_t DisplayEventReceiver::requestNextVsync() { + if (mEventConnection != NULL) { + mEventConnection->requestNextVsync(); + return NO_ERROR; + } + return NO_INIT; +} + + ssize_t DisplayEventReceiver::getEvents(DisplayEventReceiver::Event* events, size_t count) { ssize_t size = mDataChannel->read(events, sizeof(events[0])*count); diff --git a/libs/gui/IDisplayEventConnection.cpp b/libs/gui/IDisplayEventConnection.cpp index 44127fb..887d176 100644 --- a/libs/gui/IDisplayEventConnection.cpp +++ b/libs/gui/IDisplayEventConnection.cpp @@ -32,6 +32,8 @@ namespace android { enum { GET_DATA_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, + SET_VSYNC_RATE, + REQUEST_NEXT_VSYNC }; class BpDisplayEventConnection : public BpInterface<IDisplayEventConnection> @@ -49,6 +51,19 @@ public: remote()->transact(GET_DATA_CHANNEL, data, &reply); return new BitTube(reply); } + + virtual void setVsyncRate(uint32_t count) { + Parcel data, reply; + data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor()); + data.writeInt32(count); + remote()->transact(SET_VSYNC_RATE, data, &reply); + } + + virtual void requestNextVsync() { + Parcel data, reply; + data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor()); + remote()->transact(REQUEST_NEXT_VSYNC, data, &reply, IBinder::FLAG_ONEWAY); + } }; IMPLEMENT_META_INTERFACE(DisplayEventConnection, "android.gui.DisplayEventConnection"); @@ -65,6 +80,16 @@ status_t BnDisplayEventConnection::onTransact( channel->writeToParcel(reply); return NO_ERROR; } break; + case SET_VSYNC_RATE: { + CHECK_INTERFACE(IDisplayEventConnection, data, reply); + setVsyncRate(data.readInt32()); + return NO_ERROR; + } break; + case REQUEST_NEXT_VSYNC: { + CHECK_INTERFACE(IDisplayEventConnection, data, reply); + requestNextVsync(); + return NO_ERROR; + } break; } return BBinder::onTransact(code, data, reply, flags); } diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index 8d71dcf..4c70e9d 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -1735,6 +1735,9 @@ public class MediaPlayer /** * Called to indicate the video size * + * The video size (width and height) could be 0 if there was no video, + * no display surface was set, or the value was not determined yet. + * * @param mp the MediaPlayer associated with this callback * @param width the width of the video * @param height the height of the video diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 759d05a..964cb1f 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -2021,9 +2021,9 @@ status_t AwesomePlayer::finishSetDataSource_l() { mLock.unlock(); - // Initially make sure we have at least 128 bytes for the sniff + // Initially make sure we have at least 192 KB for the sniff // to complete without blocking. - static const size_t kMinBytesForSniffing = 128; + static const size_t kMinBytesForSniffing = 192 * 1024; off64_t metaDataSize = -1ll; for (;;) { diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEnvReverbTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEnvReverbTest.java index 3c8d05a..e788c17 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEnvReverbTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEnvReverbTest.java @@ -353,6 +353,8 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr AudioEffect vc = null; MediaPlayer mp = null; AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); + int ringerMode = am.getRingerMode(); + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); int volume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), @@ -411,6 +413,7 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr probe.release(); } am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); + am.setRingerMode(ringerMode); } assertTrue(msg, result); } @@ -425,6 +428,8 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr MediaPlayer mp = null; AudioEffect rvb = null; AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); + int ringerMode = am.getRingerMode(); + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); int volume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), @@ -495,6 +500,7 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr probe.release(); } am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); + am.setRingerMode(ringerMode); } assertTrue(msg, result); } diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaPresetReverbTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaPresetReverbTest.java index 757bbc5..bc9c48d 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaPresetReverbTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaPresetReverbTest.java @@ -198,6 +198,8 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi AudioEffect vc = null; MediaPlayer mp = null; AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); + int ringerMode = am.getRingerMode(); + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); int volume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), @@ -254,6 +256,7 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi probe.release(); } am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); + am.setRingerMode(ringerMode); } assertTrue(msg, result); } @@ -268,6 +271,8 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi MediaPlayer mp = null; AudioEffect rvb = null; AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); + int ringerMode = am.getRingerMode(); + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); int volume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), @@ -336,6 +341,7 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi probe.release(); } am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); + am.setRingerMode(ringerMode); } assertTrue(msg, result); } diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVisualizerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVisualizerTest.java index e0cf51d..b0bf654 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVisualizerTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVisualizerTest.java @@ -200,6 +200,8 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF AudioEffect vc = null; MediaPlayer mp = null; AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); + int ringerMode = am.getRingerMode(); + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); int volume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), @@ -264,6 +266,7 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF vc.release(); } am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); + am.setRingerMode(ringerMode); } assertTrue(msg, result); } @@ -276,6 +279,8 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF AudioEffect vc = null; MediaPlayer mp = null; AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); + int ringerMode = am.getRingerMode(); + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); int volume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), @@ -393,6 +398,7 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF vc.release(); } am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); + am.setRingerMode(ringerMode); } assertTrue(msg, result); } diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 1ebed1f..4ea2c31 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -115,6 +115,11 @@ 0x200000038=0x03000701:0x03010701:0x03020701; </string> + <!-- Default for Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION_URL --> + <string name="def_accessibility_screen_reader_url" translatable="false"> + https://ssl.gstatic.com/accessibility/javascript/android/AndroidScriptChooser.user.js + </string> + <!-- Default for Settings.Secure.TOUCH_EXPLORATION_ENABLED --> <bool name="def_touch_exploration_enabled">false</bool> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 1fbe08d..a6a3303 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -63,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion' // is properly propagated through your change. Not doing so will result in a loss of user // settings. - private static final int DATABASE_VERSION = 73; + private static final int DATABASE_VERSION = 74; private Context mContext; @@ -986,6 +986,22 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 73; } + if (upgradeVersion == 73) { + // URL from which WebView loads a JavaScript based screen-reader. + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT INTO secure(name,value) VALUES(?,?);"); + loadStringSetting(stmt, Settings.Secure.ACCESSIBILITY_SCREEN_READER_URL, + R.string.def_accessibility_screen_reader_url); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + upgradeVersion = 74; + } + // *** Remember to update DATABASE_VERSION above! if (upgradeVersion != currentVersion) { @@ -1526,6 +1542,9 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, R.bool.def_accessibility_speak_password); + + loadStringSetting(stmt, Settings.Secure.ACCESSIBILITY_SCREEN_READER_URL, + R.string.def_accessibility_screen_reader_url); } finally { if (stmt != null) stmt.close(); } diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_ticker_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_ticker_panel.xml index 6cd8899..d51f9c8 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_ticker_panel.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_ticker_panel.xml @@ -15,20 +15,29 @@ * limitations under the License. --> -<LinearLayout +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="horizontal" - android:gravity="bottom" > + <View + android:layout_height="@*android:dimen/status_bar_height" + android:layout_width="match_parent" + android:background="@drawable/status_bar_ticker_background" + android:layout_alignParentLeft="true" + android:layout_alignParentBottom="true" + android:clickable="false" + /> + <ImageView android:id="@+id/large_icon" android:layout_width="@android:dimen/notification_large_icon_height" android:layout_height="@android:dimen/notification_large_icon_width" android:scaleType="center" android:visibility="gone" + android:layout_alignParentLeft="true" + android:layout_alignParentBottom="true" /> <FrameLayout @@ -36,6 +45,8 @@ android:layout_weight="1" android:layout_height="@*android:dimen/status_bar_height" android:layout_width="match_parent" - android:background="@drawable/status_bar_ticker_background" + android:layout_toRightOf="@id/large_icon" + android:layout_alignParentBottom="true" + android:layout_alignWithParentIfMissing="true" /> -</LinearLayout> +</RelativeLayout> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 490191a..9919d82 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -522,6 +522,16 @@ public class TabletStatusBar extends StatusBar implements // don't wait for these transitions; we just want icons to fade in/out, not move around lt.setDuration(LayoutTransition.CHANGE_APPEARING, 0); lt.setDuration(LayoutTransition.CHANGE_DISAPPEARING, 0); + lt.addTransitionListener(new LayoutTransition.TransitionListener() { + public void endTransition(LayoutTransition transition, ViewGroup container, + View view, int transitionType) { + // ensure the menu button doesn't stick around on the status bar after it's been + // removed + mBarContents.invalidate(); + } + public void startTransition(LayoutTransition transition, ViewGroup container, + View view, int transitionType) {} + }); mNavigationArea.setLayoutTransition(lt); // no multi-touch on the nav buttons mNavigationArea.setMotionEventSplittingEnabled(false); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java index 6045e31..e93a32b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java @@ -73,6 +73,8 @@ public class TabletTicker private StatusBarNotification[] mQueue = new StatusBarNotification[QUEUE_LENGTH]; private int mQueuePos; + private final int mLargeIconHeight; + private TabletStatusBar mBar; private LayoutTransition mLayoutTransition; @@ -81,6 +83,9 @@ public class TabletTicker public TabletTicker(TabletStatusBar bar) { mBar = bar; mContext = bar.getContext(); + final Resources res = mContext.getResources(); + mLargeIconHeight = res.getDimensionPixelSize( + android.R.dimen.notification_large_icon_height); } public void add(IBinder key, StatusBarNotification notification) { @@ -209,8 +214,6 @@ public class TabletTicker final Resources res = mContext.getResources(); final FrameLayout view = new FrameLayout(mContext); final int width = res.getDimensionPixelSize(R.dimen.notification_ticker_width); - final int height = res.getDimensionPixelSize( - android.R.dimen.notification_large_icon_height); int windowFlags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; @@ -219,7 +222,7 @@ public class TabletTicker } else { windowFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; } - WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height, + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, mLargeIconHeight, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, windowFlags, PixelFormat.TRANSLUCENT); lp.gravity = Gravity.BOTTOM | Gravity.RIGHT; @@ -297,6 +300,16 @@ public class TabletTicker if (n.largeIcon != null) { largeIcon.setImageBitmap(n.largeIcon); largeIcon.setVisibility(View.VISIBLE); + final ViewGroup.LayoutParams lp = largeIcon.getLayoutParams(); + final int statusBarHeight = mBar.getStatusBarHeight(); + if (n.largeIcon.getHeight() <= statusBarHeight) { + // for smallish largeIcons, it looks a little odd to have them floating halfway up + // the ticker, so we vertically center them in the status bar area instead + lp.height = statusBarHeight; + } else { + lp.height = mLargeIconHeight; + } + largeIcon.setLayoutParams(lp); } if (CLICKABLE_TICKER) { diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index 0e2d2a8..38c85bb 100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java @@ -195,6 +195,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac .setInverseBackgroundForced(true); final AlertDialog dialog = ab.create(); + dialog.getListView().setItemsCanFocus(true); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); dialog.setOnDismissListener(this); @@ -518,8 +519,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { View v = inflater.inflate(R.layout.global_actions_silent_mode, parent, false); - // Handle clicks outside the icons and ignore - v.setOnClickListener(this); int selectedIndex = ringerModeToIndex(mAudioManager.getRingerMode()); for (int i = 0; i < 3; i++) { diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index dfb1b07..92260d6 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -3213,10 +3213,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } final int preferredRotation; - if (mHdmiPlugged) { - // Ignore sensor when plugged into HDMI. - preferredRotation = mHdmiRotation; - } else if (mLidOpen == LID_OPEN && mLidOpenRotation >= 0) { + if (mLidOpen == LID_OPEN && mLidOpenRotation >= 0) { // Ignore sensor when lid switch is open and rotation is forced. preferredRotation = mLidOpenRotation; } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR @@ -3235,6 +3232,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { // enable 180 degree rotation while docked. preferredRotation = mDeskDockEnablesAccelerometer ? sensorRotation : mDeskDockRotation; + } else if (mHdmiPlugged) { + // Ignore sensor when plugged into HDMI. + // Note that the dock orientation overrides the HDMI orientation. + preferredRotation = mHdmiRotation; } else if ((mAccelerometerDefault != 0 /* implies not rotation locked */ && (orientation == ActivityInfo.SCREEN_ORIENTATION_USER || orientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) @@ -3477,6 +3478,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManager.LayoutParams.FLAG_DIM_BEHIND | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); mBootMsgDialog.getWindow().setDimAmount(1); + WindowManager.LayoutParams lp = mBootMsgDialog.getWindow().getAttributes(); + lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR; + mBootMsgDialog.getWindow().setAttributes(lp); mBootMsgDialog.setCancelable(false); mBootMsgDialog.show(); } diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index 2af5103..4f81178 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -24,9 +24,9 @@ import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.Intent.FilterComparison; import android.content.IntentFilter; import android.content.ServiceConnection; -import android.content.Intent.FilterComparison; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; @@ -39,6 +39,8 @@ import android.content.res.XmlResourceParser; import android.net.Uri; import android.os.Binder; import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; @@ -74,6 +76,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.Set; class AppWidgetService extends IAppWidgetService.Stub { @@ -805,6 +808,45 @@ class AppWidgetService extends IAppWidgetService.Stub id.host.callbacks = null; } } + + // If the host is unavailable, then we call the associated + // RemoteViewsFactory.onDataSetChanged() directly + if (id.host.callbacks == null) { + Set<FilterComparison> keys = mRemoteViewsServicesAppWidgets.keySet(); + for (FilterComparison key : keys) { + if (mRemoteViewsServicesAppWidgets.get(key).contains(id.appWidgetId)) { + Intent intent = key.getIntent(); + + final ServiceConnection conn = new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + IRemoteViewsFactory cb = + IRemoteViewsFactory.Stub.asInterface(service); + try { + cb.onDataSetChangedAsync(); + } catch (RemoteException e) { + e.printStackTrace(); + } catch (RuntimeException e) { + e.printStackTrace(); + } + mContext.unbindService(this); + } + @Override + public void onServiceDisconnected(android.content.ComponentName name) { + // Do nothing + } + }; + + // Bind to the service and call onDataSetChanged() + final long token = Binder.clearCallingIdentity(); + try { + mContext.bindService(intent, conn, Context.BIND_AUTO_CREATE); + } finally { + Binder.restoreCallingIdentity(token); + } + } + } + } } } diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 3c65255..16643ff 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -1078,7 +1078,6 @@ public class WifiService extends IWifiManager.Stub { mWifiStateMachine.setHighPerfModeEnabled(strongestLockMode == WifiManager.WIFI_MODE_FULL_HIGH_PERF); } else { - mWifiStateMachine.requestCmWakeLock(); mWifiStateMachine.setDriverStart(false); } } else { diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index b5edc0a..6c11953 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -1932,8 +1932,9 @@ final class ActivityStack { // should be left as-is. replyChainEnd = -1; } - - } else if (target.resultTo != null) { + + } else if (target.resultTo != null && (below == null + || below.task == target.task)) { // If this activity is sending a reply to a previous // activity, we can't do anything with it now until // we reach the start of the reply chain. @@ -1963,6 +1964,8 @@ final class ActivityStack { replyChainEnd = targetI; } ActivityRecord p = null; + if (DEBUG_TASKS) Slog.v(TAG, "Finishing task at index " + + targetI + " to " + replyChainEnd); for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) { p = mHistory.get(srcPos); if (p.finishing) { @@ -1981,6 +1984,8 @@ final class ActivityStack { if (replyChainEnd < 0) { replyChainEnd = targetI; } + if (DEBUG_TASKS) Slog.v(TAG, "Reparenting task at index " + + targetI + " to " + replyChainEnd); for (int srcPos=replyChainEnd; srcPos>=targetI; srcPos--) { ActivityRecord p = mHistory.get(srcPos); if (p.finishing) { @@ -2002,6 +2007,7 @@ final class ActivityStack { p.setTask(task, null, false); mHistory.add(lastReparentPos, p); if (DEBUG_TASKS) Slog.v(TAG, "Pulling activity " + p + + " from " + srcPos + " to " + lastReparentPos + " in to resetting task " + task); mService.mWindowManager.moveAppToken(lastReparentPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, p.task.taskId); @@ -2031,6 +2037,11 @@ final class ActivityStack { } } } + + } else if (below != null && below.task != target.task) { + // We hit the botton of a task; the reply chain can't + // pass through it. + replyChainEnd = -1; } target = below; diff --git a/services/surfaceflinger/DisplayEventConnection.cpp b/services/surfaceflinger/DisplayEventConnection.cpp index a0aa9c0..77ecbd2 100644 --- a/services/surfaceflinger/DisplayEventConnection.cpp +++ b/services/surfaceflinger/DisplayEventConnection.cpp @@ -25,6 +25,7 @@ #include "SurfaceFlinger.h" #include "DisplayEventConnection.h" +#include "EventThread.h" // --------------------------------------------------------------------------- @@ -33,30 +34,38 @@ namespace android { // --------------------------------------------------------------------------- DisplayEventConnection::DisplayEventConnection( - const sp<SurfaceFlinger>& flinger) - : mFlinger(flinger), mChannel(new BitTube()) + const sp<EventThread>& eventThread) + : mEventThread(eventThread), mChannel(new BitTube()) { } DisplayEventConnection::~DisplayEventConnection() { - mFlinger->cleanupDisplayEventConnection(this); + mEventThread->unregisterDisplayEventConnection(this); } void DisplayEventConnection::onFirstRef() { - // nothing to do here for now. + // NOTE: mEventThread doesn't hold a strong reference on us + mEventThread->registerDisplayEventConnection(this); } sp<BitTube> DisplayEventConnection::getDataChannel() const { return mChannel; } +void DisplayEventConnection::setVsyncRate(uint32_t count) { + mEventThread->setVsyncRate(count, this); +} + +void DisplayEventConnection::requestNextVsync() { + mEventThread->requestNextVsync(this); +} + status_t DisplayEventConnection::postEvent(const DisplayEventReceiver::Event& event) { ssize_t size = mChannel->write(&event, sizeof(DisplayEventReceiver::Event)); return size < 0 ? status_t(size) : status_t(NO_ERROR); } - // --------------------------------------------------------------------------- }; // namespace android diff --git a/services/surfaceflinger/DisplayEventConnection.h b/services/surfaceflinger/DisplayEventConnection.h index 46cf64b..cc3ee36 100644 --- a/services/surfaceflinger/DisplayEventConnection.h +++ b/services/surfaceflinger/DisplayEventConnection.h @@ -32,13 +32,13 @@ namespace android { // --------------------------------------------------------------------------- class BitTube; -class SurfaceFlinger; +class EventThread; // --------------------------------------------------------------------------- class DisplayEventConnection : public BnDisplayEventConnection { public: - DisplayEventConnection(const sp<SurfaceFlinger>& flinger); + DisplayEventConnection(const sp<EventThread>& flinger); status_t postEvent(const DisplayEventReceiver::Event& event); @@ -46,8 +46,10 @@ private: virtual ~DisplayEventConnection(); virtual void onFirstRef(); virtual sp<BitTube> getDataChannel() const; + virtual void setVsyncRate(uint32_t count); + virtual void requestNextVsync(); // asynchronous - sp<SurfaceFlinger> const mFlinger; + sp<EventThread> const mEventThread; sp<BitTube> const mChannel; }; diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index 42477a9..dc39f88 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -47,7 +47,8 @@ void EventThread::onFirstRef() { status_t EventThread::registerDisplayEventConnection( const sp<DisplayEventConnection>& connection) { Mutex::Autolock _l(mLock); - mDisplayEventConnections.add(connection); + ConnectionInfo info; + mDisplayEventConnections.add(connection, info); mCondition.signal(); return NO_ERROR; } @@ -55,44 +56,97 @@ status_t EventThread::registerDisplayEventConnection( status_t EventThread::unregisterDisplayEventConnection( const wp<DisplayEventConnection>& connection) { Mutex::Autolock _l(mLock); - mDisplayEventConnections.remove(connection); + mDisplayEventConnections.removeItem(connection); mCondition.signal(); return NO_ERROR; } -status_t EventThread::removeDisplayEventConnection( +void EventThread::removeDisplayEventConnection( const wp<DisplayEventConnection>& connection) { Mutex::Autolock _l(mLock); - mDisplayEventConnections.remove(connection); - return NO_ERROR; + mDisplayEventConnections.removeItem(connection); +} + +EventThread::ConnectionInfo* EventThread::getConnectionInfoLocked( + const wp<DisplayEventConnection>& connection) { + ssize_t index = mDisplayEventConnections.indexOfKey(connection); + if (index < 0) return NULL; + return &mDisplayEventConnections.editValueAt(index); +} + +void EventThread::setVsyncRate(uint32_t count, + const wp<DisplayEventConnection>& connection) { + if (int32_t(count) >= 0) { // server must protect against bad params + Mutex::Autolock _l(mLock); + ConnectionInfo* info = getConnectionInfoLocked(connection); + if (info) { + info->count = (count == 0) ? -1 : count; + mCondition.signal(); + } + } +} + +void EventThread::requestNextVsync( + const wp<DisplayEventConnection>& connection) { + Mutex::Autolock _l(mLock); + ConnectionInfo* info = getConnectionInfoLocked(connection); + if (info) { + if (info->count < 0) { + info->count = 0; + } + mCondition.signal(); + } } bool EventThread::threadLoop() { nsecs_t timestamp; DisplayEventReceiver::Event vsync; - SortedVector<wp<DisplayEventConnection> > displayEventConnections; + KeyedVector< wp<DisplayEventConnection>, ConnectionInfo > displayEventConnections; { // scope for the lock Mutex::Autolock _l(mLock); do { // wait for listeners - while (!mDisplayEventConnections.size()) { + do { + bool waitForNextVsync = false; + size_t count = mDisplayEventConnections.size(); + for (size_t i=0 ; i<count ; i++) { + const ConnectionInfo& info( + mDisplayEventConnections.valueAt(i)); + if (info.count >= 1) { + // continuous mode + waitForNextVsync = true; + } else { + // one-shot event + if (info.count >= -1) { + ConnectionInfo& info( + mDisplayEventConnections.editValueAt(i)); + info.count--; + if (info.count == -1) { + // fired this time around + waitForNextVsync = true; + } + } + } + } + + if (waitForNextVsync) + break; + mCondition.wait(mLock); - } + } while(true); // wait for vsync mLock.unlock(); timestamp = mHw.waitForVSync(); mLock.lock(); + mDeliveredEvents++; // make sure we still have some listeners } while (!mDisplayEventConnections.size()); - // dispatch vsync events to listeners... - mDeliveredEvents++; - vsync.header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; vsync.header.timestamp = timestamp; vsync.vsync.count = mDeliveredEvents; @@ -104,9 +158,30 @@ bool EventThread::threadLoop() { const size_t count = displayEventConnections.size(); for (size_t i=0 ; i<count ; i++) { - sp<DisplayEventConnection> conn(displayEventConnections.itemAt(i).promote()); + sp<DisplayEventConnection> conn(displayEventConnections.keyAt(i).promote()); // make sure the connection didn't die if (conn != NULL) { + + const ConnectionInfo& info( + displayEventConnections.valueAt(i)); + + if ((info.count > 1) && (mDeliveredEvents % info.count)) { + // continuous event, but not time to send this event yet + continue; + } else if (info.count < -1) { + // disabled event + continue; + } else if (info.count == 0) { + // impossible by construction. but we prefer to be safe. + continue; + } + + // here, either: + // count = -1 : one-shot scheduled this time around + // count = 1 : continuous not rate-limited + // count > 1 : continuous, rate-limited + // Note: count == 0 is not possible by construction + status_t err = conn->postEvent(vsync); if (err == -EAGAIN || err == -EWOULDBLOCK) { // The destination doesn't accept events anymore, it's probably @@ -118,12 +193,12 @@ bool EventThread::threadLoop() { // handle any other error on the pipe as fatal. the only // reasonable thing to do is to clean-up this connection. // The most common error we'll get here is -EPIPE. - removeDisplayEventConnection(displayEventConnections.itemAt(i)); + removeDisplayEventConnection(displayEventConnections.keyAt(i)); } } else { // somehow the connection is dead, but we still have it in our list // just clean the list. - removeDisplayEventConnection(displayEventConnections.itemAt(i)); + removeDisplayEventConnection(displayEventConnections.keyAt(i)); } } diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h index 4872c2b..35bd299 100644 --- a/services/surfaceflinger/EventThread.h +++ b/services/surfaceflinger/EventThread.h @@ -24,7 +24,7 @@ #include <utils/Errors.h> #include <utils/threads.h> -#include <utils/SortedVector.h> +#include <utils/KeyedVector.h> #include "DisplayEventConnection.h" @@ -51,6 +51,11 @@ public: status_t unregisterDisplayEventConnection( const wp<DisplayEventConnection>& connection); + void setVsyncRate(uint32_t count, + const wp<DisplayEventConnection>& connection); + + void requestNextVsync(const wp<DisplayEventConnection>& connection); + void dump(String8& result, char* buffer, size_t SIZE) const; private: @@ -58,7 +63,20 @@ private: virtual status_t readyToRun(); virtual void onFirstRef(); - status_t removeDisplayEventConnection( + struct ConnectionInfo { + ConnectionInfo() : count(-1) { } + + // count >= 1 : continuous event. count is the vsync rate + // count == 0 : one-shot event that has not fired + // count ==-1 : one-shot event that fired this round / disabled + // count ==-2 : one-shot event that fired the round before + int32_t count; + }; + + void removeDisplayEventConnection( + const wp<DisplayEventConnection>& connection); + + ConnectionInfo* getConnectionInfoLocked( const wp<DisplayEventConnection>& connection); // constants @@ -69,7 +87,9 @@ private: mutable Condition mCondition; // protected by mLock - SortedVector<wp<DisplayEventConnection> > mDisplayEventConnections; + KeyedVector< wp<DisplayEventConnection>, ConnectionInfo > mDisplayEventConnections; + + // main thread only size_t mDeliveredEvents; }; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 58196d8..014c7e2 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -389,16 +389,10 @@ bool SurfaceFlinger::authenticateSurfaceTexture( // ---------------------------------------------------------------------------- sp<IDisplayEventConnection> SurfaceFlinger::createDisplayEventConnection() { - sp<DisplayEventConnection> result(new DisplayEventConnection(this)); - mEventThread->registerDisplayEventConnection(result); + sp<DisplayEventConnection> result(new DisplayEventConnection(mEventThread)); return result; } -void SurfaceFlinger::cleanupDisplayEventConnection( - const wp<DisplayEventConnection>& connection) { - mEventThread->unregisterDisplayEventConnection(connection); -} - // ---------------------------------------------------------------------------- #if 0 #pragma mark - diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index e6d2cd9..41caee3 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -335,9 +335,6 @@ private: status_t electronBeamOffAnimationImplLocked(); status_t electronBeamOnAnimationImplLocked(); - void cleanupDisplayEventConnection( - const wp<DisplayEventConnection>& connection); - void debugFlashRegions(); void debugShowFPS() const; void drawWormhole() const; diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index f111dd6..07b6183 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -683,6 +683,13 @@ public abstract class BaseCommands implements CommandsInterface { mRilConnectedRegistrants.remove(h); } + /** + * {@inheritDoc} + */ + @Override + public void setCurrentPreferredNetworkType() { + } + //***** Protected Methods /** * Store new RadioState and send notification based on the changes diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index 33ead75..d6e6ae0 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -1311,6 +1311,12 @@ public interface CommandsInterface { void queryAvailableBandMode (Message response); /** + * Set the current preferred network type. This will be the last + * networkType that was passed to setPreferredNetworkType. + */ + void setCurrentPreferredNetworkType(); + + /** * Requests to set the preferred network type for searching and registering * (CS/PS domain, RAT, and operation mode) * @param networkType one of NT_*_TYPE diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 9f93fb8..f2e7f45 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -1823,6 +1823,16 @@ public final class RIL extends BaseCommands implements CommandsInterface { /** * {@inheritDoc} */ + @Override + public void setCurrentPreferredNetworkType() { + if (RILJ_LOGD) riljLog("setCurrentPreferredNetworkType: " + mSetPreferredNetworkType); + setPreferredNetworkType(mSetPreferredNetworkType, null); + } + private int mSetPreferredNetworkType; + + /** + * {@inheritDoc} + */ public void setPreferredNetworkType(int networkType , Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, response); @@ -1830,6 +1840,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { rr.mp.writeInt(1); rr.mp.writeInt(networkType); + mSetPreferredNetworkType = networkType; mPreferredNetworkType = networkType; if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index 3d6cd68..d939e98 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -257,6 +257,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { break; case EVENT_RUIM_READY: + // TODO: Consider calling setCurrentPreferredNetworkType as we do in GsmSST. + // cm.setCurrentPreferredNetworkType(); + // The RUIM is now ready i.e if it was locked it has been // unlocked. At this stage, the radio is already powered on. isSubscriptionFromRuim = true; @@ -277,6 +280,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { break; case EVENT_NV_READY: + // TODO: Consider calling setCurrentPreferredNetworkType as we do in GsmSST. + // cm.setCurrentPreferredNetworkType(); + isSubscriptionFromRuim = false; // For Non-RUIM phones, the subscription information is stored in // Non Volatile. Here when Non-Volatile is ready, we can poll the CDMA diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 11f1623..963db2c 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -914,10 +914,16 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.NUMERIC)), cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.NAME)), cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.APN)), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROXY)), + NetworkUtils.trimV4AddrZeros( + cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.PROXY))), cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PORT)), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSC)), - cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSPROXY)), + NetworkUtils.trimV4AddrZeros( + cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSC))), + NetworkUtils.trimV4AddrZeros( + cursor.getString( + cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSPROXY))), cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.MMSPORT)), cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.USER)), cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PASSWORD)), diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java index 3799894..16d3129 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java @@ -132,7 +132,7 @@ public final class GsmMmiCode extends Handler implements MmiCode { // See TS 22.030 6.5.2 "Structure of the MMI" static Pattern sPatternSuppService = Pattern.compile( - "((\\*|#|\\*#|\\*\\*|##)(\\d{2,3})(\\*([^*#]*)(\\*([^*#]*)(\\*([^*#]*)(\\*([^*#]*))?)?)?)?#)(.*)"); + "((\\*|#|\\*#|\\*\\*|##)(\\d{2,3})(\\*([^*#]*)(\\*([^*#]*)(\\*([^*#]*)(\\*([^*#]*))?)?)?)?#)([^#]*)"); /* 1 2 3 4 5 6 7 8 9 10 11 12 1 = Full string up to and including # @@ -141,7 +141,7 @@ public final class GsmMmiCode extends Handler implements MmiCode { 5 = SIA 7 = SIB 9 = SIC - 10 = dialing number + 10 = dialing number which must not include #, e.g. *SCn*SI#DN format */ static final int MATCH_GROUP_POUND_STRING = 1; @@ -1338,4 +1338,20 @@ public final class GsmMmiCode extends Handler implements MmiCode { * SpecialCharSequenceMgr class. */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder("GsmMmiCode {"); + + sb.append("State=" + getState()); + if (action != null) sb.append(" action=" + action); + if (sc != null) sb.append(" sc=" + sc); + if (sia != null) sb.append(" sia=" + sia); + if (sib != null) sb.append(" sib=" + sib); + if (sic != null) sb.append(" sic=" + sic); + if (poundString != null) sb.append(" poundString=" + poundString); + if (dialingNumber != null) sb.append(" dialingNumber=" + dialingNumber); + if (pwd != null) sb.append(" pwd=" + pwd); + sb.append("}"); + return sb.toString(); + } } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index eea2780..84127cf 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -270,6 +270,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker { break; case EVENT_SIM_READY: + // Set the network type, in case the radio does not restore it. + cm.setCurrentPreferredNetworkType(); + // The SIM is now ready i.e if it was locked // it has been unlocked. At this stage, the radio is already // powered on. diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java index 06b4af7..ba70c71 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java @@ -62,6 +62,9 @@ public class FillTest implements RsBenchBaseTest{ mTests[index].testName = Allocation.createFromString(mRS, mNames[index], Allocation.USAGE_SCRIPT); + mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS, + mNames[index], + Allocation.USAGE_SCRIPT); ScriptField_FillTestData_s.Item dataItem = new ScriptField_FillTestData_s.Item(); dataItem.testId = testId; diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/MeshTest.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/MeshTest.java index f39e7db..cdb4435 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/MeshTest.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/MeshTest.java @@ -69,6 +69,9 @@ public class MeshTest implements RsBenchBaseTest{ mTests[index].testName = Allocation.createFromString(mRS, mNames[index], Allocation.USAGE_SCRIPT); + mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS, + mNames[index], + Allocation.USAGE_SCRIPT); ScriptField_MeshTestData_s.Item dataItem = new ScriptField_MeshTestData_s.Item(); dataItem.meshNum = meshNum; diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java index c51bd82..8c67026 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java @@ -60,7 +60,6 @@ public class RsBenchRS { mWidth = width; mHeight = height; mMode = 0; - mMaxModes = 0; mLoops = loops; mCurrentLoop = 0; mBenchmarkDimX = 1280; @@ -88,11 +87,30 @@ public class RsBenchRS { ScriptField_TestScripts_s.Item[] mIndividualTests; int mMode; - int mMaxModes; String[] mTestNames; float[] mLocalTestResults; + static Allocation createZeroTerminatedAlloc(RenderScript rs, + String str, + int usage) { + byte[] allocArray = null; + try { + allocArray = str.getBytes("UTF-8"); + byte[] allocArrayZero = new byte[allocArray.length + 1]; + System.arraycopy(allocArray, 0, allocArrayZero, 0, allocArray.length); + allocArrayZero[allocArrayZero.length - 1] = '\0'; + Allocation alloc = Allocation.createSized(rs, Element.U8(rs), + allocArrayZero.length, usage); + alloc.copyFrom(allocArrayZero); + return alloc; + } + catch (Exception e) { + throw new RSRuntimeException("Could not convert string to utf-8."); + } + + } + void appendTests(RsBenchBaseTest testSet) { ScriptField_TestScripts_s.Item[] newTests = testSet.getTests(); if (mIndividualTests != null) { @@ -119,6 +137,7 @@ public class RsBenchRS { void createTestAllocation() { int numTests = mIndividualTests.length; + mLocalTestResults = new float[numTests]; ScriptField_TestScripts_s allTests; allTests = new ScriptField_TestScripts_s(mRS, numTests); for (int i = 0; i < numTests; i ++) { @@ -239,11 +258,6 @@ public class RsBenchRS { return count; } - private void prepareTestData() { - mTestNames = new String[mMaxModes]; - mLocalTestResults = new float[mMaxModes]; - } - public void setDebugMode(int num) { mScript.invoke_setDebugMode(num); } @@ -261,8 +275,6 @@ public class RsBenchRS { mScript.set_gMaxLoops(mLoops); - prepareTestData(); - initProgramVertex(); initProgramFragment(); mScript.set_gFontSerif(Font.create(mRS, mRes, "serif", Font.Style.NORMAL, 8)); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TextTest.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TextTest.java index ca9e660..3ca2792 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TextTest.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TextTest.java @@ -48,6 +48,9 @@ public class TextTest implements RsBenchBaseTest{ mTests[index].testName = Allocation.createFromString(mRS, mNames[index], Allocation.USAGE_SCRIPT); + mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS, + mNames[index], + Allocation.USAGE_SCRIPT); ScriptField_TextTestData_s.Item dataItem = new ScriptField_TextTestData_s.Item(); dataItem.fillNum = fillNum; diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TorusTest.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TorusTest.java index d785dc1..5c9ecd5 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TorusTest.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/TorusTest.java @@ -98,6 +98,9 @@ public class TorusTest implements RsBenchBaseTest{ mTests[index].testName = Allocation.createFromString(mRS, mNames[index], Allocation.USAGE_SCRIPT); + mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS, + mNames[index], + Allocation.USAGE_SCRIPT); ScriptField_TorusTestData_s.Item dataItem = new ScriptField_TorusTestData_s.Item(); dataItem.testId = testId; diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/UiTest.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/UiTest.java index cca237e..c8b58b2 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/UiTest.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/UiTest.java @@ -82,6 +82,9 @@ public class UiTest implements RsBenchBaseTest{ mTests[index].testName = Allocation.createFromString(mRS, mNames[index], Allocation.USAGE_SCRIPT); + mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS, + mNames[index], + Allocation.USAGE_SCRIPT); ScriptField_UiTestData_s.Item dataItem = new ScriptField_UiTestData_s.Item(); dataItem.testId = testId; diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs index 2b849a2..cb15449 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs @@ -45,6 +45,7 @@ VertexShaderInputs *gVSInputs; typedef struct TestScripts_s { rs_allocation testData; rs_allocation testName; + rs_allocation debugName; rs_script testScript; } TestScripts; TestScripts *gTestScripts; @@ -195,7 +196,8 @@ static void benchmark() { int64_t end = rsUptimeMillis(); float fps = (float)(frameCount) / ((float)(end - start)*0.001f); - rsDebug("Finishes test ", fps); + const char *testName = rsGetElementAt(gTestScripts[benchMode].debugName, 0); + rsDebug(testName, fps); gResultBuffer[benchMode] = fps; int bufferW = rsAllocationGetDimX(gRenderBufferColor); diff --git a/tests/StatusBar/res/layout/notification_builder_test.xml b/tests/StatusBar/res/layout/notification_builder_test.xml index e1199c7..6c384f7 100644 --- a/tests/StatusBar/res/layout/notification_builder_test.xml +++ b/tests/StatusBar/res/layout/notification_builder_test.xml @@ -605,6 +605,11 @@ style="@style/FieldContents" android:text="pineapple2" /> + <RadioButton + android:id="@+id/large_icon_small" + style="@style/FieldContents" + android:text="small" + /> </RadioGroup> diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java index 5a2ebac..fefd890 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java @@ -287,6 +287,9 @@ public class NotificationBuilderTest extends Activity case R.id.large_icon_pineapple2: b.setLargeIcon(loadBitmap(R.drawable.pineapple2)); break; + case R.id.large_icon_small: + b.setLargeIcon(loadBitmap(R.drawable.icon2)); + break; } // sound TODO diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 253e0ec..ae8f466 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -306,8 +306,6 @@ public class WifiStateMachine extends StateMachine { static final int CMD_SET_HIGH_PERF_MODE = BASE + 77; /* Set the country code */ static final int CMD_SET_COUNTRY_CODE = BASE + 80; - /* Request connectivity manager wake lock before driver stop */ - static final int CMD_REQUEST_CM_WAKELOCK = BASE + 81; /* Enables RSSI poll */ static final int CMD_ENABLE_RSSI_POLL = BASE + 82; /* RSSI poll */ @@ -1061,15 +1059,6 @@ public class WifiStateMachine extends StateMachine { return result; } - /** - * Request a wakelock with connectivity service to - * keep the device awake until we hand-off from wifi - * to an alternate network - */ - public void requestCmWakeLock() { - sendMessage(CMD_REQUEST_CM_WAKELOCK); - } - public void updateBatteryWorkSource(WorkSource newSource) { synchronized (mRunningWifiUids) { try { @@ -1867,7 +1856,6 @@ public class WifiStateMachine extends StateMachine { case CMD_SET_HIGH_PERF_MODE: case CMD_SET_COUNTRY_CODE: case CMD_SET_FREQUENCY_BAND: - case CMD_REQUEST_CM_WAKELOCK: case CMD_CONNECT_NETWORK: case CMD_SAVE_NETWORK: case CMD_FORGET_NETWORK: @@ -3024,10 +3012,6 @@ public class WifiStateMachine extends StateMachine { WifiNative.disconnectCommand(); transitionTo(mDisconnectingState); break; - case CMD_REQUEST_CM_WAKELOCK: - checkAndSetConnectivityInstance(); - mCm.requestNetworkTransitionWakelock(TAG); - break; case CMD_SET_SCAN_MODE: if (message.arg1 == SCAN_ONLY_MODE) { sendMessage(CMD_DISCONNECT); @@ -3100,6 +3084,11 @@ public class WifiStateMachine extends StateMachine { } @Override public void exit() { + + /* Request a CS wakelock during transition to mobile */ + checkAndSetConnectivityInstance(); + mCm.requestNetworkTransitionWakelock(TAG); + /* If a scan result is pending in connected state, the supplicant * is in SCAN_ONLY_MODE. Restore CONNECT_MODE on exit */ |
