Skip to content

Commit d4f3f82

Browse files
mnazzzimcodex-corp
authored andcommitted
Return: Smart Pulldown [1/2]
Adds the ability to directly open the QS panel when there are no notifications present in the notification panel. This commit combines the enhancement by HardCorePawn for detectin notification types for the same. Credits: kufikugel, HardCorePawn PS 2-4 : Cleanup Change-Id: Idf7076eff47a9b02659e1e98e60fa474b3e7cbeb
1 parent 20923ab commit d4f3f82

3 files changed

Lines changed: 30 additions & 7 deletions

File tree

core/java/android/provider/Settings.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3329,6 +3329,13 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
33293329
*/
33303330
public static final String QS_COLLAPSE_PANEL = "qs_collapse_panel";
33313331

3332+
/**
3333+
* Quick Settings Smart Pulldown
3334+
*
3335+
* @hide
3336+
*/
3337+
public static final String QS_SMART_PULLDOWN = "qs_smart_pulldown";
3338+
33323339
/**
33333340
* Quick Settings Quick access ribbon
33343341
*

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,21 @@ public boolean onTouchEvent(MotionEvent event) {
167167
mGestureStartY > getHeight() - mHandleBarHeight - getPaddingBottom();
168168
}
169169
mOkToFlip = getExpandedHeight() == 0;
170-
if (event.getX(0) > getWidth() * (1.0f - STATUS_BAR_SETTINGS_RIGHT_PERCENTAGE) &&
171-
Settings.System.getIntForUser(getContext().getContentResolver(),
172-
Settings.System.QS_QUICK_PULLDOWN, 0, UserHandle.USER_CURRENT) == 1) {
170+
int quickPulldownMode = Settings.System.getIntForUser(
171+
getContext().getContentResolver(), Settings.System.QS_QUICK_PULLDOWN,
172+
0, UserHandle.USER_CURRENT);
173+
int smartPulldownMode = Settings.System.getIntForUser(
174+
getContext().getContentResolver(), Settings.System.QS_SMART_PULLDOWN,
175+
0, UserHandle.USER_CURRENT);
176+
if (smartPulldownMode == 1 && !mStatusBar.hasClearableNotifications()) {
173177
flip = true;
174-
} else if (event.getX(0) < getWidth() * (1.0f - STATUS_BAR_SETTINGS_LEFT_PERCENTAGE) &&
175-
Settings.System.getIntForUser(getContext().getContentResolver(),
176-
Settings.System.QS_QUICK_PULLDOWN, 0, UserHandle.USER_CURRENT) == 2) {
178+
} else if (smartPulldownMode == 2 && !mStatusBar.hasVisibleNotifications()) {
179+
flip = true;
180+
} else if (quickPulldownMode == 1
181+
&& mGestureStartX > getWidth() * (1.0f - STATUS_BAR_SETTINGS_RIGHT_PERCENTAGE)) {
182+
flip = true;
183+
} else if (quickPulldownMode == 2
184+
&& mGestureStartX < getWidth() * (1.0f - STATUS_BAR_SETTINGS_LEFT_PERCENTAGE)) {
177185
flip = true;
178186
}
179187
break;

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,11 +1934,19 @@ public void onAnimationEnd(Animator animation) {
19341934
}
19351935
}
19361936

1937+
protected boolean hasVisibleNotifications() {
1938+
return mNotificationData.hasVisibleItems();
1939+
}
1940+
1941+
protected boolean hasClearableNotifications() {
1942+
return mNotificationData.hasClearableItems();
1943+
}
1944+
19371945
@Override
19381946
protected void setAreThereNotifications() {
19391947
final boolean any = mNotificationData.size() > 0;
19401948

1941-
final boolean clearable = any && mNotificationData.hasClearableItems();
1949+
final boolean clearable = any && hasClearableNotifications();
19421950

19431951
if (SPEW) {
19441952
Log.d(TAG, "setAreThereNotifications: N=" + mNotificationData.size()

0 commit comments

Comments
 (0)