Skip to content

Commit fdd1ae2

Browse files
committed
Revert "SystemUI: Expose heads up"
@28ed94629c4b9d8dca64dd0203805952bd500a0d @6eb6bf8f3056ef0f253df6ecd0e1a108b09f3973
1 parent 46a1a70 commit fdd1ae2

11 files changed

Lines changed: 24 additions & 165 deletions

File tree

core/java/android/provider/Settings.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,20 +3245,6 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
32453245
*/
32463246
public static final String DIALER_OPENCNAM_AUTH_TOKEN = "dialer_opencnam_auth_token";
32473247

3248-
/**
3249-
* Heads Up Notifications
3250-
*
3251-
* @hide
3252-
*/
3253-
public static final String HEADS_UP_NOTIFICATION = "heads_up_enabled";
3254-
3255-
/**
3256-
* Which applications to disable heads up notifications for
3257-
*
3258-
* @hide
3259-
*/
3260-
public static final String HEADS_UP_CUSTOM_VALUES = "heads_up_custom_values";
3261-
32623248
/**
32633249
* Quick Settings Panel Dynamic Tiles
32643250
*

core/java/android/view/inputmethod/InputMethodManager.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,17 +1274,6 @@ static void scheduleCheckFocusLocked(View view) {
12741274
}
12751275
}
12761276

1277-
/**
1278-
* @hide
1279-
*/
1280-
public boolean isImeShowing() {
1281-
try {
1282-
return mService.isImeShowing();
1283-
} catch (RemoteException e) {
1284-
return false;
1285-
}
1286-
}
1287-
12881277
/**
12891278
* @hide
12901279
*/

core/java/com/android/internal/view/IInputMethodManager.aidl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,4 @@ interface IInputMethodManager {
7474
boolean shouldOfferSwitchingToNextInputMethod(in IBinder token);
7575
boolean setInputMethodEnabled(String id, boolean enabled);
7676
void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
77-
boolean isImeShowing();
7877
}

packages/SettingsProvider/res/values/defaults.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,4 @@
224224

225225
<!-- Default value of Settings.System.QUICK_SETTINGS_RIBBON_TILES -->
226226
<string name="def_quick_settings_ribbon_tiles"></string>
227-
228-
<!-- Default values of Settings.System.HEADS_UP_NOTIFICATION -->
229-
<string name="def_heads_up_notification_values"></string>
230227
</resources>

packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,15 +2067,6 @@ private void loadRibbonSetting(SQLiteStatement stmt) {
20672067
}
20682068
}
20692069

