Skip to content

Commit 0dc2b81

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Cleanup internal status bar APIs." into jb-mr1-dev
2 parents 195b6e1 + 11cf178 commit 0dc2b81

File tree

17 files changed

+118
-151
lines changed

17 files changed

+118
-151
lines changed

core/java/android/app/StatusBarManager.java

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ public void disable(int what) {
9797
}
9898

9999
/**
100-
* Expand the notifications.
100+
* Expand the notifications panel.
101101
*/
102-
public void expandNotifications() {
102+
public void expandNotificationsPanel() {
103103
try {
104104
final IStatusBarService svc = getService();
105105
if (svc != null) {
106-
svc.expandNotifications();
106+
svc.expandNotificationsPanel();
107107
}
108108
} catch (RemoteException ex) {
109109
// system process is dead anyway.
@@ -112,13 +112,13 @@ public void expandNotifications() {
112112
}
113113

114114
/**
115-
* Collapse the notifications.
115+
* Collapse the notifications and settings panels.
116116
*/
117-
public void collapseNotifications() {
117+
public void collapsePanels() {
118118
try {
119119
final IStatusBarService svc = getService();
120120
if (svc != null) {
121-
svc.collapseNotifications();
121+
svc.collapsePanels();
122122
}
123123
} catch (RemoteException ex) {
124124
// system process is dead anyway.
@@ -127,28 +127,13 @@ public void collapseNotifications() {
127127
}
128128

129129
/**
130-
* Expand the quick settings.
130+
* Expand the settings panel.
131131
*/
132-
public void expandQuickSettings() {
132+
public void expandSettingsPanel() {
133133
try {
134134
final IStatusBarService svc = getService();
135135
if (svc != null) {
136-
svc.expandQuickSettings();
137-
}
138-
} catch (RemoteException ex) {
139-
// system process is dead anyway.
140-
throw new RuntimeException(ex);
141-
}
142-
}
143-
144-
/**
145-
* Collapse the quick settings.
146-
*/
147-
public void collapseQuickSettings() {
148-
try {
149-
final IStatusBarService svc = getService();
150-
if (svc != null) {
151-
svc.collapseQuickSettings();
136+
svc.expandSettingsPanel();
152137
}
153138
} catch (RemoteException ex) {
154139
// system process is dead anyway.

core/java/com/android/internal/statusbar/IStatusBar.aidl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ oneway interface IStatusBar
2828
void updateNotification(IBinder key, in StatusBarNotification notification);
2929
void removeNotification(IBinder key);
3030
void disable(int state);
31-
void animateExpandNotifications();
32-
void animateCollapseNotifications();
33-
void animateExpandQuickSettings();
34-
void animateCollapseQuickSettings();
31+
void animateExpandNotificationsPanel();
32+
void animateExpandSettingsPanel();
33+
void animateCollapsePanels();
3534
void setSystemUiVisibility(int vis, int mask);
3635
void topAppWindowChanged(boolean menuVisible);
3736
void setImeWindowStatus(in IBinder token, int vis, int backDisposition);

core/java/com/android/internal/statusbar/IStatusBarService.aidl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@ import com.android.internal.statusbar.StatusBarNotification;
2424
/** @hide */
2525
interface IStatusBarService
2626
{
27-
void expandNotifications();
28-
void collapseNotifications();
29-
void expandQuickSettings();
30-
void collapseQuickSettings();
27+
void expandNotificationsPanel();
28+
void collapsePanels();
3129
void disable(int what, IBinder token, String pkg);
3230
void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
3331
void setIconVisibility(String slot, boolean visible);
3432
void removeIcon(String slot);
3533
void topAppWindowChanged(boolean menuVisible);
3634
void setImeWindowStatus(in IBinder token, int vis, int backDisposition);
35+
void expandSettingsPanel();
3736

3837
// ---- Methods below are for use by the status bar policy services ----
3938
// You need the STATUS_BAR_SERVICE permission

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public SearchPanelView(Context context, AttributeSet attrs, int defStyle) {
7272

7373
private void startAssistActivity() {
7474
// Close Recent Apps if needed
75-
mBar.animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
75+
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
7676
// Launch Assist
7777
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
7878
.getAssistIntent(mContext, UserHandle.USER_CURRENT);
@@ -220,7 +220,7 @@ public void show(final boolean show, boolean animate) {
220220
public void hide(boolean animate) {
221221
if (mBar != null) {
222222
// This will indirectly cause show(false, ...) to get called
223-
mBar.animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE);
223+
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
224224
} else {
225225
setVisibility(View.INVISIBLE);
226226
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fil
185185

186186
if (isActivity && handled) {
187187
// close the shade if it was open
188-
animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE);
188+
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
189189
visibilityChanged(false);
190190
}
191191
return handled;
@@ -357,7 +357,7 @@ public boolean onLongClick(View v) {
357357
public boolean onMenuItemClick(MenuItem item) {
358358
if (item.getItemId() == R.id.notification_inspect_item) {
359359
startApplicationDetailsActivity(packageNameF);
360-
animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE);
360+
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
361361
} else {
362362
return false;
363363
}
@@ -789,7 +789,7 @@ public void onClick(View v) {
789789
}
790790

791791
// close the shade if it was open
792-
animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE);
792+
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
793793
visibilityChanged(false);
794794

795795
// If this click was on the intruder alert, hide that instead

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

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@ public class CommandQueue extends IStatusBar.Stub {
4646
private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT;
4747
private static final int MSG_DISABLE = 5 << MSG_SHIFT;
4848
private static final int MSG_EXPAND_NOTIFICATIONS = 6 << MSG_SHIFT;
49-
private static final int MSG_COLLAPSE_NOTIFICATIONS = 7 << MSG_SHIFT;
50-
private static final int MSG_EXPAND_QUICK_SETTINGS = 8 << MSG_SHIFT;
51-
private static final int MSG_COLLAPSE_QUICK_SETTINGS = 9 << MSG_SHIFT;
52-
private static final int MSG_SET_SYSTEMUI_VISIBILITY = 10 << MSG_SHIFT;
53-
private static final int MSG_TOP_APP_WINDOW_CHANGED = 11 << MSG_SHIFT;
54-
private static final int MSG_SHOW_IME_BUTTON = 12 << MSG_SHIFT;
55-
private static final int MSG_SET_HARD_KEYBOARD_STATUS = 13 << MSG_SHIFT;
56-
private static final int MSG_TOGGLE_RECENT_APPS = 14 << MSG_SHIFT;
57-
private static final int MSG_PRELOAD_RECENT_APPS = 15 << MSG_SHIFT;
58-
private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 16 << MSG_SHIFT;
59-
private static final int MSG_SET_NAVIGATION_ICON_HINTS = 17 << MSG_SHIFT;
49+
private static final int MSG_COLLAPSE_PANELS = 7 << MSG_SHIFT;
50+
private static final int MSG_EXPAND_SETTINGS = 8 << MSG_SHIFT;
51+
private static final int MSG_SET_SYSTEMUI_VISIBILITY = 9 << MSG_SHIFT;
52+
private static final int MSG_TOP_APP_WINDOW_CHANGED = 10 << MSG_SHIFT;
53+
private static final int MSG_SHOW_IME_BUTTON = 11 << MSG_SHIFT;
54+
private static final int MSG_SET_HARD_KEYBOARD_STATUS = 12 << MSG_SHIFT;
55+
private static final int MSG_TOGGLE_RECENT_APPS = 13 << MSG_SHIFT;
56+
private static final int MSG_PRELOAD_RECENT_APPS = 14 << MSG_SHIFT;
57+
private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 15 << MSG_SHIFT;
58+
private static final int MSG_SET_NAVIGATION_ICON_HINTS = 16 << MSG_SHIFT;
6059

6160
public static final int FLAG_EXCLUDE_NONE = 0;
6261
public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -86,10 +85,9 @@ public void updateIcon(String slot, int index, int viewIndex,
8685
public void updateNotification(IBinder key, StatusBarNotification notification);
8786
public void removeNotification(IBinder key);
8887
public void disable(int state);
89-
public void animateExpandNotifications();
90-
public void animateCollapseNotifications(int flags);
91-
public void animateExpandQuickSettings();
92-
public void animateCollapseQuickSettings();
88+
public void animateExpandNotificationsPanel();
89+
public void animateCollapsePanels(int flags);
90+
public void animateExpandSettingsPanel();
9391
public void setSystemUiVisibility(int vis, int mask);
9492
public void topAppWindowChanged(boolean visible);
9593
public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
@@ -154,31 +152,24 @@ public void disable(int state) {
154152
}
155153
}
156154

157-
public void animateExpandNotifications() {
155+
public void animateExpandNotificationsPanel() {
158156
synchronized (mList) {
159157
mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS);
160158
mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS);
161159
}
162160
}
163161

164-
public void animateCollapseNotifications() {
162+
public void animateCollapsePanels() {
165163
synchronized (mList) {
166-
mHandler.removeMessages(MSG_COLLAPSE_NOTIFICATIONS);
167-
mHandler.sendEmptyMessage(MSG_COLLAPSE_NOTIFICATIONS);
164+
mHandler.removeMessages(MSG_COLLAPSE_PANELS);
165+
mHandler.sendEmptyMessage(MSG_COLLAPSE_PANELS);
168166
}
169167
}
170168

171-
public void animateExpandQuickSettings() {
169+
public void animateExpandSettingsPanel() {
172170
synchronized (mList) {
173-
mHandler.removeMessages(MSG_EXPAND_QUICK_SETTINGS);
174-
mHandler.sendEmptyMessage(MSG_EXPAND_QUICK_SETTINGS);
175-
}
176-
}
177-
178-
public void animateCollapseQuickSettings() {
179-
synchronized (mList) {
180-
mHandler.removeMessages(MSG_COLLAPSE_QUICK_SETTINGS);
181-
mHandler.sendEmptyMessage(MSG_COLLAPSE_QUICK_SETTINGS);
171+
mHandler.removeMessages(MSG_EXPAND_SETTINGS);
172+
mHandler.sendEmptyMessage(MSG_EXPAND_SETTINGS);
182173
}
183174
}
184175

@@ -289,16 +280,13 @@ public void handleMessage(Message msg) {
289280
mCallbacks.disable(msg.arg1);
290281
break;
291282
case MSG_EXPAND_NOTIFICATIONS:
292-
mCallbacks.animateExpandNotifications();
293-
break;
294-
case MSG_COLLAPSE_NOTIFICATIONS:
295-
mCallbacks.animateCollapseNotifications(0);
283+
mCallbacks.animateExpandNotificationsPanel();
296284
break;
297-
case MSG_EXPAND_QUICK_SETTINGS:
298-
mCallbacks.animateExpandQuickSettings();
285+
case MSG_COLLAPSE_PANELS:
286+
mCallbacks.animateCollapsePanels(0);
299287
break;
300-
case MSG_COLLAPSE_QUICK_SETTINGS:
301-
mCallbacks.animateCollapseQuickSettings();
288+
case MSG_EXPAND_SETTINGS:
289+
mCallbacks.animateExpandSettingsPanel();
302290
break;
303291
case MSG_SET_SYSTEMUI_VISIBILITY:
304292
mCallbacks.setSystemUiVisibility(msg.arg1, msg.arg2);

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

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ public class PhoneStatusBar extends BaseStatusBar {
104104
= "com.android.internal.policy.statusbar.START";
105105

106106
private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
107-
private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
107+
private static final int MSG_CLOSE_PANELS = 1001;
108+
private static final int MSG_OPEN_SETTINGS_PANEL = 1002;
108109
// 1020-1030 reserved for BaseStatusBar
109110

110111
// will likely move to a resource or other tunable param at some point
@@ -296,7 +297,7 @@ protected PhoneStatusBarView makeStatusBarView() {
296297
public boolean onTouch(View v, MotionEvent event) {
297298
if (event.getAction() == MotionEvent.ACTION_DOWN) {
298299
if (mExpandedVisible && !mAnimating) {
299-
animateCollapseNotifications();
300+
animateCollapsePanels();
300301
}
301302
}
302303
return mStatusBarWindow.onTouchEvent(event);
@@ -778,7 +779,7 @@ public void removeNotification(IBinder key) {
778779
}
779780

780781
if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0 && !mAnimating) {
781-
animateCollapseNotifications();
782+
animateCollapsePanels();
782783
}
783784
}
784785

@@ -1051,7 +1052,7 @@ public void disable(int state) {
10511052
}
10521053
if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
10531054
if ((state & StatusBarManager.DISABLE_EXPAND) != 0) {
1054-
animateCollapseNotifications();
1055+
animateCollapsePanels();
10551056
}
10561057
}
10571058

@@ -1111,10 +1112,13 @@ public void handleMessage(Message m) {
11111112
super.handleMessage(m);
11121113
switch (m.what) {
11131114
case MSG_OPEN_NOTIFICATION_PANEL:
1114-
animateExpandNotifications();
1115+
animateExpandNotificationsPanel();
11151116
break;
1116-
case MSG_CLOSE_NOTIFICATION_PANEL:
1117-
animateCollapseNotifications();
1117+
case MSG_OPEN_SETTINGS_PANEL:
1118+
animateExpandSettingsPanel();
1119+
break;
1120+
case MSG_CLOSE_PANELS:
1121+
animateCollapsePanels();
11181122
break;
11191123
case MSG_SHOW_INTRUDER:
11201124
setIntruderAlertVisibility(true);
@@ -1167,11 +1171,11 @@ void makeExpandedVisible(boolean revealAfterDraw) {
11671171
visibilityChanged(true);
11681172
}
11691173

1170-
public void animateCollapseNotifications() {
1171-
animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE);
1174+
public void animateCollapsePanels() {
1175+
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
11721176
}
11731177

1174-
public void animateCollapseNotifications(int flags) {
1178+
public void animateCollapsePanels(int flags) {
11751179
if (SPEW) {
11761180
Slog.d(TAG, "animateCollapse():"
11771181
+ " mExpandedVisible=" + mExpandedVisible
@@ -1196,7 +1200,7 @@ public void animateCollapseNotifications(int flags) {
11961200
}
11971201

11981202
@Override
1199-
public void animateExpandNotifications() {
1203+
public void animateExpandNotificationsPanel() {
12001204
if (SPEW) Slog.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible);
12011205
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) {
12021206
return ;
@@ -1208,7 +1212,7 @@ public void animateExpandNotifications() {
12081212
}
12091213

12101214
@Override
1211-
public void animateExpandQuickSettings() {
1215+
public void animateExpandSettingsPanel() {
12121216
if (SPEW) Slog.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible);
12131217
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) {
12141218
return;
@@ -1352,7 +1356,7 @@ public void setSystemUiVisibility(int vis, int mask) {
13521356
if (0 != (diff & View.SYSTEM_UI_FLAG_LOW_PROFILE)) {
13531357
final boolean lightsOut = (0 != (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE));
13541358
if (lightsOut) {
1355-
animateCollapseNotifications();
1359+
animateCollapsePanels();
13561360
if (mTicking) {
13571361
mTicker.halt();
13581362
}
@@ -1678,7 +1682,7 @@ public void onClick(View v) {
16781682
}
16791683
}
16801684
if (snapshot.isEmpty()) {
1681-
animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE);
1685+
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
16821686
return;
16831687
}
16841688
new Thread(new Runnable() {
@@ -1729,7 +1733,7 @@ public void run() {
17291733
mHandler.postDelayed(new Runnable() {
17301734
@Override
17311735
public void run() {
1732-
animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE);
1736+
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
17331737
}
17341738
}, totalDelay + 225);
17351739
}
@@ -1751,7 +1755,7 @@ public void onClick(View v) {
17511755
v.getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS)
17521756
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
17531757
new UserHandle(UserHandle.USER_CURRENT));
1754-
animateCollapseNotifications();
1758+
animateCollapsePanels();
17551759
}
17561760
};
17571761

@@ -1767,7 +1771,7 @@ public void onReceive(Context context, Intent intent) {
17671771
flags |= CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL;
17681772
}
17691773
}
1770-
animateCollapseNotifications(flags);
1774+
animateCollapsePanels(flags);
17711775
}
17721776
else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
17731777
// no waiting!
@@ -1792,7 +1796,7 @@ else if (Intent.ACTION_SCREEN_ON.equals(action)) {
17921796
@Override
17931797
public void userSwitched(int newUserId) {
17941798
if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
1795-
animateCollapseNotifications();
1799+
animateCollapsePanels();
17961800
updateNotificationIcons();
17971801
}
17981802

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ private void startSettingsActivity(Intent intent, boolean onlyProvisioned) {
235235
}
236236
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
237237
mContext.startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT));
238-
getService().animateCollapseNotifications();
238+
getService().animateCollapsePanels();
239239
}
240240

241241
private void addUserTiles(ViewGroup parent, LayoutInflater inflater) {

0 commit comments

Comments
 (0)