Merge change I250f2433 into eclair-mr2
* changes:
Initial checkin of stagefright MP3 audio decoder based on PV source code.
diff --git a/api/current.xml b/api/current.xml
index 8b20412..41714ef 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -85562,6 +85562,142 @@
>
</method>
</class>
+<class name="SslError"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="SslError"
+ type="android.net.http.SslError"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="error" type="int">
+</parameter>
+<parameter name="certificate" type="android.net.http.SslCertificate">
+</parameter>
+</constructor>
+<constructor name="SslError"
+ type="android.net.http.SslError"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="error" type="int">
+</parameter>
+<parameter name="certificate" type="java.security.cert.X509Certificate">
+</parameter>
+</constructor>
+<method name="addError"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="error" type="int">
+</parameter>
+</method>
+<method name="getCertificate"
+ return="android.net.http.SslCertificate"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getPrimaryError"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="hasError"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="error" type="int">
+</parameter>
+</method>
+<field name="SSL_EXPIRED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SSL_IDMISMATCH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SSL_MAX_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SSL_NOTYETVALID"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SSL_UNTRUSTED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
</package>
<package name="android.net.wifi"
>
@@ -180048,6 +180184,23 @@
<parameter name="realm" type="java.lang.String">
</parameter>
</method>
+<method name="onReceivedSslError"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.webkit.WebView">
+</parameter>
+<parameter name="handler" type="android.webkit.SslErrorHandler">
+</parameter>
+<parameter name="error" type="android.net.http.SslError">
+</parameter>
+</method>
<method name="onScaleChanged"
return="void"
abstract="false"
diff --git a/core/java/android/net/http/SslError.java b/core/java/android/net/http/SslError.java
index 2788cb1..e1b9deb 100644
--- a/core/java/android/net/http/SslError.java
+++ b/core/java/android/net/http/SslError.java
@@ -20,8 +20,6 @@
/**
* One or more individual SSL errors and the associated SSL certificate
- *
- * {@hide}
*/
public class SslError {
diff --git a/core/java/android/webkit/FileLoader.java b/core/java/android/webkit/FileLoader.java
index 085f1f4..974ccbf 100644
--- a/core/java/android/webkit/FileLoader.java
+++ b/core/java/android/webkit/FileLoader.java
@@ -23,9 +23,12 @@
import android.net.http.EventHandler;
import android.net.http.Headers;
import android.os.Environment;
+import android.util.Log;
+import android.util.TypedValue;
import java.io.File;
import java.io.FileInputStream;
+import java.lang.reflect.Field;
/**
* This class is a concrete implementation of StreamLoader that uses a
@@ -35,10 +38,19 @@
class FileLoader extends StreamLoader {
private String mPath; // Full path to the file to load
- private Context mContext; // Application context, used for asset loads
- private boolean mIsAsset; // Indicates if the load is an asset or not
+ private Context mContext; // Application context, used for asset/res loads
+ private int mType; // Indicates the type of the load
private boolean mAllowFileAccess; // Allow/block file system access
+ // used for files under asset directory
+ static final int TYPE_ASSET = 1;
+ // used for files under res directory
+ static final int TYPE_RES = 2;
+ // generic file
+ static final int TYPE_FILE = 3;
+
+ private static final String LOGTAG = "webkit";
+
/**
* Construct a FileLoader with the file URL specified as the content
* source.
@@ -51,19 +63,24 @@
* on the file system.
*/
FileLoader(String url, LoadListener loadListener, Context context,
- boolean asset, boolean allowFileAccess) {
+ int type, boolean allowFileAccess) {
super(loadListener);
- mIsAsset = asset;
+ mType = type;
mContext = context;
mAllowFileAccess = allowFileAccess;
// clean the Url
int index = url.indexOf('?');
- if (mIsAsset) {
+ if (mType == TYPE_ASSET) {
mPath = index > 0 ? URLUtil.stripAnchor(
url.substring(URLUtil.ASSET_BASE.length(), index)) :
URLUtil.stripAnchor(url.substring(
URLUtil.ASSET_BASE.length()));
+ } else if (mType == TYPE_RES) {
+ mPath = index > 0 ? URLUtil.stripAnchor(
+ url.substring(URLUtil.RESOURCE_BASE.length(), index)) :
+ URLUtil.stripAnchor(url.substring(
+ URLUtil.RESOURCE_BASE.length()));
} else {
mPath = index > 0 ? URLUtil.stripAnchor(
url.substring(URLUtil.FILE_BASE.length(), index)) :
@@ -84,13 +101,69 @@
@Override
protected boolean setupStreamAndSendStatus() {
try {
- if (mIsAsset) {
+ if (mType == TYPE_ASSET) {
try {
mDataStream = mContext.getAssets().open(mPath);
} catch (java.io.FileNotFoundException ex) {
// try the rest files included in the package
mDataStream = mContext.getAssets().openNonAsset(mPath);
}
+ } else if (mType == TYPE_RES) {
+ // get the resource id from the path. e.g. for the path like
+ // drawable/foo.png, the id is located at field "foo" of class
+ // "<package>.R$drawable"
+ if (mPath == null || mPath.length() == 0) {
+ Log.e(LOGTAG, "Need a path to resolve the res file");
+ mHandler.error(EventHandler.FILE_ERROR, mContext
+ .getString(R.string.httpErrorFileNotFound));
+ return false;
+
+ }
+ int slash = mPath.indexOf('/');
+ int dot = mPath.indexOf('.', slash);
+ if (slash == -1 || dot == -1) {
+ Log.e(LOGTAG, "Incorrect res path: " + mPath);
+ mHandler.error(EventHandler.FILE_ERROR, mContext
+ .getString(R.string.httpErrorFileNotFound));
+ return false;
+ }
+ String subClassName = mPath.substring(0, slash);
+ String fieldName = mPath.substring(slash + 1, dot);
+ String errorMsg = null;
+ try {
+ final Class<?> d = mContext.getApplicationContext()
+ .getClassLoader().loadClass(
+ mContext.getPackageName() + ".R$"
+ + subClassName);
+ final Field field = d.getField(fieldName);
+ final int id = field.getInt(null);
+ TypedValue value = new TypedValue();
+ mContext.getResources().getValue(id, value, true);
+ if (value.type == TypedValue.TYPE_STRING) {
+ mDataStream = mContext.getAssets().openNonAsset(
+ value.assetCookie, value.string.toString(),
+ AssetManager.ACCESS_STREAMING);
+ } else {
+ errorMsg = "Only support TYPE_STRING for the res files";
+ }
+ } catch (ClassNotFoundException e) {
+ errorMsg = "Can't find class: "
+ + mContext.getPackageName() + ".R$" + subClassName;
+ } catch (SecurityException e) {
+ errorMsg = "Caught SecurityException: " + e;
+ } catch (NoSuchFieldException e) {
+ errorMsg = "Can't find field: " + fieldName + " in "
+ + mContext.getPackageName() + ".R$" + subClassName;
+ } catch (IllegalArgumentException e) {
+ errorMsg = "Caught IllegalArgumentException: " + e;
+ } catch (IllegalAccessException e) {
+ errorMsg = "Caught IllegalAccessException: " + e;
+ }
+ if (errorMsg != null) {
+ mHandler.error(EventHandler.FILE_ERROR, mContext
+ .getString(R.string.httpErrorFileNotFound));
+ return false;
+ }
} else {
if (!mAllowFileAccess) {
mHandler.error(EventHandler.FILE_ERROR,
@@ -131,8 +204,8 @@
* file system.
*/
public static void requestUrl(String url, LoadListener loadListener,
- Context context, boolean asset, boolean allowFileAccess) {
- FileLoader loader = new FileLoader(url, loadListener, context, asset,
+ Context context, int type, boolean allowFileAccess) {
+ FileLoader loader = new FileLoader(url, loadListener, context, type,
allowFileAccess);
loader.load();
}
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index c3dac6e..51f60c3 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -142,11 +142,15 @@
}
if (URLUtil.isAssetUrl(url)) {
FileLoader.requestUrl(url, loadListener, loadListener.getContext(),
- true, settings.getAllowFileAccess());
+ FileLoader.TYPE_ASSET, true);
+ return true;
+ } else if (URLUtil.isResourceUrl(url)) {
+ FileLoader.requestUrl(url, loadListener, loadListener.getContext(),
+ FileLoader.TYPE_RES, true);
return true;
} else if (URLUtil.isFileUrl(url)) {
FileLoader.requestUrl(url, loadListener, loadListener.getContext(),
- false, settings.getAllowFileAccess());
+ FileLoader.TYPE_FILE, settings.getAllowFileAccess());
return true;
} else if (URLUtil.isContentUrl(url)) {
// Send the raw url to the ContentLoader because it will do a
diff --git a/core/java/android/webkit/Network.java b/core/java/android/webkit/Network.java
index b53e404..598f20d 100644
--- a/core/java/android/webkit/Network.java
+++ b/core/java/android/webkit/Network.java
@@ -163,10 +163,10 @@
return false;
}
- // asset, file system or data stream are handled in the other code path.
- // This only handles network request.
- if (URLUtil.isAssetUrl(url) || URLUtil.isFileUrl(url) ||
- URLUtil.isDataUrl(url)) {
+ // asset, res, file system or data stream are handled in the other code
+ // path. This only handles network request.
+ if (URLUtil.isAssetUrl(url) || URLUtil.isResourceUrl(url)
+ || URLUtil.isFileUrl(url) || URLUtil.isDataUrl(url)) {
return false;
}
diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java
index 211e5e4..7c5f2b0 100644
--- a/core/java/android/webkit/URLUtil.java
+++ b/core/java/android/webkit/URLUtil.java
@@ -28,8 +28,14 @@
public final class URLUtil {
private static final String LOGTAG = "webkit";
-
+
+ // to refer to bar.png under your package's asset/foo/ directory, use
+ // "file:///android_asset/foo/bar.png".
static final String ASSET_BASE = "file:///android_asset/";
+ // to refer to bar.png under your package's res/drawable/ directory, use
+ // "file:///android_res/drawable/bar.png". Use "drawable" to refer to
+ // "drawable-hdpi" directory as well.
+ static final String RESOURCE_BASE = "file:///android_res/";
static final String FILE_BASE = "file://";
static final String PROXY_BASE = "file:///cookieless_proxy/";
@@ -166,7 +172,15 @@
public static boolean isAssetUrl(String url) {
return (null != url) && url.startsWith(ASSET_BASE);
}
-
+
+ /**
+ * @return True iff the url is a resource file.
+ * @hide
+ */
+ public static boolean isResourceUrl(String url) {
+ return (null != url) && url.startsWith(RESOURCE_BASE);
+ }
+
/**
* @return True iff the url is an proxy url to allow cookieless network
* requests from a file url.
@@ -251,6 +265,7 @@
}
return (isAssetUrl(url) ||
+ isResourceUrl(url) ||
isFileUrl(url) ||
isAboutUrl(url) ||
isHttpUrl(url) ||
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 99b3f21..924398e 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -599,7 +599,8 @@
*/
public void setAdapterCustom(AutoCompleteAdapter adapter) {
if (adapter != null) {
- setInputType(EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE);
+ setInputType(getInputType()
+ | EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE);
adapter.setTextView(this);
}
super.setAdapter(adapter);
@@ -740,7 +741,7 @@
mFromSetInputType = false;
}
- /* package */ void setMaxLength(int maxLength) {
+ private void setMaxLength(int maxLength) {
mMaxLength = maxLength;
if (-1 == maxLength) {
setFilters(NO_FILTERS);
@@ -805,45 +806,6 @@
}
/**
- * Set whether this is a single-line textfield or a multi-line textarea.
- * Textfields scroll horizontally, and do not handle the enter key.
- * Textareas behave oppositely.
- * Do NOT call this after calling setInPassword(true). This will result in
- * removing the password input type.
- */
- public void setSingleLine(boolean single) {
- int inputType = EditorInfo.TYPE_CLASS_TEXT
- | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT;
- if (single) {
- int action = mWebView.nativeTextFieldAction();
- switch (action) {
- // Keep in sync with CachedRoot::ImeAction
- case 0: // NEXT
- setImeOptions(EditorInfo.IME_ACTION_NEXT);
- break;
- case 1: // GO
- setImeOptions(EditorInfo.IME_ACTION_GO);
- break;
- case -1: // FAILURE
- case 2: // DONE
- setImeOptions(EditorInfo.IME_ACTION_DONE);
- break;
- case 3: // SEARCH
- setImeOptions(EditorInfo.IME_ACTION_SEARCH);
- break;
- }
- } else {
- inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
- | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES
- | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
- setImeOptions(EditorInfo.IME_ACTION_NONE);
- }
- mSingle = single;
- setHorizontallyScrolling(single);
- setInputType(inputType);
- }
-
- /**
* Set the text to the new string, but use the old selection, making sure
* to keep it within the new string.
* @param text The new text to place in the textfield.
@@ -858,6 +820,90 @@
}
/**
+ * Called by WebView.rebuildWebTextView(). Based on the type of the <input>
+ * element, set up the WebTextView, its InputType, and IME Options properly.
+ * @param type int corresponding to enum "type" defined in WebView.cpp.
+ * Does not correspond to HTMLInputElement::InputType so this
+ * is unaffected if that changes, and also because that has no
+ * type corresponding to textarea (which is its own tag).
+ */
+ /* package */ void setType(int type) {
+ if (mWebView == null) return;
+ boolean single = true;
+ boolean inPassword = false;
+ int maxLength = -1;
+ int inputType = EditorInfo.TYPE_CLASS_TEXT
+ | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT;
+ switch (type) {
+ case 1: // TEXT_AREA
+ single = false;
+ inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
+ | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES
+ | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
+ setImeOptions(EditorInfo.IME_ACTION_NONE);
+ break;
+ case 2: // PASSWORD
+ inPassword = true;
+ break;
+ case 3: // SEARCH
+ setImeOptions(EditorInfo.IME_ACTION_SEARCH);
+ break;
+ case 4: // EMAIL
+ // TYPE_TEXT_VARIATION_WEB_EDIT_TEXT prevents EMAIL_ADDRESS
+ // from working, so exclude it for now.
+ inputType = EditorInfo.TYPE_CLASS_TEXT
+ | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+ break;
+ case 5: // NUMBER
+ inputType = EditorInfo.TYPE_CLASS_NUMBER;
+ break;
+ case 6: // TELEPHONE
+ inputType = EditorInfo.TYPE_CLASS_PHONE;
+ break;
+ case 7: // URL
+ // TYPE_TEXT_VARIATION_WEB_EDIT_TEXT prevents URI
+ // from working, so exclude it for now.
+ inputType = EditorInfo.TYPE_CLASS_TEXT
+ | EditorInfo.TYPE_TEXT_VARIATION_URI;
+ break;
+ default:
+ break;
+ }
+ if (single) {
+ maxLength = mWebView.nativeFocusCandidateMaxLength();
+ if (type != 2 /* PASSWORD */) {
+ String name = mWebView.nativeFocusCandidateName();
+ if (name != null && name.length() > 0) {
+ mWebView.requestFormData(name, mNodePointer);
+ }
+ }
+ if (type != 3 /* SEARCH */) {
+ int action = mWebView.nativeTextFieldAction();
+ switch (action) {
+ // Keep in sync with CachedRoot::ImeAction
+ case 0: // NEXT
+ setImeOptions(EditorInfo.IME_ACTION_NEXT);
+ break;
+ case 1: // GO
+ setImeOptions(EditorInfo.IME_ACTION_GO);
+ break;
+ case -1: // FAILURE
+ case 2: // DONE
+ setImeOptions(EditorInfo.IME_ACTION_DONE);
+ break;
+ }
+ }
+ }
+ mSingle = single;
+ setMaxLength(maxLength);
+ setHorizontallyScrolling(single);
+ setInputType(inputType);
+ setInPassword(inPassword);
+ AutoCompleteAdapter adapter = null;
+ setAdapterCustom(adapter);
+ }
+
+ /**
* Update the cache to reflect the current text.
*/
/* package */ void updateCachedTextfield() {
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 7885b8a..3be6a3f 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3236,34 +3236,10 @@
vBox.height());
mWebTextView.setGravity(nativeFocusCandidateIsRtlText() ?
Gravity.RIGHT : Gravity.NO_GRAVITY);
- // this needs to be called before update adapter thread starts to
- // ensure the mWebTextView has the same node pointer
+ // This needs to be called before setType, which may call
+ // requestFormData, and it needs to have the correct nodePointer.
mWebTextView.setNodePointer(nodePointer);
- int maxLength = -1;
- boolean isTextField = nativeFocusCandidateIsTextField();
- boolean isPassword;
- if (isTextField) {
- maxLength = nativeFocusCandidateMaxLength();
- String name = nativeFocusCandidateName();
- isPassword = nativeFocusCandidateIsPassword();
- if (!isPassword && mWebViewCore.getSettings().getSaveFormData()
- && name != null && name.length() > 0) {
- Message update = mPrivateHandler.obtainMessage(
- REQUEST_FORM_DATA);
- update.arg1 = nodePointer;
- RequestFormData updater = new RequestFormData(name,
- getUrl(), update);
- Thread t = new Thread(updater);
- t.start();
- }
- } else {
- isPassword = false;
- }
- mWebTextView.setMaxLength(maxLength);
- AutoCompleteAdapter adapter = null;
- mWebTextView.setAdapterCustom(adapter);
- mWebTextView.setSingleLine(isTextField);
- mWebTextView.setInPassword(isPassword);
+ mWebTextView.setType(nativeFocusCandidateType());
if (null == text) {
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "rebuildWebTextView null == text");
@@ -3275,6 +3251,25 @@
}
}
+ /**
+ * Called by WebTextView to find saved form data associated with the
+ * textfield
+ * @param name Name of the textfield.
+ * @param nodePointer Pointer to the node of the textfield, so it can be
+ * compared to the currently focused textfield when the data is
+ * retrieved.
+ */
+ /* package */ void requestFormData(String name, int nodePointer) {
+ if (mWebViewCore.getSettings().getSaveFormData()) {
+ Message update = mPrivateHandler.obtainMessage(REQUEST_FORM_DATA);
+ update.arg1 = nodePointer;
+ RequestFormData updater = new RequestFormData(name, getUrl(),
+ update);
+ Thread t = new Thread(updater);
+ t.start();
+ }
+ }
+
/*
* This class requests an Adapter for the WebTextView which shows past
* entries stored in the database. It is a Runnable so that it can be done
@@ -5914,14 +5909,18 @@
private native boolean nativeFocusCandidateIsPassword();
private native boolean nativeFocusCandidateIsPlugin();
private native boolean nativeFocusCandidateIsRtlText();
- private native boolean nativeFocusCandidateIsTextField();
private native boolean nativeFocusCandidateIsTextInput();
- private native int nativeFocusCandidateMaxLength();
+ /* package */ native int nativeFocusCandidateMaxLength();
/* package */ native String nativeFocusCandidateName();
private native Rect nativeFocusCandidateNodeBounds();
/* package */ native int nativeFocusCandidatePointer();
private native String nativeFocusCandidateText();
private native int nativeFocusCandidateTextSize();
+ /**
+ * Returns an integer corresponding to WebView.cpp::type.
+ * See WebTextView.setType()
+ */
+ private native int nativeFocusCandidateType();
private native boolean nativeFocusIsPlugin();
/* package */ native int nativeFocusNodePointer();
private native Rect nativeGetCursorRingBounds();
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index 30dea74..032295d 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -173,8 +173,6 @@
* @param handler An SslErrorHandler object that will handle the user's
* response.
* @param error The SSL error object.
- * @hide - hide this because it contains a parameter of type SslError,
- * which is located in a hidden package.
*/
public void onReceivedSslError(WebView view, SslErrorHandler handler,
SslError error) {
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml
index f8944b5..a45faad 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml
@@ -45,7 +45,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/carrier"
- android:layout_marginBottom="10dip"
android:layout_marginTop="52dip"
android:layout_marginLeft="20dip"
>
@@ -53,6 +52,8 @@
<TextView android:id="@+id/timeDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="none"
android:gravity="bottom"
android:textSize="72sp"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -60,6 +61,7 @@
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
+ android:layout_marginBottom="10dip"
/>
@@ -67,10 +69,10 @@
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="bottom"
- android:textSize="22sp"
android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="22sp"
android:layout_marginLeft="8dip"
- android:layout_marginBottom="-6dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:shadowColor="#C0000000"
android:shadowDx="0"
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
index 22c0b8e..1001697 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
@@ -49,7 +49,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/carrier"
- android:layout_marginBottom="8dip"
android:layout_marginTop="56dip"
>
@@ -57,12 +56,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
+ android:singleLine="true"
+ android:ellipsize="none"
android:textSize="72sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:shadowColor="#C0000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
+ android:layout_marginBottom="6dip"
/>
@@ -70,10 +72,10 @@
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="bottom"
- android:textSize="22sp"
android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="22sp"
android:layout_marginLeft="8dip"
- android:layout_marginBottom="-6dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:shadowColor="#C0000000"
android:shadowDx="0"
diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
index 602a37c..f8f326a 100644
--- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
@@ -60,7 +60,6 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
- android:layout_marginBottom="8dip"
android:layout_marginTop="8dip"
>
@@ -68,12 +67,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
+ android:singleLine="true"
+ android:ellipsize="none"
android:textSize="72sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:shadowColor="#C0000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
+ android:layout_marginBottom="6dip"
/>
@@ -81,10 +83,10 @@
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="bottom"
- android:textSize="22sp"
android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="22sp"
android:layout_marginLeft="8dip"
- android:layout_marginBottom="-6dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:shadowColor="#C0000000"
android:shadowDx="0"
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index 9ce5a25..d7c4aae 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -50,7 +50,6 @@
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="15dip"
- android:layout_marginBottom="6dip"
android:layout_marginLeft="20dip"
>
@@ -58,22 +57,25 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
+ android:singleLine="true"
+ android:ellipsize="none"
android:textSize="56sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:shadowColor="#C0000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
+ android:layout_marginBottom="6dip"
/>
<TextView android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="bottom"
- android:textSize="18sp"
android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="18sp"
android:layout_marginLeft="4dip"
- android:layout_marginBottom="-6dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:shadowColor="#C0000000"
android:shadowDx="0"
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 957f2dd..b6ac14a 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -40,27 +40,36 @@
}
public void uploadToTexture(int baseMipLevel) {
+ mRS.validate();
+ mRS.validateSurface();
mRS.nAllocationUploadToTexture(mID, baseMipLevel);
}
public void uploadToBufferObject() {
+ mRS.validate();
+ mRS.validateSurface();
mRS.nAllocationUploadToBufferObject(mID);
}
public void data(int[] d) {
+ mRS.validate();
subData1D(0, mType.getElementCount(), d);
}
public void data(short[] d) {
+ mRS.validate();
subData1D(0, mType.getElementCount(), d);
}
public void data(byte[] d) {
+ mRS.validate();
subData1D(0, mType.getElementCount(), d);
}
public void data(float[] d) {
+ mRS.validate();
subData1D(0, mType.getElementCount(), d);
}
private void data1DChecks(int off, int count, int len, int dataSize) {
+ mRS.validate();
if((off < 0) || (count < 1) || ((off + count) > mType.getElementCount())) {
throw new IllegalArgumentException("Offset or Count out of bounds.");
}
@@ -93,30 +102,37 @@
public void subData2D(int xoff, int yoff, int w, int h, int[] d) {
+ mRS.validate();
mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4);
}
public void subData2D(int xoff, int yoff, int w, int h, float[] d) {
+ mRS.validate();
mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4);
}
public void readData(int[] d) {
+ mRS.validate();
mRS.nAllocationRead(mID, d);
}
public void readData(float[] d) {
+ mRS.validate();
mRS.nAllocationRead(mID, d);
}
public void data(Object o) {
+ mRS.validate();
mRS.nAllocationSubDataFromObject(mID, mType, 0, o);
}
public void read(Object o) {
+ mRS.validate();
mRS.nAllocationSubReadFromObject(mID, mType, 0, o);
}
public void subData(int offset, Object o) {
+ mRS.validate();
mRS.nAllocationSubDataFromObject(mID, mType, offset, o);
}
@@ -127,27 +143,33 @@
}
public void setConstraint(Dimension dim, int value) {
+ mRS.validate();
mRS.nAdapter1DSetConstraint(mID, dim.mID, value);
}
public void data(int[] d) {
+ mRS.validate();
mRS.nAdapter1DData(mID, d);
}
public void data(float[] d) {
+ mRS.validate();
mRS.nAdapter1DData(mID, d);
}
public void subData(int off, int count, int[] d) {
+ mRS.validate();
mRS.nAdapter1DSubData(mID, off, count, d);
}
public void subData(int off, int count, float[] d) {
+ mRS.validate();
mRS.nAdapter1DSubData(mID, off, count, d);
}
}
public Adapter1D createAdapter1D() {
+ mRS.validate();
int id = mRS.nAdapter1DCreate();
if (id != 0) {
mRS.nAdapter1DBindAllocation(id, mID);
@@ -163,27 +185,33 @@
}
public void setConstraint(Dimension dim, int value) {
+ mRS.validate();
mRS.nAdapter2DSetConstraint(mID, dim.mID, value);
}
public void data(int[] d) {
+ mRS.validate();
mRS.nAdapter2DData(mID, d);
}
public void data(float[] d) {
+ mRS.validate();
mRS.nAdapter2DData(mID, d);
}
public void subData(int xoff, int yoff, int w, int h, int[] d) {
+ mRS.validate();
mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d);
}
public void subData(int xoff, int yoff, int w, int h, float[] d) {
+ mRS.validate();
mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d);
}
}
public Adapter2D createAdapter2D() {
+ mRS.validate();
int id = mRS.nAdapter2DCreate();
if (id != 0) {
mRS.nAdapter2DBindAllocation(id, mID);
@@ -202,6 +230,7 @@
static public Allocation createTyped(RenderScript rs, Type type)
throws IllegalArgumentException {
+ rs.validate();
if(type.mID == 0) {
throw new IllegalStateException("Bad Type");
}
@@ -212,6 +241,7 @@
static public Allocation createSized(RenderScript rs, Element e, int count)
throws IllegalArgumentException {
+ rs.validate();
Type.Builder b = new Type.Builder(rs, e);
b.add(Dimension.X, count);
Type t = b.create();
@@ -226,6 +256,7 @@
static public Allocation createFromBitmap(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips)
throws IllegalArgumentException {
+ rs.validate();
int id = rs.nAllocationCreateFromBitmap(dstFmt.mID, genMips, b);
return new Allocation(id, rs, null);
}
@@ -233,6 +264,7 @@
static public Allocation createFromBitmapBoxed(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips)
throws IllegalArgumentException {
+ rs.validate();
int id = rs.nAllocationCreateFromBitmapBoxed(dstFmt.mID, genMips, b);
return new Allocation(id, rs, null);
}
@@ -240,6 +272,7 @@
static public Allocation createFromBitmapResource(RenderScript rs, Resources res, int id, Element dstFmt, boolean genMips)
throws IllegalArgumentException {
+ rs.validate();
InputStream is = null;
try {
final TypedValue value = new TypedValue();
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index 73d8266..ee9b098 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -284,6 +284,7 @@
}
public static Element createFromClass(RenderScript rs, Class c) {
+ rs.validate();
Field[] fields = c.getFields();
Builder b = new Builder(rs);
@@ -322,6 +323,7 @@
}
void init() {
+ mRS.validate();
internalCreate(mRS, this);
}
@@ -483,6 +485,7 @@
}
public Element create() {
+ mRS.validate();
Element e = new Element(mRS, mEntryCount);
java.lang.System.arraycopy(mEntries, 0, e.mEntries, 0, mEntryCount);
e.init();
diff --git a/graphics/java/android/renderscript/Light.java b/graphics/java/android/renderscript/Light.java
index 115ae03..aab656f 100644
--- a/graphics/java/android/renderscript/Light.java
+++ b/graphics/java/android/renderscript/Light.java
@@ -30,10 +30,12 @@
}
public void setColor(float r, float g, float b) {
+ mRS.validate();
mRS.nLightSetColor(mID, r, g, b);
}
public void setPosition(float x, float y, float z) {
+ mRS.validate();
mRS.nLightSetPosition(mID, x, y, z);
}
@@ -65,6 +67,7 @@
}
public Light create() {
+ mRS.validate();
return internalCreate(mRS, this);
}
}
diff --git a/graphics/java/android/renderscript/ProgramFragment.java b/graphics/java/android/renderscript/ProgramFragment.java
index 392d93d..1a72578 100644
--- a/graphics/java/android/renderscript/ProgramFragment.java
+++ b/graphics/java/android/renderscript/ProgramFragment.java
@@ -47,6 +47,7 @@
public void bindTexture(Allocation va, int slot)
throws IllegalArgumentException {
+ mRS.validate();
if((slot < 0) || (slot >= MAX_SLOT)) {
throw new IllegalArgumentException("Slot ID out of range.");
}
@@ -56,6 +57,7 @@
public void bindSampler(Sampler vs, int slot)
throws IllegalArgumentException {
+ mRS.validate();
if((slot < 0) || (slot >= MAX_SLOT)) {
throw new IllegalArgumentException("Slot ID out of range.");
}
@@ -149,6 +151,7 @@
}
public ProgramFragment create() {
+ mRS.validate();
return internalCreate(mRS, this);
}
}
diff --git a/graphics/java/android/renderscript/ProgramRaster.java b/graphics/java/android/renderscript/ProgramRaster.java
index ab327f1..56f9bf4 100644
--- a/graphics/java/android/renderscript/ProgramRaster.java
+++ b/graphics/java/android/renderscript/ProgramRaster.java
@@ -46,11 +46,13 @@
}
public void setLineWidth(float w) {
+ mRS.validate();
mLineWidth = w;
mRS.nProgramRasterSetLineWidth(mID, w);
}
public void setPointSize(float s) {
+ mRS.validate();
mPointSize = s;
mRS.nProgramRasterSetPointSize(mID, s);
}
@@ -98,6 +100,7 @@
}
public ProgramRaster create() {
+ mRS.validate();
return internalCreate(mRS, this);
}
}
diff --git a/graphics/java/android/renderscript/ProgramStore.java b/graphics/java/android/renderscript/ProgramStore.java
index 5cbe1b2..69be245 100644
--- a/graphics/java/android/renderscript/ProgramStore.java
+++ b/graphics/java/android/renderscript/ProgramStore.java
@@ -162,6 +162,7 @@
}
public ProgramStore create() {
+ mRS.validate();
return internalCreate(mRS, this);
}
}
diff --git a/graphics/java/android/renderscript/ProgramVertex.java b/graphics/java/android/renderscript/ProgramVertex.java
index ddb23ac..ba97d5b 100644
--- a/graphics/java/android/renderscript/ProgramVertex.java
+++ b/graphics/java/android/renderscript/ProgramVertex.java
@@ -34,6 +34,7 @@
}
public void bindAllocation(MatrixAllocation va) {
+ mRS.validate();
mRS.nProgramVertexBindAllocation(mID, va.mAlloc.mID);
}
@@ -88,6 +89,7 @@
}
public ProgramVertex create() {
+ mRS.validate();
return internalCreate(mRS, this);
}
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index c42f647..0d8b675 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -242,6 +242,18 @@
}
}
+ void validate() {
+ if (mContext == 0) {
+ throw new IllegalStateException("Calling RS with no Context active.");
+ }
+ }
+
+ void validateSurface() {
+ if (mSurface == null) {
+ throw new IllegalStateException("Uploading data to GL with no surface.");
+ }
+ }
+
public void contextSetPriority(Priority p) {
nContextSetPriority(p.mID);
}
diff --git a/graphics/java/android/renderscript/Sampler.java b/graphics/java/android/renderscript/Sampler.java
index 5e0b110..625a576 100644
--- a/graphics/java/android/renderscript/Sampler.java
+++ b/graphics/java/android/renderscript/Sampler.java
@@ -100,6 +100,7 @@
}
public Sampler create() {
+ mRS.validate();
return internalCreate(mRS, this);
}
}
diff --git a/graphics/java/android/renderscript/Script.java b/graphics/java/android/renderscript/Script.java
index 35791a3..57ccfa3 100644
--- a/graphics/java/android/renderscript/Script.java
+++ b/graphics/java/android/renderscript/Script.java
@@ -48,22 +48,27 @@
}
public void bindAllocation(Allocation va, int slot) {
+ mRS.validate();
mRS.nScriptBindAllocation(mID, va.mID, slot);
}
public void setClearColor(float r, float g, float b, float a) {
+ mRS.validate();
mRS.nScriptSetClearColor(mID, r, g, b, a);
}
public void setClearDepth(float d) {
+ mRS.validate();
mRS.nScriptSetClearDepth(mID, d);
}
public void setClearStencil(int stencil) {
+ mRS.validate();
mRS.nScriptSetClearStencil(mID, stencil);
}
public void setTimeZone(String timeZone) {
+ mRS.validate();
try {
mRS.nScriptSetTimeZone(mID, timeZone.getBytes("UTF-8"));
} catch (java.io.UnsupportedEncodingException e) {
diff --git a/graphics/java/android/renderscript/SimpleMesh.java b/graphics/java/android/renderscript/SimpleMesh.java
index 3d10e3b..f45074e 100644
--- a/graphics/java/android/renderscript/SimpleMesh.java
+++ b/graphics/java/android/renderscript/SimpleMesh.java
@@ -35,18 +35,22 @@
}
public void bindVertexAllocation(Allocation a, int slot) {
+ mRS.validate();
mRS.nSimpleMeshBindVertex(mID, a.mID, slot);
}
public void bindIndexAllocation(Allocation a) {
+ mRS.validate();
mRS.nSimpleMeshBindIndex(mID, a.mID);
}
public Allocation createVertexAllocation(int slot) {
+ mRS.validate();
return Allocation.createTyped(mRS, mVertexTypes[slot]);
}
public Allocation createIndexAllocation() {
+ mRS.validate();
return Allocation.createTyped(mRS, mIndexType);
}
@@ -162,6 +166,7 @@
}
public SimpleMesh create() {
+ mRS.validate();
SimpleMesh sm = internalCreate(mRS, this);
sm.mVertexTypes = new Type[mVertexTypeCount];
for(int ct=0; ct < mVertexTypeCount; ct++) {
diff --git a/media/jni/soundpool/SoundPool.h b/media/jni/soundpool/SoundPool.h
index e0ead9a..94cd978 100644
--- a/media/jni/soundpool/SoundPool.h
+++ b/media/jni/soundpool/SoundPool.h
@@ -186,9 +186,6 @@
SoundPool() {} // no default constructor
bool startThreads();
void doLoad(sp<Sample>& sample);
- inline void notify(const SoundPoolEvent* event) {
- android_soundpool_SoundPool_notify(mSoundPoolRef, event);
- }
sp<Sample> findSample(int sampleID) { return mSamples.valueFor(sampleID); }
SoundChannel* findChannel (int channelID);
SoundChannel* findNextChannel (int channelID);
@@ -202,7 +199,6 @@
int run();
void quit();
- jobject mSoundPoolRef;
Mutex mLock;
Mutex mRestartLock;
Condition mCondition;