summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-01-26 11:30:58 -0800
committerChris Craik <ccraik@google.com>2014-01-29 13:55:39 -0800
commit6657a6c53930eb0ff8d03317eb10ea7ddb0c49b4 (patch)
tree37821f1cd1b594c83b6341ce65c1e1847ef1ecf6
parent967c7fb2af23cbdadba45f9113cbcaa9f55c3f24 (diff)
downloadframeworks_base-6657a6c53930eb0ff8d03317eb10ea7ddb0c49b4.zip
frameworks_base-6657a6c53930eb0ff8d03317eb10ea7ddb0c49b4.tar.gz
frameworks_base-6657a6c53930eb0ff8d03317eb10ea7ddb0c49b4.tar.bz2
Update reordering method names, and make 3d reordering API public
IsContainedVolume -> hasIsolatedZVolume conveys that this affects Z ordering of views ProjectToContainedBackground -> ProjectBackwards, since it ended up using its own projection target, separate from the 3d volume bit Change-Id: Ia2cde838cc4da134366fe6ff623290fbd65e50c3
-rw-r--r--api/current.txt3
-rw-r--r--core/java/android/view/DisplayList.java16
-rw-r--r--core/java/android/view/View.java4
-rw-r--r--core/java/android/view/ViewGroup.java41
-rw-r--r--core/jni/android_view_DisplayList.cpp15
-rw-r--r--core/res/res/values/attrs.xml3
-rw-r--r--core/res/res/values/public.xml1
-rw-r--r--libs/hwui/DisplayList.cpp8
-rw-r--r--libs/hwui/DisplayList.h12
-rw-r--r--tests/HwAccelerationTest/AndroidManifest.xml9
-rw-r--r--tests/HwAccelerationTest/res/layout/isolation.xml52
-rw-r--r--tests/HwAccelerationTest/res/values/styles.xml34
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/IsolationVolumeActivity.java12
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ProjectionActivity.java2
14 files changed, 162 insertions, 50 deletions
diff --git a/api/current.txt b/api/current.txt
index 52900c9..9b6ee47 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -633,6 +633,7 @@ package android {
field public static final int isScrollContainer = 16843342; // 0x101024e
field public static final int isSticky = 16843335; // 0x1010247
field public static final int isolatedProcess = 16843689; // 0x10103a9
+ field public static final int isolatedZVolume = 16843769; // 0x10103f9
field public static final int itemBackground = 16843056; // 0x1010130
field public static final int itemIconDisabledAlpha = 16843057; // 0x1010131
field public static final int itemPadding = 16843565; // 0x101032d
@@ -29320,6 +29321,7 @@ package android.view {
method public int getLayoutMode();
method public android.animation.LayoutTransition getLayoutTransition();
method public int getPersistentDrawingCache();
+ method public boolean hasIsolatedZVolume();
method public int indexOfChild(android.view.View);
method public final void invalidateChild(android.view.View, android.graphics.Rect);
method public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
@@ -29364,6 +29366,7 @@ package android.view {
method public void setClipChildren(boolean);
method public void setClipToPadding(boolean);
method public void setDescendantFocusability(int);
+ method public void setIsolatedZVolume(boolean);
method public void setLayoutAnimation(android.view.animation.LayoutAnimationController);
method public void setLayoutAnimationListener(android.view.animation.Animation.AnimationListener);
method public void setLayoutMode(int);
diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java
index 439fc6c..5f6e7cf 100644
--- a/core/java/android/view/DisplayList.java
+++ b/core/java/android/view/DisplayList.java
@@ -406,26 +406,26 @@ public class DisplayList {
* Set whether the display list should collect and Z order all 3d composited descendents, and
* draw them in order with the default Z=0 content.
*
- * @param isContainedVolume true if the display list should collect and Z order descendents.
+ * @param isolateZVolume true if the display list should collect and Z order descendents.
*/
- public void setIsContainedVolume(boolean isContainedVolume) {
+ public void setIsolatedZVolume(boolean isolatedZVolume) {
if (hasNativeDisplayList()) {
- nSetIsContainedVolume(mFinalizer.mNativeDisplayList, isContainedVolume);
+ nSetIsolatedZVolume(mFinalizer.mNativeDisplayList, isolatedZVolume);
}
}
/**
* Sets whether the display list should be drawn immediately after the
- * closest ancestor display list where isContainedVolume is true. If the
+ * closest ancestor display list where isolateZVolume is true. If the
* display list itself satisfies this constraint, changing this attribute
* has no effect on drawing order.
*
* @param shouldProject true if the display list should be projected onto a
* containing volume.
*/
- public void setProjectToContainedVolume(boolean shouldProject) {
+ public void setProjectBackwards(boolean shouldProject) {
if (hasNativeDisplayList()) {
- nSetProjectToContainedVolume(mFinalizer.mNativeDisplayList, shouldProject);
+ nSetProjectBackwards(mFinalizer.mNativeDisplayList, shouldProject);
}
}
@@ -1049,8 +1049,8 @@ public class DisplayList {
private static native void nSetPivotX(long displayList, float pivotX);
private static native void nSetCaching(long displayList, boolean caching);
private static native void nSetClipToBounds(long displayList, boolean clipToBounds);
- private static native void nSetProjectToContainedVolume(long displayList, boolean shouldProject);
- private static native void nSetIsContainedVolume(long displayList, boolean isContainedVolume);
+ private static native void nSetProjectBackwards(long displayList, boolean shouldProject);
+ private static native void nSetIsolatedZVolume(long displayList, boolean isolateZVolume);
private static native void nSetAlpha(long displayList, float alpha);
private static native void nSetHasOverlappingRendering(long displayList,
boolean hasOverlappingRendering);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 52b1b39..9576602 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -14263,8 +14263,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
(((ViewGroup) mParent).mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) != 0);
}
if (this instanceof ViewGroup) {
- displayList.setIsContainedVolume(
- (((ViewGroup) this).mGroupFlags & ViewGroup.FLAG_IS_CONTAINED_VOLUME) != 0);
+ displayList.setIsolatedZVolume(
+ (((ViewGroup) this).mGroupFlags & ViewGroup.FLAG_ISOLATED_Z_VOLUME) != 0);
}
float alpha = 1;
if (mParent instanceof ViewGroup && (((ViewGroup) mParent).mGroupFlags &
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 241b1a7..bcf263b 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -358,7 +358,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* When true, indicates that all 3d composited descendents are contained within this group, and
* will not be interleaved with other 3d composited content.
*/
- static final int FLAG_IS_CONTAINED_VOLUME = 0x1000000;
+ static final int FLAG_ISOLATED_Z_VOLUME = 0x1000000;
/**
* Indicates which types of drawing caches are to be kept in memory.
@@ -492,7 +492,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
mGroupFlags |= FLAG_ANIMATION_DONE;
mGroupFlags |= FLAG_ANIMATION_CACHE;
mGroupFlags |= FLAG_ALWAYS_DRAWN_WITH_CACHE;
- mGroupFlags |= FLAG_IS_CONTAINED_VOLUME;
+ mGroupFlags |= FLAG_ISOLATED_Z_VOLUME;
if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB) {
mGroupFlags |= FLAG_SPLIT_MOTION_EVENTS;
@@ -520,6 +520,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
case R.styleable.ViewGroup_clipToPadding:
setClipToPadding(a.getBoolean(attr, true));
break;
+ case R.styleable.ViewGroup_isolatedZVolume:
+ setIsolatedZVolume(a.getBoolean(attr, true));
+ break;
case R.styleable.ViewGroup_animationCache:
setAnimationCacheEnabled(a.getBoolean(attr, true));
break;
@@ -3115,34 +3118,30 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* independent Z volume. Views drawn in one contained volume will not
* interleave with views in another, even if their Z values are interleaved.
* The default value is true.
- * @see #setIsContainedVolume(boolean)
- *
- * @return True if the ViewGroup is a contained volume.
+ * @see #setIsolatedZVolume(boolean)
*
- * @hide
+ * @return True if the ViewGroup has an isolated Z volume.
*/
- public boolean isContainedVolume() {
- return ((mGroupFlags & FLAG_IS_CONTAINED_VOLUME) != 0);
+ public boolean hasIsolatedZVolume() {
+ return ((mGroupFlags & FLAG_ISOLATED_Z_VOLUME) != 0);
}
/**
- * By default, only direct children of a group can interleave with
- * interleaved Z values. Set to false on individual groups to enable Z
+ * By default, only direct children of a group can interleave drawing order
+ * by interleaving Z values. Set to false on individual groups to enable Z
* interleaving of views that aren't direct siblings.
*
- * @return True if the group should be a contained volume with its own Z
- * ordering space, false if its decendents should join the current Z
- * ordering volume.
- * @attr ref android.R.styleable#ViewGroup_isContainedVolume
- *
- * @hide
+ * @return True if the group should be an isolated Z volume with its own Z
+ * ordering space, false if its decendents should inhabit the
+ * inherited Z ordering volume.
+ * @attr ref android.R.styleable#ViewGroup_isolateZVolume
*/
- public void setIsContainedVolume(boolean isContainedVolume) {
- boolean previousValue = (mGroupFlags & FLAG_IS_CONTAINED_VOLUME) == FLAG_IS_CONTAINED_VOLUME;
- if (isContainedVolume != previousValue) {
- setBooleanFlag(FLAG_IS_CONTAINED_VOLUME, isContainedVolume);
+ public void setIsolatedZVolume(boolean isolateZVolume) {
+ boolean previousValue = (mGroupFlags & FLAG_ISOLATED_Z_VOLUME) == FLAG_ISOLATED_Z_VOLUME;
+ if (isolateZVolume != previousValue) {
+ setBooleanFlag(FLAG_ISOLATED_Z_VOLUME, isolateZVolume);
if (mDisplayList != null) {
- mDisplayList.setIsContainedVolume(isContainedVolume);
+ mDisplayList.setIsolatedZVolume(isolateZVolume);
}
}
}
diff --git a/core/jni/android_view_DisplayList.cpp b/core/jni/android_view_DisplayList.cpp
index a796302..61d2a5e 100644
--- a/core/jni/android_view_DisplayList.cpp
+++ b/core/jni/android_view_DisplayList.cpp
@@ -105,16 +105,16 @@ static void android_view_DisplayList_setClipToBounds(JNIEnv* env,
displayList->setClipToBounds(clipToBounds);
}
-static void android_view_DisplayList_setIsContainedVolume(JNIEnv* env,
- jobject clazz, jlong displayListPtr, jboolean isContainedVolume) {
+static void android_view_DisplayList_setIsolatedZVolume(JNIEnv* env,
+ jobject clazz, jlong displayListPtr, jboolean shouldIsolate) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
- displayList->setIsContainedVolume(isContainedVolume);
+ displayList->setIsolatedZVolume(shouldIsolate);
}
-static void android_view_DisplayList_setProjectToContainedVolume(JNIEnv* env,
+static void android_view_DisplayList_setProjectBackwards(JNIEnv* env,
jobject clazz, jlong displayListPtr, jboolean shouldProject) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
- displayList->setProjectToContainedVolume(shouldProject);
+ displayList->setProjectBackwards(shouldProject);
}
static void android_view_DisplayList_setAlpha(JNIEnv* env,
@@ -383,9 +383,8 @@ static JNINativeMethod gMethods[] = {
{ "nSetStaticMatrix", "(JJ)V", (void*) android_view_DisplayList_setStaticMatrix },
{ "nSetAnimationMatrix", "(JJ)V", (void*) android_view_DisplayList_setAnimationMatrix },
{ "nSetClipToBounds", "(JZ)V", (void*) android_view_DisplayList_setClipToBounds },
- { "nSetIsContainedVolume", "(JZ)V", (void*) android_view_DisplayList_setIsContainedVolume },
- { "nSetProjectToContainedVolume", "(JZ)V",
- (void*) android_view_DisplayList_setProjectToContainedVolume },
+ { "nSetIsolatedZVolume", "(JZ)V", (void*) android_view_DisplayList_setIsolatedZVolume },
+ { "nSetProjectBackwards", "(JZ)V", (void*) android_view_DisplayList_setProjectBackwards },
{ "nSetAlpha", "(JF)V", (void*) android_view_DisplayList_setAlpha },
{ "nSetHasOverlappingRendering", "(JZ)V",
(void*) android_view_DisplayList_setHasOverlappingRendering },
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index c603418..6af708d 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2264,6 +2264,9 @@
<!-- Defines whether the ViewGroup will clip its drawing surface so as to exclude
the padding area. This property is set to true by default. -->
<attr name="clipToPadding" format="boolean" />
+ <!-- Defines whether 3d composited descendents of the ViewGroup will be reordered into their
+ own independent Z volume. This property is set to true by default. -->
+ <attr name="isolatedZVolume" format="boolean" />
<!-- Defines the layout animation to use the first time the ViewGroup is laid out.
Layout animations can also be started manually after the first layout. -->
<attr name="layoutAnimation" format="reference" />
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 6969d2c..94298aa 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2099,6 +2099,7 @@
<public type="attr" name="translationZ" />
<public type="attr" name="colorFilterColor" />
<public type="attr" name="colorFilterMode" />
+ <public type="attr" name="isolatedZVolume" />
<public type="style" name="Widget.Holo.FragmentBreadCrumbs" />
<public type="style" name="Widget.Holo.Light.FragmentBreadCrumbs" />
diff --git a/libs/hwui/DisplayList.cpp b/libs/hwui/DisplayList.cpp
index ee24a17..66a526a 100644
--- a/libs/hwui/DisplayList.cpp
+++ b/libs/hwui/DisplayList.cpp
@@ -238,8 +238,8 @@ void DisplayList::init() {
mRight = 0;
mBottom = 0;
mClipToBounds = true;
- mIsContainedVolume = true;
- mProjectToContainedVolume = false;
+ mIsolatedZVolume = true;
+ mProjectBackwards = false;
mAlpha = 1;
mHasOverlappingRendering = true;
mTranslationX = 0;
@@ -542,7 +542,7 @@ void DisplayList::computeOrderingImpl(
applyViewPropertyTransforms(totalTransform);
totalTransform.mapPoint3d(pivot);
compositedChildrenOf3dRoot->add(ZDrawDisplayListOpPair(pivot.z, opState));
- } else if (mProjectToContainedVolume) {
+ } else if (mProjectBackwards) {
// composited projectee, flag for out of order draw, save matrix, and store in proj surface
opState->mSkipInOrderDraw = true;
opState->mTransformFromCompositingAncestor.load(localTransformFromProjectionSurface);
@@ -552,7 +552,7 @@ void DisplayList::computeOrderingImpl(
opState->mSkipInOrderDraw = false;
}
- if (mIsContainedVolume) {
+ if (mIsolatedZVolume) {
// create a new 3d space for descendents by collecting them
compositedChildrenOf3dRoot = &m3dNodes;
transformFrom3dRoot = &mat4::identity();
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index 6e6e596..6d9a8c1 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -190,12 +190,12 @@ public:
mClipToBounds = clipToBounds;
}
- void setIsContainedVolume(bool isContainedVolume) {
- mIsContainedVolume = isContainedVolume;
+ void setIsolatedZVolume(bool shouldIsolate) {
+ mIsolatedZVolume = shouldIsolate;
}
- void setProjectToContainedVolume(bool shouldProject) {
- mProjectToContainedVolume = shouldProject;
+ void setProjectBackwards(bool shouldProject) {
+ mProjectBackwards = shouldProject;
}
void setStaticMatrix(SkMatrix* matrix) {
@@ -590,8 +590,8 @@ private:
// Rendering properties
bool mClipToBounds;
- bool mIsContainedVolume;
- bool mProjectToContainedVolume;
+ bool mIsolatedZVolume;
+ bool mProjectBackwards;
float mAlpha;
bool mHasOverlappingRendering;
float mTranslationX, mTranslationY, mTranslationZ;
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index 0ad3456..c8eefe0 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -867,5 +867,14 @@
</intent-filter>
</activity>
+ <activity
+ android:name="IsolationVolumeActivity"
+ android:label="Reordering/IsolationVolume">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.android.test.hwui.TEST" />
+ </intent-filter>
+ </activity>
+
</application>
</manifest>
diff --git a/tests/HwAccelerationTest/res/layout/isolation.xml b/tests/HwAccelerationTest/res/layout/isolation.xml
new file mode 100644
index 0000000..802ac7f
--- /dev/null
+++ b/tests/HwAccelerationTest/res/layout/isolation.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#f55">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="150dp"
+ android:layout_weight="1"
+ android:isolatedZVolume="false"
+ android:orientation="vertical">
+ <TextView style="@style/TopLeftReorderTextView"/>
+ <TextView style="@style/BottomLeftReorderTextView"/>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="150dp"
+ android:layout_weight="1"
+ android:isolatedZVolume="false"
+ android:orientation="vertical">
+ <TextView style="@style/TopRightReorderTextView"/>
+ <TextView style="@style/BottomRightReorderTextView"/>
+ </LinearLayout>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="150dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <TextView style="@style/TopLeftReorderTextView"/>
+ <TextView style="@style/BottomLeftReorderTextView"/>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="150dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <TextView style="@style/TopRightReorderTextView"/>
+ <TextView style="@style/BottomRightReorderTextView"/>
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/tests/HwAccelerationTest/res/values/styles.xml b/tests/HwAccelerationTest/res/values/styles.xml
new file mode 100644
index 0000000..0ffd3d7
--- /dev/null
+++ b/tests/HwAccelerationTest/res/values/styles.xml
@@ -0,0 +1,34 @@
+<resources>
+ <style name="ReorderTextView" parent="@android:style/TextAppearance.Medium">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">75dp</item>
+ <item name="android:gravity">center</item>
+ </style>
+ <style name="LeftReorderTextView" parent="@style/ReorderTextView">
+ <item name="android:translationX">50dp</item>
+ </style>
+ <style name="RightReorderTextView" parent="@style/ReorderTextView">
+ <item name="android:translationX">-50dp</item>
+ </style>
+
+ <style name="TopLeftReorderTextView" parent="@style/LeftReorderTextView">
+ <item name="android:background">#666</item>
+ <item name="android:text">100</item>
+ <item name="android:translationZ">100dp</item>
+ </style>
+ <style name="BottomLeftReorderTextView" parent="@style/LeftReorderTextView">
+ <item name="android:background">#bbb</item>
+ <item name="android:text">300</item>
+ <item name="android:translationZ">300dp</item>
+ </style>
+ <style name="TopRightReorderTextView" parent="@style/RightReorderTextView">
+ <item name="android:background">#888</item>
+ <item name="android:text">200</item>
+ <item name="android:translationZ">200dp</item>
+ </style>
+ <style name="BottomRightReorderTextView" parent="@style/RightReorderTextView">
+ <item name="android:background">#ccc</item>
+ <item name="android:text">400</item>
+ <item name="android:translationZ">400dp</item>
+ </style>
+</resources>
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/IsolationVolumeActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/IsolationVolumeActivity.java
new file mode 100644
index 0000000..d5c93f2
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/IsolationVolumeActivity.java
@@ -0,0 +1,12 @@
+package com.android.test.hwui;
+
+import android.os.Bundle;
+import android.app.Activity;
+
+public class IsolationVolumeActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.isolation);
+ }
+}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ProjectionActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ProjectionActivity.java
index 51a6803..f27652d 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/ProjectionActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ProjectionActivity.java
@@ -48,7 +48,7 @@ public class ProjectionActivity extends Activity {
private void setProject(boolean value) {
DisplayList displayList = getDisplayList();
if (displayList != null) {
- displayList.setProjectToContainedVolume(value);
+ displayList.setProjectBackwards(value);
}
// NOTE: we can't invalidate ProjectedView for the redraw because:
// 1) the view won't preserve displayList properties that it doesn't know about