diff options
37 files changed, 361 insertions, 206 deletions
diff --git a/api/current.txt b/api/current.txt index 57fedce..f8329f2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2066,6 +2066,7 @@ package android.accessibilityservice { field public static final int GLOBAL_ACTION_BACK = 1; // 0x1 field public static final int GLOBAL_ACTION_HOME = 2; // 0x2 field public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; // 0x4 + field public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; // 0x5 field public static final int GLOBAL_ACTION_RECENTS = 3; // 0x3 field public static final java.lang.String SERVICE_INTERFACE = "android.accessibilityservice.AccessibilityService"; field public static final java.lang.String SERVICE_META_DATA = "android.accessibilityservice"; @@ -12744,6 +12745,7 @@ package android.net { method public static javax.net.ssl.SSLSocketFactory getDefault(int, android.net.SSLSessionCache); method public java.lang.String[] getDefaultCipherSuites(); method public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache); + method public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, int, android.net.SSLSessionCache); method public static javax.net.ssl.SSLSocketFactory getInsecure(int, android.net.SSLSessionCache); method public byte[] getNpnSelectedProtocol(java.net.Socket); method public java.lang.String[] getSupportedCipherSuites(); 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); diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 294d4c4..0737b52 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -28,8 +28,10 @@ oneway interface IStatusBar void updateNotification(IBinder key, in StatusBarNotification notification); void removeNotification(IBinder key); void disable(int state); - void animateExpand(); - void animateCollapse(); + void animateExpandNotifications(); + void animateCollapseNotifications(); + void animateExpandQuickSettings(); + void animateCollapseQuickSettings(); void setSystemUiVisibility(int vis, int mask); void topAppWindowChanged(boolean menuVisible); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index c64f170..60e2b34 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -24,8 +24,10 @@ import com.android.internal.statusbar.StatusBarNotification; /** @hide */ interface IStatusBarService { - void expand(); - void collapse(); + void expandNotifications(); + void collapseNotifications(); + void expandQuickSettings(); + void collapseQuickSettings(); void disable(int what, IBinder token, String pkg); void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); void setIconVisibility(String slot, boolean visible); diff --git a/core/res/res/drawable/progress_horizontal_holo_dark.xml b/core/res/res/drawable/progress_horizontal_holo_dark.xml index bc1ecf3..ff270b3 100644 --- a/core/res/res/drawable/progress_horizontal_holo_dark.xml +++ b/core/res/res/drawable/progress_horizontal_holo_dark.xml @@ -21,13 +21,11 @@ <item android:id="@android:id/secondaryProgress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/progress_secondary_holo_dark" /> </item> <item android:id="@android:id/progress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/progress_primary_holo_dark" /> </item> diff --git a/core/res/res/drawable/progress_horizontal_holo_light.xml b/core/res/res/drawable/progress_horizontal_holo_light.xml index ee9b629..4935185 100644 --- a/core/res/res/drawable/progress_horizontal_holo_light.xml +++ b/core/res/res/drawable/progress_horizontal_holo_light.xml @@ -21,13 +21,11 @@ <item android:id="@android:id/secondaryProgress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/progress_secondary_holo_light" /> </item> <item android:id="@android:id/progress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/progress_primary_holo_light" /> </item> diff --git a/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml b/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml index 4d83191..97cd513 100644 --- a/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml +++ b/core/res/res/drawable/scrubber_progress_horizontal_holo_dark.xml @@ -19,12 +19,10 @@ android:drawable="@android:drawable/scrubber_track_holo_dark" /> <item android:id="@android:id/secondaryProgress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/scrubber_secondary_holo" /> </item> <item android:id="@android:id/progress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/scrubber_primary_holo" /> </item> </layer-list> diff --git a/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml b/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml index a3461fa..14e19f4 100644 --- a/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml +++ b/core/res/res/drawable/scrubber_progress_horizontal_holo_light.xml @@ -19,12 +19,10 @@ android:drawable="@android:drawable/scrubber_track_holo_light" /> <item android:id="@android:id/secondaryProgress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/scrubber_secondary_holo" /> </item> <item android:id="@android:id/progress"> <scale android:scaleWidth="100%" - android:scaleGravity="start" android:drawable="@android:drawable/scrubber_primary_holo" /> </item> </layer-list> diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd index 5f5484e..da410a4 100644 --- a/docs/html/guide/topics/resources/string-resource.jd +++ b/docs/html/guide/topics/resources/string-resource.jd @@ -13,8 +13,7 @@ your application with strings:</p> <dt><a href="#StringArray">String Array</a></dt> <dd>XML resource that provides an array of strings.</dd> <dt><a href="#Plurals">Quantity Strings (Plurals)</a></dt> - <dd>XML resource that carries different strings for different quantities - of the same word or phrase.</dd> + <dd>XML resource that carries different strings for pluralization.</dd> </dl> <p>All strings are capable of applying some styling markup and formatting arguments. For @@ -231,10 +230,19 @@ so Android provides you with methods such as {@link android.content.res.Resources#getQuantityString(int,int) getQuantityString()} to select the appropriate resource for you. -<p>Note that the selection is made based on grammatical necessity. A string for <code>zero</code> -in English will be ignored even if the quantity is 0, because 0 isn't grammatically different -from 2, or any other number except 1 ("zero books", "one book", "two books", and so on). -Don't be misled either by the fact that, say, <code>two</code> sounds like it could only apply to +<p>Although historically called "quantity strings" (and still called that in API), quantity +strings should <i>only</i> be used for plurals. It would be a mistake to use quantity strings to +implement something like Gmail's "Inbox" versus "Inbox (12)" when there are unread messages, for +example. It might seem convenient to use quantity strings instead of an {@code if} statement, +but it's important to note that some languages (such as Chinese) don't make these grammatical +distinctions at all, so you'll always get the <code>other</code> string. + +<p>The selection of which string to use is made solely based on grammatical <i>necessity</i>. +In English, a string for <code>zero</code> will be ignored even if the quantity is 0, because 0 +isn't grammatically different from 2, or any other number except 1 ("zero books", "one book", +"two books", and so on). + +<p>Don't be misled either by the fact that, say, <code>two</code> sounds like it could only apply to the quantity 2: a language may require that 2, 12, 102 (and so on) are all treated like one another but differently to other quantities. Rely on your translator to know what distinctions their language actually insists upon. @@ -313,7 +321,7 @@ values, with non-exhaustive examples in parentheses: <td>{@code one}</td><td>When the language requires special treatment of numbers like one (as with the number 1 in English and most other languages; in Russian, any number ending in 1 but not ending in 11 is in this class).</td> </tr> <tr> - <td>{@code two}</td><td>When the language requires special treatment of numbers like two (as in Welsh).</td> + <td>{@code two}</td><td>When the language requires special treatment of numbers like two (as with 2 in Welsh, or 102 in Slovenian).</td> </tr> <tr> <td>{@code few}</td><td>When the language requires special treatment of "small" numbers (as with 2, 3, and 4 in Czech; or numbers ending 2, 3, or 4 but not 12, 13, or 14 in Polish).</td> @@ -322,7 +330,7 @@ values, with non-exhaustive examples in parentheses: <td>{@code many}</td><td>When the language requires special treatment of "large" numbers (as with numbers ending 11-99 in Maltese).</td> </tr> <tr> - <td>{@code other}</td><td>When the language does not require special treatment of the given quantity.</td> + <td>{@code other}</td><td>When the language does not require special treatment of the given quantity (as with all numbers in Chinese, or 42 in English).</td> </tr> </table> </dd> diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index fb525ee..cd2e571 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -19,6 +19,7 @@ #include <utils/Log.h> #include "Layer.h" +#include "LayerRenderer.h" #include "OpenGLRenderer.h" #include "Caches.h" @@ -46,15 +47,12 @@ Layer::~Layer() { if (mesh) delete mesh; if (meshIndices) delete meshIndices; if (colorFilter) Caches::getInstance().resourceCache.decrementRefcount(colorFilter); - if (fbo) Caches::getInstance().fboCache.put(fbo); - deleteTexture(); -} - -void Layer::freeResourcesLocked() { - if (colorFilter) { - Caches::getInstance().resourceCache.decrementRefcountLocked(colorFilter); - colorFilter = NULL; + if (fbo) { + LayerRenderer::flushLayer(this); + Caches::getInstance().fboCache.put(fbo); + fbo = 0; } + deleteTexture(); } void Layer::setPaint(SkPaint* paint) { @@ -71,7 +69,5 @@ void Layer::setColorFilter(SkiaColorFilter* filter) { } } - - }; // namespace uirenderer }; // namespace android diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h index 9b6205d..59c66d7 100644 --- a/libs/hwui/Layer.h +++ b/libs/hwui/Layer.h @@ -48,8 +48,6 @@ struct Layer { Layer(const uint32_t layerWidth, const uint32_t layerHeight); ~Layer(); - void freeResourcesLocked(); - /** * Sets this layer's region to a rectangle. Computes the appropriate * texture coordinates. diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index 799aea3..c581041 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -299,13 +299,6 @@ void LayerRenderer::destroyLayer(Layer* layer) { LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d", layer->getWidth(), layer->getHeight(), layer->getFbo()); - GLuint fbo = layer->getFbo(); - if (fbo) { - flushLayer(layer); - Caches::getInstance().fboCache.put(fbo); - layer->setFbo(0); - } - if (!Caches::getInstance().layerCache.put(layer)) { LAYER_RENDERER_LOGD(" Destroyed!"); Caches::getInstance().resourceCache.decrementRefcount(layer); @@ -322,7 +315,6 @@ void LayerRenderer::destroyLayer(Layer* layer) { void LayerRenderer::destroyLayerDeferred(Layer* layer) { if (layer) { LAYER_RENDERER_LOGD("Deferring layer destruction, fbo = %d", layer->getFbo()); - Caches::getInstance().deleteLayerDeferred(layer); } } diff --git a/libs/hwui/LayerRenderer.h b/libs/hwui/LayerRenderer.h index 392f863..acedbcc 100644 --- a/libs/hwui/LayerRenderer.h +++ b/libs/hwui/LayerRenderer.h @@ -60,6 +60,8 @@ public: ANDROID_API static void destroyLayerDeferred(Layer* layer); ANDROID_API static bool copyLayer(Layer* layer, SkBitmap* bitmap); + static void flushLayer(Layer* layer); + protected: virtual bool hasLayer(); virtual Region* getRegion(); @@ -69,8 +71,6 @@ protected: private: void generateMesh(); - static void flushLayer(Layer* layer); - Layer* mLayer; }; // class LayerRenderer diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp index 18d8324..39e64bc 100644 --- a/libs/hwui/ResourceCache.cpp +++ b/libs/hwui/ResourceCache.cpp @@ -325,9 +325,9 @@ void ResourceCache::deleteResourceReferenceLocked(void* resource, ResourceRefere } break; case kLayer: { - Layer* layer = (Layer*) resource; - layer->freeResourcesLocked(); - delete layer; + // No need to check for hasInstance, layers only exist + // when we have a Caches instance + Caches::getInstance().deleteLayerDeferred((Layer*) resource); } break; } diff --git a/packages/SystemUI/res/values-sw720dp/dimens.xml b/packages/SystemUI/res/values-sw720dp/dimens.xml index 0015445..e42855c 100644 --- a/packages/SystemUI/res/values-sw720dp/dimens.xml +++ b/packages/SystemUI/res/values-sw720dp/dimens.xml @@ -75,8 +75,6 @@ <dimen name="status_bar_recents_text_fading_edge_length">20dip</dimen> <!-- Size of fading edge for scrolling --> <dimen name="status_bar_recents_scroll_fading_edge_length">10dip</dimen> - <!-- Margin between recents container and glow on the right --> - <dimen name="status_bar_recents_right_glow_margin">100dip</dimen> <!-- Where to place the app icon over the thumbnail --> <dimen name="status_bar_recents_app_icon_left_margin">0dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java index 281f25f..b0879fc 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java @@ -72,7 +72,7 @@ public class SearchPanelView extends FrameLayout implements private void startAssistActivity() { // Close Recent Apps if needed - mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL); + mBar.animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL); // Launch Assist Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(mContext, UserHandle.USER_CURRENT); @@ -220,7 +220,7 @@ public class SearchPanelView extends FrameLayout implements public void hide(boolean animate) { if (mBar != null) { // This will indirectly cause show(false, ...) to get called - mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + mBar.animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } else { setVisibility(View.INVISIBLE); } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java index 291f38c..7ff7b17 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java @@ -120,7 +120,7 @@ public class RecentsActivity extends Activity { if (mRecentsPanel != null) { final SystemUIApplication app = (SystemUIApplication) getApplication(); final RecentTasksLoader recentTasksLoader = app.getRecentTasksLoader(); - TaskDescription firstTask = recentTasksLoader.getFirstTask(); + TaskDescription firstTask = mRecentsPanel.getBottomTask(); if (firstTask != null && mRecentsPanel.simulateClick(firstTask)) { // recents panel will take care of calling show(false); return; diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index 5296ae9..005b4a2 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -488,6 +488,24 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener showIfReady(); } + public TaskDescription getBottomTask() { + if (mRecentsContainer != null) { + ViewGroup container = mRecentsContainer; + if (container instanceof RecentsScrollView) { + container = (ViewGroup) container.findViewById( + R.id.recents_linear_layout); + } + if (container.getChildCount() > 0) { + View v = container.getChildAt(container.getChildCount() - 1); + if (v.getTag() instanceof ViewHolder) { + ViewHolder h = (ViewHolder)v.getTag(); + return h.taskDescription; + } + } + } + return null; + } + public void clearRecentTasksList() { // Clear memory used by screenshots if (mRecentTaskDescriptions != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 6b75364..c1104d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -184,7 +184,7 @@ public abstract class BaseStatusBar extends SystemUI implements if (isActivity && handled) { // close the shade if it was open - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); } return handled; @@ -361,7 +361,7 @@ public abstract class BaseStatusBar extends SystemUI implements public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.notification_inspect_item) { startApplicationDetailsActivity(packageNameF); - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } else { return false; } @@ -793,7 +793,7 @@ public abstract class BaseStatusBar extends SystemUI implements } // close the shade if it was open - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); // If this click was on the intruder alert, hide that instead diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index a00d95a..39e49b8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -33,38 +33,30 @@ import com.android.internal.statusbar.StatusBarNotification; * are coalesced, note that they are all idempotent. */ public class CommandQueue extends IStatusBar.Stub { - private static final String TAG = "StatusBar.CommandQueue"; - private static final int INDEX_MASK = 0xffff; private static final int MSG_SHIFT = 16; private static final int MSG_MASK = 0xffff << MSG_SHIFT; - - private static final int MSG_ICON = 1 << MSG_SHIFT; private static final int OP_SET_ICON = 1; private static final int OP_REMOVE_ICON = 2; - private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; - private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; - private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; - - private static final int MSG_DISABLE = 5 << MSG_SHIFT; - - private static final int MSG_SET_VISIBILITY = 6 << MSG_SHIFT; - private static final int OP_EXPAND = 1; - private static final int OP_COLLAPSE = 2; - - private static final int MSG_SET_SYSTEMUI_VISIBILITY = 7 << MSG_SHIFT; - - private static final int MSG_TOP_APP_WINDOW_CHANGED = 8 << MSG_SHIFT; - private static final int MSG_SHOW_IME_BUTTON = 9 << MSG_SHIFT; - private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT; - - private static final int MSG_TOGGLE_RECENT_APPS = 11 << MSG_SHIFT; - private static final int MSG_PRELOAD_RECENT_APPS = 12 << MSG_SHIFT; - private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 13 << MSG_SHIFT; - - private static final int MSG_SET_NAVIGATION_ICON_HINTS = 14 << MSG_SHIFT; + private static final int MSG_ICON = 1 << MSG_SHIFT; + private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; + private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; + private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; + private static final int MSG_DISABLE = 5 << MSG_SHIFT; + private static final int MSG_EXPAND_NOTIFICATIONS = 6 << MSG_SHIFT; + private static final int MSG_COLLAPSE_NOTIFICATIONS = 7 << MSG_SHIFT; + private static final int MSG_EXPAND_QUICK_SETTINGS = 8 << MSG_SHIFT; + private static final int MSG_COLLAPSE_QUICK_SETTINGS = 9 << MSG_SHIFT; + private static final int MSG_SET_SYSTEMUI_VISIBILITY = 10 << MSG_SHIFT; + private static final int MSG_TOP_APP_WINDOW_CHANGED = 11 << MSG_SHIFT; + private static final int MSG_SHOW_IME_BUTTON = 12 << MSG_SHIFT; + private static final int MSG_SET_HARD_KEYBOARD_STATUS = 13 << MSG_SHIFT; + private static final int MSG_TOGGLE_RECENT_APPS = 14 << MSG_SHIFT; + private static final int MSG_PRELOAD_RECENT_APPS = 15 << MSG_SHIFT; + private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 16 << MSG_SHIFT; + private static final int MSG_SET_NAVIGATION_ICON_HINTS = 17 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; @@ -94,8 +86,10 @@ public class CommandQueue extends IStatusBar.Stub { public void updateNotification(IBinder key, StatusBarNotification notification); public void removeNotification(IBinder key); public void disable(int state); - public void animateExpand(); - public void animateCollapse(int flags); + public void animateExpandNotifications(); + public void animateCollapseNotifications(int flags); + public void animateExpandQuickSettings(); + public void animateCollapseQuickSettings(); public void setSystemUiVisibility(int vis, int mask); public void topAppWindowChanged(boolean visible); public void setImeWindowStatus(IBinder token, int vis, int backDisposition); @@ -160,21 +154,31 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void animateExpand() { + public void animateExpandNotifications() { + synchronized (mList) { + mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS); + mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS); + } + } + + public void animateCollapseNotifications() { synchronized (mList) { - mHandler.removeMessages(MSG_SET_VISIBILITY); - mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_EXPAND, 0, null).sendToTarget(); + mHandler.removeMessages(MSG_COLLAPSE_NOTIFICATIONS); + mHandler.sendEmptyMessage(MSG_COLLAPSE_NOTIFICATIONS); } } - public void animateCollapse() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + public void animateExpandQuickSettings() { + synchronized (mList) { + mHandler.removeMessages(MSG_EXPAND_QUICK_SETTINGS); + mHandler.sendEmptyMessage(MSG_EXPAND_QUICK_SETTINGS); + } } - public void animateCollapse(int flags) { + public void animateCollapseQuickSettings() { synchronized (mList) { - mHandler.removeMessages(MSG_SET_VISIBILITY); - mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, flags, null).sendToTarget(); + mHandler.removeMessages(MSG_COLLAPSE_QUICK_SETTINGS); + mHandler.sendEmptyMessage(MSG_COLLAPSE_QUICK_SETTINGS); } } @@ -284,12 +288,17 @@ public class CommandQueue extends IStatusBar.Stub { case MSG_DISABLE: mCallbacks.disable(msg.arg1); break; - case MSG_SET_VISIBILITY: - if (msg.arg1 == OP_EXPAND) { - mCallbacks.animateExpand(); - } else { - mCallbacks.animateCollapse(msg.arg2); - } + case MSG_EXPAND_NOTIFICATIONS: + mCallbacks.animateExpandNotifications(); + break; + case MSG_COLLAPSE_NOTIFICATIONS: + mCallbacks.animateCollapseNotifications(0); + break; + case MSG_EXPAND_QUICK_SETTINGS: + mCallbacks.animateExpandQuickSettings(); + break; + case MSG_COLLAPSE_QUICK_SETTINGS: + mCallbacks.animateCollapseQuickSettings(); break; case MSG_SET_SYSTEMUI_VISIBILITY: mCallbacks.setSystemUiVisibility(msg.arg1, msg.arg2); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 2f30a38..e6aa632 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; -import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import android.app.ActivityManager; import android.app.ActivityManagerNative; @@ -52,7 +51,6 @@ import android.util.Log; import android.util.Slog; import android.view.Display; import android.view.Gravity; -import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; @@ -77,7 +75,6 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.GestureRecorder; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationData.Entry; -import com.android.systemui.statusbar.RotationToggle; import com.android.systemui.statusbar.SignalClusterView; import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.policy.BatteryController; @@ -298,7 +295,7 @@ public class PhoneStatusBar extends BaseStatusBar { public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (mExpandedVisible && !mAnimating) { - animateCollapse(); + animateCollapseNotifications(); } } return mStatusBarWindow.onTouchEvent(event); @@ -780,7 +777,7 @@ public class PhoneStatusBar extends BaseStatusBar { } if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0 && !mAnimating) { - animateCollapse(); + animateCollapseNotifications(); } } @@ -1053,7 +1050,7 @@ public class PhoneStatusBar extends BaseStatusBar { } if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) { if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { - animateCollapse(); + animateCollapseNotifications(); } } @@ -1113,10 +1110,10 @@ public class PhoneStatusBar extends BaseStatusBar { super.handleMessage(m); switch (m.what) { case MSG_OPEN_NOTIFICATION_PANEL: - animateExpand(); + animateExpandNotifications(); break; case MSG_CLOSE_NOTIFICATION_PANEL: - animateCollapse(); + animateCollapseNotifications(); break; case MSG_SHOW_INTRUDER: setIntruderAlertVisibility(true); @@ -1169,11 +1166,11 @@ public class PhoneStatusBar extends BaseStatusBar { visibilityChanged(true); } - public void animateCollapse() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + public void animateCollapseNotifications() { + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } - public void animateCollapse(int flags) { + public void animateCollapseNotifications(int flags) { if (SPEW) { Slog.d(TAG, "animateCollapse():" + " mExpandedVisible=" + mExpandedVisible @@ -1198,7 +1195,7 @@ public class PhoneStatusBar extends BaseStatusBar { } @Override - public void animateExpand() { + public void animateExpandNotifications() { if (SPEW) Slog.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible); if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) { return ; @@ -1209,6 +1206,22 @@ public class PhoneStatusBar extends BaseStatusBar { if (false) postStartTracing(); } + @Override + public void animateExpandQuickSettings() { + if (SPEW) Slog.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible); + if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) { + return; + } + + mSettingsPanel.expand(); + + if (false) postStartTracing(); + } + + public void animateCollapseQuickSettings() { + mStatusBarView.collapseAllPanels(true); + } + void makeExpandedInvisible() { if (SPEW) Slog.d(TAG, "makeExpandedInvisible: mExpandedVisible=" + mExpandedVisible + " mExpandedVisible=" + mExpandedVisible); @@ -1338,7 +1351,7 @@ public class PhoneStatusBar extends BaseStatusBar { if (0 != (diff & View.SYSTEM_UI_FLAG_LOW_PROFILE)) { final boolean lightsOut = (0 != (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE)); if (lightsOut) { - animateCollapse(); + animateCollapseNotifications(); if (mTicking) { mTicker.halt(); } @@ -1664,7 +1677,7 @@ public class PhoneStatusBar extends BaseStatusBar { } } if (snapshot.isEmpty()) { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); return; } new Thread(new Runnable() { @@ -1715,7 +1728,7 @@ public class PhoneStatusBar extends BaseStatusBar { mHandler.postDelayed(new Runnable() { @Override public void run() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } }, totalDelay + 225); } @@ -1737,7 +1750,7 @@ public class PhoneStatusBar extends BaseStatusBar { v.getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), new UserHandle(UserHandle.USER_CURRENT)); - animateCollapse(); + animateCollapseNotifications(); } }; @@ -1753,7 +1766,7 @@ public class PhoneStatusBar extends BaseStatusBar { flags |= CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL; } } - animateCollapse(flags); + animateCollapseNotifications(flags); } else if (Intent.ACTION_SCREEN_OFF.equals(action)) { // no waiting! @@ -1778,7 +1791,7 @@ public class PhoneStatusBar extends BaseStatusBar { @Override public void userSwitched(int newUserId) { if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId); - animateCollapse(); + animateCollapseNotifications(); updateNotificationIcons(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index f83517b..85b91d1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -70,7 +70,7 @@ public class StatusBarWindowView extends FrameLayout switch (event.getKeyCode()) { case KeyEvent.KEYCODE_BACK: if (!down) { - mService.animateCollapse(); + mService.animateCollapseNotifications(); } return true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java index c1ea50d..73d1c7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -204,14 +204,14 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, // We exclusively handle the back key by hiding this panel. case KeyEvent.KEYCODE_BACK: { if (event.getAction() == KeyEvent.ACTION_UP) { - mBar.animateCollapse(); + mBar.animateCollapseNotifications(); } return true; } // We react to the home key but let the system handle it. case KeyEvent.KEYCODE_HOME: { if (event.getAction() == KeyEvent.ACTION_UP) { - mBar.animateCollapse(); + mBar.animateCollapseNotifications(); } } break; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java index c45ac3f..ab4ef75 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java @@ -112,7 +112,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { private void onClickNetwork() { getContext().startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - getStatusBarManager().collapse(); + getStatusBarManager().collapseNotifications(); } // Settings @@ -121,7 +121,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), new UserHandle(UserHandle.USER_CURRENT)); - getStatusBarManager().collapse(); + getStatusBarManager().collapseNotifications(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 3335dfd..d1dd3c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -38,12 +38,10 @@ import android.inputmethodservice.InputMethodService; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; -import android.os.ServiceManager; import android.text.TextUtils; import android.util.Slog; import android.view.Display; import android.view.Gravity; -import android.view.IWindowManager; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SoundEffectConstants; @@ -742,7 +740,7 @@ public class TabletStatusBar extends BaseStatusBar implements SharedPreferences.Editor editor = Prefs.edit(mContext); editor.putBoolean(Prefs.DO_NOT_DISTURB_PREF, false); editor.apply(); - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); } }); @@ -823,7 +821,7 @@ public class TabletStatusBar extends BaseStatusBar implements break; case MSG_HIDE_CHROME: if (DEBUG) Slog.d(TAG, "showing shadows (lights out)"); - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); mBarContents.setVisibility(View.GONE); mShadow.setVisibility(View.VISIBLE); @@ -909,7 +907,7 @@ public class TabletStatusBar extends BaseStatusBar implements if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) { if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { Slog.i(TAG, "DISABLE_EXPAND: yes"); - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); } } @@ -990,16 +988,16 @@ public class TabletStatusBar extends BaseStatusBar implements mFeedbackIconArea.setVisibility(View.VISIBLE); } - public void animateExpand() { + public void animateExpandNotifications() { mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PANEL); mHandler.sendEmptyMessage(MSG_OPEN_NOTIFICATION_PANEL); } - public void animateCollapse() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + public void animateCollapseNotifications() { + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } - public void animateCollapse(int flags) { + public void animateCollapseNotifications(int flags) { if ((flags & CommandQueue.FLAG_EXCLUDE_NOTIFICATION_PANEL) == 0) { mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PANEL); mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PANEL); @@ -1023,6 +1021,16 @@ public class TabletStatusBar extends BaseStatusBar implements } + @Override + public void animateExpandQuickSettings() { + // TODO: Implement when TabletStatusBar begins to be used. + } + + @Override + public void animateCollapseQuickSettings() { + // TODO: Implement when TabletStatusBar begins to be used. + } + @Override // CommandQueue public void setNavigationIconHints(int hints) { if (hints == mNavigationIconHints) return; @@ -1291,7 +1299,7 @@ public class TabletStatusBar extends BaseStatusBar implements mVT.computeCurrentVelocity(1000); // pixels per second // require a little more oomph once we're already in peekaboo mode if (mVT.getYVelocity() < -mNotificationFlingVelocity) { - animateExpand(); + animateExpandNotifications(); visibilityChanged(true); hilite(false); mVT.recycle(); @@ -1309,7 +1317,7 @@ public class TabletStatusBar extends BaseStatusBar implements && Math.abs(event.getY() - mInitialTouchY) < (mTouchSlop / 3) // dragging off the bottom doesn't count && (int)event.getY() < v.getBottom()) { - animateExpand(); + animateExpandNotifications(); visibilityChanged(true); v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); v.playSoundEffect(SoundEffectConstants.CLICK); @@ -1485,7 +1493,7 @@ public class TabletStatusBar extends BaseStatusBar implements } catch (RemoteException ex) { // system process is dead if we're here. } - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); } @@ -1501,7 +1509,7 @@ public class TabletStatusBar extends BaseStatusBar implements flags |= CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL; } } - animateCollapse(flags); + animateCollapseNotifications(flags); } } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java index 6022fd2..fd2ee38 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java @@ -30,7 +30,6 @@ import android.view.WindowManager; */ public class TvStatusBar extends BaseStatusBar { - View mView; @Override public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) { @@ -62,11 +61,11 @@ public class TvStatusBar extends BaseStatusBar { } @Override - public void animateExpand() { + public void animateExpandNotifications() { } @Override - public void animateCollapse(int flags) { + public void animateCollapseNotifications(int flags) { } @Override @@ -139,28 +138,15 @@ public class TvStatusBar extends BaseStatusBar { return true; } - protected View makeStatusBarView() { - synchronized (this) { - if (mView == null) { - mView = new View(mContext); - } - } - return mView; - } - public View getStatusBarView() { return null; } - protected int getStatusBarGravity() { - return 0; - } - - public int getStatusBarHeight() { - return 0; + @Override + public void animateExpandQuickSettings() { } - public void animateCollapse() { + @Override + public void animateCollapseQuickSettings() { } - } diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 7034264..fe8e45b 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2916,7 +2916,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { try { IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { - statusbar.collapse(); + statusbar.collapseNotifications(); + statusbar.collapseQuickSettings(); } } catch (RemoteException ex) { // re-acquire status bar service next time it is needed. diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java index 46dcedc..b567992 100644 --- a/services/java/com/android/server/StatusBarManagerService.java +++ b/services/java/com/android/server/StatusBarManagerService.java @@ -117,23 +117,45 @@ public class StatusBarManagerService extends IStatusBarService.Stub // ================================================================================ // From IStatusBarService // ================================================================================ - public void expand() { + public void expandNotifications() { enforceExpandStatusBar(); if (mBar != null) { try { - mBar.animateExpand(); + mBar.animateExpandNotifications(); } catch (RemoteException ex) { } } } - public void collapse() { + public void collapseNotifications() { enforceExpandStatusBar(); if (mBar != null) { try { - mBar.animateCollapse(); + mBar.animateCollapseNotifications(); + } catch (RemoteException ex) { + } + } + } + + public void expandQuickSettings() { + enforceExpandStatusBar(); + + if (mBar != null) { + try { + mBar.animateExpandQuickSettings(); + } catch (RemoteException ex) { + } + } + } + + public void collapseQuickSettings() { + enforceExpandStatusBar(); + + if (mBar != null) { + try { + mBar.animateCollapseQuickSettings(); } catch (RemoteException ex) { } } @@ -598,7 +620,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub String action = intent.getAction(); if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action) || Intent.ACTION_SCREEN_OFF.equals(action)) { - collapse(); + collapseNotifications(); + collapseQuickSettings(); } /* else if (Telephony.Intents.SPN_STRINGS_UPDATED_ACTION.equals(action)) { diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java index 117f6b7..25f98de 100644 --- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -1738,7 +1738,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { return true; } - public boolean performGlobalAction(int action) throws RemoteException { + public boolean performGlobalAction(int action) { synchronized (mLock) { final int resolvedUserId = mSecurityPolicy .resolveCallingUserIdEnforcingPermissionsLocked( @@ -1760,7 +1760,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { openRecents(); } return true; case AccessibilityService.GLOBAL_ACTION_NOTIFICATIONS: { - expandStatusBar(); + expandNotifications(); + } return true; + case AccessibilityService.GLOBAL_ACTION_QUICK_SETTINGS: { + expandQuickSettings(); } return true; } return false; @@ -1932,12 +1935,22 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { Binder.restoreCallingIdentity(token); } - private void expandStatusBar() { + private void expandNotifications() { + final long token = Binder.clearCallingIdentity(); + + StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService( + android.app.Service.STATUS_BAR_SERVICE); + statusBarManager.expandNotifications(); + + Binder.restoreCallingIdentity(token); + } + + private void expandQuickSettings() { final long token = Binder.clearCallingIdentity(); StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService( android.app.Service.STATUS_BAR_SERVICE); - statusBarManager.expand(); + statusBarManager.expandQuickSettings(); Binder.restoreCallingIdentity(token); } diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java index c171a64..a8462e6 100644 --- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java +++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java @@ -377,7 +377,7 @@ public class ImageProcessingActivity extends Activity long result = 0; //Log.v(TAG, "Warming"); - long t = java.lang.System.currentTimeMillis() + 2000; + long t = java.lang.System.currentTimeMillis() + 250; do { mTest.runTest(); mTest.finish(); @@ -391,7 +391,7 @@ public class ImageProcessingActivity extends Activity mTest.runTest(); mTest.finish(); ct++; - } while ((t+5000) > java.lang.System.currentTimeMillis()); + } while ((t+1000) > java.lang.System.currentTimeMillis()); t = java.lang.System.currentTimeMillis() - t; float ft = (float)t; ft /= ct; diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index 94ad620..3b6e107 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -16,29 +16,15 @@ package com.android.statusbartest; -import android.app.ListActivity; import android.app.Notification; import android.app.NotificationManager; -import android.widget.ArrayAdapter; import android.view.View; -import android.widget.ListView; import android.content.Intent; import android.app.PendingIntent; -import android.app.Notification; -import android.app.NotificationManager; import android.app.StatusBarManager; -import android.content.Context; -import android.util.AttributeSet; -import android.os.Vibrator; -import android.os.Bundle; import android.os.Handler; import android.util.Log; -import android.net.Uri; import android.os.SystemClock; -import android.widget.RemoteViews; -import android.widget.Toast; -import android.os.PowerManager; -import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -300,14 +286,14 @@ public class StatusBarTest extends TestActivity }, new Test("Expand") { public void run() { - mStatusBarManager.expand(); + mStatusBarManager.expandNotifications(); } }, new Test("Expand in 3 sec.") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.expand(); + mStatusBarManager.expandNotifications(); } }, 3000); } @@ -316,7 +302,7 @@ public class StatusBarTest extends TestActivity public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.collapse(); + mStatusBarManager.collapseNotifications(); } }, 3000); } |
