diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/accessibilityservice/AccessibilityService.java | 7 | ||||
| -rw-r--r-- | core/java/android/app/FragmentManager.java | 2 | ||||
| -rw-r--r-- | core/java/android/app/StatusBarManager.java | 42 | ||||
| -rw-r--r-- | core/java/android/net/SSLCertificateSocketFactory.java | 36 | ||||
| -rw-r--r-- | core/java/android/net/http/AndroidHttpClient.java | 33 | ||||
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 28 | ||||
| -rw-r--r-- | core/java/android/widget/ProgressBar.java | 14 |
7 files changed, 135 insertions, 27 deletions
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index 81ee192..b0bad07 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -323,7 +323,7 @@ public abstract class AccessibilityService extends Service { public static final int GLOBAL_ACTION_HOME = 2; /** - * Action to open the recents. + * Action to open the recent apps. */ public static final int GLOBAL_ACTION_RECENTS = 3; @@ -332,6 +332,11 @@ public abstract class AccessibilityService extends Service { */ public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; + /** + * Action to open the quick settings. + */ + public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; + private static final String LOG_TAG = "AccessibilityService"; interface Callbacks { diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 7f11437..aad5487 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -776,7 +776,7 @@ final class FragmentManagerImpl extends FragmentManager { // + " mRemoving=" + f.mRemoving + " Callers=" + Debug.getCallers(5)); // Fragments that are not currently added will sit in the onCreate() state. - if (!f.mAdded && newState > Fragment.CREATED) { + if ((!f.mAdded || f.mDetached) && newState > Fragment.CREATED) { newState = Fragment.CREATED; } if (f.mRemoving && newState > f.mState) { diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index dd9f337..1e61e10 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -97,13 +97,13 @@ public class StatusBarManager { } /** - * Expand the status bar. + * Expand the notifications. */ - public void expand() { + public void expandNotifications() { try { final IStatusBarService svc = getService(); if (svc != null) { - svc.expand(); + svc.expandNotifications(); } } catch (RemoteException ex) { // system process is dead anyway. @@ -112,13 +112,43 @@ public class StatusBarManager { } /** - * Collapse the status bar. + * Collapse the notifications. */ - public void collapse() { + public void collapseNotifications() { try { final IStatusBarService svc = getService(); if (svc != null) { - svc.collapse(); + svc.collapseNotifications(); + } + } catch (RemoteException ex) { + // system process is dead anyway. + throw new RuntimeException(ex); + } + } + + /** + * Expand the quick settings. + */ + public void expandQuickSettings() { + try { + final IStatusBarService svc = getService(); + if (svc != null) { + svc.expandQuickSettings(); + } + } catch (RemoteException ex) { + // system process is dead anyway. + throw new RuntimeException(ex); + } + } + + /** + * Collapse the quick settings. + */ + public void collapseQuickSettings() { + try { + final IStatusBarService svc = getService(); + if (svc != null) { + svc.collapseQuickSettings(); } } catch (RemoteException ex) { // system process is dead anyway. diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java index 543f6a1..42fb5c3 100644 --- a/core/java/android/net/SSLCertificateSocketFactory.java +++ b/core/java/android/net/SSLCertificateSocketFactory.java @@ -90,6 +90,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { private byte[] mNpnProtocols = null; private final int mHandshakeTimeoutMillis; + private final int mWriteTimeoutMillis; private final SSLClientSessionCache mSessionCache; private final boolean mSecure; @@ -100,12 +101,21 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { } private SSLCertificateSocketFactory( - int handshakeTimeoutMillis, SSLSessionCache cache, boolean secure) { + int handshakeTimeoutMillis, + int writeTimeoutMillis, + SSLSessionCache cache, + boolean secure) { mHandshakeTimeoutMillis = handshakeTimeoutMillis; + mWriteTimeoutMillis = writeTimeoutMillis; mSessionCache = cache == null ? null : cache.mSessionCache; mSecure = secure; } + private SSLCertificateSocketFactory( + int handshakeTimeoutMillis, SSLSessionCache cache, boolean secure) { + this(handshakeTimeoutMillis, 0, cache, secure); + } + /** * Returns a new socket factory instance with an optional handshake timeout. * @@ -162,6 +172,24 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { } /** + * Returns a socket factory (also named SSLSocketFactory, but in a different + * namespace) for use with the Apache HTTP stack. + * + * @param handshakeTimeoutMillis to use for SSL connection handshake, or 0 + * for none. The socket timeout is reset to 0 after the handshake. + * @param writeTimeoutMillis the desired write timeout in milliseconds or 0 for none. + * @param cache The {@link SSLSessionCache} to use, or null for no cache. + * @return a new SocketFactory with the specified parameters + */ + public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory( + int handshakeTimeoutMillis, + int writeTimeoutMillis, + SSLSessionCache cache) { + return new org.apache.http.conn.ssl.SSLSocketFactory(new SSLCertificateSocketFactory( + handshakeTimeoutMillis, writeTimeoutMillis, cache, true)); + } + + /** * Verify the hostname of the certificate used by the other end of a * connected socket. You MUST call this if you did not supply a hostname * to {@link #createSocket()}. It is harmless to call this method @@ -376,6 +404,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(k, host, port, close); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setSoWriteTimeout(mWriteTimeoutMillis); if (mSecure) { verifyHostname(s, host); } @@ -395,6 +424,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setSoWriteTimeout(mWriteTimeoutMillis); return s; } @@ -412,6 +442,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { addr, port, localAddr, localPort); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setSoWriteTimeout(mWriteTimeoutMillis); return s; } @@ -427,6 +458,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(addr, port); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setSoWriteTimeout(mWriteTimeoutMillis); return s; } @@ -443,6 +475,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { host, port, localAddr, localPort); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setSoWriteTimeout(mWriteTimeoutMillis); if (mSecure) { verifyHostname(s, host); } @@ -460,6 +493,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(host, port); s.setNpnProtocols(mNpnProtocols); s.setHandshakeTimeout(mHandshakeTimeoutMillis); + s.setSoWriteTimeout(mWriteTimeoutMillis); if (mSecure) { verifyHostname(s, host); } diff --git a/core/java/android/net/http/AndroidHttpClient.java b/core/java/android/net/http/AndroidHttpClient.java index c534e58..8169a94 100644 --- a/core/java/android/net/http/AndroidHttpClient.java +++ b/core/java/android/net/http/AndroidHttpClient.java @@ -16,7 +16,16 @@ package android.net.http; +import android.content.ContentResolver; +import android.content.Context; +import android.net.SSLCertificateSocketFactory; +import android.net.SSLSessionCache; +import android.os.Looper; +import android.util.Base64; +import android.util.Log; + import com.android.internal.http.HttpDateTime; + import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpEntityEnclosingRequest; @@ -25,18 +34,18 @@ import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpResponse; -import org.apache.http.entity.AbstractHttpEntity; -import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.protocol.ClientContext; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.params.HttpClientParams; +import org.apache.http.client.protocol.ClientContext; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.scheme.PlainSocketFactory; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.entity.AbstractHttpEntity; +import org.apache.http.entity.ByteArrayEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.RequestWrapper; import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; @@ -44,25 +53,17 @@ import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; +import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.BasicHttpProcessor; import org.apache.http.protocol.HttpContext; -import org.apache.http.protocol.BasicHttpContext; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.ByteArrayOutputStream; import java.io.OutputStream; +import java.net.URI; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; -import java.net.URI; - -import android.content.Context; -import android.content.ContentResolver; -import android.net.SSLCertificateSocketFactory; -import android.net.SSLSessionCache; -import android.os.Looper; -import android.util.Base64; -import android.util.Log; /** * Implementation of the Apache {@link DefaultHttpClient} that is configured with @@ -134,7 +135,7 @@ public final class AndroidHttpClient implements HttpClient { PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", SSLCertificateSocketFactory.getHttpSocketFactory( - SOCKET_OPERATION_TIMEOUT, sessionCache), 443)); + SOCKET_OPERATION_TIMEOUT, SOCKET_OPERATION_TIMEOUT, sessionCache), 443)); ClientConnectionManager manager = new ThreadSafeClientConnManager(params, schemeRegistry); diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 920d44f..6264315 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -675,6 +675,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te static final Interpolator sLinearInterpolator = new LinearInterpolator(); /** + * The saved state that we will be restoring from when we next sync. + * Kept here so that if we happen to be asked to save our state before + * the sync happens, we can return this existing data rather than losing + * it. + */ + private SavedState mPendingSync; + + /** * Interface definition for a callback to be invoked when the list or grid * has been scrolled. */ @@ -1612,6 +1620,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te SavedState ss = new SavedState(superState); + if (mPendingSync != null) { + // Just keep what we last restored. + ss.selectedId = mPendingSync.selectedId; + ss.firstId = mPendingSync.firstId; + ss.viewTop = mPendingSync.viewTop; + ss.position = mPendingSync.position; + ss.height = mPendingSync.height; + ss.filter = mPendingSync.filter; + ss.inActionMode = mPendingSync.inActionMode; + ss.checkedItemCount = mPendingSync.checkedItemCount; + ss.checkState = mPendingSync.checkState; + ss.checkIdState = mPendingSync.checkIdState; + return ss; + } + boolean haveChildren = getChildCount() > 0 && mItemCount > 0; long selectedId = getSelectedItemId(); ss.selectedId = selectedId; @@ -1692,6 +1715,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (ss.selectedId >= 0) { mNeedSync = true; + mPendingSync = ss; mSyncRowId = ss.selectedId; mSyncPosition = ss.position; mSpecificTop = ss.viewTop; @@ -1702,6 +1726,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te setNextSelectedPositionInt(INVALID_POSITION); mSelectorPosition = INVALID_POSITION; mNeedSync = true; + mPendingSync = ss; mSyncRowId = ss.firstId; mSyncPosition = ss.position; mSpecificTop = ss.viewTop; @@ -1803,6 +1828,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mDataChanged = false; mPositionScrollAfterLayout = null; mNeedSync = false; + mPendingSync = null; mOldSelectedPosition = INVALID_POSITION; mOldSelectedRowId = INVALID_ROW_ID; setSelectedPositionInt(INVALID_POSITION); @@ -5209,6 +5235,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (mNeedSync) { // Update this first, since setNextSelectedPositionInt inspects it mNeedSync = false; + mPendingSync = null; if (mTranscriptMode == TRANSCRIPT_MODE_ALWAYS_SCROLL) { mLayoutMode = LAYOUT_FORCE_BOTTOM; @@ -5324,6 +5351,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mNextSelectedPosition = INVALID_POSITION; mNextSelectedRowId = INVALID_ROW_ID; mNeedSync = false; + mPendingSync = null; mSelectorPosition = INVALID_POSITION; checkSelectionChanged(); } diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index 6afaba3..ea50e2e 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -354,7 +354,7 @@ public class ProgressBar extends View { Shader.TileMode.REPEAT, Shader.TileMode.CLAMP); shapeDrawable.getPaint().setShader(bitmapShader); - return (clip) ? new ClipDrawable(shapeDrawable, Gravity.START, + return (clip) ? new ClipDrawable(shapeDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL) : shapeDrawable; } @@ -1040,6 +1040,11 @@ public class ProgressBar extends View { } } } + if (isLayoutRtl()) { + int tempLeft = left; + left = w - right; + right = w - tempLeft; + } mIndeterminateDrawable.setBounds(left, top, right, bottom); } @@ -1057,7 +1062,12 @@ public class ProgressBar extends View { // Translate canvas so a indeterminate circular progress bar with padding // rotates properly in its animation canvas.save(); - canvas.translate(mPaddingLeft, mPaddingTop); + if(isLayoutRtl()) { + canvas.translate(getWidth() - mPaddingRight, mPaddingTop); + canvas.scale(-1.0f, 1.0f); + } else { + canvas.translate(mPaddingLeft, mPaddingTop); + } long time = getDrawingTime(); if (mHasAnimation) { mAnimation.getTransformation(time, mTransformation); |
