Merge "New lock pattern assets and animations" into lmp-dev
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index e693d91..35baf9c 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1359,8 +1359,8 @@
<item name="lightY">-200dp</item>
<item name="lightZ">800dp</item>
<item name="lightRadius">800dp</item>
- <item name="ambientShadowAlpha">0.0471</item>
- <item name="spotShadowAlpha">0.1765</item>
+ <item name="ambientShadowAlpha">0.06</item>
+ <item name="spotShadowAlpha">0.22</item>
</style>
</resources>
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index b210e64..f0a6e55 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -176,15 +176,15 @@
status_t DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t flags) {
// dirty is an out parameter and should not be recorded,
// it matters only when replaying the display list
+ DrawRenderNodeOp* op = new (alloc()) DrawRenderNodeOp(renderNode, flags, *currentTransform());
+ int opIndex = addDrawOp(op);
+ mDisplayListData->addChild(op);
if (renderNode->stagingProperties().isProjectionReceiver()) {
// use staging property, since recording on UI thread
- mDisplayListData->projectionReceiveIndex = mDisplayListData->displayListOps.size();
+ mDisplayListData->projectionReceiveIndex = opIndex;
}
- DrawRenderNodeOp* op = new (alloc()) DrawRenderNodeOp(renderNode, flags, *currentTransform());
- addDrawOp(op);
- mDisplayListData->addChild(op);
return DrawGlInfo::kStatusDone;
}
@@ -447,11 +447,11 @@
}
}
-void DisplayListRenderer::addStateOp(StateOp* op) {
- addOpInternal(op);
+int DisplayListRenderer::addStateOp(StateOp* op) {
+ return addOpInternal(op);
}
-void DisplayListRenderer::addDrawOp(DrawOp* op) {
+int DisplayListRenderer::addDrawOp(DrawOp* op) {
Rect localBounds;
if (op->getLocalBounds(localBounds)) {
bool rejected = quickRejectConservative(localBounds.left, localBounds.top,
@@ -460,7 +460,7 @@
}
mDisplayListData->hasDrawOps = true;
- addOpInternal(op);
+ return addOpInternal(op);
}
}; // namespace uirenderer
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 1b3a48a..b5c0159 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -158,12 +158,14 @@
void insertTranslate();
LinearAllocator& alloc() { return mDisplayListData->allocator; }
- void addStateOp(StateOp* op);
- void addDrawOp(DrawOp* op);
- void addOpInternal(DisplayListOp* op) {
+
+ // Each method returns final index of op
+ int addStateOp(StateOp* op);
+ int addDrawOp(DrawOp* op);
+ int addOpInternal(DisplayListOp* op) {
insertRestoreToCount();
insertTranslate();
- mDisplayListData->displayListOps.add(op);
+ return mDisplayListData->displayListOps.add(op);
}
template<class T>
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 636f218..7123bfe 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1641,8 +1641,9 @@
mCaches.disableTexCoordsVertexArray();
}
-void OpenGLRenderer::setupDrawAA() {
+void OpenGLRenderer::setupDrawAA(bool useShadowInterp) {
mDescription.isAA = true;
+ mDescription.isShadowAA = useShadowInterp;
}
void OpenGLRenderer::setupDrawColor(int color, int alpha) {
@@ -2365,7 +2366,7 @@
}
status_t OpenGLRenderer::drawVertexBuffer(float translateX, float translateY,
- const VertexBuffer& vertexBuffer, const SkPaint* paint, bool useOffset) {
+ const VertexBuffer& vertexBuffer, const SkPaint* paint, int displayFlags) {
// not missing call to quickReject/dirtyLayer, always done at a higher level
if (!vertexBuffer.getVertexCount()) {
// no vertices to draw
@@ -2381,13 +2382,14 @@
setupDraw();
setupDrawNoTexture();
- if (isAA) setupDrawAA();
+ if (isAA) setupDrawAA((displayFlags & kVertexBuffer_ShadowAA));
setupDrawColor(color, ((color >> 24) & 0xFF) * mSnapshot->alpha);
setupDrawColorFilter(getColorFilter(paint));
setupDrawShader(getShader(paint));
setupDrawBlending(paint, isAA);
setupDrawProgram();
- setupDrawModelView(kModelViewMode_Translate, useOffset, translateX, translateY, 0, 0);
+ setupDrawModelView(kModelViewMode_Translate, (displayFlags & kVertexBuffer_Offset),
+ translateX, translateY, 0, 0);
setupDrawColorUniforms(getShader(paint));
setupDrawColorFilterUniforms(getColorFilter(paint));
setupDrawShaderUniforms(getShader(paint));
@@ -2397,7 +2399,6 @@
mCaches.bindPositionVertexPointer(true, vertices, isAA ? gAlphaVertexStride : gVertexStride);
mCaches.resetTexCoordsVertexPointer();
-
int alphaSlot = -1;
if (isAA) {
void* alphaCoords = ((GLbyte*) vertices) + gVertexAlphaOffset;
@@ -2466,8 +2467,8 @@
return DrawGlInfo::kStatusDone;
}
- bool useOffset = !paint->isAntiAlias();
- return drawVertexBuffer(buffer, paint, useOffset);
+ int displayFlags = paint->isAntiAlias() ? 0 : kVertexBuffer_Offset;
+ return drawVertexBuffer(buffer, paint, displayFlags);
}
status_t OpenGLRenderer::drawPoints(const float* points, int count, const SkPaint* paint) {
@@ -2483,8 +2484,8 @@
return DrawGlInfo::kStatusDone;
}
- bool useOffset = !paint->isAntiAlias();
- return drawVertexBuffer(buffer, paint, useOffset);
+ int displayFlags = paint->isAntiAlias() ? 0 : kVertexBuffer_Offset;
+ return drawVertexBuffer(buffer, paint, displayFlags);
}
status_t OpenGLRenderer::drawColor(int color, SkXfermode::Mode mode) {
@@ -3167,12 +3168,12 @@
if (ambientShadowVertexBuffer && mAmbientShadowAlpha > 0) {
paint.setARGB(casterAlpha * mAmbientShadowAlpha, 0, 0, 0);
- drawVertexBuffer(*ambientShadowVertexBuffer, &paint);
+ drawVertexBuffer(*ambientShadowVertexBuffer, &paint, kVertexBuffer_ShadowAA);
}
if (spotShadowVertexBuffer && mSpotShadowAlpha > 0) {
paint.setARGB(casterAlpha * mSpotShadowAlpha, 0, 0, 0);
- drawVertexBuffer(*spotShadowVertexBuffer, &paint);
+ drawVertexBuffer(*spotShadowVertexBuffer, &paint, kVertexBuffer_ShadowAA);
}
return DrawGlInfo::kStatusDrew;
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index fd228db..2a9badd 100755
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -94,6 +94,11 @@
kClipSide_ConservativeFull = 0x1F
};
+enum VertexBufferDisplayFlags {
+ kVertexBuffer_Offset = 0x1,
+ kVertexBuffer_ShadowAA = 0x2,
+};
+
/**
* Defines additional transformation that should be applied by the model view matrix, beyond that of
* the currentTransform()
@@ -656,17 +661,17 @@
*
* @param vertexBuffer The VertexBuffer to be drawn
* @param paint The paint to render with
- * @param useOffset Offset the vertexBuffer (used in drawing non-AA lines)
+ * @param flags flags with which to draw
*/
status_t drawVertexBuffer(float translateX, float translateY, const VertexBuffer& vertexBuffer,
- const SkPaint* paint, bool useOffset = false);
+ const SkPaint* paint, int flags = 0);
/**
* Convenience for translating method
*/
status_t drawVertexBuffer(const VertexBuffer& vertexBuffer,
- const SkPaint* paint, bool useOffset = false) {
- return drawVertexBuffer(0.0f, 0.0f, vertexBuffer, paint, useOffset);
+ const SkPaint* paint, int flags = 0) {
+ return drawVertexBuffer(0.0f, 0.0f, vertexBuffer, paint, flags);
}
/**
@@ -842,7 +847,7 @@
void setupDrawWithTextureAndColor(bool isAlpha8 = false);
void setupDrawWithExternalTexture();
void setupDrawNoTexture();
- void setupDrawAA();
+ void setupDrawAA(bool useShadowInterp);
void setupDrawColor(int color, int alpha);
void setupDrawColor(float r, float g, float b, float a);
void setupDrawAlpha8Color(int color, int alpha);
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h
index 3e191d0..1d95c40 100644
--- a/libs/hwui/Program.h
+++ b/libs/hwui/Program.h
@@ -72,19 +72,20 @@
#define PROGRAM_MODULATE_SHIFT 35
#define PROGRAM_HAS_AA_SHIFT 36
+#define PROGRAM_HAS_SHADOW_AA_SHIFT 37
-#define PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT 37
-#define PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT 38
+#define PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT 38
+#define PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT 39
-#define PROGRAM_HAS_GAMMA_CORRECTION 39
+#define PROGRAM_HAS_GAMMA_CORRECTION 40
-#define PROGRAM_IS_SIMPLE_GRADIENT 40
+#define PROGRAM_IS_SIMPLE_GRADIENT 41
-#define PROGRAM_HAS_COLORS 41
+#define PROGRAM_HAS_COLORS 42
-#define PROGRAM_HAS_DEBUG_HIGHLIGHT 42
-#define PROGRAM_EMULATE_STENCIL 43
-#define PROGRAM_HAS_ROUND_RECT_CLIP 44
+#define PROGRAM_HAS_DEBUG_HIGHLIGHT 43
+#define PROGRAM_EMULATE_STENCIL 44
+#define PROGRAM_HAS_ROUND_RECT_CLIP 45
///////////////////////////////////////////////////////////////////////////////
// Types
@@ -135,6 +136,7 @@
bool isBitmapNpot;
bool isAA; // drawing with a per-vertex alpha
+ bool isShadowAA; // drawing per vertex alpha with shadow interpolation
bool hasGradient;
Gradient gradientType;
@@ -175,6 +177,7 @@
hasColors = false;
isAA = false;
+ isShadowAA = false;
modulate = false;
@@ -262,6 +265,7 @@
if (swapSrcDst) key |= PROGRAM_KEY_SWAP_SRC_DST;
if (modulate) key |= programid(0x1) << PROGRAM_MODULATE_SHIFT;
if (isAA) key |= programid(0x1) << PROGRAM_HAS_AA_SHIFT;
+ if (isShadowAA) key |= programid(0x1) << PROGRAM_HAS_SHADOW_AA_SHIFT;
if (hasExternalTexture) key |= programid(0x1) << PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT;
if (hasTextureTransform) key |= programid(0x1) << PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT;
if (hasGammaCorrection) key |= programid(0x1) << PROGRAM_HAS_GAMMA_CORRECTION;
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 3ef2a71..2dd89b8 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -121,8 +121,12 @@
const char* gVS_Main_Position =
" vec4 transformedPosition = projection * transform * position;\n"
" gl_Position = transformedPosition;\n";
+
+const char* gVS_Main_ShadowAAVertexShape =
+ " alpha = pow(vtxAlpha, 0.667);\n";
const char* gVS_Main_AAVertexShape =
" alpha = vtxAlpha;\n";
+
const char* gVS_Main_HasRoundRectClip =
" roundRectPos = (roundRectInvTransform * transformedPosition).xy;\n";
const char* gVS_Footer =
@@ -237,6 +241,8 @@
" fragColor *= color.a;\n";
const char* gFS_Main_AccountForAAVertexShape =
" fragColor *= alpha;\n";
+const char* gFS_Main_AccountForShadowAAVertexShape =
+ " fragColor *= pow(alpha, 1.5);\n";
const char* gFS_Main_FetchTexture[2] = {
// Don't modulate
@@ -515,7 +521,11 @@
shader.append(gVS_Main_OutTexCoords);
}
if (description.isAA) {
- shader.append(gVS_Main_AAVertexShape);
+ if (description.isShadowAA) {
+ shader.append(gVS_Main_ShadowAAVertexShape);
+ } else {
+ shader.append(gVS_Main_AAVertexShape);
+ }
}
if (description.hasColors) {
shader.append(gVS_Main_OutColors);
@@ -750,7 +760,11 @@
shader.append(gFS_Main_ApplyColorOp[description.colorOp]);
if (description.isAA) {
- shader.append(gFS_Main_AccountForAAVertexShape);
+ if (description.isShadowAA) {
+ shader.append(gFS_Main_AccountForShadowAAVertexShape);
+ } else {
+ shader.append(gFS_Main_AccountForAAVertexShape);
+ }
}
// Output the fragment
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index c59b010..e3732a1 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -741,15 +741,24 @@
const SkPath* projectionReceiverOutline = properties().getOutline().getPath();
int restoreTo = renderer.getSaveCount();
+ LinearAllocator& alloc = handler.allocator();
+ handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag),
+ PROPERTY_SAVECOUNT, properties().getClipToBounds());
+
+ // Transform renderer to match background we're projecting onto
+ // (by offsetting canvas by translationX/Y of background rendernode, since only those are set)
+ const DisplayListOp* op =
+ (mDisplayListData->displayListOps[mDisplayListData->projectionReceiveIndex]);
+ const DrawRenderNodeOp* backgroundOp = reinterpret_cast<const DrawRenderNodeOp*>(op);
+ const RenderProperties& backgroundProps = backgroundOp->mRenderNode->properties();
+ renderer.translate(backgroundProps.getTranslationX(), backgroundProps.getTranslationY());
+
// If the projection reciever has an outline, we mask each of the projected rendernodes to it
// Either with clipRect, or special saveLayer masking
- LinearAllocator& alloc = handler.allocator();
if (projectionReceiverOutline != NULL) {
const SkRect& outlineBounds = projectionReceiverOutline->getBounds();
if (projectionReceiverOutline->isRect(NULL)) {
// mask to the rect outline simply with clipRect
- handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag),
- PROPERTY_SAVECOUNT, properties().getClipToBounds());
ClipRectOp* clipOp = new (alloc) ClipRectOp(
outlineBounds.left(), outlineBounds.top(),
outlineBounds.right(), outlineBounds.bottom(), SkRegion::kIntersect_Op);
diff --git a/telecomm/java/android/telecomm/StatusHints.java b/telecomm/java/android/telecomm/StatusHints.java
index 50f525a..496a38c 100644
--- a/telecomm/java/android/telecomm/StatusHints.java
+++ b/telecomm/java/android/telecomm/StatusHints.java
@@ -27,6 +27,7 @@
import android.util.DisplayMetrics;
import java.util.MissingResourceException;
+import java.util.Objects;
/**
* Contains status label and icon displayed in the in-call UI.
@@ -127,4 +128,22 @@
return null;
}
}
+
+ @Override
+ public boolean equals(Object other) {
+ if (other != null && other instanceof StatusHints) {
+ StatusHints otherHints = (StatusHints) other;
+ return Objects.equals(otherHints.getComponentName(), getComponentName()) &&
+ Objects.equals(otherHints.getLabel(), getLabel()) &&
+ otherHints.getIconId() == getIconId() &&
+ Objects.equals(otherHints.getExtras(), getExtras());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(mComponentName) + Objects.hashCode(mLabel) + mIconId +
+ Objects.hashCode(mExtras);
+ }
}