Fix occasional jank when going to QS.

We change the listening state of the QS panel before the user
actually navigates there and when the animations are probably
not running (after expanding the panel).

Change-Id: Iad48b3459e7db09c423f6983a9fec17ec0088050
This commit is contained in:
Jorim Jaggi
2014-07-01 22:00:50 +02:00
parent 2e115c5d9a
commit e65e310fc9
3 changed files with 35 additions and 6 deletions

View File

@@ -50,6 +50,7 @@ public class QSPanel extends ViewGroup {
private int mPanelPaddingBottom;
private int mDualTileUnderlap;
private boolean mExpanded;
private boolean mListening;
private TileRecord mDetailRecord;
private Callback mCallback;
@@ -100,9 +101,14 @@ public class QSPanel extends ViewGroup {
if (!mExpanded) {
showDetail(false /*show*/, mDetailRecord);
}
}
public void setListening(boolean listening) {
if (mListening == listening) return;
mListening = listening;
for (TileRecord r : mRecords) {
r.tile.setListening(mExpanded);
if (mExpanded) {
r.tile.setListening(mListening);
if (mListening) {
r.tile.refreshState();
}
}

View File

@@ -35,6 +35,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.GestureRecorder;
@@ -61,7 +62,7 @@ public class NotificationPanelView extends PanelView implements
private KeyguardPageSwipeHelper mPageSwiper;
private StatusBarHeaderView mHeader;
private View mQsContainer;
private View mQsPanel;
private QSPanel mQsPanel;
private View mKeyguardStatusView;
private ObservableScrollView mScrollView;
private TextView mClockView;
@@ -136,7 +137,7 @@ public class NotificationPanelView extends PanelView implements
mHeader.setOverlayParent(this);
mKeyguardStatusView = findViewById(R.id.keyguard_status_view);
mQsContainer = findViewById(R.id.quick_settings_container);
mQsPanel = findViewById(R.id.quick_settings_panel);
mQsPanel = (QSPanel) findViewById(R.id.quick_settings_panel);
mClockView = (TextView) findViewById(R.id.clock_view);
mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view);
mScrollView.setListener(this);
@@ -873,6 +874,20 @@ public class NotificationPanelView extends PanelView implements
super.onExpandingFinished();
mNotificationStackScroller.onExpansionStopped();
mIsExpanding = false;
if (mExpandedHeight == 0f) {
mHeader.setListening(false);
mQsPanel.setListening(false);
} else {
mHeader.setListening(true);
mQsPanel.setListening(true);
}
}
@Override
public void instantExpand() {
super.instantExpand();
mHeader.setListening(true);
mQsPanel.setListening(true);
}
@Override

View File

@@ -45,6 +45,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
private static final float EXPANSION_RUBBERBAND_FACTOR = 0.35f;
private boolean mExpanded;
private boolean mListening;
private boolean mOverscrolled;
private boolean mKeyguardShowing;
@@ -145,6 +146,14 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
return mExpandedHeight;
}
public void setListening(boolean listening) {
if (listening == mListening) {
return;
}
mListening = listening;
updateBrightnessControllerState();
}
public void setExpanded(boolean expanded, boolean overscrolled) {
boolean changed = expanded != mExpanded;
boolean overscrollChanged = overscrolled != mOverscrolled;
@@ -154,7 +163,6 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
updateHeights();
updateVisibilities();
updateSystemIconsLayoutParams();
updateBrightnessControllerState();
updateZTranslation();
updateClickTargets();
updateWidth();
@@ -254,7 +262,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
}
private void updateBrightnessControllerState() {
if (mExpanded) {
if (mListening) {
mBrightnessController.registerCallbacks();
} else {
mBrightnessController.unregisterCallbacks();