2070-
private void loadHeadsUpSetting(SQLiteStatement stmt) {
2071-
String headsUpValues = mContext.getResources()
2072-
.getString(R.string.def_heads_up_notification_values);
2073-
if (!TextUtils.isEmpty(headsUpValues)) {
2074-
loadSetting(stmt, Settings.System.HEADS_UP_NOTIFICATION, "0");
2075-
loadSetting(stmt, Settings.System.HEADS_UP_CUSTOM_VALUES, headsUpValues);
2076-
}
2077-
}
2078-
20792070
private void loadScreenAnimationStyle(SQLiteDatabase db) {
20802071
db.beginTransaction();
20812072
SQLiteStatement stmt = null;
@@ -2176,8 +2167,6 @@ private void loadSystemSettings(SQLiteDatabase db) {
21762167

21772168
loadRibbonSetting(stmt);
21782169

2179-
loadHeadsUpSetting(stmt);
2180-
21812170
} finally {
21822171
if (stmt != null) stmt.close();
21832172
}

packages/SystemUI/src/com/android/systemui/ExpandHelper.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public interface Callback {
7676
private int mExpansionStyle = NONE;
7777
private boolean mWatchingForPull;
7878
private boolean mHasPopped;
79-
private boolean mForcedOneFinger = false;
8079
private View mEventSource;
8180
private View mCurrView;
8281
private View mCurrViewTopGlow;
@@ -338,10 +337,6 @@ public void setGlow(float glow) {
338337
}
339338
}
340339

341-
public void setForceOneFinger(boolean forceOneFinger) {
342-
mForcedOneFinger = forceOneFinger;
343-
}
344-
345340
private void handleGlowVisibility() {
346341
mCurrViewTopGlow.setVisibility(mCurrViewTopGlow.getAlpha() <= 0.0f ?
347342
View.INVISIBLE : View.VISIBLE);
@@ -412,7 +407,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
412407

413408
case MotionEvent.ACTION_DOWN:
414409
final boolean inside = isInside(mScrollView, x, y);
415-
mWatchingForPull = (inside || mForcedOneFinger);
410+
mWatchingForPull = isInside(mScrollView, x, y);
416411
mLastMotionY = y;
417412
if (inside) {
418413
mInitialTouchY = y;

packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
import android.view.ViewGroup.LayoutParams;
8181
import android.view.WindowManager;
8282
import android.view.WindowManagerGlobal;
83-
import android.view.inputmethod.InputMethodManager;
8483
import android.widget.FrameLayout;
8584
import android.widget.ImageView;
8685
import android.widget.LinearLayout;
@@ -119,7 +118,6 @@
119118
import com.android.internal.util.cm.DevUtils;
120119

121120
import java.util.ArrayList;
122-
import java.util.List;
123121
import java.util.Locale;
124122

125123
public abstract class BaseStatusBar extends SystemUI implements
@@ -140,7 +138,8 @@ public abstract class BaseStatusBar extends SystemUI implements
140138

141139
protected static final boolean ENABLE_HEADS_UP = true;
142140
// scores above this threshold should be displayed in heads up mode.
143-
protected static final int INTERRUPTION_THRESHOLD = 1;
141+
protected static final int INTERRUPTION_THRESHOLD = 11;
142+
protected static final String SETTING_HEADS_UP = "heads_up_enabled";
144143

145144
// Should match the value in PhoneWindowManager
146145
public static final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps";
@@ -1021,7 +1020,6 @@ protected void rebuildRecentsScreen() {
10211020
}
10221021

10231022
public abstract void resetHeadsUpDecayTimer();
1024-
public abstract void hideHeadsUp();
10251023

10261024
protected class H extends Handler {
10271025
public void handleMessage(Message m) {
@@ -1753,7 +1751,6 @@ protected void notifyHeadsUpScreenOn(boolean screenOn) {
17531751

17541752
protected boolean shouldInterrupt(StatusBarNotification sbn) {
17551753
Notification notification = sbn.getNotification();
1756-
17571754
// some predicates to make the boolean logic legible
17581755
boolean isNoisy = (notification.defaults & Notification.DEFAULT_SOUND) != 0
17591756
|| (notification.defaults & Notification.DEFAULT_VIBRATE) != 0
@@ -1763,71 +1760,23 @@ protected boolean shouldInterrupt(StatusBarNotification sbn) {
17631760
boolean isFullscreen = notification.fullScreenIntent != null;
17641761
boolean isAllowed = notification.extras.getInt(Notification.EXTRA_AS_HEADS_UP,
17651762
Notification.HEADS_UP_ALLOWED) != Notification.HEADS_UP_NEVER;
1766-
boolean isOngoing = sbn.isOngoing();
17671763

17681764
final KeyguardTouchDelegate keyguard = KeyguardTouchDelegate.getInstance(mContext);
1769-
boolean keyguardNotVisible = !keyguard.isShowingAndNotHidden()
1770-
&& !keyguard.isInputRestricted();
1771-
1772-
final InputMethodManager inputMethodManager = (InputMethodManager)
1773-
mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
1774-
1775-
boolean isIMEShowing = inputMethodManager.isImeShowing();
1776-
17771765
boolean interrupt = (isFullscreen || (isHighPriority && isNoisy))
17781766
&& isAllowed
1779-
&& keyguardNotVisible
1780-
&& !isOngoing
1781-
&& !isIMEShowing
1782-
&& mPowerManager.isScreenOn();
1783-
1767+
&& mPowerManager.isScreenOn()
1768+
&& !keyguard.isShowingAndNotHidden()
1769+
&& !keyguard.isInputRestricted();
17841770
try {
17851771
interrupt = interrupt && !mDreamManager.isDreaming();
17861772
} catch (RemoteException e) {
17871773
Log.d(TAG, "failed to query dream manager", e);
17881774
}
17891775

1790-
// its below our threshold priority, we might want to always display
1791-
// notifications from certain apps
1792-
if (!isHighPriority && keyguardNotVisible && !isOngoing && !isIMEShowing) {
1793-
// However, we don't want to interrupt if we're in an application that is
1794-
// in Do Not Disturb
1795-
if (!isPackageInDnd(getTopLevelPackage())) {
1796-
return true;
1797-
}
1798-
}
1799-
18001776
if (DEBUG) Log.d(TAG, "interrupt: " + interrupt);
18011777
return interrupt;
18021778
}
18031779

1804-
private String getTopLevelPackage() {
1805-
final ActivityManager am = (ActivityManager)
1806-
mContext.getSystemService(Context.ACTIVITY_SERVICE);
1807-
List<ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(1);
1808-
ComponentName componentInfo = taskInfo.get(0).topActivity;
1809-
return componentInfo.getPackageName();
1810-
}
1811-
1812-
private boolean isPackageInDnd(String packageName) {
1813-
final String baseString = Settings.System.getString(mContext.getContentResolver(),
1814-
Settings.System.HEADS_UP_CUSTOM_VALUES);
1815-
1816-
if (baseString != null) {
1817-
final String[] array = TextUtils.split(baseString, "\\|");
1818-
for (String item : array) {
1819-
if (TextUtils.isEmpty(item)) {
1820-
continue;
1821-
}
1822-
if (TextUtils.equals(item, packageName)) {
1823-
return true;
1824-
}
1825-
}
1826-
}
1827-
1828-
return false;
1829-
}
1830-
18311780
// Q: What kinds of notifications should show during setup?
18321781
// A: Almost none! Only things coming from the system (package is "android") that also
18331782
// have special "kind" tags marking them as relevant for setup (see below).

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

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ public void run() {
416416
}
417417
};
418418

419-
private int mInitialHeadsUpDecay;
420-
421419
class SettingsObserver extends ContentObserver {
422420
SettingsObserver(Handler handler) {
423421
super(handler);
@@ -706,9 +704,8 @@ public void onChange(boolean selfChange) {
706704
@Override
707705
public void onChange(boolean selfChange) {
708706
boolean wasUsing = mUseHeadsUp;
709-
mUseHeadsUp = ENABLE_HEADS_UP && Settings.System.getIntForUser(
710-
mContext.getContentResolver(),
711-
Settings.System.HEADS_UP_NOTIFICATION, 0, UserHandle.USER_CURRENT) == 1;;
707+
mUseHeadsUp = ENABLE_HEADS_UP && 0 != Settings.Global.getInt(
708+
mContext.getContentResolver(), SETTING_HEADS_UP, 0);
712709
Log.d(TAG, "heads up is " + (mUseHeadsUp ? "enabled" : "disabled"));
713710
if (wasUsing != mUseHeadsUp) {
714711
if (!mUseHeadsUp) {
@@ -781,8 +778,8 @@ public void start() {
781778
mHeadsUpObserver.onChange(true); // set up
782779
if (ENABLE_HEADS_UP) {
783780
mContext.getContentResolver().registerContentObserver(
784-
Settings.System.getUriFor(Settings.System.HEADS_UP_NOTIFICATION), true,
785-
mHeadsUpObserver, mCurrentUserId);
781+
Settings.Global.getUriFor(SETTING_HEADS_UP), true,
782+
mHeadsUpObserver);
786783
}
787784

788785
}
@@ -832,7 +829,6 @@ protected PhoneStatusBarView makeStatusBarView() {
832829
mScreenWidth = (float) context.getResources().getDisplayMetrics().widthPixels;
833830
mMinBrightness = context.getResources().getInteger(
834831
com.android.internal.R.integer.config_screenBrightnessDim);
835-
mInitialHeadsUpDecay = mContext.getResources().getInteger(R.integer.heads_up_sensitivity_delay);
836832

837833
mCurrOrientation = res.getConfiguration().orientation;
838834

@@ -1591,17 +1587,13 @@ private void addHeadsUpView() {
15911587
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
15921588
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, // above the status bar!
15931589
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
1594-
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
1595-
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
1596-
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
1597-
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
1598-
PixelFormat.TRANSPARENT);
1599-
1600-
// this will allow HeadsUp to run in an overlay on devices that support this
1601-
if (ActivityManager.isHighEndGfx()) {
1602-
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
1603-
}
1604-
1590+
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
1591+
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
1592+
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
1593+
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
1594+
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
1595+
PixelFormat.TRANSLUCENT);
1596+
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
16051597
lp.gravity = Gravity.TOP;
16061598
lp.y = getStatusBarHeight();
16071599
lp.setTitle("Heads Up");
@@ -1657,7 +1649,7 @@ public void addNotification(IBinder key, StatusBarNotification notification) {
16571649
if (shadeEntry == null) {
16581650
return;
16591651
}
1660-
if (mUseHeadsUp && shouldInterrupt(notification) && mStatusBarView.panelsEnabled()) {
1652+
if (mUseHeadsUp && shouldInterrupt(notification)) {
16611653
if (DEBUG) Log.d(TAG, "launching notification in heads up mode");
16621654
Entry interruptionCandidate = new Entry(key, notification, null);
16631655
if (inflateViews(interruptionCandidate, mHeadsUpNotificationView.getHolder())) {
@@ -1703,26 +1695,11 @@ public void addNotification(IBinder key, StatusBarNotification notification) {
17031695
public void resetHeadsUpDecayTimer() {
17041696
if (mUseHeadsUp && mHeadsUpNotificationDecay > 0
17051697
&& mHeadsUpNotificationView.isClearable()) {
1706-
1707-
final boolean sbVisible = (mSystemUiVisibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0
1708-
|| (mStatusBarMode & View.STATUS_BAR_TRANSIENT) != 0;
1709-
if (!sbVisible) {
1710-
mHandler.removeMessages(MSG_HIDE_HEADS_UP);
1711-
mHandler.sendEmptyMessageDelayed(MSG_HIDE_HEADS_UP, 700);
1712-
} else {
1713-
mHandler.removeMessages(MSG_HIDE_HEADS_UP);
1714-
mHandler.sendEmptyMessageDelayed(MSG_HIDE_HEADS_UP, mHeadsUpNotificationDecay);
1715-
}
1716-
1698+
mHandler.removeMessages(MSG_HIDE_HEADS_UP);
1699+
mHandler.sendEmptyMessageDelayed(MSG_HIDE_HEADS_UP, mHeadsUpNotificationDecay);
17171700
}
17181701
}
17191702

1720-
@Override
1721-
public void hideHeadsUp() {
1722-
mHandler.removeMessages(MSG_HIDE_HEADS_UP);
1723-
mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
1724-
}
1725-
17261703
public void removeNotification(IBinder key) {
17271704
StatusBarNotification old = removeNotificationViews(key);
17281705
if (SPEW) Log.d(TAG, "removeNotification key=" + key + " old=" + old);
@@ -2092,7 +2069,6 @@ public void disable(int state) {
20922069
if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
20932070
if ((state & StatusBarManager.DISABLE_EXPAND) != 0) {
20942071
animateCollapsePanels();
2095-
hideHeadsUp();
20962072
}
20972073
}
20982074

@@ -3109,9 +3085,6 @@ public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
31093085
altBack ? (mNavigationIconHints | NAVIGATION_HINT_BACK_ALT)
31103086
: (mNavigationIconHints & ~NAVIGATION_HINT_BACK_ALT));
31113087
if (mQS != null) mQS.setImeWindowStatus(vis > 0);
3112-
if (vis > 0) {
3113-
mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
3114-
}
31153088
}
31163089

31173090
@Override

packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ public void onAttachedToWindow() {
129129
int minHeight = getResources().getDimensionPixelSize(R.dimen.default_notification_row_min_height);
130130
int maxHeight = getResources().getDimensionPixelSize(R.dimen.default_notification_row_max_height);
131131
mExpandHelper = new ExpandHelper(mContext, this, minHeight, maxHeight);
132-
mExpandHelper.setForceOneFinger(true);
133132

134133
mContentHolder = (ViewGroup) findViewById(R.id.content_holder);
135134
mContentSlider = (ViewGroup) findViewById(R.id.content_slider);
@@ -158,16 +157,10 @@ public boolean onTouchEvent(MotionEvent ev) {
158157
if (System.currentTimeMillis() < mStartTouchTime) {
159158
return false;
160159
}
161-
switch (ev.getAction()) {
162-
case MotionEvent.ACTION_OUTSIDE:
163-
mBar.hideHeadsUp();
164-
return true;
165-
default:
166-
mBar.resetHeadsUpDecayTimer();
167-
return mSwipeHelper.onTouchEvent(ev)
168-
|| mExpandHelper.onTouchEvent(ev)
169-
|| super.onTouchEvent(ev);
170-
}
160+
mBar.resetHeadsUpDecayTimer();
161+
return mSwipeHelper.onTouchEvent(ev)
162+
|| mExpandHelper.onTouchEvent(ev)
163+
|| super.onTouchEvent(ev);
171164
}
172165

173166
@Override
@@ -229,8 +222,6 @@ public void onChildTriggered(View v) {
229222

230223
@Override
231224
public void onBeginDrag(View v) {
232-
// We need to prevent any surrounding View from intercepting us now.
233-
requestDisallowInterceptTouchEvent(true);
234225
}
235226

236227
@Override

packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,6 @@ public View getStatusBarView() {
160160
public void resetHeadsUpDecayTimer() {
161161
}
162162

163-
@Override
164-
public void hideHeadsUp() {
165-
}
166-
167163
@Override
168164
public void animateExpandSettingsPanel() {
169165
}

0 commit comments

Comments
 (0)