Fix unnecessary layer creation for appear animation

Bug: 22561692
Change-Id: I9e5a52f8113d1cbb5afba61d7979770c2dddc5ed
This commit is contained in:
Jorim Jaggi
2015-07-20 11:43:27 -07:00
parent 15d6894170
commit 1f98c62f9a
2 changed files with 9 additions and 7 deletions

View File

@@ -31,7 +31,7 @@
android:layout_height="match_parent"
/>
<LinearLayout
<com.android.keyguard.AlphaOptimizedLinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -63,6 +63,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</com.android.keyguard.AlphaOptimizedLinearLayout>
</com.android.systemui.statusbar.NotificationOverflowContainer>

View File

@@ -656,12 +656,14 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
}
private void setContentAlpha(float contentAlpha) {
int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE
: LAYER_TYPE_HARDWARE;
View contentView = getContentView();
int currentLayerType = contentView.getLayerType();
if (currentLayerType != layerType) {
contentView.setLayerType(layerType, null);
if (contentView.hasOverlappingRendering()) {
int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE
: LAYER_TYPE_HARDWARE;
int currentLayerType = contentView.getLayerType();
if (currentLayerType != layerType) {
contentView.setLayerType(layerType, null);
}
}
contentView.setAlpha(contentAlpha);
}