summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcore/java/android/animation/ValueAnimator.java4
-rw-r--r--core/java/android/content/res/AssetManager.java4
-rwxr-xr-xcore/java/android/content/res/Resources.java2
-rw-r--r--core/java/android/content/res/TypedArray.java2
-rw-r--r--core/java/android/os/HandlerThread.java6
-rw-r--r--core/java/android/os/Looper.java2
-rw-r--r--core/java/android/util/XmlPullAttributes.java2
-rw-r--r--core/java/android/view/Display.java6
-rw-r--r--core/java/android/view/GLES20Canvas.java7
-rw-r--r--core/java/android/view/LayoutInflater.java6
-rw-r--r--core/java/android/view/ViewConfiguration.java2
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java17
-rw-r--r--core/jni/Android.mk1
-rw-r--r--core/jni/AndroidRuntime.cpp2
-rw-r--r--core/jni/android/graphics/ParcelSurfaceTexture.cpp165
-rw-r--r--core/jni/android_view_GLES20Canvas.cpp6
-rw-r--r--graphics/java/android/graphics/Bitmap.java2
-rw-r--r--graphics/java/android/graphics/Canvas.java11
-rw-r--r--graphics/java/android/graphics/Paint.java10
-rw-r--r--graphics/java/android/graphics/ParcelSurfaceTexture.java118
-rw-r--r--graphics/java/android/graphics/Path.java2
-rw-r--r--graphics/java/android/graphics/Typeface.java2
-rw-r--r--include/android_runtime/android_graphics_ParcelSurfaceTexture.h37
-rw-r--r--libs/hwui/OpenGLRenderer.cpp7
-rw-r--r--libs/hwui/OpenGLRenderer.h1
-rw-r--r--media/java/android/media/MediaPlayer.java61
-rw-r--r--media/jni/android_media_MediaPlayer.cpp97
-rw-r--r--native/android/native_window.cpp10
-rw-r--r--packages/SystemUI/res/layout-sw600dp/status_bar_notification_area.xml13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java133
-rw-r--r--services/input/EventHub.cpp3
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java2
-rw-r--r--tools/layoutlib/bridge/src/android/animation/AnimationThread.java (renamed from tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java)3
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/BridgeAssetManager.java (renamed from tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeAssetManager.java)4
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/BridgeResources.java122
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java9
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/TypedArray_Delegate.java30
-rw-r--r--tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java7
-rw-r--r--tools/layoutlib/bridge/src/android/graphics/Typeface_Accessor.java (renamed from graphics/java/android/graphics/ParcelSurfaceTexture.aidl)13
-rw-r--r--tools/layoutlib/bridge/src/android/os/Looper_Accessor.java24
-rw-r--r--tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java24
-rw-r--r--tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java (renamed from tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java)3
-rw-r--r--tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java40
-rw-r--r--tools/layoutlib/bridge/src/android/view/BridgeInflater.java (renamed from tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java)4
-rw-r--r--tools/layoutlib/bridge/src/android/view/Display_Delegate.java18
-rw-r--r--tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java1
-rw-r--r--tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java26
-rw-r--r--tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java24
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java9
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java27
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java3
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java2
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java6
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/PhoneSystemBar.java3
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java1
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java7
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderDrawable.java16
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java19
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java5
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java2
60 files changed, 500 insertions, 695 deletions
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index 5df8bdcd6d23..edd0fa339256 100755
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -54,8 +54,8 @@ public class ValueAnimator extends Animator {
* Messages sent to timing handler: START is sent when an animation first begins, FRAME is sent
* by the handler to itself to process the next animation frame
*/
- private static final int ANIMATION_START = 0;
- private static final int ANIMATION_FRAME = 1;
+ static final int ANIMATION_START = 0;
+ static final int ANIMATION_FRAME = 1;
/**
* Values used with internal variable mPlayingState to indicate the current state of an
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index 931cb189d7f8..ffefaa27a852 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -62,7 +62,7 @@ public final class AssetManager {
private static final boolean DEBUG_REFS = false;
private static final Object sSync = new Object();
- private static AssetManager sSystem = null;
+ /*package*/ static AssetManager sSystem = null;
private final TypedValue mValue = new TypedValue();
private final long[] mOffsets = new long[2];
@@ -252,7 +252,7 @@ public final class AssetManager {
}
}
- private final void makeStringBlocks(boolean copyFromSystem) {
+ /*package*/ final void makeStringBlocks(boolean copyFromSystem) {
final int sysNum = copyFromSystem ? sSystem.mStringBlocks.length : 0;
final int num = getStringBlockCount();
mStringBlocks = new StringBlock[num];
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 324c9fdea6db..f52692324177 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -77,7 +77,7 @@ public class Resources {
private static final int ID_OTHER = 0x01000004;
private static final Object mSync = new Object();
- private static Resources mSystem = null;
+ /*package*/ static Resources mSystem = null;
// Information about preloaded resources. Note that they are not
// protected by a lock, because while preloading in zygote we are all
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index 37fdeb652742..2df492e74612 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -42,7 +42,7 @@ public class TypedArray {
/*package*/ int[] mData;
/*package*/ int[] mIndices;
/*package*/ int mLength;
- private TypedValue mValue = new TypedValue();
+ /*package*/ TypedValue mValue = new TypedValue();
/**
* Return the number of values in this array.
diff --git a/core/java/android/os/HandlerThread.java b/core/java/android/os/HandlerThread.java
index 911439a12227..d61b3b4a7bbc 100644
--- a/core/java/android/os/HandlerThread.java
+++ b/core/java/android/os/HandlerThread.java
@@ -21,9 +21,9 @@ package android.os;
* used to create handler classes. Note that start() must still be called.
*/
public class HandlerThread extends Thread {
- private int mPriority;
- private int mTid = -1;
- private Looper mLooper;
+ int mPriority;
+ int mTid = -1;
+ Looper mLooper;
public HandlerThread(String name) {
super(name);
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index c61f28a41894..5607f7fc7917 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -54,7 +54,7 @@ public class Looper {
private static final String TAG = "Looper";
// sThreadLocal.get() will return null unless you've called prepare().
- private static final ThreadLocal<Looper> sThreadLocal = new ThreadLocal<Looper>();
+ static final ThreadLocal<Looper> sThreadLocal = new ThreadLocal<Looper>();
final MessageQueue mQueue;
final Thread mThread;
diff --git a/core/java/android/util/XmlPullAttributes.java b/core/java/android/util/XmlPullAttributes.java
index ecedbe158dd0..6c8bb39772f3 100644
--- a/core/java/android/util/XmlPullAttributes.java
+++ b/core/java/android/util/XmlPullAttributes.java
@@ -143,5 +143,5 @@ class XmlPullAttributes implements AttributeSet {
return getAttributeResourceValue(null, "style", 0);
}
- private XmlPullParser mParser;
+ /*package*/ XmlPullParser mParser;
}
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index d9efe0c014f2..85e990aa3680 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -366,9 +366,9 @@ public class Display {
// Following fields are initialized from native code
private int mPixelFormat;
private float mRefreshRate;
- private float mDensity;
- private float mDpiX;
- private float mDpiY;
+ /*package*/ float mDensity;
+ /*package*/ float mDpiX;
+ /*package*/ float mDpiY;
private final Point mTmpPoint = new Point();
private final DisplayMetrics mTmpMetrics = new DisplayMetrics();
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index a7fe95d225fb..e586370b4830 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -509,13 +509,6 @@ class GLES20Canvas extends HardwareCanvas {
private static native void nSetMatrix(int renderer, int matrix);
@Override
- public int getNativeMatrix() {
- return nGetMatrix(mRenderer);
- }
-
- private static native int nGetMatrix(int renderer);
-
- @Override
public void getMatrix(Matrix matrix) {
nGetMatrix(mRenderer, matrix.native_instance);
}
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index 332a0fa1b6c5..9628d6b0f9fe 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -75,9 +75,9 @@ public abstract class LayoutInflater {
private Factory2 mPrivateFactory;
private Filter mFilter;
- private final Object[] mConstructorArgs = new Object[2];
+ final Object[] mConstructorArgs = new Object[2];
- private static final Class<?>[] mConstructorSignature = new Class[] {
+ static final Class<?>[] mConstructorSignature = new Class[] {
Context.class, AttributeSet.class};
private static final HashMap<String, Constructor<? extends View>> sConstructorMap =
@@ -705,7 +705,7 @@ public abstract class LayoutInflater {
* Recursive method used to descend down the xml hierarchy and instantiate
* views, instantiate their children, and then call onFinishInflate().
*/
- private void rInflate(XmlPullParser parser, View parent, final AttributeSet attrs,
+ void rInflate(XmlPullParser parser, View parent, final AttributeSet attrs,
boolean finishInflate) throws XmlPullParserException, IOException {
final int depth = parser.getDepth();
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 95209581f7c5..5e104f9e373f 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -225,7 +225,7 @@ public class ViewConfiguration {
private boolean sHasPermanentMenuKey;
private boolean sHasPermanentMenuKeySet;
- private static final SparseArray<ViewConfiguration> sConfigurations =
+ static final SparseArray<ViewConfiguration> sConfigurations =
new SparseArray<ViewConfiguration>(2);
/**
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 181958cefa37..d72a78dba960 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -462,8 +462,9 @@ public class ActionBarView extends AbsActionBarView {
mTitle = title;
if (mTitleView != null) {
mTitleView.setText(title);
- mTitleLayout.setVisibility(TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle) ?
- GONE : VISIBLE);
+ mTitleLayout.setVisibility(mExpandedActionView != null &&
+ (mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0 &&
+ (!TextUtils.isEmpty(mTitle) || !TextUtils.isEmpty(mSubtitle)) ? VISIBLE : GONE);
}
if (mLogoNavItem != null) {
mLogoNavItem.setTitle(title);
@@ -479,8 +480,9 @@ public class ActionBarView extends AbsActionBarView {
if (mSubtitleView != null) {
mSubtitleView.setText(subtitle);
mSubtitleView.setVisibility(subtitle != null ? VISIBLE : GONE);
- mTitleLayout.setVisibility(TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle) ?
- GONE : VISIBLE);
+ mTitleLayout.setVisibility(mExpandedActionView != null &&
+ (mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0 &&
+ (!TextUtils.isEmpty(mTitle) || !TextUtils.isEmpty(mSubtitle)) ? VISIBLE : GONE);
}
}
@@ -739,7 +741,12 @@ public class ActionBarView extends AbsActionBarView {
mTitleLayout.setEnabled(titleUp);
}
- addView(mTitleLayout);
+ addView(mTitleLayout, new LayoutParams(LayoutParams.WRAP_CONTENT,
+ LayoutParams.MATCH_PARENT));
+ if (mExpandedActionView != null) {
+ // Don't show while in expanded mode
+ mTitleLayout.setVisibility(GONE);
+ }
}
public void setContextView(ActionBarContextView view) {
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 170957cf9783..aece5f0b6e7e 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -104,7 +104,6 @@ LOCAL_SRC_FILES:= \
android/graphics/NinePatchImpl.cpp \
android/graphics/NinePatchPeeker.cpp \
android/graphics/Paint.cpp \
- android/graphics/ParcelSurfaceTexture.cpp \
android/graphics/Path.cpp \
android/graphics/PathMeasure.cpp \
android/graphics/PathEffect.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 9e46d805c00b..dd7dd867d5f2 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -105,7 +105,6 @@ extern int register_android_graphics_ColorFilter(JNIEnv* env);
extern int register_android_graphics_DrawFilter(JNIEnv* env);
extern int register_android_graphics_Matrix(JNIEnv* env);
extern int register_android_graphics_Paint(JNIEnv* env);
-extern int register_android_graphics_ParcelSurfaceTexture(JNIEnv* env);
extern int register_android_graphics_Path(JNIEnv* env);
extern int register_android_graphics_PathMeasure(JNIEnv* env);
extern int register_android_graphics_Picture(JNIEnv*);
@@ -1125,7 +1124,6 @@ static const RegJNIRec gRegJNI[] = {
REG_JNI(register_android_graphics_Movie),
REG_JNI(register_android_graphics_NinePatch),
REG_JNI(register_android_graphics_Paint),
- REG_JNI(register_android_graphics_ParcelSurfaceTexture),
REG_JNI(register_android_graphics_Path),
REG_JNI(register_android_graphics_PathMeasure),
REG_JNI(register_android_graphics_PathEffect),
diff --git a/core/jni/android/graphics/ParcelSurfaceTexture.cpp b/core/jni/android/graphics/ParcelSurfaceTexture.cpp
deleted file mode 100644
index 754485f9ea4f..000000000000
--- a/core/jni/android/graphics/ParcelSurfaceTexture.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2011 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 "ParcelSurfaceTexture"
-
-#include <gui/SurfaceTextureClient.h>
-#include <surfaceflinger/Surface.h>
-
-#include <android_runtime/AndroidRuntime.h>
-#include <android_runtime/android_graphics_SurfaceTexture.h>
-#include <android_runtime/android_view_Surface.h>
-
-#include <utils/Log.h>
-
-#include <binder/Parcel.h>
-
-#include "android_util_Binder.h"
-#include "jni.h"
-#include "JNIHelp.h"
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-const char* const kParcelSurfaceTextureClassPathName =
- "android/graphics/ParcelSurfaceTexture";
-
-struct fields_t {
- jfieldID iSurfaceTexture;
-};
-static fields_t fields;
-
-#define ANDROID_GRAPHICS_ISURFACETEXTURE_JNI_ID "mISurfaceTexture"
-
-// ----------------------------------------------------------------------------
-
-static void ParcelSurfaceTexture_setISurfaceTexture(
- JNIEnv* env, jobject thiz, const sp<ISurfaceTexture>& iSurfaceTexture)
-{
- ISurfaceTexture* const p =
- (ISurfaceTexture*)env->GetIntField(thiz, fields.iSurfaceTexture);
- if (iSurfaceTexture.get()) {
- iSurfaceTexture->incStrong(thiz);
- }
- if (p) {
- p->decStrong(thiz);
- }
- env->SetIntField(thiz, fields.iSurfaceTexture, (int)iSurfaceTexture.get());
-}
-
-sp<ISurfaceTexture> ParcelSurfaceTexture_getISurfaceTexture(
- JNIEnv* env, jobject thiz)
-{
- sp<ISurfaceTexture> iSurfaceTexture(
- (ISurfaceTexture*)env->GetIntField(thiz, fields.iSurfaceTexture));
- return iSurfaceTexture;
-}
-
-sp<ANativeWindow> android_ParcelSurfaceTexture_getNativeWindow(
- JNIEnv* env, jobject thiz)
-{
- sp<ISurfaceTexture> iSurfaceTexture(
- ParcelSurfaceTexture_getISurfaceTexture(env, thiz));
- sp<SurfaceTextureClient> surfaceTextureClient(iSurfaceTexture != NULL ?
- new SurfaceTextureClient(iSurfaceTexture) : NULL);
- return surfaceTextureClient;
-}
-
-bool android_ParcelSurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz)
-{
- jclass parcelSurfaceTextureClass = env->FindClass(
- kParcelSurfaceTextureClassPathName);
- return env->IsInstanceOf(thiz, parcelSurfaceTextureClass);
-}
-
-// ----------------------------------------------------------------------------
-
-static void ParcelSurfaceTexture_classInit(JNIEnv* env, jclass clazz)
-{
- fields.iSurfaceTexture =
- env->GetFieldID(clazz, ANDROID_GRAPHICS_ISURFACETEXTURE_JNI_ID, "I");
- if (fields.iSurfaceTexture == NULL) {
- LOGE("can't find android/graphics/ParcelSurfaceTexture.%s",
- ANDROID_GRAPHICS_ISURFACETEXTURE_JNI_ID);
- }
-}
-
-static void ParcelSurfaceTexture_initFromSurface(
- JNIEnv* env, jobject thiz, jobject jSurface)
-{
- sp<Surface> surface(Surface_getSurface(env, jSurface));
- sp<ISurfaceTexture> iSurfaceTexture(surface->getSurfaceTexture());
- ParcelSurfaceTexture_setISurfaceTexture(env, thiz, iSurfaceTexture);
-}
-
-static void ParcelSurfaceTexture_initFromSurfaceTexture(
- JNIEnv* env, jobject thiz, jobject jSurfaceTexture)
-{
- sp<ISurfaceTexture> iSurfaceTexture(
- SurfaceTexture_getSurfaceTexture(env, jSurfaceTexture));
- ParcelSurfaceTexture_setISurfaceTexture(env, thiz, iSurfaceTexture);
-}
-
-static void ParcelSurfaceTexture_finalize(JNIEnv* env, jobject thiz)
-{
- ParcelSurfaceTexture_setISurfaceTexture(env, thiz, 0);
-}
-
-static void ParcelSurfaceTexture_writeToParcel(
- JNIEnv* env, jobject thiz, jobject jParcel, jint flags)
-{
- Parcel* parcel = parcelForJavaObject(env, jParcel);
- sp<ISurfaceTexture> iSurfaceTexture(
- ParcelSurfaceTexture_getISurfaceTexture(env, thiz));
- sp<IBinder> b(iSurfaceTexture->asBinder());
- parcel->writeStrongBinder(b);
-}
-
-static void ParcelSurfaceTexture_readFromParcel(
- JNIEnv* env, jobject thiz, jobject jParcel)
-{
- Parcel* parcel = parcelForJavaObject(env, jParcel);
- sp<ISurfaceTexture> iSurfaceTexture(
- interface_cast<ISurfaceTexture>(parcel->readStrongBinder()));
- ParcelSurfaceTexture_setISurfaceTexture(env, thiz, iSurfaceTexture);
-}
-
-// ----------------------------------------------------------------------------
-
-static JNINativeMethod gParcelSurfaceTextureMethods[] = {
- {"nativeClassInit", "()V", (void*)ParcelSurfaceTexture_classInit },
- {"nativeInitFromSurface", "(Landroid/view/Surface;)V",
- (void *)ParcelSurfaceTexture_initFromSurface },
- {"nativeInitFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)V",
- (void *)ParcelSurfaceTexture_initFromSurfaceTexture },
- { "nativeFinalize", "()V", (void *)ParcelSurfaceTexture_finalize },
- { "nativeWriteToParcel", "(Landroid/os/Parcel;I)V",
- (void *)ParcelSurfaceTexture_writeToParcel },
- { "nativeReadFromParcel", "(Landroid/os/Parcel;)V",
- (void *)ParcelSurfaceTexture_readFromParcel },
-};
-
-
-int register_android_graphics_ParcelSurfaceTexture(JNIEnv* env)
-{
- int err = 0;
- err = AndroidRuntime::registerNativeMethods(env, kParcelSurfaceTextureClassPathName,
- gParcelSurfaceTextureMethods, NELEM(gParcelSurfaceTextureMethods));
- return err;
-}
-
-} // namespace android
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index b3f2d514c504..039c5ba32ce1 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -289,11 +289,6 @@ static void android_view_GLES20Canvas_setMatrix(JNIEnv* env, jobject clazz,
renderer->setMatrix(matrix);
}
-static const float* android_view_GLES20Canvas_getNativeMatrix(JNIEnv* env,
- jobject clazz, OpenGLRenderer* renderer) {
- return renderer->getMatrix();
-}
-
static void android_view_GLES20Canvas_getMatrix(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, SkMatrix* matrix) {
renderer->getMatrix(matrix);
@@ -776,7 +771,6 @@ static JNINativeMethod gMethods[] = {
{ "nSkew", "(IFF)V", (void*) android_view_GLES20Canvas_skew },
{ "nSetMatrix", "(II)V", (void*) android_view_GLES20Canvas_setMatrix },
- { "nGetMatrix", "(I)I", (void*) android_view_GLES20Canvas_getNativeMatrix },
{ "nGetMatrix", "(II)V", (void*) android_view_GLES20Canvas_getMatrix },
{ "nConcatMatrix", "(II)V", (void*) android_view_GLES20Canvas_concatMatrix },
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 3fc6463df80f..79acd552b583 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -93,7 +93,7 @@ public final class Bitmap implements Parcelable {
This can be called from JNI code.
*/
- private Bitmap(int nativeBitmap, byte[] buffer, boolean isMutable, byte[] ninePatchChunk,
+ /*package*/ Bitmap(int nativeBitmap, byte[] buffer, boolean isMutable, byte[] ninePatchChunk,
int density) {
if (nativeBitmap == 0) {
throw new RuntimeException("internal error: native bitmap is 0");
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 6ae8c9ba17ae..eefd21ed1984 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -508,17 +508,6 @@ public class Canvas {
}
/**
- * Returns a pointer to an internal 4x4 native matrix. The returned
- * pointer is a pointer to an array of 16 floats.
- *
- * @hide
- */
- @SuppressWarnings({"UnusedDeclaration"})
- public int getNativeMatrix() {
- return 0;
- }
-
- /**
* Return a new matrix with a copy of the canvas' current transformation
* matrix.
*/
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index fe4b08247ad7..828bafdc6141 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -70,16 +70,16 @@ public class Paint {
*/
public int mBidiFlags = BIDI_DEFAULT_LTR;
- private static final Style[] sStyleArray = {
+ static final Style[] sStyleArray = {
Style.FILL, Style.STROKE, Style.FILL_AND_STROKE
};
- private static final Cap[] sCapArray = {
+ static final Cap[] sCapArray = {
Cap.BUTT, Cap.ROUND, Cap.SQUARE
};
- private static final Join[] sJoinArray = {
+ static final Join[] sJoinArray = {
Join.MITER, Join.ROUND, Join.BEVEL
};
- private static final Align[] sAlignArray = {
+ static final Align[] sAlignArray = {
Align.LEFT, Align.CENTER, Align.RIGHT
};
@@ -103,7 +103,7 @@ public class Paint {
public static final int DEV_KERN_TEXT_FLAG = 0x100;
// we use this when we first create a paint
- private static final int DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG;
+ static final int DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG;
/**
* Bidi flag to set LTR paragraph direction.
diff --git a/graphics/java/android/graphics/ParcelSurfaceTexture.java b/graphics/java/android/graphics/ParcelSurfaceTexture.java
deleted file mode 100644
index cc8bd02de19f..000000000000
--- a/graphics/java/android/graphics/ParcelSurfaceTexture.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package android.graphics;
-
-import android.graphics.SurfaceTexture;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.view.Surface;
-
-/**
- *
- * @hide Pending review by API council.
- */
-public final class ParcelSurfaceTexture implements Parcelable {
- /**
- * This field is used by native code, do not access or modify.
- *
- * @hide
- */
- @SuppressWarnings({"UnusedDeclaration"})
- private int mISurfaceTexture;
-
- /**
- * Create a new ParcelSurfaceTexture from a Surface
- *
- * @param surface The Surface to create a ParcelSurfaceTexture from.
- *
- * @return Returns a new ParcelSurfaceTexture for the given Surface.
- */
- public static ParcelSurfaceTexture fromSurface(Surface surface) {
- return new ParcelSurfaceTexture(surface);
- }
-
- /**
- * Create a new ParcelSurfaceTexture from a SurfaceTexture
- *
- * @param surfaceTexture The SurfaceTexture to transport.
- *
- * @return Returns a new ParcelSurfaceTexture for the given SurfaceTexture.
- */
- public static ParcelSurfaceTexture fromSurfaceTexture(SurfaceTexture surfaceTexture) {
- return new ParcelSurfaceTexture(surfaceTexture);
- }
-
- /**
- * @see android.os.Parcelable#describeContents()
- */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- nativeWriteToParcel(dest, flags);
- }
-
- public static final Parcelable.Creator<ParcelSurfaceTexture> CREATOR =
- new Parcelable.Creator<ParcelSurfaceTexture>() {
- @Override
- public ParcelSurfaceTexture createFromParcel(Parcel in) {
- return new ParcelSurfaceTexture(in);
- }
- @Override
- public ParcelSurfaceTexture[] newArray(int size) {
- return new ParcelSurfaceTexture[size];
- }
- };
-
- private ParcelSurfaceTexture(Parcel in) {
- nativeReadFromParcel(in);
- }
- private ParcelSurfaceTexture(Surface surface) {
- nativeInitFromSurface(surface);
- }
- private ParcelSurfaceTexture(SurfaceTexture surfaceTexture) {
- nativeInitFromSurfaceTexture(surfaceTexture);
- }
-
- @Override
- protected void finalize() throws Throwable {
- try {
- nativeFinalize();
- } finally {
- super.finalize();
- }
- }
-
- private native void nativeInitFromSurface(Surface surface);
- private native void nativeInitFromSurfaceTexture(SurfaceTexture surfaceTexture);
- private native void nativeFinalize();
- private native void nativeWriteToParcel(Parcel dest, int flags);
- private native void nativeReadFromParcel(Parcel in);
-
- /*
- * We use a class initializer to allow the native code to cache some
- * field offsets.
- */
- private static native void nativeClassInit();
- static { nativeClassInit(); }
-}
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index c5d7500a25e2..b4f1e84d6ba1 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -115,7 +115,7 @@ public class Path {
}
// these must be in the same order as their native values
- private static final FillType[] sFillTypeArray = {
+ static final FillType[] sFillTypeArray = {
FillType.WINDING,
FillType.EVEN_ODD,
FillType.INVERSE_WINDING,
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index bc92d3ad8bc9..ed6fa080c4a1 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -43,7 +43,7 @@ public class Typeface {
/** The NORMAL style of the default monospace typeface. */
public static final Typeface MONOSPACE;
- private static Typeface[] sDefaults;
+ /* package */ static Typeface[] sDefaults;
/* package */ int native_instance;
diff --git a/include/android_runtime/android_graphics_ParcelSurfaceTexture.h b/include/android_runtime/android_graphics_ParcelSurfaceTexture.h
deleted file mode 100644
index b94ac9b532be..000000000000
--- a/include/android_runtime/android_graphics_ParcelSurfaceTexture.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2011 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_GRAPHICS_PARCELSURFACETEXTURE_H
-#define _ANDROID_GRAPHICS_PARCELSURFACETEXTURE_H
-
-#include <android/native_window.h>
-
-#include "jni.h"
-
-namespace android {
-
-class ISurfaceTexture;
-
-extern sp<ANativeWindow> android_ParcelSurfaceTexture_getNativeWindow(
- JNIEnv* env, jobject thiz);
-extern bool android_ParcelSurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz);
-
-/* Gets the underlying ISurfaceTexture from a ParcelSurfaceTexture Java object. */
-extern sp<ISurfaceTexture> ParcelSurfaceTexture_getISurfaceTexture(JNIEnv* env, jobject thiz);
-
-} // namespace android
-
-#endif // _ANDROID_GRAPHICS_PARCELSURFACETEXTURE_H
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index ed2fa3c6e107..4864cff6931d 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -924,13 +924,6 @@ void OpenGLRenderer::setMatrix(SkMatrix* matrix) {
mSnapshot->transform->load(*matrix);
}
-const float* OpenGLRenderer::getMatrix() const {
- if (mSnapshot->fbo != 0) {
- return &mSnapshot->transform->data[0];
- }
- return &mIdentity.data[0];
-}
-
void OpenGLRenderer::getMatrix(SkMatrix* matrix) {
mSnapshot->transform->copyTo(*matrix);
}
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index fa893f02a69d..14b22b39cfdb 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -87,7 +87,6 @@ public:
virtual void scale(float sx, float sy);
virtual void skew(float sx, float sy);
- const float* getMatrix() const;
void getMatrix(SkMatrix* matrix);
virtual void setMatrix(SkMatrix* matrix);
virtual void concatMatrix(SkMatrix* matrix);
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 434ef1478fe4..66bd56a01b3b 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -30,7 +30,6 @@ import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.graphics.Bitmap;
-import android.graphics.ParcelSurfaceTexture;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
@@ -527,10 +526,9 @@ public class MediaPlayer
private final static String IMEDIA_PLAYER = "android.media.IMediaPlayer";
private int mNativeContext; // accessed by native methods
+ private int mNativeSurfaceTexture; // accessed by native methods
private int mListenerContext; // accessed by native methods
- private Surface mSurface; // accessed by native methods
- private SurfaceHolder mSurfaceHolder;
- private ParcelSurfaceTexture mParcelSurfaceTexture; // accessed by native methods
+ private SurfaceHolder mSurfaceHolder;
private EventHandler mEventHandler;
private PowerManager.WakeLock mWakeLock = null;
private boolean mScreenOnWhilePlaying;
@@ -561,10 +559,10 @@ public class MediaPlayer
}
/*
- * Update the MediaPlayer ISurface and ISurfaceTexture.
- * Call after updating mSurface and/or mParcelSurfaceTexture.
+ * Update the MediaPlayer SurfaceTexture.
+ * Call after setting a new display surface.
*/
- private native void _setVideoSurfaceOrSurfaceTexture();
+ private native void _setVideoSurface(Surface surface);
/**
* Create a request parcel which can be routed to the native media
@@ -619,13 +617,13 @@ public class MediaPlayer
*/
public void setDisplay(SurfaceHolder sh) {
mSurfaceHolder = sh;
+ Surface surface;
if (sh != null) {
- mSurface = sh.getSurface();
+ surface = sh.getSurface();
} else {
- mSurface = null;
+ surface = null;
}
- mParcelSurfaceTexture = null;
- _setVideoSurfaceOrSurfaceTexture();
+ _setVideoSurface(surface);
updateSurfaceScreenOn();
}
@@ -641,13 +639,11 @@ public class MediaPlayer
* @hide Pending review by API council.
*/
public void setSurface(Surface surface) {
- if (mScreenOnWhilePlaying && surface != null && mSurface != null) {
+ if (mScreenOnWhilePlaying && surface != null) {
Log.w(TAG, "setScreenOnWhilePlaying(true) is ineffective for Surface");
}
mSurfaceHolder = null;
- mSurface = surface;
- mParcelSurfaceTexture = null; // TODO(tedbo): Remove.
- _setVideoSurfaceOrSurfaceTexture();
+ _setVideoSurface(surface);
updateSurfaceScreenOn();
}
@@ -670,34 +666,19 @@ public class MediaPlayer
* by time-of-day adjustments, but is reset when the position is set.
*/
public void setTexture(SurfaceTexture st) {
- ParcelSurfaceTexture pst = null;
+ // TODO: This method should be hidden before it is published and setSurface
+ // should be unhidden and made public instead.
if (st != null) {
- pst = ParcelSurfaceTexture.fromSurfaceTexture(st);
- }
- setParcelSurfaceTexture(pst);
- }
+ Surface surface = new Surface(st);
+ setSurface(surface);
- /**
- * Sets the {@link ParcelSurfaceTexture} to be used as the sink for the video portion of
- * the media. This is similar to {@link #setTexture(SurfaceTexture)}, but supports using
- * a {@link ParcelSurfaceTexture} to transport the texture to be used via Binder. Setting
- * a parceled surface texture will un-set any surface or surface texture that was previously
- * set. See {@link #setTexture(SurfaceTexture)} for more details.
- *
- * @param pst The {@link ParcelSurfaceTexture} to be used as the sink for
- * the video portion of the media.
- *
- * @hide Pending removal when there are no more callers.
- */
- public void setParcelSurfaceTexture(ParcelSurfaceTexture pst) {
- if (mScreenOnWhilePlaying && pst != null && mParcelSurfaceTexture == null) {
- Log.w(TAG, "setScreenOnWhilePlaying(true) is ineffective for SurfaceTexture");
+ // It is safe and desired to release the newly created Surface here since the
+ // native code will grab a reference to the underlying ISurfaceTexture. At that
+ // point the Surface we just created is no longer needed.
+ surface.release();
+ } else {
+ setSurface(null);
}
- mSurfaceHolder = null;
- mSurface = null;
- mParcelSurfaceTexture = pst;
- _setVideoSurfaceOrSurfaceTexture();
- updateSurfaceScreenOn();
}
/**
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 9090daac17d6..13ed152c6486 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -30,7 +30,7 @@
#include "jni.h"
#include "JNIHelp.h"
#include "android_runtime/AndroidRuntime.h"
-#include "android_runtime/android_graphics_ParcelSurfaceTexture.h"
+#include "android_runtime/android_view_Surface.h"
#include "utils/Errors.h" // for status_t
#include "utils/KeyedVector.h"
#include "utils/String8.h"
@@ -51,10 +51,7 @@ using namespace android;
struct fields_t {
jfieldID context;
- jfieldID surface;
- jfieldID parcelSurfaceTexture;
- /* actually in android.view.Surface XXX */
- jfieldID surface_native;
+ jfieldID surface_texture;
jmethodID post_event;
};
@@ -123,11 +120,6 @@ void JNIMediaPlayerListener::notify(int msg, int ext1, int ext2, const Parcel *o
// ----------------------------------------------------------------------------
-static Surface* get_surface(JNIEnv* env, jobject clazz)
-{
- return (Surface*)env->GetIntField(clazz, fields.surface_native);
-}
-
static sp<MediaPlayer> getMediaPlayer(JNIEnv* env, jobject thiz)
{
Mutex::Autolock l(sLock);
@@ -244,40 +236,38 @@ android_media_MediaPlayer_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fil
process_media_player_call( env, thiz, mp->setDataSource(fd, offset, length), "java/io/IOException", "setDataSourceFD failed." );
}
-static void setVideoSurfaceOrSurfaceTexture(
- const sp<MediaPlayer>& mp, JNIEnv *env, jobject thiz, const char *prefix)
-{
- // Both mSurface and mParcelSurfaceTexture could be null.
- // We give priority to mSurface over mParcelSurfaceTexture.
- jobject surface = env->GetObjectField(thiz, fields.surface);
- if (surface != NULL) {
- sp<Surface> native_surface(get_surface(env, surface));
- LOGV("%s: surface=%p (id=%d)", prefix,
- native_surface.get(), native_surface->getIdentity());
- mp->setVideoSurface(native_surface);
- } else {
- jobject parcelSurfaceTexture = env->GetObjectField(thiz, fields.parcelSurfaceTexture);
- if (parcelSurfaceTexture != NULL) {
- sp<ISurfaceTexture> native_surfaceTexture(
- ParcelSurfaceTexture_getISurfaceTexture(env, parcelSurfaceTexture));
- LOGV("%s: texture=%p", prefix, native_surfaceTexture.get());
- mp->setVideoSurfaceTexture(native_surfaceTexture);
- } else {
- mp->setVideoSurfaceTexture(NULL);
- }
- }
+static sp<ISurfaceTexture>
+getVideoSurfaceTexture(JNIEnv* env, jobject thiz) {
+ ISurfaceTexture * const p = (ISurfaceTexture*)env->GetIntField(thiz, fields.surface_texture);
+ return sp<ISurfaceTexture>(p);
}
static void
-android_media_MediaPlayer_setVideoSurfaceOrSurfaceTexture(JNIEnv *env, jobject thiz)
+android_media_MediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface)
{
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
- setVideoSurfaceOrSurfaceTexture(mp, env, thiz,
- "_setVideoSurfaceOrSurfaceTexture");
+
+ sp<ISurfaceTexture> old_st = getVideoSurfaceTexture(env, thiz);
+ sp<ISurfaceTexture> new_st;
+ if (jsurface) {
+ sp<Surface> surface(Surface_getSurface(env, jsurface));
+ new_st = surface->getSurfaceTexture();
+ new_st->incStrong(thiz);
+ }
+ if (old_st != NULL) {
+ old_st->decStrong(thiz);
+ }
+ env->SetIntField(thiz, fields.surface_texture, (int)new_st.get());
+
+ // This will fail if the media player has not been initialized yet. This
+ // can be the case if setDisplay() on MediaPlayer.java has been called
+ // before setDataSource(). The redundant call to setVideoSurfaceTexture()
+ // in prepare/prepareAsync covers for this case.
+ mp->setVideoSurfaceTexture(new_st);
}
static void
@@ -288,7 +278,12 @@ android_media_MediaPlayer_prepare(JNIEnv *env, jobject thiz)
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
- setVideoSurfaceOrSurfaceTexture(mp, env, thiz, "prepare");
+
+ // Handle the case where the display surface was set before the mp was
+ // initialized. We try again to make it stick.
+ sp<ISurfaceTexture> st = getVideoSurfaceTexture(env, thiz);
+ mp->setVideoSurfaceTexture(st);
+
process_media_player_call( env, thiz, mp->prepare(), "java/io/IOException", "Prepare failed." );
}
@@ -300,7 +295,12 @@ android_media_MediaPlayer_prepareAsync(JNIEnv *env, jobject thiz)
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
- setVideoSurfaceOrSurfaceTexture(mp, env, thiz, "prepareAsync");
+
+ // Handle the case where the display surface was set before the mp was
+ // initialized. We try again to make it stick.
+ sp<ISurfaceTexture> st = getVideoSurfaceTexture(env, thiz);
+ mp->setVideoSurfaceTexture(st);
+
process_media_player_call( env, thiz, mp->prepareAsync(), "java/io/IOException", "Prepare Async failed." );
}
@@ -587,24 +587,8 @@ android_media_MediaPlayer_native_init(JNIEnv *env)
return;
}
- fields.surface = env->GetFieldID(clazz, "mSurface", "Landroid/view/Surface;");
- if (fields.surface == NULL) {
- return;
- }
-
- jclass surface = env->FindClass("android/view/Surface");
- if (surface == NULL) {
- return;
- }
-
- fields.surface_native = env->GetFieldID(surface, ANDROID_VIEW_SURFACE_JNI_ID, "I");
- if (fields.surface_native == NULL) {
- return;
- }
-
- fields.parcelSurfaceTexture = env->GetFieldID(clazz, "mParcelSurfaceTexture",
- "Landroid/graphics/ParcelSurfaceTexture;");
- if (fields.parcelSurfaceTexture == NULL) {
+ fields.surface_texture = env->GetFieldID(clazz, "mNativeSurfaceTexture", "I");
+ if (fields.surface_texture == NULL) {
return;
}
}
@@ -643,6 +627,7 @@ static void
android_media_MediaPlayer_native_finalize(JNIEnv *env, jobject thiz)
{
LOGV("native_finalize");
+ android_media_MediaPlayer_setVideoSurface(env, thiz, NULL);
android_media_MediaPlayer_release(env, thiz);
}
@@ -749,7 +734,7 @@ static JNINativeMethod gMethods[] = {
},
{"setDataSource", "(Ljava/io/FileDescriptor;JJ)V", (void *)android_media_MediaPlayer_setDataSourceFD},
- {"_setVideoSurfaceOrSurfaceTexture", "()V", (void *)android_media_MediaPlayer_setVideoSurfaceOrSurfaceTexture},
+ {"_setVideoSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaPlayer_setVideoSurface},
{"prepare", "()V", (void *)android_media_MediaPlayer_prepare},
{"prepareAsync", "()V", (void *)android_media_MediaPlayer_prepareAsync},
{"_start", "()V", (void *)android_media_MediaPlayer_start},
diff --git a/native/android/native_window.cpp b/native/android/native_window.cpp
index 36fc9bfad71d..d266fc681e3d 100644
--- a/native/android/native_window.cpp
+++ b/native/android/native_window.cpp
@@ -20,20 +20,12 @@
#include <android/native_window_jni.h>
#include <surfaceflinger/Surface.h>
#include <android_runtime/android_view_Surface.h>
-#include <android_runtime/android_graphics_ParcelSurfaceTexture.h>
#include <android_runtime/android_graphics_SurfaceTexture.h>
using namespace android;
ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface) {
- sp<ANativeWindow> win;
- if (android_Surface_isInstanceOf(env, surface)) {
- win = android_Surface_getNativeWindow(env, surface);
- } else if (android_SurfaceTexture_isInstanceOf(env, surface)) {
- win = android_SurfaceTexture_getNativeWindow(env, surface);
- } else if (android_ParcelSurfaceTexture_isInstanceOf(env, surface)) {
- win = android_ParcelSurfaceTexture_getNativeWindow(env, surface);
- }
+ sp<ANativeWindow> win = android_Surface_getNativeWindow(env, surface);
if (win != NULL) {
win->incStrong((void*)ANativeWindow_acquire);
}
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_notification_area.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_area.xml
index 17fa6537cb4a..c735dbd6efa4 100644
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_notification_area.xml
+++ b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_area.xml
@@ -24,6 +24,8 @@
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:orientation="horizontal"
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:clickable="true"
>
<LinearLayout
@@ -65,14 +67,7 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
- />
- <View
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignLeft="@id/icons"
- android:layout_alignRight="@id/icons"
- android:background="@drawable/notification_icon_area_smoke"
- android:clickable="false"
+ android:alpha="0.4"
/>
</com.android.systemui.statusbar.tablet.NotificationIconArea>
</LinearLayout>
@@ -88,7 +83,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dip"
- android:layout_marginLeft="4dip"
+ android:layout_marginLeft="8dip"
android:layout_marginRight="4dip"
>
<TextView android:id="@+id/time_solid"
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 7f56d45d19ff..e90aad4e36d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -103,6 +103,11 @@ public class TabletStatusBar extends StatusBar implements
// Fitts' Law assistance for LatinIME; see policy.EventHole
private static final boolean FAKE_SPACE_BAR = true;
+ // Notification "peeking" (flyover preview of individual notifications)
+ final static boolean NOTIFICATION_PEEK_ENABLED = false;
+ final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
+ final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms
+
// The height of the bar, as definied by the build. It may be taller if we're plugged
// into hdmi.
int mNaturalBarHeight = -1;
@@ -250,43 +255,45 @@ public class TabletStatusBar extends StatusBar implements
WindowManagerImpl.getDefault().addView(mNotificationPanel, lp);
// Notification preview window
- mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context,
- R.layout.status_bar_notification_peek, null);
- mNotificationPeekWindow.setBar(this);
-
- mNotificationPeekRow = (ViewGroup) mNotificationPeekWindow.findViewById(R.id.content);
- mNotificationPeekWindow.setVisibility(View.GONE);
- mNotificationPeekWindow.setOnTouchListener(
- new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PEEK, mNotificationPeekWindow));
- mNotificationPeekScrubRight = new LayoutTransition();
- mNotificationPeekScrubRight.setAnimator(LayoutTransition.APPEARING,
- ObjectAnimator.ofInt(null, "left", -512, 0));
- mNotificationPeekScrubRight.setAnimator(LayoutTransition.DISAPPEARING,
- ObjectAnimator.ofInt(null, "left", -512, 0));
- mNotificationPeekScrubRight.setDuration(500);
-
- mNotificationPeekScrubLeft = new LayoutTransition();
- mNotificationPeekScrubLeft.setAnimator(LayoutTransition.APPEARING,
- ObjectAnimator.ofInt(null, "left", 512, 0));
- mNotificationPeekScrubLeft.setAnimator(LayoutTransition.DISAPPEARING,
- ObjectAnimator.ofInt(null, "left", 512, 0));
- mNotificationPeekScrubLeft.setDuration(500);
-
- // XXX: setIgnoreChildren?
- lp = new WindowManager.LayoutParams(
- 512, // ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT,
- WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
- PixelFormat.TRANSLUCENT);
- lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
- lp.y = res.getDimensionPixelOffset(R.dimen.peek_window_y_offset);
- lp.setTitle("NotificationPeekWindow");
- lp.windowAnimations = com.android.internal.R.style.Animation_Toast;
-
- WindowManagerImpl.getDefault().addView(mNotificationPeekWindow, lp);
+ if (NOTIFICATION_PEEK_ENABLED) {
+ mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context,
+ R.layout.status_bar_notification_peek, null);
+ mNotificationPeekWindow.setBar(this);
+
+ mNotificationPeekRow = (ViewGroup) mNotificationPeekWindow.findViewById(R.id.content);
+ mNotificationPeekWindow.setVisibility(View.GONE);
+ mNotificationPeekWindow.setOnTouchListener(
+ new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PEEK, mNotificationPeekWindow));
+ mNotificationPeekScrubRight = new LayoutTransition();
+ mNotificationPeekScrubRight.setAnimator(LayoutTransition.APPEARING,
+ ObjectAnimator.ofInt(null, "left", -512, 0));
+ mNotificationPeekScrubRight.setAnimator(LayoutTransition.DISAPPEARING,
+ ObjectAnimator.ofInt(null, "left", -512, 0));
+ mNotificationPeekScrubRight.setDuration(500);
+
+ mNotificationPeekScrubLeft = new LayoutTransition();
+ mNotificationPeekScrubLeft.setAnimator(LayoutTransition.APPEARING,
+ ObjectAnimator.ofInt(null, "left", 512, 0));
+ mNotificationPeekScrubLeft.setAnimator(LayoutTransition.DISAPPEARING,
+ ObjectAnimator.ofInt(null, "left", 512, 0));
+ mNotificationPeekScrubLeft.setDuration(500);
+
+ // XXX: setIgnoreChildren?
+ lp = new WindowManager.LayoutParams(
+ 512, // ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT,
+ WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
+ WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
+ PixelFormat.TRANSLUCENT);
+ lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
+ lp.y = res.getDimensionPixelOffset(R.dimen.peek_window_y_offset);
+ lp.setTitle("NotificationPeekWindow");
+ lp.windowAnimations = com.android.internal.R.style.Animation_Toast;
+
+ WindowManagerImpl.getDefault().addView(mNotificationPeekWindow, lp);
+ }
// Recents Panel
mRecentsPanel = (RecentsPanelView) View.inflate(context,
@@ -444,17 +451,24 @@ public class TabletStatusBar extends StatusBar implements
// the whole right-hand side of the bar
mNotificationArea = sb.findViewById(R.id.notificationArea);
+ if (!NOTIFICATION_PEEK_ENABLED) {
+ mNotificationArea.setOnTouchListener(new NotificationTriggerTouchListener());
+ }
// the button to open the notification area
mNotificationTrigger = sb.findViewById(R.id.notificationTrigger);
- mNotificationTrigger.setOnTouchListener(new NotificationTriggerTouchListener());
+ if (NOTIFICATION_PEEK_ENABLED) {
+ mNotificationTrigger.setOnTouchListener(new NotificationTriggerTouchListener());
+ }
// the more notifications icon
mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons);
// where the icons go
mIconLayout = (NotificationIconArea.IconLayout) sb.findViewById(R.id.icons);
- mIconLayout.setOnTouchListener(new NotificationIconTouchListener());
+ if (NOTIFICATION_PEEK_ENABLED) {
+ mIconLayout.setOnTouchListener(new NotificationIconTouchListener());
+ }
ViewConfiguration vc = ViewConfiguration.get(context);
mNotificationPeekTapDuration = vc.getTapTimeout();
@@ -684,7 +698,9 @@ public class TabletStatusBar extends StatusBar implements
case MSG_OPEN_NOTIFICATION_PANEL:
if (DEBUG) Slog.d(TAG, "opening notifications panel");
if (!mNotificationPanel.isShowing()) {
- mNotificationPeekWindow.setVisibility(View.GONE);
+ if (NOTIFICATION_PEEK_ENABLED) {
+ mNotificationPeekWindow.setVisibility(View.GONE);
+ }
mNotificationPanel.show(true, true);
mNotificationArea.setVisibility(View.INVISIBLE);
mTicker.halt();
@@ -863,7 +879,7 @@ public class TabletStatusBar extends StatusBar implements
oldEntry.largeIcon.setVisibility(View.INVISIBLE);
}
- if (key == mNotificationPeekKey) {
+ if (NOTIFICATION_PEEK_ENABLED && key == mNotificationPeekKey) {
// must update the peek window
Message peekMsg = mHandler.obtainMessage(MSG_OPEN_NOTIFICATION_PEEK);
peekMsg.arg1 = mNotificationPeekIndex;
@@ -1010,9 +1026,11 @@ public class TabletStatusBar extends StatusBar implements
}
public void animateExpand() {
- mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
- mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK);
- mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
+ if (NOTIFICATION_PEEK_ENABLED) {
+ mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
+ mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK);
+ mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
+ }
mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PANEL);
mHandler.sendEmptyMessage(MSG_OPEN_NOTIFICATION_PANEL);
}
@@ -1026,8 +1044,10 @@ public class TabletStatusBar extends StatusBar implements
mHandler.sendEmptyMessage(MSG_CLOSE_INPUT_METHODS_PANEL);
mHandler.removeMessages(MSG_CLOSE_COMPAT_MODE_PANEL);
mHandler.sendEmptyMessage(MSG_CLOSE_COMPAT_MODE_PANEL);
- mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
- mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
+ if (NOTIFICATION_PEEK_ENABLED) {
+ mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
+ mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
+ }
}
private void notifyUiVisibilityChanged() {
@@ -1328,7 +1348,7 @@ public class TabletStatusBar extends StatusBar implements
ViewGroup rowParent = (ViewGroup)entry.row.getParent();
if (rowParent != null) rowParent.removeView(entry.row);
- if (key == mNotificationPeekKey) {
+ if (NOTIFICATION_PEEK_ENABLED && key == mNotificationPeekKey) {
// must close the peek as well, since it's gone
mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
}
@@ -1349,6 +1369,19 @@ public class TabletStatusBar extends StatusBar implements
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
+ private Runnable mHiliteOnR = new Runnable() { public void run() {
+ mNotificationArea.setBackgroundResource(
+ com.android.internal.R.drawable.list_selector_pressed_holo_dark);
+ }};
+ public void hilite(final boolean on) {
+ if (on) {
+ mNotificationArea.postDelayed(mHiliteOnR, 100);
+ } else {
+ mNotificationArea.removeCallbacks(mHiliteOnR);
+ mNotificationArea.setBackgroundDrawable(null);
+ }
+ }
+
public boolean onTouch(View v, MotionEvent event) {
// Slog.d(TAG, String.format("touch: (%.1f, %.1f) initial: (%.1f, %.1f)",
// event.getX(),
@@ -1361,6 +1394,7 @@ public class TabletStatusBar extends StatusBar implements
mVT = VelocityTracker.obtain();
mInitialTouchX = event.getX();
mInitialTouchY = event.getY();
+ hilite(true);
// fall through
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_MOVE:
@@ -1371,6 +1405,7 @@ public class TabletStatusBar extends StatusBar implements
// require a little more oomph once we're already in peekaboo mode
if (mVT.getYVelocity() < -mNotificationFlingVelocity) {
animateExpand();
+ hilite(false);
mVT.recycle();
mVT = null;
}
@@ -1378,6 +1413,7 @@ public class TabletStatusBar extends StatusBar implements
return true;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
+ hilite(false);
if (mVT != null) {
if (action == MotionEvent.ACTION_UP
// was this a sloppy tap?
@@ -1399,9 +1435,6 @@ public class TabletStatusBar extends StatusBar implements
}
}
- final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
- final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms
-
public void resetNotificationPeekFadeTimer() {
if (DEBUG) {
Slog.d(TAG, "setting peek fade timer for " + NOTIFICATION_PEEK_FADE_DELAY
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 960e4143e659..1d7cc19c02b8 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -312,6 +312,8 @@ int32_t EventHub::getSwitchState(int32_t deviceId, int32_t sw) const {
}
status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const {
+ *outValue = 0;
+
if (axis >= 0 && axis <= ABS_MAX) {
AutoMutex _l(mLock);
@@ -328,7 +330,6 @@ status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t*
return OK;
}
}
- *outValue = 0;
return -1;
}
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 5bc5f304042e..0a6e89e3c31d 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -598,7 +598,7 @@ public class WindowManagerService extends IWindowManager.Stub
* Whether the UI is currently running in touch mode (not showing
* navigational focus because the user is directly pressing the screen).
*/
- boolean mInTouchMode = false;
+ boolean mInTouchMode = true;
private ViewServer mViewServer;
private ArrayList<WindowChangeListener> mWindowChangeListeners =
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java b/tools/layoutlib/bridge/src/android/animation/AnimationThread.java
index 4c18656fe48a..2b5e4fad1f0a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java
+++ b/tools/layoutlib/bridge/src/android/animation/AnimationThread.java
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-package com.android.layoutlib.bridge.impl;
+package android.animation;
import com.android.ide.common.rendering.api.IAnimationListener;
import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.common.rendering.api.Result;
import com.android.ide.common.rendering.api.Result.Status;
import com.android.layoutlib.bridge.Bridge;
+import com.android.layoutlib.bridge.impl.RenderSessionImpl;
import android.animation.ValueAnimator;
import android.os.Handler;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeAssetManager.java b/tools/layoutlib/bridge/src/android/content/res/BridgeAssetManager.java
index a8250603af5d..a95391885444 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeAssetManager.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeAssetManager.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.layoutlib.bridge.android;
+package android.content.res;
import com.android.layoutlib.bridge.Bridge;
@@ -30,7 +30,7 @@ public class BridgeAssetManager extends AssetManager {
* <p/>
* {@link Bridge} calls this method after setting up a new bridge.
*/
- /*package*/ public static AssetManager initSystem() {
+ public static AssetManager initSystem() {
if (!(AssetManager.sSystem instanceof BridgeAssetManager)) {
// Note that AssetManager() creates a system AssetManager and we override it
// with our BridgeAssetManager.
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
index 0928ec572540..7b672da0c45e 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
@@ -214,7 +214,15 @@ public final class BridgeResources extends Resources {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
if (value != null) {
- return value.getSecond().getValue();
+ ResourceValue resValue = value.getSecond();
+
+ assert resValue != null;
+ if (resValue != null) {
+ String v = resValue.getValue();
+ if (v != null) {
+ return v;
+ }
+ }
}
// id was not found or not resolved. Throw a NotFoundException.
@@ -318,20 +326,24 @@ public final class BridgeResources extends Resources {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
if (value != null) {
- String v = value.getSecond().getValue();
-
- if (v != null) {
- if (v.equals(BridgeConstants.MATCH_PARENT) ||
- v.equals(BridgeConstants.FILL_PARENT)) {
- return LayoutParams.MATCH_PARENT;
- } else if (v.equals(BridgeConstants.WRAP_CONTENT)) {
- return LayoutParams.WRAP_CONTENT;
- }
+ ResourceValue resValue = value.getSecond();
+
+ assert resValue != null;
+ if (resValue != null) {
+ String v = resValue.getValue();
+ if (v != null) {
+ if (v.equals(BridgeConstants.MATCH_PARENT) ||
+ v.equals(BridgeConstants.FILL_PARENT)) {
+ return LayoutParams.MATCH_PARENT;
+ } else if (v.equals(BridgeConstants.WRAP_CONTENT)) {
+ return LayoutParams.WRAP_CONTENT;
+ }
- if (ResourceHelper.parseFloatAttribute(
- value.getFirst(), v, mTmpValue, true /*requireUnit*/) &&
- mTmpValue.type == TypedValue.TYPE_DIMENSION) {
- return mTmpValue.getDimension(getDisplayMetrics());
+ if (ResourceHelper.parseFloatAttribute(
+ value.getFirst(), v, mTmpValue, true /*requireUnit*/) &&
+ mTmpValue.type == TypedValue.TYPE_DIMENSION) {
+ return mTmpValue.getDimension(getDisplayMetrics());
+ }
}
}
}
@@ -348,14 +360,18 @@ public final class BridgeResources extends Resources {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
if (value != null) {
- String v = value.getSecond().getValue();
-
- if (v != null) {
- if (ResourceHelper.parseFloatAttribute(
- value.getFirst(), v, mTmpValue, true /*requireUnit*/) &&
- mTmpValue.type == TypedValue.TYPE_DIMENSION) {
- return TypedValue.complexToDimensionPixelOffset(mTmpValue.data,
- getDisplayMetrics());
+ ResourceValue resValue = value.getSecond();
+
+ assert resValue != null;
+ if (resValue != null) {
+ String v = resValue.getValue();
+ if (v != null) {
+ if (ResourceHelper.parseFloatAttribute(
+ value.getFirst(), v, mTmpValue, true /*requireUnit*/) &&
+ mTmpValue.type == TypedValue.TYPE_DIMENSION) {
+ return TypedValue.complexToDimensionPixelOffset(mTmpValue.data,
+ getDisplayMetrics());
+ }
}
}
}
@@ -372,14 +388,18 @@ public final class BridgeResources extends Resources {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
if (value != null) {
- String v = value.getSecond().getValue();
-
- if (v != null) {
- if (ResourceHelper.parseFloatAttribute(
- value.getFirst(), v, mTmpValue, true /*requireUnit*/) &&
- mTmpValue.type == TypedValue.TYPE_DIMENSION) {
- return TypedValue.complexToDimensionPixelSize(mTmpValue.data,
- getDisplayMetrics());
+ ResourceValue resValue = value.getSecond();
+
+ assert resValue != null;
+ if (resValue != null) {
+ String v = resValue.getValue();
+ if (v != null) {
+ if (ResourceHelper.parseFloatAttribute(
+ value.getFirst(), v, mTmpValue, true /*requireUnit*/) &&
+ mTmpValue.type == TypedValue.TYPE_DIMENSION) {
+ return TypedValue.complexToDimensionPixelSize(mTmpValue.data,
+ getDisplayMetrics());
+ }
}
}
}
@@ -395,17 +415,24 @@ public final class BridgeResources extends Resources {
public int getInteger(int id) throws NotFoundException {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
- if (value != null && value.getSecond().getValue() != null) {
- String v = value.getSecond().getValue();
- int radix = 10;
- if (v.startsWith("0x")) {
- v = v.substring(2);
- radix = 16;
- }
- try {
- return Integer.parseInt(v, radix);
- } catch (NumberFormatException e) {
- // return exception below
+ if (value != null) {
+ ResourceValue resValue = value.getSecond();
+
+ assert resValue != null;
+ if (resValue != null) {
+ String v = resValue.getValue();
+ if (v != null) {
+ int radix = 10;
+ if (v.startsWith("0x")) {
+ v = v.substring(2);
+ radix = 16;
+ }
+ try {
+ return Integer.parseInt(v, radix);
+ } catch (NumberFormatException e) {
+ // return exception below
+ }
+ }
}
}
@@ -420,9 +447,16 @@ public final class BridgeResources extends Resources {
public boolean getBoolean(int id) throws NotFoundException {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
- if (value != null && value.getSecond().getValue() != null) {
- String v = value.getSecond().getValue();
- return Boolean.parseBoolean(v);
+ if (value != null) {
+ ResourceValue resValue = value.getSecond();
+
+ assert resValue != null;
+ if (resValue != null) {
+ String v = resValue.getValue();
+ if (v != null) {
+ return Boolean.parseBoolean(v);
+ }
+ }
}
// id was not found or not resolved. Throw a NotFoundException.
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
index 9deed32555d1..8fdac02738ab 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
@@ -33,9 +33,6 @@ import com.android.resources.ResourceType;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import android.content.res.ColorStateList;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.util.TypedValue;
@@ -897,12 +894,6 @@ public final class BridgeTypedArray extends TypedArray {
}
@Override
- public boolean getValueAt(int index, TypedValue outValue) {
- // pass
- return false;
- }
-
- @Override
public String toString() {
return Arrays.toString(mResourceData);
}
diff --git a/tools/layoutlib/bridge/src/android/content/res/TypedArray_Delegate.java b/tools/layoutlib/bridge/src/android/content/res/TypedArray_Delegate.java
new file mode 100644
index 000000000000..0a7899a09beb
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/content/res/TypedArray_Delegate.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+package android.content.res;
+
+import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+
+import android.util.TypedValue;
+
+public class TypedArray_Delegate {
+
+ @LayoutlibDelegate
+ public static boolean getValueAt(TypedArray theTypedArray, int index, TypedValue outValue) {
+ // pass
+ return false;
+ }
+}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
index 66e59d865534..eadec023bc37 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -22,7 +22,6 @@ import com.android.layoutlib.bridge.impl.DelegateManager;
import com.android.resources.Density;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
-import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Parcel;
@@ -149,7 +148,7 @@ public final class Bitmap_Delegate {
}
public static int getBufferedImageType(int nativeBitmapConfig) {
- switch (Config.sConfigs[nativeBitmapConfig]) {
+ switch (Config.nativeToConfig(nativeBitmapConfig)) {
case ALPHA_8:
return BufferedImage.TYPE_INT_ARGB;
case RGB_565:
@@ -210,7 +209,7 @@ public final class Bitmap_Delegate {
}
// create a delegate with the content of the stream.
- Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.sConfigs[nativeConfig]);
+ Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.nativeToConfig(nativeConfig));
return createBitmap(delegate, mutable, Bitmap.getDefaultDensity());
}
@@ -238,7 +237,7 @@ public final class Bitmap_Delegate {
image.setRGB(0, 0, width, height, argb, 0, width);
// create a delegate with the content of the stream.
- Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.sConfigs[nativeConfig]);
+ Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.nativeToConfig(nativeConfig));
return createBitmap(delegate, isMutable, Bitmap.getDefaultDensity());
}
diff --git a/graphics/java/android/graphics/ParcelSurfaceTexture.aidl b/tools/layoutlib/bridge/src/android/graphics/Typeface_Accessor.java
index 35ff285075fc..274577076f2c 100644
--- a/graphics/java/android/graphics/ParcelSurfaceTexture.aidl
+++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Accessor.java
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2011, The Android Open Source Project
+/*
+ * Copyright (C) 2011 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
+ * 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,
@@ -16,4 +16,9 @@
package android.graphics;
-parcelable ParcelSurfaceTexture;
+public class Typeface_Accessor {
+
+ public static void resetDefaults() {
+ Typeface.sDefaults = null;
+ }
+}
diff --git a/tools/layoutlib/bridge/src/android/os/Looper_Accessor.java b/tools/layoutlib/bridge/src/android/os/Looper_Accessor.java
new file mode 100644
index 000000000000..ad95fcc1e624
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/os/Looper_Accessor.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+package android.os;
+
+public class Looper_Accessor {
+
+ public static void cleanupThread() {
+ // clean up the looper
+ Looper.sThreadLocal.remove();
+ }
+}
diff --git a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
index 63711a78e5d8..bd332a68f8fb 100644
--- a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
@@ -68,4 +68,28 @@ public class SystemClock_Delegate {
/*package*/ static long currentThreadTimeMillis() {
return System.currentTimeMillis();
}
+
+ /**
+ * Returns microseconds running in the current thread.
+ *
+ * @return elapsed microseconds in the thread
+ *
+ * @hide
+ */
+ @LayoutlibDelegate
+ /*package*/ static long currentThreadTimeMicro() {
+ return System.currentTimeMillis() * 1000;
+ }
+
+ /**
+ * Returns current wall time in microseconds.
+ *
+ * @return elapsed microseconds in wall time
+ *
+ * @hide
+ */
+ @LayoutlibDelegate
+ /*package*/ static long currentTimeMicro() {
+ return elapsedRealtime() * 1000;
+ }
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java
index ba856e09a8ca..0a3cdc66f032 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java
+++ b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-package com.android.layoutlib.bridge.android;
+package android.util;
import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.BridgeConstants;
+import com.android.layoutlib.bridge.android.BridgeContext;
import com.android.resources.ResourceType;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java b/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java
new file mode 100644
index 000000000000..e3778b199f67
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+package android.view;
+
+import com.android.layoutlib.bridge.android.BridgeWindow;
+import com.android.layoutlib.bridge.android.BridgeWindowSession;
+
+import android.os.Handler;
+import android.view.View.AttachInfo;
+
+public class AttachInfo_Accessor {
+
+ public static void setAttachInfo(View view) {
+ AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(),
+ new Handler(), null);
+ info.mHasWindowFocus = true;
+ info.mWindowVisibility = View.VISIBLE;
+ info.mInTouchMode = false; // this is so that we can display selections.
+ info.mHardwareAccelerated = false;
+ view.dispatchAttachedToWindow(info, 0);
+ }
+
+ public static void dispatchOnPreDraw(View view) {
+ view.mAttachInfo.mTreeObserver.dispatchOnPreDraw();
+ }
+}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
index 4a6393d88d9f..941f1ce6ef22 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java
+++ b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.layoutlib.bridge.android;
+package android.view;
import com.android.ide.common.rendering.api.IProjectCallback;
import com.android.ide.common.rendering.api.LayoutLog;
@@ -22,6 +22,8 @@ import com.android.ide.common.rendering.api.MergeCookie;
import com.android.ide.common.rendering.api.ResourceReference;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.layoutlib.bridge.Bridge;
+import com.android.layoutlib.bridge.android.BridgeContext;
+import com.android.layoutlib.bridge.android.BridgeXmlBlockParser;
import com.android.layoutlib.bridge.impl.ParserFactory;
import com.android.resources.ResourceType;
import com.android.util.Pair;
diff --git a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java
index 83f9cc25faf0..973253074640 100644
--- a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java
@@ -46,31 +46,17 @@ public class Display_Delegate {
}
@LayoutlibDelegate
- /** @hide Returns the actual screen size, not including any decor. */
- /*package*/ static int getRealWidth(Display theDisplay) {
- // always dynamically query for the current window manager
- return RenderAction.getCurrentContext().getIWindowManager().getMetrics().widthPixels;
- }
-
- @LayoutlibDelegate
- /** @hide Returns the actual screen size, not including any decor. */
- /*package*/ static int getRealHeight(Display theDisplay) {
- // always dynamically query for the current window manager
- return RenderAction.getCurrentContext().getIWindowManager().getMetrics().heightPixels;
- }
-
- @LayoutlibDelegate
/** @hide special for when we are faking the screen size. */
/*package*/ static int getRawWidth(Display theDisplay) {
// same as real since we're not faking compatibility mode.
- return getRealWidth(theDisplay);
+ return RenderAction.getCurrentContext().getIWindowManager().getMetrics().widthPixels;
}
@LayoutlibDelegate
/** @hide special for when we are faking the screen size. */
/*package*/ static int getRawHeight(Display theDisplay) {
// same as real since we're not faking compatibility mode.
- return getRealHeight(theDisplay);
+ return RenderAction.getCurrentContext().getIWindowManager().getMetrics().heightPixels;
}
@LayoutlibDelegate
diff --git a/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java b/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java
index 64efa7e51dfe..3db3a1b0857b 100644
--- a/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java
@@ -16,7 +16,6 @@
package android.view;
-import com.android.layoutlib.bridge.android.BridgeInflater;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java b/tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java
new file mode 100644
index 000000000000..01db34e3721f
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+package android.view;
+
+public class ViewConfiguration_Accessor {
+
+ public static void clearConfigurations() {
+ // clear the stored ViewConfiguration since the map is per density and not per context.
+ ViewConfiguration.sConfigurations.clear();
+ }
+
+}
diff --git a/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java b/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java
new file mode 100644
index 000000000000..875336aa3e6e
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+package android.view.inputmethod;
+
+public class InputMethodManager_Accessor {
+
+ public static void resetInstance() {
+ InputMethodManager.mInstance = null;
+ }
+}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index 3ba32573aec8..33bf7bc785e3 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -26,7 +26,6 @@ import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.common.rendering.api.Result;
import com.android.ide.common.rendering.api.SessionParams;
import com.android.ide.common.rendering.api.Result.Status;
-import com.android.layoutlib.bridge.android.BridgeAssetManager;
import com.android.layoutlib.bridge.impl.FontLoader;
import com.android.layoutlib.bridge.impl.RenderDrawable;
import com.android.layoutlib.bridge.impl.RenderSessionImpl;
@@ -36,10 +35,12 @@ import com.android.tools.layoutlib.create.MethodAdapter;
import com.android.tools.layoutlib.create.OverrideMethod;
import com.android.util.Pair;
+import android.content.res.BridgeAssetManager;
import android.graphics.Bitmap;
-import android.graphics.Typeface;
+import android.graphics.Typeface_Accessor;
import android.graphics.Typeface_Delegate;
import android.os.Looper;
+import android.os.Looper_Accessor;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
@@ -295,7 +296,7 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge {
BridgeAssetManager.clearSystem();
// dispose of the default typeface.
- Typeface.sDefaults = null;
+ Typeface_Accessor.resetDefaults();
return true;
}
@@ -429,7 +430,7 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge {
*/
public static void cleanupThread() {
// clean up the looper
- Looper.sThreadLocal.remove();
+ Looper_Accessor.cleanupThread();
}
public static LayoutLog getLog() {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index b38b3b8c5741..0453a5e3097c 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -33,8 +33,6 @@ import com.android.util.Pair;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import android.app.Activity;
-import android.app.Fragment;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -65,7 +63,7 @@ import android.os.Looper;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
-import android.view.LayoutInflater;
+import android.view.BridgeInflater;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
@@ -87,7 +85,7 @@ import java.util.concurrent.atomic.AtomicReference;
/**
* Custom implementation of Context/Activity to handle non compiled resources.
*/
-public final class BridgeContext extends Activity {
+public final class BridgeContext extends Context {
private Resources mSystemResources;
private final HashMap<View, Object> mViewKeyMap = new HashMap<View, Object>();
@@ -97,9 +95,10 @@ public final class BridgeContext extends Activity {
private final Configuration mConfig;
private final ApplicationInfo mApplicationInfo;
private final IProjectCallback mProjectCallback;
-
private final BridgeWindowManager mIWindowManager;
+ private Resources.Theme mTheme;
+
private final Map<Object, Map<String, String>> mDefaultPropMaps =
new IdentityHashMap<Object, Map<String,String>>();
@@ -139,9 +138,6 @@ public final class BridgeContext extends Activity {
mIWindowManager = new BridgeWindowManager(mConfig, metrics, Surface.ROTATION_0);
- mFragments.mCurState = Fragment.CREATED;
- mFragments.mActivity = this;
-
mApplicationInfo = new ApplicationInfo();
mApplicationInfo.targetSdkVersion = targetSdkVersion;
}
@@ -395,13 +391,6 @@ public final class BridgeContext extends Activity {
return Pair.of(null, false);
}
- // ------------- Activity Methods
-
- @Override
- public LayoutInflater getLayoutInflater() {
- return mBridgeInflater;
- }
-
// ------------ Context methods
@Override
@@ -1275,7 +1264,7 @@ public final class BridgeContext extends Activity {
@Override
public Context getApplicationContext() {
- throw new UnsupportedOperationException();
+ return this;
}
@Override
@@ -1288,4 +1277,10 @@ public final class BridgeContext extends Activity {
public boolean isRestricted() {
return false;
}
+
+ @Override
+ public File getObbDir() {
+ Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "OBB not supported", null);
+ return null;
+ }
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
index a8da37702676..8e673adc77f1 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
@@ -26,10 +26,9 @@ import android.view.DragEvent;
import android.view.IWindow;
import android.view.KeyEvent;
import android.view.MotionEvent;
-import android.view.View.AttachInfo;
/**
- * Implementation of {@link IWindow} to pass to the {@link AttachInfo}.
+ * Implementation of {@link IWindow} to pass to the AttachInfo.
*/
public final class BridgeWindow implements IWindow {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
index 5952c37a0e6b..7d83a9f5b50c 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
@@ -456,9 +456,7 @@ public class BridgeWindowManager implements IWindowManager {
return null;
}
- @Override
public int getPreferredOptionsPanelGravity() throws RemoteException {
return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
}
-
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java
index 1016b3271744..f8ed4f70a9f3 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java
@@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParserException;
import android.content.res.XmlResourceParser;
import android.util.AttributeSet;
-import android.util.XmlPullAttributes;
+import android.util.BridgeXmlPullAttributes;
import java.io.IOException;
import java.io.InputStream;
@@ -34,12 +34,12 @@ import java.io.Reader;
/**
* {@link BridgeXmlBlockParser} reimplements most of android.xml.XmlBlock.Parser.
* It delegates to both an instance of {@link XmlPullParser} and an instance of
- * {@link XmlPullAttributes} (for the {@link AttributeSet} part).
+ * XmlPullAttributes (for the {@link AttributeSet} part).
*/
public class BridgeXmlBlockParser implements XmlResourceParser {
private final XmlPullParser mParser;
- private final XmlPullAttributes mAttrib;
+ private final BridgeXmlPullAttributes mAttrib;
private final BridgeContext mContext;
private final boolean mPlatformFile;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/PhoneSystemBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/PhoneSystemBar.java
index 5569e069260f..7521011c76e8 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/PhoneSystemBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/PhoneSystemBar.java
@@ -32,7 +32,8 @@ public class PhoneSystemBar extends CustomBar {
public PhoneSystemBar(Context context, Density density) throws XmlPullParserException {
super(context, density, "/bars/phone_system_bar.xml", "phone_system_bar.xml");
- setGravity(mGravity | Gravity.RIGHT);
+ // FIXME: use FILL_H?
+ setGravity(Gravity.START | Gravity.TOP | Gravity.RIGHT);
setBackgroundColor(0xFF000000);
// Cannot access the inside items through id because no R.id values have been
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java
index 35e598732c61..7b701802b9a5 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java
@@ -20,6 +20,7 @@ import com.android.ide.common.rendering.api.IAnimationListener;
import com.android.ide.common.rendering.api.Result;
import com.android.ide.common.rendering.api.Result.Status;
+import android.animation.AnimationThread;
import android.animation.Animator;
public class PlayAnimationThread extends AnimationThread {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
index d40222f5ebc1..7323c6af8839 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
@@ -35,8 +35,9 @@ import android.content.res.Configuration;
import android.os.HandlerThread_Delegate;
import android.os.Looper;
import android.util.DisplayMetrics;
-import android.view.ViewConfiguration;
+import android.view.ViewConfiguration_Accessor;
import android.view.inputmethod.InputMethodManager;
+import android.view.inputmethod.InputMethodManager_Accessor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
@@ -248,10 +249,10 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
HandlerThread_Delegate.cleanUp(sCurrentContext);
// clear the stored ViewConfiguration since the map is per density and not per context.
- ViewConfiguration.sConfigurations.clear();
+ ViewConfiguration_Accessor.clearConfigurations();
// remove the InputMethodManager
- InputMethodManager.mInstance = null;
+ InputMethodManager_Accessor.resetInstance();
sCurrentContext = null;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderDrawable.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderDrawable.java
index 953d8cfe1bdf..813321080b7b 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderDrawable.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderDrawable.java
@@ -23,17 +23,13 @@ import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.rendering.api.Result;
import com.android.ide.common.rendering.api.Result.Status;
import com.android.layoutlib.bridge.android.BridgeContext;
-import com.android.layoutlib.bridge.android.BridgeWindow;
-import com.android.layoutlib.bridge.android.BridgeWindowSession;
import com.android.resources.ResourceType;
import android.graphics.Bitmap;
import android.graphics.Bitmap_Delegate;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.view.View;
-import android.view.View.AttachInfo;
+import android.view.AttachInfo_Accessor;
import android.view.View.MeasureSpec;
import android.widget.FrameLayout;
@@ -82,13 +78,7 @@ public class RenderDrawable extends RenderAction<DrawableParams> {
content.setBackgroundDrawable(d);
// set the AttachInfo on the root view.
- AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(),
- new Handler(), null);
- info.mHasWindowFocus = true;
- info.mWindowVisibility = View.VISIBLE;
- info.mInTouchMode = false; // this is so that we can display selections.
- info.mHardwareAccelerated = false;
- content.dispatchAttachedToWindow(info, 0);
+ AttachInfo_Accessor.setAttachInfo(content);
// measure
@@ -102,7 +92,7 @@ public class RenderDrawable extends RenderAction<DrawableParams> {
content.layout(0, 0, w, h);
// preDraw setup
- content.mAttachInfo.mTreeObserver.dispatchOnPreDraw();
+ AttachInfo_Accessor.dispatchOnPreDraw(content);
// draw into a new image
BufferedImage image = getImage(w, h);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index aa30e2943892..d5400d7f3b65 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -40,10 +40,7 @@ import com.android.ide.common.rendering.api.SessionParams.RenderingMode;
import com.android.internal.util.XmlUtils;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.android.BridgeContext;
-import com.android.layoutlib.bridge.android.BridgeInflater;
import com.android.layoutlib.bridge.android.BridgeLayoutParamsMapAttributes;
-import com.android.layoutlib.bridge.android.BridgeWindow;
-import com.android.layoutlib.bridge.android.BridgeWindowSession;
import com.android.layoutlib.bridge.android.BridgeXmlBlockParser;
import com.android.layoutlib.bridge.bars.FakeActionBar;
import com.android.layoutlib.bridge.bars.PhoneSystemBar;
@@ -57,6 +54,7 @@ import com.android.util.Pair;
import org.xmlpull.v1.XmlPullParserException;
+import android.animation.AnimationThread;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.LayoutTransition;
@@ -66,12 +64,12 @@ import android.graphics.Bitmap;
import android.graphics.Bitmap_Delegate;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
-import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.TypedValue;
+import android.view.AttachInfo_Accessor;
+import android.view.BridgeInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.View.AttachInfo;
import android.view.View.MeasureSpec;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
@@ -190,7 +188,6 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
// build the inflater and parser.
mInflater = new BridgeInflater(context, params.getProjectCallback());
context.setBridgeInflater(mInflater);
- mInflater.setFactory2(context);
mBlockParser = new BridgeXmlBlockParser(
params.getLayoutDescription(), context, false /* platformResourceFlag */);
@@ -329,13 +326,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
Fragment_Delegate.setProjectCallback(null);
// set the AttachInfo on the root view.
- AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(),
- new Handler(), null);
- info.mHasWindowFocus = true;
- info.mWindowVisibility = View.VISIBLE;
- info.mInTouchMode = false; // this is so that we can display selections.
- info.mHardwareAccelerated = false;
- mViewRoot.dispatchAttachedToWindow(info, 0);
+ AttachInfo_Accessor.setAttachInfo(mViewRoot);
// post-inflate process. For now this supports TabHost/TabWidget
postInflateProcess(view, params.getProjectCallback());
@@ -462,7 +453,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
mImage = null;
mCanvas = null;
} else {
- mViewRoot.mAttachInfo.mTreeObserver.dispatchOnPreDraw();
+ AttachInfo_Accessor.dispatchOnPreDraw(mViewRoot);
// draw the views
// create the BufferedImage into which the layout will be rendered.
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index 7c02f7e0cffc..0a15627bc98d 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -95,10 +95,11 @@ public final class CreateInfo implements ICreateInfo {
/**
* The list of methods to rewrite as delegates.
*/
- private final static String[] DELEGATE_METHODS = new String[] {
+ public final static String[] DELEGATE_METHODS = new String[] {
"android.app.Fragment#instantiate", //(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;",
"android.content.res.Resources$Theme#obtainStyledAttributes",
"android.content.res.Resources$Theme#resolveAttribute",
+ "android.content.res.TypedArray#getValueAt",
"android.graphics.BitmapFactory#finishDecode",
"android.os.Handler#sendMessageAtTime",
"android.os.HandlerThread#run",
@@ -116,7 +117,7 @@ public final class CreateInfo implements ICreateInfo {
/**
* The list of classes on which to delegate all native methods.
*/
- private final static String[] DELEGATE_CLASS_NATIVES = new String[] {
+ public final static String[] DELEGATE_CLASS_NATIVES = new String[] {
"android.animation.PropertyValuesHolder",
"android.graphics.AvoidXfermode",
"android.graphics.Bitmap",
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
index b027b6a0d699..4b7a348f3849 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
@@ -165,6 +165,8 @@ public class Main {
return false;
}
+ sOptions.generatePublicAccess = false;
+
return true;
}
}