Merge "TabletStatusBar: Hide notifications during Setup Wizard" into jb-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b032f9fc9d
@ -65,6 +65,7 @@ import com.android.systemui.recent.RecentsPanelView;
|
|||||||
import com.android.systemui.recent.RecentTasksLoader;
|
import com.android.systemui.recent.RecentTasksLoader;
|
||||||
import com.android.systemui.recent.TaskDescription;
|
import com.android.systemui.recent.TaskDescription;
|
||||||
import com.android.systemui.statusbar.CommandQueue;
|
import com.android.systemui.statusbar.CommandQueue;
|
||||||
|
import com.android.systemui.statusbar.NotificationData.Entry;
|
||||||
import com.android.systemui.statusbar.policy.NotificationRowLayout;
|
import com.android.systemui.statusbar.policy.NotificationRowLayout;
|
||||||
import com.android.systemui.statusbar.tablet.StatusBarPanel;
|
import com.android.systemui.statusbar.tablet.StatusBarPanel;
|
||||||
|
|
||||||
@ -904,4 +905,21 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Q: What kinds of notifications should show during setup?
|
||||||
|
// A: Almost none! Only things coming from the system (package is "android") that also
|
||||||
|
// have special "kind" tags marking them as relevant for setup (see below).
|
||||||
|
protected boolean showNotificationEvenIfUnprovisioned(StatusBarNotification sbn) {
|
||||||
|
if ("android".equals(sbn.pkg)) {
|
||||||
|
if (sbn.notification.kind != null) {
|
||||||
|
for (String aKind : sbn.notification.kind) {
|
||||||
|
// IME switcher, created by InputMethodManagerService
|
||||||
|
if ("android.system.imeswitcher".equals(aKind)) return true;
|
||||||
|
// OTA availability & errors, created by SystemUpdateService
|
||||||
|
if ("android.system.update".equals(aKind)) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -821,23 +821,6 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
R.integer.config_show_search_delay);
|
R.integer.config_show_search_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Q: What kinds of notifications should show during setup?
|
|
||||||
// A: Almost none! Only things coming from the system (package is "android") that also
|
|
||||||
// have special "kind" tags marking them as relevant for setup (see below).
|
|
||||||
private boolean showNotificationEvenIfUnprovisioned(StatusBarNotification sbn) {
|
|
||||||
if ("android".equals(sbn.pkg)) {
|
|
||||||
if (sbn.notification.kind != null) {
|
|
||||||
for (String aKind : sbn.notification.kind) {
|
|
||||||
// IME switcher, created by InputMethodManagerService
|
|
||||||
if ("android.system.imeswitcher".equals(aKind)) return true;
|
|
||||||
// OTA availability & errors, created by SystemUpdateService
|
|
||||||
if ("android.system.update".equals(aKind)) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadNotificationShade() {
|
private void loadNotificationShade() {
|
||||||
if (mPile == null) return;
|
if (mPile == null) return;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v == mTitleArea) {
|
if (mSettingsButton.isEnabled() && v == mTitleArea) {
|
||||||
swapPanels();
|
swapPanels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
|||||||
|
|
||||||
public void updatePanelModeButtons() {
|
public void updatePanelModeButtons() {
|
||||||
final boolean settingsVisible = (mSettingsView != null);
|
final boolean settingsVisible = (mSettingsView != null);
|
||||||
mSettingsButton.setVisibility(!settingsVisible ? View.VISIBLE : View.GONE);
|
mSettingsButton.setVisibility(!settingsVisible && mSettingsButton.isEnabled() ? View.VISIBLE : View.GONE);
|
||||||
mNotificationButton.setVisibility(settingsVisible ? View.VISIBLE : View.GONE);
|
mNotificationButton.setVisibility(settingsVisible ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,5 +421,12 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
|||||||
super.onTouchEvent(ev);
|
super.onTouchEvent(ev);
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSettingsEnabled(boolean settingsEnabled) {
|
||||||
|
if (mSettingsButton != null) {
|
||||||
|
mSettingsButton.setEnabled(settingsEnabled);
|
||||||
|
mSettingsButton.setVisibility(settingsEnabled ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import com.android.systemui.R;
|
|||||||
public class NotificationPanelTitle extends RelativeLayout implements View.OnClickListener {
|
public class NotificationPanelTitle extends RelativeLayout implements View.OnClickListener {
|
||||||
private NotificationPanel mPanel;
|
private NotificationPanel mPanel;
|
||||||
private ArrayList<View> buttons;
|
private ArrayList<View> buttons;
|
||||||
private View mNotificationsButton;
|
private View mSettingsButton;
|
||||||
|
|
||||||
public NotificationPanelTitle(Context context, AttributeSet attrs) {
|
public NotificationPanelTitle(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@ -47,7 +47,7 @@ public class NotificationPanelTitle extends RelativeLayout implements View.OnCli
|
|||||||
@Override
|
@Override
|
||||||
public void onFinishInflate() {
|
public void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
buttons.add(findViewById(R.id.settings_button));
|
buttons.add(mSettingsButton = findViewById(R.id.settings_button));
|
||||||
buttons.add(findViewById(R.id.notification_button));
|
buttons.add(findViewById(R.id.notification_button));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +63,8 @@ public class NotificationPanelTitle extends RelativeLayout implements View.OnCli
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent e) {
|
public boolean onTouchEvent(MotionEvent e) {
|
||||||
|
if (!mSettingsButton.isEnabled())
|
||||||
|
return false;
|
||||||
switch (e.getAction()) {
|
switch (e.getAction()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
setPressed(true);
|
setPressed(true);
|
||||||
@ -88,7 +90,7 @@ public class NotificationPanelTitle extends RelativeLayout implements View.OnCli
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v == this) {
|
if (mSettingsButton.isEnabled() && v == this) {
|
||||||
mPanel.swapPanels();
|
mPanel.swapPanels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1235,7 +1235,7 @@ public class TabletStatusBar extends BaseStatusBar implements
|
|||||||
@Override
|
@Override
|
||||||
protected void setAreThereNotifications() {
|
protected void setAreThereNotifications() {
|
||||||
if (mNotificationPanel != null) {
|
if (mNotificationPanel != null) {
|
||||||
mNotificationPanel.setClearable(mNotificationData.hasClearableItems());
|
mNotificationPanel.setClearable(isDeviceProvisioned() && mNotificationData.hasClearableItems());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1533,10 +1533,13 @@ public class TabletStatusBar extends BaseStatusBar implements
|
|||||||
if (mInputMethodSwitchButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
|
if (mInputMethodSwitchButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
|
||||||
if (mCompatModeButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
|
if (mCompatModeButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
|
||||||
|
|
||||||
|
final boolean provisioned = isDeviceProvisioned();
|
||||||
|
// If the device hasn't been through Setup, we only show system notifications
|
||||||
for (int i=0; toShow.size()< maxNotificationIconsCount; i++) {
|
for (int i=0; toShow.size()< maxNotificationIconsCount; i++) {
|
||||||
if (i >= N) break;
|
if (i >= N) break;
|
||||||
Entry ent = mNotificationData.get(N-i-1);
|
Entry ent = mNotificationData.get(N-i-1);
|
||||||
if (ent.notification.score >= HIDE_ICONS_BELOW_SCORE) {
|
if ((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
|
||||||
|
|| showNotificationEvenIfUnprovisioned(ent.notification)) {
|
||||||
toShow.add(ent.icon);
|
toShow.add(ent.icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1567,9 +1570,13 @@ public class TabletStatusBar extends BaseStatusBar implements
|
|||||||
|
|
||||||
ArrayList<View> toShow = new ArrayList<View>();
|
ArrayList<View> toShow = new ArrayList<View>();
|
||||||
|
|
||||||
|
final boolean provisioned = isDeviceProvisioned();
|
||||||
|
// If the device hasn't been through Setup, we only show system notifications
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
View row = mNotificationData.get(N-i-1).row;
|
Entry ent = mNotificationData.get(N-i-1);
|
||||||
toShow.add(row);
|
if (provisioned || showNotificationEvenIfUnprovisioned(ent.notification)) {
|
||||||
|
toShow.add(ent.row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<View> toRemove = new ArrayList<View>();
|
ArrayList<View> toRemove = new ArrayList<View>();
|
||||||
@ -1588,11 +1595,12 @@ public class TabletStatusBar extends BaseStatusBar implements
|
|||||||
View v = toShow.get(i);
|
View v = toShow.get(i);
|
||||||
if (v.getParent() == null) {
|
if (v.getParent() == null) {
|
||||||
// the notification panel has the most important things at the bottom
|
// the notification panel has the most important things at the bottom
|
||||||
mPile.addView(v, N-1-i);
|
mPile.addView(v, Math.min(toShow.size()-1-i, mPile.getChildCount()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mNotificationPanel.setNotificationCount(N);
|
mNotificationPanel.setNotificationCount(toShow.size());
|
||||||
|
mNotificationPanel.setSettingsEnabled(isDeviceProvisioned());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user