Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 618236fe authored by Chris Craik's avatar Chris Craik
Browse files

Revert "Remove castsShadow and globalCamera APIs"

This reverts commit 0334c314.

Change-Id: I64714d17fb877e1b43c65eb44820d1128281c7a2
parent 0334c314
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -346,6 +346,7 @@ package android {
    field public static final int canRetrieveWindowContent = 16843653; // 0x1010385
    field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
    field public static final deprecated int capitalize = 16843113; // 0x1010169
    field public static final int castsShadow = 16843775; // 0x10103ff
    field public static final int category = 16843752; // 0x10103e8
    field public static final int centerBright = 16842956; // 0x10100cc
    field public static final int centerColor = 16843275; // 0x101020b
@@ -825,7 +826,7 @@ package android {
    field public static final int persistent = 16842765; // 0x101000d
    field public static final int persistentDrawingCache = 16842990; // 0x10100ee
    field public static final deprecated int phoneNumber = 16843111; // 0x1010167
    field public static final int pinned = 16843776; // 0x1010400
    field public static final int pinned = 16843777; // 0x1010401
    field public static final int pivotX = 16843189; // 0x10101b5
    field public static final int pivotY = 16843190; // 0x10101b6
    field public static final int popupAnimationStyle = 16843465; // 0x10102c9
@@ -889,7 +890,7 @@ package android {
    field public static final int required = 16843406; // 0x101028e
    field public static final int requiredAccountType = 16843734; // 0x10103d6
    field public static final int requiredForAllUsers = 16843728; // 0x10103d0
    field public static final int requiredForProfile = 16843775; // 0x10103ff
    field public static final int requiredForProfile = 16843776; // 0x1010400
    field public static final int requiresFadingEdge = 16843685; // 0x10103a5
    field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
    field public static final int resizeMode = 16843619; // 0x1010363
@@ -29015,6 +29016,7 @@ package android.view {
    method protected float getBottomFadingEdgeStrength();
    method protected int getBottomPaddingOffset();
    method public float getCameraDistance();
    method public final boolean getCastsShadow();
    method public android.graphics.Rect getClipBounds();
    method public final boolean getClipToOutline();
    method public java.lang.CharSequence getContentDescription();
@@ -29284,6 +29286,7 @@ package android.view {
    method public void setBackgroundResource(int);
    method public final void setBottom(int);
    method public void setCameraDistance(float);
    method public void setCastsShadow(boolean);
    method public void setClickable(boolean);
    method public void setClipBounds(android.graphics.Rect);
    method public void setClipToOutline(boolean);
+19 −0
Original line number Diff line number Diff line
@@ -364,6 +364,25 @@ public class RenderNode {
        nSetClipToOutline(mNativeDisplayList, clipToOutline);
    }

    /**
     * Set whether the DisplayList should cast a shadow.
     *
     * The shape of the shadow casting area is defined by the outline of the display list, if set
     * and non-empty, otherwise it will be the bounds rect.
     */
    public void setCastsShadow(boolean castsShadow) {
        nSetCastsShadow(mNativeDisplayList, castsShadow);
    }

    /**
     * Sets whether the DisplayList should be drawn with perspective applied from the global camera.
     *
     * If set to true, camera distance will be ignored. Defaults to false.
     */
    public void setUsesGlobalCamera(boolean usesGlobalCamera) {
        nSetUsesGlobalCamera(mNativeDisplayList, usesGlobalCamera);
    }

    /**
     * Set the static matrix on the display list. The specified matrix is combined with other
     * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.)
+110 −2
Original line number Diff line number Diff line
@@ -2386,6 +2386,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    static final int PFLAG3_FITTING_SYSTEM_WINDOWS = 0x80;
    /**
     * Flag indicating that an view will cast a shadow onto the Z=0 plane if elevated.
     */
    static final int PFLAG3_CASTS_SHADOW = 0x100;
    /**
     * Flag indicating that view will be transformed by the global camera if rotated in 3d, or given
     * a non-0 Z translation.
     */
    static final int PFLAG3_USES_GLOBAL_CAMERA = 0x200;
    /* End of masks for mPrivateFlags3 */
    static final int DRAG_MASK = PFLAG2_DRAG_CAN_ACCEPT | PFLAG2_DRAG_HOVERED;
@@ -4028,6 +4039,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                case R.styleable.View_layerType:
                    setLayerType(a.getInt(attr, LAYER_TYPE_NONE), null);
                    break;
                case R.styleable.View_castsShadow:
                    if (a.getBoolean(attr, false)) {
                        mPrivateFlags3 |= PFLAG3_CASTS_SHADOW;
                    }
                    break;
                case R.styleable.View_textDirection:
                    // Clear any text direction flag already set
                    mPrivateFlags2 &= ~PFLAG2_TEXT_DIRECTION_MASK;
@@ -10836,6 +10852,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @param outline The new outline of the view. Must be non-null, and convex.
     *
     * @see #setCastsShadow(boolean)
     * @see #getOutline(Path)
     * @see #getClipToOutline()
     * @see #setClipToOutline(boolean)
@@ -10898,6 +10915,95 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * Returns whether the View will cast shadows when its
     * {@link #setTranslationZ(float) z translation} is greater than 0, or it is
     * rotated in 3D.
     *
     * @see #setTranslationZ(float)
     * @see #setRotationX(float)
     * @see #setRotationY(float)
     * @see #setCastsShadow(boolean)
     * @attr ref android.R.styleable#View_castsShadow
     */
    public final boolean getCastsShadow() {
        return ((mPrivateFlags3 & PFLAG3_CASTS_SHADOW) != 0);
    }
    /**
     * Set to true to enable this View to cast shadows.
     * <p>
     * If enabled, and the View has a z translation greater than 0, or is
     * rotated in 3D, the shadow will be cast onto its parent at the z = 0
     * plane.
     * <p>
     * The shape of the shadow being cast is defined by the
     * {@link #setOutline(Path) outline} of the view, or the rectangular bounds
     * of the view if the outline is not set or is empty.
     *
     * @see #setTranslationZ(float)
     * @see #getCastsShadow()
     * @attr ref android.R.styleable#View_castsShadow
     */
    public void setCastsShadow(boolean castsShadow) {
        // TODO : Add a fast invalidation here.
        if (getCastsShadow() != castsShadow) {
            if (castsShadow) {
                mPrivateFlags3 |= PFLAG3_CASTS_SHADOW;
            } else {
                mPrivateFlags3 &= ~PFLAG3_CASTS_SHADOW;
            }
            if (mDisplayList != null) {
                mDisplayList.setCastsShadow(castsShadow);
            }
        }
    }
    /**
     * Returns whether the View will be transformed by the global camera.
     *
     * @see #setUsesGlobalCamera(boolean)
     *
     * @hide
     */
    public final boolean getUsesGlobalCamera() {
        return ((mPrivateFlags3 & PFLAG3_USES_GLOBAL_CAMERA) != 0);
    }
    /**
     * Sets whether the View should be transformed by the global camera.
     * <p>
     * If the view has a Z translation or 3D rotation, perspective from the
     * global camera will be applied. This enables an app to transform multiple
     * views in 3D with coherent perspective projection among them all.
     * <p>
     * Setting this to true will cause {@link #setCameraDistance() camera distance}
     * to be ignored, as the global camera's position will dictate perspective
     * transform.
     * <p>
     * This should not be used in conjunction with {@link android.graphics.Camera}.
     *
     * @see #getUsesGlobalCamera()
     * @see #setTranslationZ(float)
     * @see #setRotationX(float)
     * @see #setRotationY(float)
     *
     * @hide
     */
    public void setUsesGlobalCamera(boolean usesGlobalCamera) {
        // TODO : Add a fast invalidation here.
        if (getUsesGlobalCamera() != usesGlobalCamera) {
            if (usesGlobalCamera) {
                mPrivateFlags3 |= PFLAG3_USES_GLOBAL_CAMERA;
            } else {
                mPrivateFlags3 &= ~PFLAG3_USES_GLOBAL_CAMERA;
            }
            if (mDisplayList != null) {
                mDisplayList.setUsesGlobalCamera(usesGlobalCamera);
            }
        }
    }
    /**
     * Hit rectangle in parent's coordinates
     *
@@ -11461,7 +11567,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            }
            // Damage the entire IsolatedZVolume recieving this view's shadow.
            if (getTranslationZ() != 0) {
            if (getCastsShadow() && getTranslationZ() != 0) {
                damageIsolatedZVolume();
            }
        }
@@ -11541,7 +11647,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        } else {
            damageInParent();
        }
        if (invalidateParent && getTranslationZ() != 0) {
        if (invalidateParent && getCastsShadow() && getTranslationZ() != 0) {
            damageIsolatedZVolume();
        }
    }
@@ -14579,6 +14685,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            }
            displayList.setOutline(mOutline);
            displayList.setClipToOutline(getClipToOutline());
            displayList.setCastsShadow(getCastsShadow());
            displayList.setUsesGlobalCamera(getUsesGlobalCamera());
            float alpha = 1;
            if (mParent instanceof ViewGroup && (((ViewGroup) mParent).mGroupFlags &
                    ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {
+4 −0
Original line number Diff line number Diff line
@@ -2132,6 +2132,10 @@
        <!-- scale of the view in the y direction. -->
        <attr name="scaleY" format="float" />

        <!-- Defines whether the View casts a shadow when it has a 3D rotation or Z
             translation.-->
        <attr name="castsShadow" format="boolean" />

        <!-- Determines which side the vertical scroll bar should be placed on. -->
        <attr name="verticalScrollbarPosition">
            <!-- Place the scroll bar wherever the system default determines. -->
+1 −0
Original line number Diff line number Diff line
@@ -2111,6 +2111,7 @@
  <public type="attr" name="controlY2" />
  <public type="attr" name="sharedElementName" />
  <public type="attr" name="transitionGroup" />
  <public type="attr" name="castsShadow" />
  <public type="attr" name="requiredForProfile"/>
  <public type="attr" name="pinned" />

Loading