Merge "Have RippleDrawable ignore non-attached RenderNodes" into sc-dev am: a633284efe
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15463315 Change-Id: I7603dab23da439c7f7e111d68dc3776bdfdd3ce5
This commit is contained in:
@@ -67,7 +67,7 @@ public final class RippleAnimationSession {
|
|||||||
|
|
||||||
@NonNull RippleAnimationSession enter(Canvas canvas) {
|
@NonNull RippleAnimationSession enter(Canvas canvas) {
|
||||||
mStartTime = AnimationUtils.currentAnimationTimeMillis();
|
mStartTime = AnimationUtils.currentAnimationTimeMillis();
|
||||||
if (isHwAccelerated(canvas)) {
|
if (useRTAnimations(canvas)) {
|
||||||
enterHardware((RecordingCanvas) canvas);
|
enterHardware((RecordingCanvas) canvas);
|
||||||
} else {
|
} else {
|
||||||
enterSoftware();
|
enterSoftware();
|
||||||
@@ -82,7 +82,7 @@ public final class RippleAnimationSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NonNull RippleAnimationSession exit(Canvas canvas) {
|
@NonNull RippleAnimationSession exit(Canvas canvas) {
|
||||||
if (isHwAccelerated(canvas)) exitHardware((RecordingCanvas) canvas);
|
if (useRTAnimations(canvas)) exitHardware((RecordingCanvas) canvas);
|
||||||
else exitSoftware();
|
else exitSoftware();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -102,8 +102,12 @@ public final class RippleAnimationSession {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHwAccelerated(Canvas canvas) {
|
private boolean useRTAnimations(Canvas canvas) {
|
||||||
return canvas.isHardwareAccelerated() && !mForceSoftware;
|
if (mForceSoftware) return false;
|
||||||
|
if (!canvas.isHardwareAccelerated()) return false;
|
||||||
|
RecordingCanvas hwCanvas = (RecordingCanvas) canvas;
|
||||||
|
if (hwCanvas.mNode == null || !hwCanvas.mNode.isAttached()) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exitSoftware() {
|
private void exitSoftware() {
|
||||||
|
|||||||
Reference in New Issue
Block a user