Skip to content

Commit b8ea2f5

Browse files
committed
[phones] Only allow double-flick opening of the quicksettings panel.
Bug: 7043587 Change-Id: I39d208626c477e8c081c9d81c3124eb631152998
1 parent 4d3a7b0 commit b8ea2f5

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packages/SystemUI/res/values/dimens.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@
164164
<integer name="notification_panel_layout_gravity">0x37</integer>
165165
<integer name="settings_panel_layout_gravity">0x37</integer>
166166

167+
<!-- Quick settings panels minimum fling open target width. -->
168+
<dimen name="settings_panel_fling_gutter">90dp</dimen>
169+
167170
<!-- Height of the carrier/wifi name label -->
168171
<dimen name="carrier_label_height">24dp</dimen>
169172

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public class PhoneStatusBarView extends PanelBar {
4343
private static final String TAG = "PhoneStatusBarView";
4444
PhoneStatusBar mBar;
4545
int mScrimColor;
46+
float mMinFlingGutter;
47+
float mNotificationWidth;
48+
boolean mFullWidthNotifications;
4649
PanelView mFadingPanel = null;
4750
PanelView mNotificationPanel, mSettingsPanel;
4851

@@ -58,6 +61,13 @@ public void setBar(PhoneStatusBar bar) {
5861
public void onAttachedToWindow() {
5962
Resources res = getContext().getResources();
6063
mScrimColor = res.getColor(R.color.notification_panel_scrim_color);
64+
mMinFlingGutter = res.getDimension(R.dimen.settings_panel_fling_gutter);
65+
mFullWidthNotifications = false;
66+
try {
67+
mNotificationWidth = res.getDimension(R.dimen.notification_panel_width);
68+
} catch (Resources.NotFoundException ex) {
69+
mFullWidthNotifications = true;
70+
}
6171
}
6272

6373
@Override
@@ -96,9 +106,12 @@ public PanelView selectPanelForTouchX(float x) {
96106
// right 1/3 for quick settings. If you pull the status bar down a second time you'll
97107
// toggle panels no matter where you pull it down.
98108
final float w = (float) getMeasuredWidth();
109+
final float gutter = w - mNotificationWidth;
110+
final boolean useGutter = !mFullWidthNotifications && gutter > mMinFlingGutter;
111+
final float threshold = 1.0f - (gutter / w);
99112
final float f = x / w;
100-
if (f > 0.67f && mSettingsPanel.getExpandedFraction() != 1.0f
101-
|| mNotificationPanel.getExpandedFraction() == 1.0f) {
113+
if ((useGutter && f > threshold && mSettingsPanel.getExpandedFraction() != 1.0f) ||
114+
mNotificationPanel.getExpandedFraction() == 1.0f) {
102115
return mSettingsPanel;
103116
}
104117
return mNotificationPanel;

0 commit comments

Comments
 (0)