diff options
36 files changed, 554 insertions, 115 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 67d393043668..bc7ac32add7d 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1147,6 +1147,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM IActivityController watcher = IActivityController.Stub.asInterface( data.readStrongBinder()); setActivityController(watcher); + reply.writeNoException(); return true; } diff --git a/core/java/android/app/LoaderManager.java b/core/java/android/app/LoaderManager.java index fd0f0bf6fd98..267555a70921 100644 --- a/core/java/android/app/LoaderManager.java +++ b/core/java/android/app/LoaderManager.java @@ -833,6 +833,7 @@ class LoaderManagerImpl extends LoaderManager { for (int i = mLoaders.size()-1; i >= 0; i--) { mLoaders.valueAt(i).destroy(); } + mLoaders.clear(); } if (DEBUG) Log.v(TAG, "Destroying Inactive in " + this); diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 9e406d452fa4..bde4d2ba2775 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -518,7 +518,7 @@ public abstract class ContentResolver { * ContentProvider.openFile}. * @return Returns a new ParcelFileDescriptor pointing to the file. You * own this descriptor and are responsible for closing it when done. - * @throws FileNotFoundException Throws FileNotFoundException of no + * @throws FileNotFoundException Throws FileNotFoundException if no * file exists under the URI or the mode is invalid. * @see #openAssetFileDescriptor(Uri, String) */ @@ -1049,9 +1049,9 @@ public abstract class ContentResolver { if (!SCHEME_CONTENT.equals(uri.getScheme())) { return null; } - String auth = uri.getAuthority(); + final String auth = uri.getAuthority(); if (auth != null) { - return acquireProvider(mContext, uri.getAuthority()); + return acquireProvider(mContext, auth); } return null; } @@ -1068,9 +1068,9 @@ public abstract class ContentResolver { if (!SCHEME_CONTENT.equals(uri.getScheme())) { return null; } - String auth = uri.getAuthority(); + final String auth = uri.getAuthority(); if (auth != null) { - return acquireExistingProvider(mContext, uri.getAuthority()); + return acquireExistingProvider(mContext, auth); } return null; } diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java index 6f7c1f38594a..0017c46a7a16 100644 --- a/core/java/android/database/sqlite/SQLiteConnection.java +++ b/core/java/android/database/sqlite/SQLiteConnection.java @@ -216,6 +216,13 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen setJournalSizeLimit(); setAutoCheckpointInterval(); setLocaleFromConfiguration(); + + // Register custom functions. + final int functionCount = mConfiguration.customFunctions.size(); + for (int i = 0; i < functionCount; i++) { + SQLiteCustomFunction function = mConfiguration.customFunctions.get(i); + nativeRegisterCustomFunction(mConnectionPtr, function); + } } private void dispose(boolean finalized) { @@ -974,7 +981,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen if (count != statement.mNumParameters) { throw new SQLiteBindOrColumnIndexOutOfRangeException( "Expected " + statement.mNumParameters + " bind arguments but " - + bindArgs.length + " were provided."); + + count + " were provided."); } if (count == 0) { return; diff --git a/core/java/android/database/sqlite/SQLiteSession.java b/core/java/android/database/sqlite/SQLiteSession.java index beb5b3a31cfc..d80ab1f2e867 100644 --- a/core/java/android/database/sqlite/SQLiteSession.java +++ b/core/java/android/database/sqlite/SQLiteSession.java @@ -926,7 +926,7 @@ public final class SQLiteSession { } private void throwIfNestedTransaction() { - if (mTransactionStack == null && mTransactionStack.mParent != null) { + if (hasNestedTransaction()) { throw new IllegalStateException("Cannot perform this operation because " + "a nested transaction is in progress."); } diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java index 846443d6d235..c0a894b6e66e 100644 --- a/core/java/android/net/SSLCertificateSocketFactory.java +++ b/core/java/android/net/SSLCertificateSocketFactory.java @@ -24,6 +24,7 @@ import java.net.Socket; import java.net.SocketException; import java.security.KeyManagementException; import java.security.cert.X509Certificate; +import java.security.interfaces.ECPrivateKey; import javax.net.SocketFactory; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; @@ -88,6 +89,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { private TrustManager[] mTrustManagers = null; private KeyManager[] mKeyManagers = null; private byte[] mNpnProtocols = null; + private ECPrivateKey mChannelIdPrivateKey = null; private final int mHandshakeTimeoutMillis; private final SSLClientSessionCache mSessionCache; @@ -319,6 +321,20 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { } /** + * Sets the {@link ECPrivateKey} to be used for TLS Channel ID by connections made by this + * factory. + * + * @param privateKey private key (enables TLS Channel ID) or {@code null} for no key (disables + * TLS Channel ID). The private key has to be an Elliptic Curve (EC) key based on the + * NIST P-256 curve (aka SECG secp256r1 or ANSI X9.62 prime256v1). + * + * @hide + */ + public void setChannelIdPrivateKey(ECPrivateKey privateKey) { + mChannelIdPrivateKey = privateKey; + } + + /** * Enables <a href="http://tools.ietf.org/html/rfc5077#section-3.2">session ticket</a> * support on the given socket. * @@ -378,6 +394,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(k, host, port, close); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setChannelIdPrivateKey(mChannelIdPrivateKey); if (mSecure) { verifyHostname(s, host); } @@ -397,6 +414,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setChannelIdPrivateKey(mChannelIdPrivateKey); return s; } @@ -414,6 +432,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { addr, port, localAddr, localPort); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setChannelIdPrivateKey(mChannelIdPrivateKey); return s; } @@ -429,6 +448,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(addr, port); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setChannelIdPrivateKey(mChannelIdPrivateKey); return s; } @@ -445,6 +465,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { host, port, localAddr, localPort); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setChannelIdPrivateKey(mChannelIdPrivateKey); if (mSecure) { verifyHostname(s, host); } @@ -462,6 +483,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(host, port); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setChannelIdPrivateKey(mChannelIdPrivateKey); if (mSecure) { verifyHostname(s, host); } diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index 0e7ab525bc91..cb6300f691f4 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -1324,6 +1324,18 @@ public final class MediaStore { } public static final class Media implements AudioColumns { + + private static final String[] EXTERNAL_PATHS; + + static { + String secondary_storage = System.getenv("SECONDARY_STORAGE"); + if (secondary_storage != null) { + EXTERNAL_PATHS = secondary_storage.split(":"); + } else { + EXTERNAL_PATHS = new String[0]; + } + } + /** * Get the content:// style URI for the audio media table on the * given volume. @@ -1337,6 +1349,12 @@ public final class MediaStore { } public static Uri getContentUriForPath(String path) { + for (String ep : EXTERNAL_PATHS) { + if (path.startsWith(ep)) { + return EXTERNAL_CONTENT_URI; + } + } + return (path.startsWith(Environment.getExternalStorageDirectory().getPath()) ? EXTERNAL_CONTENT_URI : INTERNAL_CONTENT_URI); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index ff44475a7e28..b3f9b3181e98 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8064,8 +8064,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // in onHoverEvent. // Note that onGenericMotionEvent will be called by default when // onHoverEvent returns false (refer to dispatchGenericMotionEvent). - dispatchGenericMotionEventInternal(event); - return true; + return dispatchGenericMotionEventInternal(event); } return false; diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 27d770b46afc..6d63c6fe901b 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -3793,6 +3793,13 @@ public final class ViewRootImpl implements ViewParent, finishInputEvent(q, true); return; } + } else { + // find the best view to give focus to in this non-touch-mode with no-focus + View v = focusSearch(null, direction); + if (v != null && v.requestFocus(direction)) { + finishInputEvent(q, true); + return; + } } } } diff --git a/core/java/android/view/WindowOrientationListener.java b/core/java/android/view/WindowOrientationListener.java index 4c34dd4e5b8c..bf77c67a7b7c 100644 --- a/core/java/android/view/WindowOrientationListener.java +++ b/core/java/android/view/WindowOrientationListener.java @@ -98,6 +98,7 @@ public abstract class WindowOrientationListener { if (LOG) { Log.d(TAG, "WindowOrientationListener enabled"); } + mSensorEventListener.reset(); mSensorManager.registerListener(mSensorEventListener, mSensor, mRate); mEnabled = true; } diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index 4dbca23c9277..c3a1a17d88a1 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -56,8 +56,8 @@ import java.util.Map; import java.util.Set; import org.apache.harmony.security.provider.cert.X509CertImpl; -import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey; -import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey; +import org.apache.harmony.xnet.provider.jsse.OpenSSLKey; +import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder; class BrowserFrame extends Handler { @@ -1129,13 +1129,10 @@ class BrowserFrame extends Handler { if (table.IsAllowed(hostAndPort)) { // previously allowed PrivateKey pkey = table.PrivateKey(hostAndPort); - if (pkey instanceof OpenSSLRSAPrivateKey) { + if (pkey instanceof OpenSSLKeyHolder) { + OpenSSLKey sslKey = ((OpenSSLKeyHolder) pkey).getOpenSSLKey(); nativeSslClientCert(handle, - ((OpenSSLRSAPrivateKey)pkey).getPkeyContext(), - table.CertificateChain(hostAndPort)); - } else if (pkey instanceof OpenSSLDSAPrivateKey) { - nativeSslClientCert(handle, - ((OpenSSLDSAPrivateKey)pkey).getPkeyContext(), + sslKey.getPkeyContext(), table.CertificateChain(hostAndPort)); } else { nativeSslClientCert(handle, diff --git a/core/java/android/webkit/ClientCertRequestHandler.java b/core/java/android/webkit/ClientCertRequestHandler.java index 6570a9b8ad4c..dac151054198 100644 --- a/core/java/android/webkit/ClientCertRequestHandler.java +++ b/core/java/android/webkit/ClientCertRequestHandler.java @@ -21,8 +21,8 @@ import java.security.PrivateKey; import java.security.cert.CertificateEncodingException; import java.security.cert.X509Certificate; import org.apache.harmony.xnet.provider.jsse.NativeCrypto; -import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey; -import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey; +import org.apache.harmony.xnet.provider.jsse.OpenSSLKey; +import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder; /** * ClientCertRequestHandler: class responsible for handling client @@ -56,14 +56,11 @@ public final class ClientCertRequestHandler extends Handler { byte[][] chainBytes = NativeCrypto.encodeCertificates(chain); mTable.Allow(mHostAndPort, privateKey, chainBytes); - if (privateKey instanceof OpenSSLRSAPrivateKey) { - setSslClientCertFromCtx(((OpenSSLRSAPrivateKey)privateKey).getPkeyContext(), - chainBytes); - } else if (privateKey instanceof OpenSSLDSAPrivateKey) { - setSslClientCertFromCtx(((OpenSSLDSAPrivateKey)privateKey).getPkeyContext(), - chainBytes); + if (privateKey instanceof OpenSSLKeyHolder) { + OpenSSLKey pkey = ((OpenSSLKeyHolder) privateKey).getOpenSSLKey(); + setSslClientCertFromCtx(pkey.getPkeyContext(), chainBytes); } else { - setSslClientCertFromPKCS8(privateKey.getEncoded(),chainBytes); + setSslClientCertFromPKCS8(privateKey.getEncoded(), chainBytes); } } catch (CertificateEncodingException e) { post(new Runnable() { diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index b1a44c5a89bc..4a7426b9562f 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -2659,23 +2659,14 @@ public class Editor { TypedArray styledAttributes = mTextView.getContext().obtainStyledAttributes( com.android.internal.R.styleable.SelectionModeDrawables); - boolean allowText = mTextView.getContext().getResources().getBoolean( - com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon); - mode.setTitle(mTextView.getContext().getString( com.android.internal.R.string.textSelectionCABTitle)); mode.setSubtitle(null); mode.setTitleOptionalHint(true); - int selectAllIconId = 0; // No icon by default - if (!allowText) { - // Provide an icon, text will not be displayed on smaller screens. - selectAllIconId = styledAttributes.getResourceId( - R.styleable.SelectionModeDrawables_actionModeSelectAllDrawable, 0); - } - menu.add(0, TextView.ID_SELECT_ALL, 0, com.android.internal.R.string.selectAll). - setIcon(selectAllIconId). + setIcon(styledAttributes.getResourceId( + R.styleable.SelectionModeDrawables_actionModeSelectAllDrawable, 0)). setAlphabeticShortcut('a'). setShowAsAction( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index 74ded18b64ed..2ac5a128598e 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -1969,8 +1969,10 @@ public class NumberPicker extends LinearLayout { * Ensure the user can't type in a value greater than the max * allowed. We have to allow less than min as the user might * want to delete some numbers and then type a new number. + * And prevent multiple-"0" that exceeds the length of upper + * bound number. */ - if (val > mMaxValue) { + if (val > mMaxValue || result.length() > String.valueOf(mMaxValue).length()) { return ""; } else { return filtered; diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp index c9cf2fa9c282..f70f0d1900c4 100644 --- a/core/jni/android_database_SQLiteConnection.cpp +++ b/core/jni/android_database_SQLiteConnection.cpp @@ -706,7 +706,7 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz, } CopyRowResult cpr = copyRow(env, window, statement, numColumns, startPos, addedRows); - if (cpr == CPR_FULL && addedRows && startPos + addedRows < requiredPos) { + if (cpr == CPR_FULL && addedRows && startPos + addedRows <= requiredPos) { // We filled the window before we got to the one row that we really wanted. // Clear the window and start filling it again from here. // TODO: Would be nicer if we could progressively replace earlier rows. diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp index 3d9d005637a3..64fb27b3e18a 100644 --- a/core/jni/android_view_DisplayEventReceiver.cpp +++ b/core/jni/android_view_DisplayEventReceiver.cpp @@ -62,7 +62,7 @@ private: bool mWaitingForVsync; virtual int handleEvent(int receiveFd, int events, void* data); - bool readLastVsyncMessage(nsecs_t* outTimestamp, int32_t* id, uint32_t* outCount); + bool processPendingEvents(nsecs_t* outTimestamp, int32_t* id, uint32_t* outCount); void dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count); void dispatchHotplug(nsecs_t timestamp, int32_t id, bool connected); }; @@ -111,7 +111,7 @@ status_t NativeDisplayEventReceiver::scheduleVsync() { nsecs_t vsyncTimestamp; int32_t vsyncDisplayId; uint32_t vsyncCount; - readLastVsyncMessage(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount); + processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount); status_t status = mReceiver.requestNextVsync(); if (status) { @@ -141,43 +141,47 @@ int NativeDisplayEventReceiver::handleEvent(int receiveFd, int events, void* dat nsecs_t vsyncTimestamp; int32_t vsyncDisplayId; uint32_t vsyncCount; - if (!readLastVsyncMessage(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount)) { - ALOGV("receiver %p ~ Woke up but there was no vsync pulse!", this); - return 1; // keep the callback, did not obtain a vsync pulse + if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount)) { + ALOGV("receiver %p ~ Vsync pulse: timestamp=%lld, id=%d, count=%d", + this, vsyncTimestamp, vsyncDisplayId, vsyncCount); + mWaitingForVsync = false; + dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount); } - ALOGV("receiver %p ~ Vsync pulse: timestamp=%lld, id=%d, count=%d", - this, vsyncTimestamp, vsyncDisplayId, vsyncCount); - mWaitingForVsync = false; - - dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount); return 1; // keep the callback } -bool NativeDisplayEventReceiver::readLastVsyncMessage( +bool NativeDisplayEventReceiver::processPendingEvents( nsecs_t* outTimestamp, int32_t* outId, uint32_t* outCount) { + bool gotVsync = false; DisplayEventReceiver::Event buf[EVENT_BUFFER_SIZE]; ssize_t n; while ((n = mReceiver.getEvents(buf, EVENT_BUFFER_SIZE)) > 0) { ALOGV("receiver %p ~ Read %d events.", this, int(n)); - while (n-- > 0) { - const DisplayEventReceiver::Event& ev = buf[n]; - if (ev.header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) { + for (ssize_t i = 0; i < n; i++) { + const DisplayEventReceiver::Event& ev = buf[i]; + switch (ev.header.type) { + case DisplayEventReceiver::DISPLAY_EVENT_VSYNC: + // Later vsync events will just overwrite the info from earlier + // ones. That's fine, we only care about the most recent. + gotVsync = true; *outTimestamp = ev.header.timestamp; *outId = ev.header.id; *outCount = ev.vsync.count; - return true; // stop at last vsync in the buffer - } - - if (ev.header.type == DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG) { + break; + case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG: dispatchHotplug(ev.header.timestamp, ev.header.id, ev.hotplug.connected); + break; + default: + ALOGW("receiver %p ~ ignoring unknown event type %#x", this, ev.header.type); + break; } } } if (n < 0) { ALOGW("Failed to get events from display event receiver, status=%d", status_t(n)); } - return false; + return gotVsync; } void NativeDisplayEventReceiver::dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count) { diff --git a/core/res/res/layout/keyguard_screen_sim_pin_portrait.xml b/core/res/res/layout/keyguard_screen_sim_pin_portrait.xml index 20c214212d2d..4c42a173ef4f 100644 --- a/core/res/res/layout/keyguard_screen_sim_pin_portrait.xml +++ b/core/res/res/layout/keyguard_screen_sim_pin_portrait.xml @@ -33,7 +33,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" - android:singleLine="true" android:textAppearance="?android:attr/textAppearanceLarge"/> <!-- Carrier info --> diff --git a/core/res/res/layout/search_view.xml b/core/res/res/layout/search_view.xml index a281fcc881d3..29c0576ffbde 100644 --- a/core/res/res/layout/search_view.xml +++ b/core/res/res/layout/search_view.xml @@ -45,6 +45,7 @@ android:layout_height="match_parent" android:layout_gravity="center_vertical" android:src="?android:attr/searchViewSearchIcon" + android:focusable="true" android:contentDescription="@string/searchview_description_search" /> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 4119f91241da..f665f3488112 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -277,8 +277,6 @@ <!-- Boolean indicating whether the wifi chipset has dual frequency band support --> <bool translatable="false" name="config_wifi_dual_band_support">false</bool> - <!-- Boolean indicating whether the wifi chipset has p2p support --> - <bool translatable="false" name="config_wifi_p2p_support">false</bool> <!-- Device type information conforming to Annex B format in WiFi Direct specification. The default represents a dual-mode smartphone --> <string translatable="false" name="config_wifi_p2p_device_type">10-0050F204-5</string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 1bac5c0d23c9..855c2f45ff10 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1348,7 +1348,6 @@ <java-symbol type="id" name="sliding_layout" /> <java-symbol type="id" name="keyguard_add_widget" /> <java-symbol type="id" name="keyguard_add_widget_view" /> - <java-symbol type="id" name="sliding_layout" /> <java-symbol type="id" name="multi_pane_challenge" /> <java-symbol type="id" name="keyguard_user_selector" /> <java-symbol type="id" name="key_enter" /> diff --git a/graphics/java/android/renderscript/Matrix3f.java b/graphics/java/android/renderscript/Matrix3f.java index 66f2c81b0cbc..5e9a7caab389 100644 --- a/graphics/java/android/renderscript/Matrix3f.java +++ b/graphics/java/android/renderscript/Matrix3f.java @@ -138,9 +138,9 @@ public class Matrix3f { mMat[6] = zx*nc + ys; mMat[1] = xy*nc + zs; mMat[4] = y*y*nc + c; - mMat[9] = yz*nc - xs; + mMat[7] = yz*nc - xs; mMat[2] = zx*nc - ys; - mMat[6] = yz*nc + xs; + mMat[5] = yz*nc + xs; mMat[8] = z*z*nc + c; } diff --git a/keystore/java/android/security/AndroidKeyStore.java b/keystore/java/android/security/AndroidKeyStore.java index aabfcae61cde..65d7b8ff0bec 100644 --- a/keystore/java/android/security/AndroidKeyStore.java +++ b/keystore/java/android/security/AndroidKeyStore.java @@ -16,9 +16,8 @@ package android.security; -import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey; import org.apache.harmony.xnet.provider.jsse.OpenSSLEngine; -import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey; +import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder; import android.util.Log; @@ -210,10 +209,8 @@ public class AndroidKeyStore extends KeyStoreSpi { byte[] keyBytes = null; final String pkeyAlias; - if (key instanceof OpenSSLRSAPrivateKey) { - pkeyAlias = ((OpenSSLRSAPrivateKey) key).getPkeyAlias(); - } else if (key instanceof OpenSSLDSAPrivateKey) { - pkeyAlias = ((OpenSSLDSAPrivateKey) key).getPkeyAlias(); + if (key instanceof OpenSSLKeyHolder) { + pkeyAlias = ((OpenSSLKeyHolder) key).getOpenSSLKey().getAlias(); } else { pkeyAlias = null; } diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java index 44be8042c58d..ceaff37f3c59 100644 --- a/keystore/java/android/security/KeyStore.java +++ b/keystore/java/android/security/KeyStore.java @@ -243,7 +243,12 @@ public class KeyStore { */ public long getmtime(String key) { try { - return mBinder.getmtime(key); + final long millis = mBinder.getmtime(key); + if (millis == -1L) { + return -1L; + } + + return millis * 1000L; } catch (RemoteException e) { Log.w(TAG, "Cannot connect to keystore", e); return -1L; diff --git a/keystore/tests/src/android/security/AndroidKeyStoreTest.java b/keystore/tests/src/android/security/AndroidKeyStoreTest.java index 49e2f1289ae7..c376f3da248d 100644 --- a/keystore/tests/src/android/security/AndroidKeyStoreTest.java +++ b/keystore/tests/src/android/security/AndroidKeyStoreTest.java @@ -51,6 +51,9 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; import javax.security.auth.x500.X500Principal; public class AndroidKeyStoreTest extends AndroidTestCase { @@ -577,17 +580,14 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertAliases(new String[] { }); } - public void testKeyStore_DeleteEntry_EmptyStore_Failure() throws Exception { + public void testKeyStore_DeleteEntry_EmptyStore_Success() throws Exception { mKeyStore.load(null, null); - try { - mKeyStore.deleteEntry(TEST_ALIAS_1); - fail("Should throw KeyStoreException with non-existent alias"); - } catch (KeyStoreException success) { - } + // Should not throw when a non-existent entry is requested for delete. + mKeyStore.deleteEntry(TEST_ALIAS_1); } - public void testKeyStore_DeleteEntry_NonExistent_Failure() throws Exception { + public void testKeyStore_DeleteEntry_NonExistent_Success() throws Exception { mKeyStore.load(null, null); // TEST_ALIAS_1 @@ -596,11 +596,8 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertTrue(mAndroidKeyStore.put(Credentials.USER_CERTIFICATE + TEST_ALIAS_1, FAKE_USER_1)); assertTrue(mAndroidKeyStore.put(Credentials.CA_CERTIFICATE + TEST_ALIAS_1, FAKE_CA_1)); - try { - mKeyStore.deleteEntry(TEST_ALIAS_2); - fail("Should throw KeyStoreException with non-existent alias"); - } catch (KeyStoreException success) { - } + // Should not throw when a non-existent entry is requested for delete. + mKeyStore.deleteEntry(TEST_ALIAS_2); } public void testKeyStore_GetCertificate_Single_Success() throws Exception { @@ -1551,4 +1548,49 @@ public class AndroidKeyStoreTest extends AndroidTestCase { } catch (UnsupportedOperationException success) { } } + + private void setupKey() throws Exception { + final String privateKeyAlias = Credentials.USER_PRIVATE_KEY + TEST_ALIAS_1; + assertTrue(mAndroidKeyStore.generate(privateKeyAlias)); + + X509Certificate cert = generateCertificate(mAndroidKeyStore, TEST_ALIAS_1, TEST_SERIAL_1, + TEST_DN_1, NOW, NOW_PLUS_10_YEARS); + + assertTrue(mAndroidKeyStore.put(Credentials.USER_CERTIFICATE + TEST_ALIAS_1, + cert.getEncoded())); + } + + public void testKeyStore_KeyOperations_Wrap_Success() throws Exception { + mKeyStore.load(null, null); + + setupKey(); + + // Test key usage + Entry e = mKeyStore.getEntry(TEST_ALIAS_1, null); + assertNotNull(e); + assertTrue(e instanceof PrivateKeyEntry); + + PrivateKeyEntry privEntry = (PrivateKeyEntry) e; + PrivateKey privKey = privEntry.getPrivateKey(); + assertNotNull(privKey); + + PublicKey pubKey = privEntry.getCertificate().getPublicKey(); + + Cipher c = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + c.init(Cipher.WRAP_MODE, pubKey); + + byte[] expectedKey = new byte[] { + 0x00, 0x05, (byte) 0xAA, (byte) 0x0A5, (byte) 0xFF, 0x55, 0x0A + }; + + SecretKey expectedSecret = new SecretKeySpec(expectedKey, "AES"); + + byte[] wrappedExpected = c.wrap(expectedSecret); + + c.init(Cipher.UNWRAP_MODE, privKey); + SecretKey actualSecret = (SecretKey) c.unwrap(wrappedExpected, "AES", Cipher.SECRET_KEY); + + assertEquals(Arrays.toString(expectedSecret.getEncoded()), + Arrays.toString(actualSecret.getEncoded())); + } } diff --git a/libs/androidfw/Input.cpp b/libs/androidfw/Input.cpp index 97b0ec127b59..05b62bbb831f 100644 --- a/libs/androidfw/Input.cpp +++ b/libs/androidfw/Input.cpp @@ -221,7 +221,7 @@ status_t PointerCoords::readFromParcel(Parcel* parcel) { } for (uint32_t i = 0; i < count; i++) { - values[i] = parcel->readInt32(); + values[i] = parcel->readFloat(); } return OK; } @@ -231,7 +231,7 @@ status_t PointerCoords::writeToParcel(Parcel* parcel) const { uint32_t count = __builtin_popcountll(bits); for (uint32_t i = 0; i < count; i++) { - parcel->writeInt32(values[i]); + parcel->writeFloat(values[i]); } return OK; } diff --git a/media/java/android/mtp/MtpStorage.java b/media/java/android/mtp/MtpStorage.java index 9cf65a373dcd..e20eabcb4790 100644 --- a/media/java/android/mtp/MtpStorage.java +++ b/media/java/android/mtp/MtpStorage.java @@ -39,7 +39,7 @@ public class MtpStorage { mStorageId = volume.getStorageId(); mPath = volume.getPath(); mDescription = context.getResources().getString(volume.getDescriptionId()); - mReserveSpace = volume.getMtpReserveSpace() * 1024 * 1024; + mReserveSpace = volume.getMtpReserveSpace() * 1024L * 1024L; mRemovable = volume.isRemovable(); mMaxFileSize = volume.getMaxFileSize(); } diff --git a/packages/InputDevices/res/raw/keyboard_layout_english_uk.kcm b/packages/InputDevices/res/raw/keyboard_layout_english_uk.kcm new file mode 100644 index 000000000000..6d9c2e59269b --- /dev/null +++ b/packages/InputDevices/res/raw/keyboard_layout_english_uk.kcm @@ -0,0 +1,331 @@ +# Copyright (C) 2012 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# English (UK) keyboard layout. +# + +type OVERLAY + +map key 43 POUND + +### ROW 1 + +key GRAVE { + label: '`' + base: '`' + shift: '\u00AC' + ralt: '\u00A6' +} + +key 1 { + label: '1' + base: '1' + shift: '!' +} + +key 2 { + label: '2' + base: '2' + shift: '"' +} + +key 3 { + label: '3' + base: '3' + shift: '\u00A3' +} + +key 4 { + label: '4' + base: '4' + shift: '$' + ralt: '\u20AC' +} + +key 5 { + label: '5' + base: '5' + shift: '%' +} + +key 6 { + label: '6' + base: '6' + shift: '^' +} + +key 7 { + label: '7' + base: '7' + shift: '&' +} + +key 8 { + label: '8' + base: '8' + shift: '*' +} + +key 9 { + label: '9' + base: '9' + shift: '(' +} + +key 0 { + label: '0' + base: '0' + shift: ')' +} + +key MINUS { + label: '-' + base: '-' + shift: '_' +} + +key EQUALS { + label: '=' + base: '=' + shift: '+' +} + +### ROW 2 + +key Q { + label: 'Q' + base: 'q' + shift, capslock: 'Q' +} + +key W { + label: 'W' + base: 'w' + shift, capslock: 'W' +} + +key E { + label: 'E' + base: 'e' + shift, capslock: 'E' + ralt: '\u00e9' + shift+ralt: '\u00c9' +} + +key R { + label: 'R' + base: 'r' + shift, capslock: 'R' +} + +key T { + label: 'T' + base: 't' + shift, capslock: 'T' +} + +key Y { + label: 'Y' + base: 'y' + shift, capslock: 'Y' +} + +key U { + label: 'U' + base: 'u' + shift, capslock: 'U' + ralt: '\u00fa' + shift+ralt: '\u00da' +} + +key I { + label: 'I' + base: 'i' + shift, capslock: 'I' + ralt: '\u00ed' + shift+ralt: '\u00cd' +} + +key O { + label: 'O' + base: 'o' + shift, capslock: 'O' + ralt: '\u00f3' + shift+ralt: '\u00d3' +} + +key P { + label: 'P' + base: 'p' + shift, capslock: 'P' +} + +key LEFT_BRACKET { + label: '[' + base: '[' + shift: '{' +} + +key RIGHT_BRACKET { + label: ']' + base: ']' + shift: '}' +} + +### ROW 3 + +key A { + label: 'A' + base: 'a' + shift, capslock: 'A' + ralt: '\u00e1' + shift+ralt: '\u00c1' +} + +key S { + label: 'S' + base: 's' + shift, capslock: 'S' +} + +key D { + label: 'D' + base: 'd' + shift, capslock: 'D' +} + +key F { + label: 'F' + base: 'f' + shift, capslock: 'F' +} + +key G { + label: 'G' + base: 'g' + shift, capslock: 'G' +} + +key H { + label: 'H' + base: 'h' + shift, capslock: 'H' +} + +key J { + label: 'J' + base: 'j' + shift, capslock: 'J' +} + +key K { + label: 'K' + base: 'k' + shift, capslock: 'K' +} + +key L { + label: 'L' + base: 'l' + shift, capslock: 'L' +} + +key SEMICOLON { + label: ';' + base: ';' + shift: ':' +} + +key APOSTROPHE { + label: '\'' + base: '\'' + shift: '@' +} + +key POUND { + label: '#' + base: '#' + shift: '~' + ralt: '\\' + shift+ralt: '|' +} + +### ROW 4 + +key BACKSLASH { + label: '\\' + base: '\\' + shift: '|' +} + +key Z { + label: 'Z' + base: 'z' + shift, capslock: 'Z' +} + +key X { + label: 'X' + base: 'x' + shift, capslock: 'X' +} + +key C { + label: 'C' + base: 'c' + shift, capslock: 'C' +} + +key V { + label: 'V' + base: 'v' + shift, capslock: 'V' +} + +key B { + label: 'B' + base: 'b' + shift, capslock: 'B' +} + +key N { + label: 'N' + base: 'n' + shift, capslock: 'N' +} + +key M { + label: 'M' + base: 'm' + shift, capslock: 'M' +} + +key COMMA { + label: ',' + base: ',' + shift: '<' +} + +key PERIOD { + label: '.' + base: '.' + shift: '>' +} + +key SLASH { + label: '/' + base: '/' + shift: '?' +} diff --git a/packages/InputDevices/res/values/strings.xml b/packages/InputDevices/res/values/strings.xml index c13e606f816b..65d33047afa5 100644 --- a/packages/InputDevices/res/values/strings.xml +++ b/packages/InputDevices/res/values/strings.xml @@ -6,6 +6,9 @@ <!-- Keyboard layouts label, used to describe the set of all built-in layouts in the UI. [CHAR LIMIT=35] --> <string name="keyboard_layouts_label">Android keyboard</string> + <!-- UK English keyboard layout label. [CHAR LIMIT=35] --> + <string name="keyboard_layout_english_uk_label">English (UK)</string> + <!-- US English keyboard layout label. [CHAR LIMIT=35] --> <string name="keyboard_layout_english_us_label">English (US)</string> diff --git a/packages/InputDevices/res/xml/keyboard_layouts.xml b/packages/InputDevices/res/xml/keyboard_layouts.xml index c2a2ecc00df5..3cfa1709c5e3 100644 --- a/packages/InputDevices/res/xml/keyboard_layouts.xml +++ b/packages/InputDevices/res/xml/keyboard_layouts.xml @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android"> + <keyboard-layout android:name="keyboard_layout_english_uk" + android:label="@string/keyboard_layout_english_uk_label" + android:keyboardLayout="@raw/keyboard_layout_english_uk" /> + <keyboard-layout android:name="keyboard_layout_english_us" android:label="@string/keyboard_layout_english_us_label" android:keyboardLayout="@raw/keyboard_layout_english_us" /> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 7864ec2747a6..e7e0818cad00 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -109,7 +109,6 @@ public class DatabaseHelper extends SQLiteOpenHelper { super(context, dbNameForUser(userHandle), null, DATABASE_VERSION); mContext = context; mUserHandle = userHandle; - setWriteAheadLoggingEnabled(true); } public static boolean isValidTable(String name) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java index 1d6b3d116f83..a7baebe7a8c4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java @@ -43,7 +43,8 @@ public class DateView extends TextView { final String action = intent.getAction(); if (Intent.ACTION_TIME_TICK.equals(action) || Intent.ACTION_TIME_CHANGED.equals(action) - || Intent.ACTION_TIMEZONE_CHANGED.equals(action)) { + || Intent.ACTION_TIMEZONE_CHANGED.equals(action) + || Intent.ACTION_LOCALE_CHANGED.equals(action)) { updateClock(); } } @@ -116,6 +117,7 @@ public class DateView extends TextView { filter.addAction(Intent.ACTION_TIME_TICK); filter.addAction(Intent.ACTION_TIME_CHANGED); filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); + filter.addAction(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiver(mIntentReceiver, filter, null, null); updateClock(); } else { diff --git a/services/java/com/android/server/display/LocalDisplayAdapter.java b/services/java/com/android/server/display/LocalDisplayAdapter.java index b37d57fbb0ff..ee2d617944a9 100644 --- a/services/java/com/android/server/display/LocalDisplayAdapter.java +++ b/services/java/com/android/server/display/LocalDisplayAdapter.java @@ -60,31 +60,38 @@ final class LocalDisplayAdapter extends DisplayAdapter { super.registerLocked(); mHotplugReceiver = new HotplugDisplayEventReceiver(getHandler().getLooper()); - scanDisplaysLocked(); - } - private void scanDisplaysLocked() { for (int builtInDisplayId : BUILT_IN_DISPLAY_IDS_TO_SCAN) { - IBinder displayToken = Surface.getBuiltInDisplay(builtInDisplayId); - if (displayToken != null && Surface.getDisplayInfo(displayToken, mTempPhys)) { - LocalDisplayDevice device = mDevices.get(builtInDisplayId); - if (device == null) { - // Display was added. - device = new LocalDisplayDevice(displayToken, builtInDisplayId, mTempPhys); - mDevices.put(builtInDisplayId, device); - sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_ADDED); - } else if (device.updatePhysicalDisplayInfoLocked(mTempPhys)) { - // Display properties changed. - sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED); - } - } else { - LocalDisplayDevice device = mDevices.get(builtInDisplayId); - if (device != null) { - // Display was removed. - mDevices.remove(builtInDisplayId); - sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_REMOVED); - } + tryConnectDisplayLocked(builtInDisplayId); + } + } + + private void tryConnectDisplayLocked(int builtInDisplayId) { + IBinder displayToken = Surface.getBuiltInDisplay(builtInDisplayId); + if (displayToken != null && Surface.getDisplayInfo(displayToken, mTempPhys)) { + LocalDisplayDevice device = mDevices.get(builtInDisplayId); + if (device == null) { + // Display was added. + device = new LocalDisplayDevice(displayToken, builtInDisplayId, mTempPhys); + mDevices.put(builtInDisplayId, device); + sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_ADDED); + } else if (device.updatePhysicalDisplayInfoLocked(mTempPhys)) { + // Display properties changed. + sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED); } + } else { + // The display is no longer available. Ignore the attempt to add it. + // If it was connected but has already been disconnected, we'll get a + // disconnect event that will remove it from mDevices. + } + } + + private void tryDisconnectDisplayLocked(int builtInDisplayId) { + LocalDisplayDevice device = mDevices.get(builtInDisplayId); + if (device != null) { + // Display was removed. + mDevices.remove(builtInDisplayId); + sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_REMOVED); } } @@ -191,7 +198,11 @@ final class LocalDisplayAdapter extends DisplayAdapter { @Override public void onHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { synchronized (getSyncRoot()) { - scanDisplaysLocked(); + if (connected) { + tryConnectDisplayLocked(builtInDisplayId); + } else { + tryDisconnectDisplayLocked(builtInDisplayId); + } } } } diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java index c272da4b420f..22c52f43f376 100644 --- a/services/java/com/android/server/location/GpsLocationProvider.java +++ b/services/java/com/android/server/location/GpsLocationProvider.java @@ -1464,7 +1464,8 @@ public class GpsLocationProvider implements LocationProviderInterface { if (networkType == TelephonyManager.NETWORK_TYPE_UMTS || networkType == TelephonyManager.NETWORK_TYPE_HSDPA || networkType == TelephonyManager.NETWORK_TYPE_HSUPA - || networkType == TelephonyManager.NETWORK_TYPE_HSPA) { + || networkType == TelephonyManager.NETWORK_TYPE_HSPA + || networkType == TelephonyManager.NETWORK_TYPE_HSPAP) { type = AGPS_REF_LOCATION_TYPE_UMTS_CELLID; } else { type = AGPS_REF_LOCATION_TYPE_GSM_CELLID; diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java index e2da53ee45dc..3ed9cef5a1d5 100644 --- a/telephony/java/android/telephony/SignalStrength.java +++ b/telephony/java/android/telephony/SignalStrength.java @@ -335,7 +335,7 @@ public class SignalStrength implements Parcelable { mCdmaEcio = (mCdmaEcio > 0) ? -mCdmaEcio : -160; mEvdoDbm = (mEvdoDbm > 0) ? -mEvdoDbm : -120; - mEvdoEcio = (mEvdoEcio > 0) ? -mEvdoEcio : -1; + mEvdoEcio = (mEvdoEcio >= 0) ? -mEvdoEcio : -1; mEvdoSnr = ((mEvdoSnr > 0) && (mEvdoSnr <= 8)) ? mEvdoSnr : -1; // TS 36.214 Physical Layer Section 5.1.3, TS 36.331 RRC diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java index 5e25623a1126..7a9f1062cfa7 100644 --- a/wifi/java/android/net/wifi/WifiNative.java +++ b/wifi/java/android/net/wifi/WifiNative.java @@ -42,7 +42,7 @@ public class WifiNative { private static final boolean DBG = false; private final String mTAG; - private static final int DEFAULT_GROUP_OWNER_INTENT = 7; + private static final int DEFAULT_GROUP_OWNER_INTENT = 6; static final int BLUETOOTH_COEXISTENCE_MODE_ENABLED = 0; static final int BLUETOOTH_COEXISTENCE_MODE_DISABLED = 1; diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 8a22e966879b..2d9cc2945465 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -2358,7 +2358,7 @@ public class WifiStateMachine extends StateMachine { if (!mWifiNative.setSerialNumber(detail)) { loge("Failed to set serial number " + detail); } - if (!mWifiNative.setConfigMethods("physical_display virtual_push_button keypad")) { + if (!mWifiNative.setConfigMethods("physical_display virtual_push_button")) { loge("Failed to set WPS config methods"); } if (!mWifiNative.setDeviceType(mPrimaryDeviceType)) { |