Merge "Restrict platform's GhostView and unhide a method needed for a backport"
diff --git a/api/current.txt b/api/current.txt
index 16bc8c8..0ce741a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -51734,6 +51734,7 @@
method public android.view.View getChildAt(int);
method public int getChildCount();
method protected int getChildDrawingOrder(int, int);
+ method public final int getChildDrawingOrder(int);
method public static int getChildMeasureSpec(int, int, int);
method protected boolean getChildStaticTransformation(android.view.View, android.view.animation.Transformation);
method public boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point);
diff --git a/core/java/android/view/GhostView.java b/core/java/android/view/GhostView.java
index 74c801b..3286bd6 100644
--- a/core/java/android/view/GhostView.java
+++ b/core/java/android/view/GhostView.java
@@ -20,6 +20,7 @@
import android.graphics.Matrix;
import android.graphics.RecordingCanvas;
import android.graphics.RenderNode;
+import android.os.Build;
import android.widget.FrameLayout;
import java.util.ArrayList;
@@ -135,12 +136,12 @@
return ghostView;
}
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static GhostView addGhost(View view, ViewGroup viewGroup) {
return addGhost(view, viewGroup, null);
}
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static void removeGhost(View view) {
GhostView ghostView = view.mGhostView;
if (ghostView != null) {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index aaf1d11..f2474a5 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -4301,6 +4301,20 @@
return i;
}
+ /**
+ * The public version of getChildDrawingOrder().
+ *
+ * Returns the index of the child to draw for this iteration.
+ *
+ * @param i The current iteration.
+ * @return The index of the child to draw this iteration.
+ *
+ * @see #getChildDrawingOrder(int, int)}
+ */
+ public final int getChildDrawingOrder(int i) {
+ return getChildDrawingOrder(getChildCount(), i);
+ }
+
private boolean hasChildWithZ() {
for (int i = 0; i < mChildrenCount; i++) {
if (mChildren[i].getZ() != 0) return true;