diff options
44 files changed, 790 insertions, 405 deletions
diff --git a/api/current.xml b/api/current.xml index 5e8a07706e74..4996e6aeb6de 100644 --- a/api/current.xml +++ b/api/current.xml @@ -118085,6 +118085,497 @@ </field> </class> </package> +<package name="android.net.rtp" +> +<class name="AudioCodec" + extends="java.lang.Object" + abstract="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<method name="getCodec" + return="android.net.rtp.AudioCodec" + abstract="false" + native="false" + synchronized="false" + static="true" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="type" type="int"> +</parameter> +<parameter name="rtpmap" type="java.lang.String"> +</parameter> +<parameter name="fmtp" type="java.lang.String"> +</parameter> +</method> +<method name="getCodecs" + return="android.net.rtp.AudioCodec[]" + abstract="false" + native="false" + synchronized="false" + static="true" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<field name="AMR" + type="android.net.rtp.AudioCodec" + transient="false" + volatile="false" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="GSM" + type="android.net.rtp.AudioCodec" + transient="false" + volatile="false" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="GSM_EFR" + type="android.net.rtp.AudioCodec" + transient="false" + volatile="false" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="PCMA" + type="android.net.rtp.AudioCodec" + transient="false" + volatile="false" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="PCMU" + type="android.net.rtp.AudioCodec" + transient="false" + volatile="false" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="fmtp" + type="java.lang.String" + transient="false" + volatile="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="rtpmap" + type="java.lang.String" + transient="false" + volatile="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="type" + type="int" + transient="false" + volatile="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +</class> +<class name="AudioGroup" + extends="java.lang.Object" + abstract="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<constructor name="AudioGroup" + type="android.net.rtp.AudioGroup" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</constructor> +<method name="clear" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getMode" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getStreams" + return="android.net.rtp.AudioStream[]" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="sendDtmf" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="event" type="int"> +</parameter> +</method> +<method name="setMode" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="mode" type="int"> +</parameter> +</method> +<field name="MODE_ECHO_SUPPRESSION" + type="int" + transient="false" + volatile="false" + value="3" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="MODE_MUTED" + type="int" + transient="false" + volatile="false" + value="1" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="MODE_NORMAL" + type="int" + transient="false" + volatile="false" + value="2" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="MODE_ON_HOLD" + type="int" + transient="false" + volatile="false" + value="0" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +</class> +<class name="AudioStream" + extends="android.net.rtp.RtpStream" + abstract="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<constructor name="AudioStream" + type="android.net.rtp.AudioStream" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="address" type="java.net.InetAddress"> +</parameter> +<exception name="SocketException" type="java.net.SocketException"> +</exception> +</constructor> +<method name="getCodec" + return="android.net.rtp.AudioCodec" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getDtmfType" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getGroup" + return="android.net.rtp.AudioGroup" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="isBusy" + return="boolean" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="join" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="group" type="android.net.rtp.AudioGroup"> +</parameter> +</method> +<method name="setCodec" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="codec" type="android.net.rtp.AudioCodec"> +</parameter> +</method> +<method name="setDtmfType" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="type" type="int"> +</parameter> +</method> +</class> +<class name="RtpStream" + extends="java.lang.Object" + abstract="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<method name="associate" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="address" type="java.net.InetAddress"> +</parameter> +<parameter name="port" type="int"> +</parameter> +</method> +<method name="getLocalAddress" + return="java.net.InetAddress" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getLocalPort" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getMode" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getRemoteAddress" + return="java.net.InetAddress" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="getRemotePort" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="isBusy" + return="boolean" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="release" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="setMode" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="mode" type="int"> +</parameter> +</method> +<field name="MODE_NORMAL" + type="int" + transient="false" + volatile="false" + value="0" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="MODE_RECEIVE_ONLY" + type="int" + transient="false" + volatile="false" + value="2" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="MODE_SEND_ONLY" + type="int" + transient="false" + volatile="false" + value="1" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +</class> +</package> <package name="android.net.sip" > <class name="SipAudioCall" @@ -206685,21 +207176,6 @@ visibility="public" > </method> -<method name="entryEvicted" - return="void" - abstract="false" - native="false" - synchronized="false" - static="false" - final="false" - deprecated="deprecated" - visibility="protected" -> -<parameter name="key" type="K"> -</parameter> -<parameter name="value" type="V"> -</parameter> -</method> <method name="entryRemoved" return="void" abstract="false" @@ -266828,7 +267304,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="t" type="T"> +<parameter name="arg0" type="T"> </parameter> </method> </interface> diff --git a/core/java/android/util/LruCache.java b/core/java/android/util/LruCache.java index a1501e66f6a6..834dac339543 100644 --- a/core/java/android/util/LruCache.java +++ b/core/java/android/util/LruCache.java @@ -139,8 +139,7 @@ public class LruCache<K, V> { * Caches {@code value} for {@code key}. The value is moved to the head of * the queue. * - * @return the previous value mapped by {@code key}. Although that entry is - * no longer cached, it has not been passed to {@link #entryEvicted}. + * @return the previous value mapped by {@code key}. */ public final V put(K key, V value) { if (key == null || value == null) { @@ -195,15 +194,14 @@ public class LruCache<K, V> { evictionCount++; } - entryEvicted(key, value); + entryRemoved(true, key, value, null); } } /** * Removes the entry for {@code key} if it exists. * - * @return the previous value mapped by {@code key}. Although that entry is - * no longer cached, it has not been passed to {@link #entryEvicted}. + * @return the previous value mapped by {@code key}. */ public final V remove(K key) { if (key == null) { @@ -226,16 +224,6 @@ public class LruCache<K, V> { } /** - * Calls {@link #entryRemoved}. - * - * @deprecated replaced by entryRemoved - */ - @Deprecated - protected void entryEvicted(K key, V value) { - entryRemoved(true, key, value, null); - } - - /** * Called for entries that have been evicted or removed. This method is * invoked when a value is evicted to make space, removed by a call to * {@link #remove}, or replaced by a call to {@link #put}. The default @@ -291,7 +279,7 @@ public class LruCache<K, V> { } /** - * Clear the cache, calling {@link #entryEvicted} on each removed entry. + * Clear the cache, calling {@link #entryRemoved} on each removed entry. */ public final void evictAll() { trimToSize(-1); // -1 will evict 0-sized elements diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 9a6a274ade12..fa5479bf1a82 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -245,11 +245,12 @@ class GLES20Canvas extends HardwareCanvas { private static native void nDestroyDisplayList(int displayList); @Override - public boolean drawDisplayList(DisplayList displayList) { - return nDrawDisplayList(mRenderer, ((GLES20DisplayList) displayList).mNativeDisplayList); + public boolean drawDisplayList(DisplayList displayList, Rect dirty) { + return nDrawDisplayList(mRenderer, + ((GLES20DisplayList) displayList).mNativeDisplayList, dirty); } - private static native boolean nDrawDisplayList(int renderer, int displayList); + private static native boolean nDrawDisplayList(int renderer, int displayList, Rect dirty); /////////////////////////////////////////////////////////////////////////// // Hardware layer diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java index e6fecc8fac05..cb1003ab077c 100644 --- a/core/java/android/view/HardwareCanvas.java +++ b/core/java/android/view/HardwareCanvas.java @@ -53,8 +53,13 @@ public abstract class HardwareCanvas extends Canvas { * Draws the specified display list onto this canvas. * * @param displayList The display list to replay. + * @param dirty The dirty region to redraw in the next pass, matters only + * if this method returns true, can be null. + * + * @return True if the content of the display list requires another + * drawing pass (invalidate()), false otherwise */ - abstract boolean drawDisplayList(DisplayList displayList); + abstract boolean drawDisplayList(DisplayList displayList, Rect dirty); /** * Draws the specified layer onto this canvas. diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index b53aa21b955b..c078c08d2e61 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -269,7 +269,7 @@ public abstract class HardwareRenderer { static EGLDisplay sEglDisplay; static EGLConfig sEglConfig; - private static Thread sEglThread; + private static Thread sEglThread; EGLSurface mEglSurface; @@ -284,6 +284,8 @@ public abstract class HardwareRenderer { final boolean mTranslucent; private boolean mDestroyed; + + private final Rect mRedrawClip = new Rect(); GlRenderer(int glVersion, boolean translucent) { mGlVersion = glVersion; @@ -606,8 +608,13 @@ public abstract class HardwareRenderer { DisplayList displayList = view.getDisplayList(); if (displayList != null) { - if (canvas.drawDisplayList(displayList)) { - view.invalidate(); + if (canvas.drawDisplayList(displayList, mRedrawClip)) { + if (mRedrawClip.isEmpty()) { + view.invalidate(); + } else { + view.getParent().invalidateChild(view, mRedrawClip); + } + mRedrawClip.setEmpty(); } } else { // Shouldn't reach here @@ -646,8 +653,8 @@ public abstract class HardwareRenderer { private int checkCurrent() { // TODO: Don't check the current context when we have one per UI thread // TODO: Use a threadlocal flag to know whether the surface has changed - if (sEgl.eglGetCurrentContext() != sEglContext || - sEgl.eglGetCurrentSurface(EGL10.EGL_DRAW) != mEglSurface) { + if (!sEglContext.equals(sEgl.eglGetCurrentContext()) || + !mEglSurface.equals(sEgl.eglGetCurrentSurface(EGL10.EGL_DRAW))) { if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, sEglContext)) { fallback(true); Log.e(LOG_TAG, "eglMakeCurrent failed " + diff --git a/core/java/android/view/ScaleGestureDetector.java b/core/java/android/view/ScaleGestureDetector.java index 0124151b5ddc..5521e9292342 100644 --- a/core/java/android/view/ScaleGestureDetector.java +++ b/core/java/android/view/ScaleGestureDetector.java @@ -19,6 +19,7 @@ package android.view; import android.content.Context; import android.util.DisplayMetrics; import android.util.FloatMath; +import android.util.Log; /** * Detects transformation gestures involving more than one pointer ("multitouch") @@ -36,6 +37,8 @@ import android.util.FloatMath; * </ul> */ public class ScaleGestureDetector { + private static final String TAG = "ScaleGestureDetector"; + /** * The listener for receiving notifications when gestures occur. * If you want to listen for all the different gestures then implement @@ -170,6 +173,10 @@ public class ScaleGestureDetector { final int action = event.getActionMasked(); boolean handled = true; + if (action == MotionEvent.ACTION_DOWN) { + reset(); // Start fresh + } + if (!mGestureInProgress) { switch (action) { case MotionEvent.ACTION_DOWN: { @@ -197,6 +204,11 @@ public class ScaleGestureDetector { int index1 = event.getActionIndex(); int index0 = event.findPointerIndex(mActiveId0); mActiveId1 = event.getPointerId(index1); + if (index0 < 0 || index0 == index1) { + // Probably someone sending us a broken event stream. + index0 = findNewActiveIndex(event, index0 == index1 ? -1 : mActiveId1, index0); + mActiveId0 = event.getPointerId(index0); + } mActive0MostRecent = false; setContext(event); @@ -315,6 +327,7 @@ public class ScaleGestureDetector { final int index = event.findPointerIndex(actionId == mActiveId0 ? mActiveId1 : mActiveId0); mActiveId0 = event.getPointerId(index); + mActive0MostRecent = true; mActiveId1 = -1; mFocusX = event.getX(index); @@ -338,6 +351,18 @@ public class ScaleGestureDetector { mActiveId1 = event.getPointerId(event.getActionIndex()); mActive0MostRecent = false; + int index0 = event.findPointerIndex(mActiveId0); + if (index0 < 0 || mActiveId0 == mActiveId1) { + // Probably someone sending us a broken event stream. + Log.e(TAG, "Got " + MotionEvent.actionToString(action) + + " with bad state while a gesture was in progress. " + + "Did you forget to pass an event to " + + "ScaleGestureDetector#onTouchEvent?"); + index0 = findNewActiveIndex(event, + mActiveId0 == mActiveId1 ? -1 : mActiveId1, index0); + mActiveId0 = event.getPointerId(index0); + } + setContext(event); mGestureInProgress = mListener.onScaleBegin(this); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index fa24d307a866..32c9e27048d5 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8563,6 +8563,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility canvas.onPreDraw(mLocalDirtyRect); mLocalDirtyRect.setEmpty(); + final int restoreCount = canvas.save(); + computeScroll(); canvas.translate(-mScrollX, -mScrollY); @@ -8576,6 +8578,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility draw(canvas); } + canvas.restoreToCount(restoreCount); } finally { canvas.onPostDraw(); mHardwareLayer.end(currentCanvas); @@ -8725,6 +8728,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility // The dirty rect should always be null for a display list canvas.onPreDraw(null); + final int restoreCount = canvas.save(); + computeScroll(); canvas.translate(-mScrollX, -mScrollY); mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID; @@ -8737,6 +8742,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility draw(canvas); } + canvas.restoreToCount(restoreCount); } finally { canvas.onPostDraw(); diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 3153ac5aaadd..6ef680bacfb6 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2585,7 +2585,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } else { child.mPrivateFlags &= ~DIRTY_MASK; - ((HardwareCanvas) canvas).drawDisplayList(displayList); + ((HardwareCanvas) canvas).drawDisplayList(displayList, null); } } } else if (cache != null) { @@ -4275,11 +4275,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * does not exist within the group */ public View getChildAt(int index) { - try { - return mChildren[index]; - } catch (IndexOutOfBoundsException ex) { + if (index < 0 || index >= mChildrenCount) { return null; } + return mChildren[index]; } /** diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index 546823047b24..11908bb8bcef 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -1606,13 +1606,9 @@ public final class ViewRoot extends Handler implements ViewParent, return; } catch (IllegalArgumentException e) { Log.e(TAG, "IllegalArgumentException locking surface", e); - try { - if (!sWindowSession.outOfMemory(mWindow)) { - Slog.w(TAG, "No processes killed for memory; killing self"); - Process.killProcess(Process.myPid()); - } - } catch (RemoteException ex) { - } + // Don't assume this is due to out of memory, it could be + // something else, and if it is something else then we could + // kill stuff (or ourself) for no reason. mLayoutRequested = true; // ask wm for a new surface next time. return; } diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 32880aa9fe5b..1316235670a5 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -351,7 +351,8 @@ public class WebView extends AbsoluteLayout private ZoomManager mZoomManager; - private Rect mGLRectViewport = new Rect(); + private final Rect mGLRectViewport = new Rect(); + private final Rect mViewRectViewport = new Rect(); private boolean mGLViewportEmpty = false; /** @@ -4153,7 +4154,7 @@ public class WebView extends AbsoluteLayout if (canvas.isHardwareAccelerated()) { int functor = nativeGetDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport, - getScale(), extras); + mGLViewportEmpty ? null : mViewRectViewport, getScale(), extras); ((HardwareCanvas) canvas).callDrawGLFunction(functor); } else { DrawFilter df = null; @@ -5259,6 +5260,7 @@ public class WebView extends AbsoluteLayout // Then need to invert the Y axis, just for GL View rootView = getRootView(); int rootViewHeight = rootView.getHeight(); + mViewRectViewport.set(mGLRectViewport); int savedWebViewBottom = mGLRectViewport.bottom; mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeight(); mGLRectViewport.top = rootViewHeight - savedWebViewBottom; @@ -5266,7 +5268,8 @@ public class WebView extends AbsoluteLayout } else { mGLViewportEmpty = true; } - nativeUpdateDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport); + nativeUpdateDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport, + mGLViewportEmpty ? null : mViewRectViewport); } /** @@ -8532,8 +8535,9 @@ public class WebView extends AbsoluteLayout boolean splitIfNeeded); private native void nativeDumpDisplayTree(String urlOrNull); private native boolean nativeEvaluateLayersAnimations(); - private native int nativeGetDrawGLFunction(Rect rect, float scale, int extras); - private native void nativeUpdateDrawGLFunction(Rect rect); + private native int nativeGetDrawGLFunction(Rect rect, Rect viewRect, + float scale, int extras); + private native void nativeUpdateDrawGLFunction(Rect rect, Rect viewRect); private native boolean nativeDrawGL(Rect rect, float scale, int extras); private native void nativeExtendSelection(int x, int y); private native int nativeFindAll(String findLower, String findUpper, diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 427126b0e68e..af954c9022e6 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -3019,12 +3019,13 @@ public class ListView extends AbsListView { hasOpaqueScrollbars()) || super.isOpaque(); if (retValue) { // only return true if the list items cover the entire area of the view - final int listTop = mListPadding.top; + final int listTop = mListPadding != null ? mListPadding.top : mPaddingTop; View first = getChildAt(0); if (first == null || first.getTop() > listTop) { return false; } - final int listBottom = getHeight() - mListPadding.bottom; + final int listBottom = getHeight() - + (mListPadding != null ? mListPadding.bottom : mPaddingBottom); View last = getChildAt(getChildCount() - 1); if (last == null || last.getBottom() < listBottom) { return false; diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java index e3a66c592829..a41b348af629 100644 --- a/core/java/com/android/internal/widget/ActionBarView.java +++ b/core/java/com/android/internal/widget/ActionBarView.java @@ -385,7 +385,7 @@ public class ActionBarView extends ViewGroup { if ((flagsChanged & ActionBar.DISPLAY_HOME_AS_UP) != 0) { mHomeAsUpView.setVisibility((options & ActionBar.DISPLAY_HOME_AS_UP) != 0 - ? VISIBLE : INVISIBLE); + ? VISIBLE : GONE); } if ((flagsChanged & ActionBar.DISPLAY_USE_LOGO) != 0) { diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 7a609a54d6c5..a78f66029add 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -35,7 +35,6 @@ #include <DisplayListRenderer.h> #include <LayerRenderer.h> -#include <OpenGLDebugRenderer.h> #include <OpenGLRenderer.h> #include <SkiaShader.h> #include <SkiaColorFilter.h> @@ -60,7 +59,6 @@ using namespace uirenderer; // Debug #define DEBUG_RENDERER 0 -#define PROFILE_RENDERER 0 // Debug #if DEBUG_RENDERER @@ -99,11 +97,7 @@ static jboolean android_view_GLES20Canvas_preserveBackBuffer(JNIEnv* env, jobjec static OpenGLRenderer* android_view_GLES20Canvas_createRenderer(JNIEnv* env, jobject clazz) { RENDERER_LOGD("Create OpenGLRenderer"); -#if PROFILE_RENDERER - return new OpenGLDebugRenderer; -#else return new OpenGLRenderer; -#endif } static void android_view_GLES20Canvas_destroyRenderer(JNIEnv* env, jobject clazz, @@ -139,7 +133,8 @@ static void android_view_GLES20Canvas_finish(JNIEnv* env, jobject clazz, static bool android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject clazz, OpenGLRenderer* renderer, Functor *functor) { - return renderer->callDrawGLFunction(functor); + android::uirenderer::Rect dirty; + return renderer->callDrawGLFunction(functor, dirty); } // ---------------------------------------------------------------------------- @@ -503,8 +498,14 @@ static void android_view_GLES20Canvas_destroyDisplayList(JNIEnv* env, } static bool android_view_GLES20Canvas_drawDisplayList(JNIEnv* env, - jobject clazz, OpenGLRenderer* renderer, DisplayList* displayList) { - return renderer->drawDisplayList(displayList); + jobject clazz, OpenGLRenderer* renderer, DisplayList* displayList, jobject dirty) { + android::uirenderer::Rect bounds; + bool redraw = renderer->drawDisplayList(displayList, bounds); + if (redraw && dirty != NULL) { + env->CallVoidMethod(dirty, gRectClassInfo.set, + int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom)); + } + return redraw; } // ---------------------------------------------------------------------------- @@ -663,7 +664,8 @@ static JNINativeMethod gMethods[] = { { "nGetDisplayList", "(I)I", (void*) android_view_GLES20Canvas_getDisplayList }, { "nDestroyDisplayList", "(I)V", (void*) android_view_GLES20Canvas_destroyDisplayList }, { "nGetDisplayListRenderer", "(I)I", (void*) android_view_GLES20Canvas_getDisplayListRenderer }, - { "nDrawDisplayList", "(II)Z", (void*) android_view_GLES20Canvas_drawDisplayList }, + { "nDrawDisplayList", "(IILandroid/graphics/Rect;)Z", + (void*) android_view_GLES20Canvas_drawDisplayList }, { "nInterrupt", "(I)V", (void*) android_view_GLES20Canvas_interrupt }, { "nResume", "(I)V", (void*) android_view_GLES20Canvas_resume }, diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index e7ea8c8f63dd..3d24bee48676 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -400,7 +400,7 @@ static jint jni_eglGetCurrentDisplay(JNIEnv *_env, jobject _this) { } static jint jni_eglGetCurrentSurface(JNIEnv *_env, jobject _this, jint readdraw) { - if (!(readdraw == EGL_READ) || (readdraw == EGL_DRAW)) { + if ((readdraw != EGL_READ) && (readdraw != EGL_DRAW)) { doThrow(_env, "java/lang/IllegalArgumentException"); return 0; } diff --git a/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png Binary files differindex 52fccf812079..7855cda9a8ac 100644 --- a/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png +++ b/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png diff --git a/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png Binary files differindex 0354599a47fc..c06277341b79 100644 --- a/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png +++ b/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png diff --git a/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png Binary files differindex 959b4e4f381a..ae3e6bfb84d4 100644 --- a/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png +++ b/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png diff --git a/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png Binary files differindex 41333b86c7e8..c61e3fa86d8a 100644 --- a/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png +++ b/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png diff --git a/core/res/res/layout/action_bar_home.xml b/core/res/res/layout/action_bar_home.xml index e8b5637603ff..7867577a9442 100644 --- a/core/res/res/layout/action_bar_home.xml +++ b/core/res/res/layout/action_bar_home.xml @@ -14,16 +14,18 @@ limitations under the License. --> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:background="?android:attr/selectableItemBackground"> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:background="?android:attr/selectableItemBackground" + android:orientation="horizontal"> <ImageView android:id="@android:id/up" android:src="?android:attr/homeAsUpIndicator" android:layout_gravity="top|left" - android:visibility="invisible" + android:visibility="gone" android:layout_width="wrap_content" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:layout_marginRight="-12dip" /> <ImageView android:id="@android:id/home" android:layout_width="wrap_content" android:layout_height="match_parent" @@ -31,4 +33,4 @@ android:paddingRight="16dip" android:layout_gravity="center" android:scaleType="center" /> -</FrameLayout> +</LinearLayout> diff --git a/core/tests/coretests/src/android/util/LruCacheTest.java b/core/tests/coretests/src/android/util/LruCacheTest.java index 7e46e26fa976..5a97158a85d1 100644 --- a/core/tests/coretests/src/android/util/LruCacheTest.java +++ b/core/tests/coretests/src/android/util/LruCacheTest.java @@ -183,20 +183,15 @@ public final class LruCacheTest extends TestCase { * Replacing the value for a key doesn't cause an eviction but it does bring * the replaced entry to the front of the queue. */ - public void testPutDoesNotCauseEviction() { - final List<String> evictionLog = new ArrayList<String>(); - List<String> expectedEvictionLog = new ArrayList<String>(); - LruCache<String, String> cache = new LruCache<String, String>(3) { - @Override protected void entryEvicted(String key, String value) { - evictionLog.add(key + "=" + value); - } - }; + public void testPutCauseEviction() { + List<String> log = new ArrayList<String>(); + LruCache<String, String> cache = newRemovalLogCache(log); cache.put("a", "A"); cache.put("b", "B"); cache.put("c", "C"); cache.put("b", "B2"); - assertEquals(expectedEvictionLog, evictionLog); + assertEquals(Arrays.asList("b=B>B2"), log); assertSnapshot(cache, "a", "A", "c", "C", "b", "B2"); } diff --git a/include/utils/Functor.h b/include/utils/Functor.h index 3955bc346079..565f4a3c8568 100644 --- a/include/utils/Functor.h +++ b/include/utils/Functor.h @@ -26,6 +26,7 @@ public: Functor() {} virtual ~Functor() {} virtual status_t operator ()() { return true; } + virtual status_t operator ()(float* data, uint32_t len) { return true; } }; }; // namespace android diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk index 38e0848d5b54..f4a0161b2e1f 100644 --- a/libs/hwui/Android.mk +++ b/libs/hwui/Android.mk @@ -15,7 +15,6 @@ ifeq ($(USE_OPENGL_RENDERER),true) LayerCache.cpp \ LayerRenderer.cpp \ Matrix.cpp \ - OpenGLDebugRenderer.cpp \ OpenGLRenderer.cpp \ Patch.cpp \ PatchCache.cpp \ diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index d5d2ba07154c..737fa025e250 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -166,7 +166,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde void DisplayList::init() { } -bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { +bool DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, uint32_t level) { bool needsInvalidate = false; TextContainer text; mReader.rewind(); @@ -189,7 +189,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { case DrawGLFunction: { Functor *functor = (Functor *) getInt(); DISPLAY_LIST_LOGD("%s%s %p", (char*) indent, OP_NAMES[op], functor); - needsInvalidate |= renderer.callDrawGLFunction(functor); + needsInvalidate |= renderer.callDrawGLFunction(functor, dirty); } break; case Save: { @@ -287,7 +287,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { DisplayList* displayList = getDisplayList(); DISPLAY_LIST_LOGD("%s%s %p, %d", (char*) indent, OP_NAMES[op], displayList, level + 1); - needsInvalidate |= renderer.drawDisplayList(displayList, level + 1); + needsInvalidate |= renderer.drawDisplayList(displayList, dirty, level + 1); } break; case DrawLayer: { @@ -589,7 +589,8 @@ void DisplayListRenderer::interrupt() { void DisplayListRenderer::resume() { } -bool DisplayListRenderer::callDrawGLFunction(Functor *functor) { +bool DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { + // Ignore dirty during recording, it matters only when we replay addOp(DisplayList::DrawGLFunction); addInt((int) functor); return false; // No invalidate needed at record-time @@ -673,7 +674,9 @@ bool DisplayListRenderer::clipRect(float left, float top, float right, float bot return OpenGLRenderer::clipRect(left, top, right, bottom, op); } -bool DisplayListRenderer::drawDisplayList(DisplayList* displayList, uint32_t level) { +bool DisplayListRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level) { + // dirty is an out parameter and should not be recorded, + // it matters only when replaying the display list addOp(DisplayList::DrawDisplayList); addDisplayList(displayList); return false; diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index e8f189db0f8d..f24545d32926 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -103,7 +103,7 @@ public: void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false); - bool replay(OpenGLRenderer& renderer, uint32_t level = 0); + bool replay(OpenGLRenderer& renderer, Rect& dirty, uint32_t level = 0); private: void init(); @@ -214,7 +214,7 @@ public: void prepareDirty(float left, float top, float right, float bottom, bool opaque); void finish(); - bool callDrawGLFunction(Functor *functor); + bool callDrawGLFunction(Functor *functor, Rect& dirty); void interrupt(); void resume(); @@ -238,7 +238,7 @@ public: bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op); - bool drawDisplayList(DisplayList* displayList, uint32_t level = 0); + bool drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level = 0); void drawLayer(Layer* layer, float x, float y, SkPaint* paint); void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint); diff --git a/libs/hwui/OpenGLDebugRenderer.cpp b/libs/hwui/OpenGLDebugRenderer.cpp deleted file mode 100644 index 05870bb2e07e..000000000000 --- a/libs/hwui/OpenGLDebugRenderer.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "OpenGLRenderer" - -#include <utils/StopWatch.h> - -#include "OpenGLDebugRenderer.h" - -namespace android { -namespace uirenderer { - -void OpenGLDebugRenderer::prepareDirty(float left, float top, - float right, float bottom, bool opaque) { - mPrimitivesCount = 0; - LOGD("========= Frame start ========="); - OpenGLRenderer::prepareDirty(left, top, right, bottom, opaque); -} - -void OpenGLDebugRenderer::finish() { - LOGD("========= Frame end ========="); - LOGD("Primitives draw count = %d", mPrimitivesCount); - OpenGLRenderer::finish(); -} - -void OpenGLDebugRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) { - mPrimitivesCount++; - StopWatch w("composeLayer"); - return OpenGLRenderer::composeLayer(current, previous); -} - -int OpenGLDebugRenderer::saveLayer(float left, float top, float right, float bottom, - SkPaint* p, int flags) { - mPrimitivesCount++; - StopWatch w("saveLayer"); - return OpenGLRenderer::saveLayer(left, top, right, bottom, p, flags); -} - -bool OpenGLDebugRenderer::drawDisplayList(DisplayList* displayList, uint32_t level) { - mPrimitivesCount++; - StopWatch w("drawDisplayList"); - return OpenGLRenderer::drawDisplayList(displayList); -} - -void OpenGLDebugRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawLayer"); - OpenGLRenderer::drawLayer(layer, x, y, paint); -} - -void OpenGLDebugRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, - SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawBitmap"); - OpenGLRenderer::drawBitmap(bitmap, left, top, paint); -} - -void OpenGLDebugRenderer::drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, - SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawBitmapMatrix"); - OpenGLRenderer::drawBitmap(bitmap, matrix, paint); -} - -void OpenGLDebugRenderer::drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop, - float srcRight, float srcBottom, float dstLeft, float dstTop, - float dstRight, float dstBottom, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawBitmapRect"); - OpenGLRenderer::drawBitmap(bitmap, srcLeft, srcTop, srcRight, srcBottom, - dstLeft, dstTop, dstRight, dstBottom, paint); -} - -void OpenGLDebugRenderer::drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs, - const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors, - float left, float top, float right, float bottom, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawPatch"); - OpenGLRenderer::drawPatch(bitmap, xDivs, yDivs, colors, width, height, numColors, - left, top, right, bottom, paint); -} - -void OpenGLDebugRenderer::drawColor(int color, SkXfermode::Mode mode) { - mPrimitivesCount++; - StopWatch w("drawColor"); - OpenGLRenderer::drawColor(color, mode); -} - -void OpenGLDebugRenderer::drawRect(float left, float top, float right, float bottom, - SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawRect"); - OpenGLRenderer::drawRect(left, top, right, bottom, paint); -} - -void OpenGLDebugRenderer::drawRoundRect(float left, float top, float right, float bottom, - float rx, float ry, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawRoundRect"); - OpenGLRenderer::drawRoundRect(left, top, right, bottom, rx, ry, paint); -} - -void OpenGLDebugRenderer::drawCircle(float x, float y, float radius, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawCircle"); - OpenGLRenderer::drawCircle(x, y, radius, paint); -} - -void OpenGLDebugRenderer::drawOval(float left, float top, float right, float bottom, - SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawOval"); - OpenGLRenderer::drawOval(left, top, right, bottom, paint); -} - -void OpenGLDebugRenderer::drawArc(float left, float top, float right, float bottom, - float startAngle, float sweepAngle, bool useCenter, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawArc"); - OpenGLRenderer::drawArc(left, top, right, bottom, startAngle, sweepAngle, useCenter, paint); -} - -void OpenGLDebugRenderer::drawPath(SkPath* path, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawPath"); - OpenGLRenderer::drawPath(path, paint); -} - -void OpenGLDebugRenderer::drawLines(float* points, int count, SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawLines"); - OpenGLRenderer::drawLines(points, count, paint); -} - -void OpenGLDebugRenderer::drawText(const char* text, int bytesCount, int count, float x, float y, - SkPaint* paint) { - mPrimitivesCount++; - StopWatch w("drawText"); - OpenGLRenderer::drawText(text, bytesCount, count, x, y, paint); -} - -}; // namespace uirenderer -}; // namespace android diff --git a/libs/hwui/OpenGLDebugRenderer.h b/libs/hwui/OpenGLDebugRenderer.h deleted file mode 100644 index 1a18a6727f9f..000000000000 --- a/libs/hwui/OpenGLDebugRenderer.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H -#define ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H - -#include "OpenGLRenderer.h" - -namespace android { -namespace uirenderer { - -/////////////////////////////////////////////////////////////////////////////// -// Renderer -/////////////////////////////////////////////////////////////////////////////// - -class OpenGLDebugRenderer: public OpenGLRenderer { -public: - OpenGLDebugRenderer(): mPrimitivesCount(0) { - } - - ~OpenGLDebugRenderer() { - } - - void prepareDirty(float left, float top, float right, float bottom, bool opaque); - void finish(); - - int saveLayer(float left, float top, float right, float bottom, - SkPaint* p, int flags); - - bool drawDisplayList(DisplayList* displayList, uint32_t level = 0); - void drawLayer(Layer* layer, float x, float y, SkPaint* paint); - void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); - void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint); - void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop, - float srcRight, float srcBottom, float dstLeft, float dstTop, - float dstRight, float dstBottom, SkPaint* paint); - void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs, - const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors, - float left, float top, float right, float bottom, SkPaint* paint); - void drawColor(int color, SkXfermode::Mode mode); - void drawRect(float left, float top, float right, float bottom, SkPaint* paint); - void drawRoundRect(float left, float top, float right, float bottom, - float rx, float ry, SkPaint* paint); - void drawCircle(float x, float y, float radius, SkPaint* paint); - void drawOval(float left, float top, float right, float bottom, SkPaint* paint); - void drawArc(float left, float top, float right, float bottom, - float startAngle, float sweepAngle, bool useCenter, SkPaint* paint); - void drawPath(SkPath* path, SkPaint* paint); - void drawLines(float* points, int count, SkPaint* paint); - void drawText(const char* text, int bytesCount, int count, float x, float y, - SkPaint* paint); - -protected: - void composeLayer(sp<Snapshot> current, sp<Snapshot> previous); - -private: - uint32_t mPrimitivesCount; - -}; // class OpenGLDebugRenderer - -}; // namespace uirenderer -}; // namespace android - -#endif // ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index dfca7ebc44b0..1f652010e627 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -210,7 +210,7 @@ void OpenGLRenderer::resume() { glBlendEquation(GL_FUNC_ADD); } -bool OpenGLRenderer::callDrawGLFunction(Functor *functor) { +bool OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { interrupt(); if (mDirtyClip) { setScissorFromClip(); @@ -226,9 +226,16 @@ bool OpenGLRenderer::callDrawGLFunction(Functor *functor) { } #endif - status_t result = (*functor)(); + float bounds[4]; + status_t result = (*functor)(&bounds[0], 4); + + if (result != 0) { + Rect localDirty(bounds[0], bounds[1], bounds[2], bounds[3]); + dirty.unionWith(localDirty); + } + resume(); - return (result == 0) ? false : true; + return result != 0; } /////////////////////////////////////////////////////////////////////////////// @@ -1057,11 +1064,11 @@ void OpenGLRenderer::finishDrawTexture() { // Drawing /////////////////////////////////////////////////////////////////////////////// -bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t level) { +bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level) { // All the usual checks and setup operations (quickReject, setupDraw, etc.) // will be performed by the display list itself if (displayList) { - return displayList->replay(*this, level); + return displayList->replay(*this, dirty, level); } return false; } @@ -1522,7 +1529,6 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count, break; } - // TODO: Handle paint->getTextScaleX() const float oldX = x; const float oldY = y; const bool pureTranslate = mSnapshot->transform->isPureTranslate(); diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 7bbf034c8497..9d8638867342 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -70,7 +70,7 @@ public: virtual void interrupt(); virtual void resume(); - virtual bool callDrawGLFunction(Functor *functor); + virtual bool callDrawGLFunction(Functor *functor, Rect& dirty); int getSaveCount() const; virtual int save(int flags); @@ -96,7 +96,7 @@ public: bool quickReject(float left, float top, float right, float bottom); virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op); - virtual bool drawDisplayList(DisplayList* displayList, uint32_t level = 0); + virtual bool drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level = 0); virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint); virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); virtual void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint); diff --git a/libs/hwui/TextDropShadowCache.h b/libs/hwui/TextDropShadowCache.h index 62c425013f80..d46686d90845 100644 --- a/libs/hwui/TextDropShadowCache.h +++ b/libs/hwui/TextDropShadowCache.h @@ -42,6 +42,17 @@ struct ShadowText { textSize = paint->getTextSize(); typeface = paint->getTypeface(); + + flags = 0; + if (paint->isFakeBoldText()) { + flags |= Font::kFakeBold; + } + + const float skewX = paint->getTextSkewX(); + italicStyle = *(uint32_t*) &skewX; + + const float scaleXFloat = paint->getTextScaleX(); + scaleX = *(uint32_t*) &scaleXFloat; } ~ShadowText() { @@ -51,6 +62,9 @@ struct ShadowText { uint32_t len; float textSize; SkTypeface* typeface; + uint32_t flags; + uint32_t italicStyle; + uint32_t scaleX; const char16_t* text; String16 str; @@ -65,7 +79,13 @@ struct ShadowText { LTE_INT(radius) { LTE_FLOAT(textSize) { LTE_INT(typeface) { - return strncmp16(text, rhs.text, len >> 1) < 0; + LTE_INT(flags) { + LTE_INT(italicStyle) { + LTE_INT(scaleX) { + return strncmp16(text, rhs.text, len >> 1) < 0; + } + } + } } } } diff --git a/media/java/android/media/videoeditor/AudioTrack.java b/media/java/android/media/videoeditor/AudioTrack.java index b2f547b0deee..7069b23d41e4 100755 --- a/media/java/android/media/videoeditor/AudioTrack.java +++ b/media/java/android/media/videoeditor/AudioTrack.java @@ -140,7 +140,7 @@ public class AudioTrack { try { properties = mMANativeHelper.getMediaProperties(filename); } catch (Exception e) { - throw new IllegalArgumentException("Unsupported file or file not found"); + throw new IllegalArgumentException(e.getMessage() + " : " + filename); } switch (mMANativeHelper.getFileType(properties.fileType)) { case MediaProperties.FILE_3GP: diff --git a/media/java/android/media/videoeditor/MediaVideoItem.java b/media/java/android/media/videoeditor/MediaVideoItem.java index c91d796c23cf..4758de6bb40e 100755 --- a/media/java/android/media/videoeditor/MediaVideoItem.java +++ b/media/java/android/media/videoeditor/MediaVideoItem.java @@ -115,7 +115,7 @@ public class MediaVideoItem extends MediaItem { try { properties = mMANativeHelper.getMediaProperties(filename); } catch ( Exception e) { - throw new IllegalArgumentException("Unsupported file or file not found: " + filename); + throw new IllegalArgumentException(e.getMessage() + " : " + filename); } switch (mMANativeHelper.getFileType(properties.fileType)) { diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java index 98de2f700999..b4a46891f95a 100644 --- a/media/java/android/mtp/MtpDatabase.java +++ b/media/java/android/mtp/MtpDatabase.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.ContentValues; import android.content.IContentProvider; import android.content.Intent; +import android.content.SharedPreferences; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.media.MediaScanner; @@ -62,8 +63,8 @@ public class MtpDatabase { // true if the database has been modified in the current MTP session private boolean mDatabaseModified; - // database for writable MTP device properties - private SQLiteDatabase mDevicePropDb; + // SharedPreferences for writable MTP device properties + private SharedPreferences mDeviceProperties; private static final int DEVICE_PROPERTIES_DATABASE_VERSION = 1; // FIXME - this should be passed in via the constructor @@ -96,9 +97,6 @@ public class MtpDatabase { private static final String PARENT_FORMAT_WHERE = PARENT_WHERE + " AND " + Files.FileColumns.FORMAT + "=?"; - private static final String[] DEVICE_PROPERTY_PROJECTION = new String[] { "_id", "value" }; - private static final String DEVICE_PROPERTY_WHERE = "code=?"; - private final MediaScanner mMediaScanner; static { @@ -114,7 +112,7 @@ public class MtpDatabase { mMediaStoragePath = storagePath; mObjectsUri = Files.getMtpObjectsUri(volumeName); mMediaScanner = new MediaScanner(context); - openDevicePropertiesDatabase(context); + initDeviceProperties(context); } @Override @@ -126,19 +124,38 @@ public class MtpDatabase { } } - private void openDevicePropertiesDatabase(Context context) { - mDevicePropDb = context.openOrCreateDatabase("device-properties", Context.MODE_PRIVATE, null); - int version = mDevicePropDb.getVersion(); - - // initialize if necessary - if (version != DEVICE_PROPERTIES_DATABASE_VERSION) { - mDevicePropDb.execSQL("CREATE TABLE properties (" + - "_id INTEGER PRIMARY KEY AUTOINCREMENT," + - "code INTEGER UNIQUE ON CONFLICT REPLACE," + - "value TEXT" + - ");"); - mDevicePropDb.execSQL("CREATE INDEX property_index ON properties (code);"); - mDevicePropDb.setVersion(DEVICE_PROPERTIES_DATABASE_VERSION); + private void initDeviceProperties(Context context) { + final String devicePropertiesName = "device-properties"; + mDeviceProperties = context.getSharedPreferences(devicePropertiesName, Context.MODE_PRIVATE); + File databaseFile = context.getDatabasePath(devicePropertiesName); + + if (databaseFile.exists()) { + // for backward compatibility - read device properties from sqlite database + // and migrate them to shared prefs + SQLiteDatabase db = null; + Cursor c = null; + try { + db = context.openOrCreateDatabase("device-properties", Context.MODE_PRIVATE, null); + if (db != null) { + c = db.query("properties", new String[] { "_id", "code", "value" }, + null, null, null, null, null); + if (c != null) { + SharedPreferences.Editor e = mDeviceProperties.edit(); + while (c.moveToNext()) { + String name = c.getString(1); + String value = c.getString(2); + e.putString(name, value); + } + e.commit(); + } + } + } catch (Exception e) { + Log.e(TAG, "failed to migrate device properties", e); + } finally { + if (c != null) c.close(); + if (db != null) db.close(); + } + databaseFile.delete(); } } @@ -567,30 +584,15 @@ public class MtpDatabase { switch (property) { case MtpConstants.DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER: case MtpConstants.DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME: - // writable string properties kept in our device property database - Cursor c = null; - try { - c = mDevicePropDb.query("properties", DEVICE_PROPERTY_PROJECTION, - DEVICE_PROPERTY_WHERE, new String[] { Integer.toString(property) }, - null, null, null); - - if (c != null && c.moveToNext()) { - String value = c.getString(1); - int length = value.length(); - if (length > 255) { - length = 255; - } - value.getChars(0, length, outStringValue, 0); - outStringValue[length] = 0; - } else { - outStringValue[0] = 0; - } - return MtpConstants.RESPONSE_OK; - } finally { - if (c != null) { - c.close(); - } + // writable string properties kept in shared preferences + String value = mDeviceProperties.getString(Integer.toString(property), ""); + int length = value.length(); + if (length > 255) { + length = 255; } + value.getChars(0, length, outStringValue, 0); + outStringValue[length] = 0; + return MtpConstants.RESPONSE_OK; case MtpConstants.DEVICE_PROPERTY_IMAGE_SIZE: // use screen size as max image size @@ -612,16 +614,11 @@ public class MtpDatabase { switch (property) { case MtpConstants.DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER: case MtpConstants.DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME: - // writable string properties kept in our device property database - try { - ContentValues values = new ContentValues(); - values.put("code", property); - values.put("value", stringValue); - mDevicePropDb.insert("properties", "code", values); - return MtpConstants.RESPONSE_OK; - } catch (Exception e) { - return MtpConstants.RESPONSE_GENERAL_ERROR; - } + // writable string properties kept in shared prefs + SharedPreferences.Editor e = mDeviceProperties.edit(); + e.putString(Integer.toString(property), stringValue); + return (e.commit() ? MtpConstants.RESPONSE_OK + : MtpConstants.RESPONSE_GENERAL_ERROR); } return MtpConstants.RESPONSE_DEVICE_PROP_NOT_SUPPORTED; diff --git a/media/jni/mediaeditor/VideoEditorOsal.cpp b/media/jni/mediaeditor/VideoEditorOsal.cpp index 423e93f4c023..035f59a4799f 100755 --- a/media/jni/mediaeditor/VideoEditorOsal.cpp +++ b/media/jni/mediaeditor/VideoEditorOsal.cpp @@ -207,6 +207,7 @@ static const VideoEdit_Osal_Result gkRESULTS[] = VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_AUDIOBITRATE_TOO_HIGH ), VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_OUTPUT_FILE_SIZE_TOO_SMALL ), VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_NOMORE_SPACE ), + VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_FILE_DRM_PROTECTED ), // M4READER_Common.h VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_READER_UNKNOWN_STREAM_TYPE ), diff --git a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp index 73a7c9c8a272..3b795ceedbb0 100755 --- a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp +++ b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp @@ -204,10 +204,17 @@ jobject videoEditProp_getProperties( result = getClipProperties( pEnv, thiz, pFile, clipType, pClipProperties); - // Check if the creation succeeded. - videoEditJava_checkAndThrowIllegalArgumentException( - &gotten, pEnv,(M4NO_ERROR != result), - "Invalid File or File not found"); + if (M4MCS_ERR_FILE_DRM_PROTECTED == result) { + // Check if the creation succeeded. + videoEditJava_checkAndThrowIllegalArgumentException( + &gotten, pEnv,(M4NO_ERROR != result), + "Invalid File - DRM Protected "); + } else { + // Check if the creation succeeded. + videoEditJava_checkAndThrowIllegalArgumentException( + &gotten, pEnv,(M4NO_ERROR != result), + "Invalid File or File not found "); + } /** * Max resolution supported is 1280 x 720. diff --git a/media/libstagefright/NuHTTPDataSource.cpp b/media/libstagefright/NuHTTPDataSource.cpp index dbbf3b4fbd05..b24343f4d192 100644 --- a/media/libstagefright/NuHTTPDataSource.cpp +++ b/media/libstagefright/NuHTTPDataSource.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2010 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. + */ + //#define LOG_NDEBUG 0 #define LOG_TAG "NuHTTPDataSource" #include <utils/Log.h> diff --git a/media/libstagefright/include/NuHTTPDataSource.h b/media/libstagefright/include/NuHTTPDataSource.h index 082b589e6a50..25695688c6cf 100644 --- a/media/libstagefright/include/NuHTTPDataSource.h +++ b/media/libstagefright/include/NuHTTPDataSource.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2010 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. + */ + #ifndef NU_HTTP_DATA_SOURCE_H_ #define NU_HTTP_DATA_SOURCE_H_ diff --git a/opengl/java/com/google/android/gles_jni/EGLContextImpl.java b/opengl/java/com/google/android/gles_jni/EGLContextImpl.java index 9cf5de79d27b..cd3609975260 100644 --- a/opengl/java/com/google/android/gles_jni/EGLContextImpl.java +++ b/opengl/java/com/google/android/gles_jni/EGLContextImpl.java @@ -32,4 +32,19 @@ public class EGLContextImpl extends EGLContext { public GL getGL() { return mGLContext; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + EGLContextImpl that = (EGLContextImpl) o; + + return mEGLContext == that.mEGLContext; + } + + @Override + public int hashCode() { + return mEGLContext; + } } diff --git a/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java b/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java index cb94888d770a..e6c9817befe5 100644 --- a/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java +++ b/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java @@ -24,4 +24,20 @@ public class EGLDisplayImpl extends EGLDisplay { public EGLDisplayImpl(int dpy) { mEGLDisplay = dpy; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + EGLDisplayImpl that = (EGLDisplayImpl) o; + + return mEGLDisplay == that.mEGLDisplay; + + } + + @Override + public int hashCode() { + return mEGLDisplay; + } } diff --git a/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java b/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java index f6b90ab501d2..e7f15dc2d4dc 100644 --- a/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java +++ b/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java @@ -29,4 +29,20 @@ public class EGLSurfaceImpl extends EGLSurface { mEGLSurface = surface; mNativePixelRef = 0; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + EGLSurfaceImpl that = (EGLSurfaceImpl) o; + + return mEGLSurface == that.mEGLSurface; + + } + + @Override + public int hashCode() { + return mEGLSurface; + } } diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java index e7f431c48a1b..3c8432ea0d5c 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java @@ -58,10 +58,12 @@ public class TextActivity extends Activity { mScaledPaint = new Paint(); mScaledPaint.setAntiAlias(true); mScaledPaint.setTextSize(16.0f); + mScaledPaint.setShadowLayer(3.0f, 3.0f, 3.0f, 0xff00ff00); mSkewPaint = new Paint(); mSkewPaint.setAntiAlias(true); - mSkewPaint.setTextSize(16.0f); + mSkewPaint.setTextSize(16.0f); + mSkewPaint.setShadowLayer(3.0f, 3.0f, 3.0f, 0xff000000); } @Override @@ -106,11 +108,11 @@ public class TextActivity extends Activity { mStrikePaint.setUnderlineText(true); mSkewPaint.setTextSkewX(-0.25f); - canvas.drawText("Hello OpenGL renderer!", 680, 200, mSkewPaint); + canvas.drawText("Hello OpenGL renderer!", 980, 200, mSkewPaint); mSkewPaint.setTextSkewX(0.5f); - canvas.drawText("Hello OpenGL renderer!", 680, 230, mSkewPaint); + canvas.drawText("Hello OpenGL renderer!", 980, 230, mSkewPaint); mSkewPaint.setTextSkewX(0.0f); - canvas.drawText("Hello OpenGL renderer!", 680, 260, mSkewPaint); + canvas.drawText("Hello OpenGL renderer!", 980, 260, mSkewPaint); mScaledPaint.setTextScaleX(0.5f); canvas.drawText("Hello OpenGL renderer!", 500, 200, mScaledPaint); @@ -125,4 +127,4 @@ public class TextActivity extends Activity { canvas.restore(); } } -}
\ No newline at end of file +} diff --git a/voip/java/android/net/rtp/AudioCodec.java b/voip/java/android/net/rtp/AudioCodec.java index 3877aeb08b2d..85255c84b346 100644 --- a/voip/java/android/net/rtp/AudioCodec.java +++ b/voip/java/android/net/rtp/AudioCodec.java @@ -33,7 +33,6 @@ import java.util.Arrays; * </pre> * * @see AudioStream - * @hide */ public class AudioCodec { /** diff --git a/voip/java/android/net/rtp/AudioGroup.java b/voip/java/android/net/rtp/AudioGroup.java index 20c896934a1b..3e7ace83c99b 100644 --- a/voip/java/android/net/rtp/AudioGroup.java +++ b/voip/java/android/net/rtp/AudioGroup.java @@ -59,7 +59,6 @@ import java.util.Map; * the AudioGroups is in use.</p> * * @see AudioStream - * @hide */ public class AudioGroup { /** diff --git a/voip/java/android/net/rtp/AudioStream.java b/voip/java/android/net/rtp/AudioStream.java index b45cc5e91b23..d761214d3fd0 100644 --- a/voip/java/android/net/rtp/AudioStream.java +++ b/voip/java/android/net/rtp/AudioStream.java @@ -41,7 +41,6 @@ import java.net.SocketException; * * @see RtpStream * @see AudioGroup - * @hide */ public class AudioStream extends RtpStream { private AudioCodec mCodec; diff --git a/voip/java/android/net/rtp/RtpStream.java b/voip/java/android/net/rtp/RtpStream.java index 87d8bc6cd81c..e94ac426430b 100644 --- a/voip/java/android/net/rtp/RtpStream.java +++ b/voip/java/android/net/rtp/RtpStream.java @@ -27,7 +27,6 @@ import java.net.SocketException; * * <p class="note">Using this class requires * {@link android.Manifest.permission#INTERNET} permission.</p> - * @hide */ public class RtpStream { /** |