Skip to content

Commit eeadda5

Browse files
author
Jim Miller
committed
Always enable hardware layers in widgets in keyguard while dragging.
This fixes a performance issue on the 7" tablet where disabling hardware layers in landscape mode resulted in extremely bad drawing performance. The code now enables hardware layers for all the widgets while the user is dragging. Fixes bug 7274971 Change-Id: Iafd18fb317fcd3caad45791fe5a0f111d40a1ed4
1 parent c2a2816 commit eeadda5

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,7 @@ void setOverScrollAmount(float r, boolean left) {
117117
mOverScrollAmount = r;
118118
mForegroundGradient = left ? mLeftToRightGradient : mRightToLeftGradient;
119119
mForegroundAlpha = (int) Math.round((0.85f * r * 255));
120-
if (getLayerType() != LAYER_TYPE_HARDWARE) {
121-
setLayerType(LAYER_TYPE_HARDWARE, null);
122-
}
123120
invalidate();
124-
} else {
125-
if (getLayerType() != LAYER_TYPE_NONE) {
126-
setLayerType(LAYER_TYPE_NONE, null);
127-
}
128121
}
129122
}
130123
}

policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,25 @@ protected void onUnhandledTap(MotionEvent ev) {
7676
}
7777
}
7878

79+
@Override
80+
protected void onPageBeginMoving() {
81+
// Enable hardware layers while pages are moving
82+
// TODO: We should only do this for the two views that are actually moving
83+
int children = getChildCount();
84+
for (int i = 0; i < children; i++) {
85+
getChildAt(i).setLayerType(LAYER_TYPE_HARDWARE, null);
86+
}
87+
}
88+
89+
@Override
90+
protected void onPageEndMoving() {
91+
// Disable hardware layers while pages are moving
92+
int children = getChildCount();
93+
for (int i = 0; i < children; i++) {
94+
getChildAt(i).setLayerType(LAYER_TYPE_NONE, null);
95+
}
96+
}
97+
7998
/*
8099
* This interpolator emulates the rate at which the perceived scale of an object changes
81100
* as its distance from a camera increases. When this interpolator is applied to a scale

0 commit comments

Comments
 (0)