diff options
author | John Spurlock <jspurlock@google.com> | 2012-06-23 17:11:27 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2012-06-25 09:52:38 -0400 |
commit | 3623128d13839b48693245a64448fb2dabc1977f (patch) | |
tree | f9eab8cf78321e8db10428882e65b12241e89d16 /packages | |
parent | dbbfa702a09f6d2d36dee1b552442d04a4673f89 (diff) | |
download | frameworks_base-3623128d13839b48693245a64448fb2dabc1977f.zip frameworks_base-3623128d13839b48693245a64448fb2dabc1977f.tar.gz frameworks_base-3623128d13839b48693245a64448fb2dabc1977f.tar.bz2 |
TabletStatusBar: Hide notifications during Setup Wizard
Protect tablet users going through the initial setup wizard from trapping
themselves in Settings before the setup wizard is complete. A similar change
was already made for phones, so use the same logic.
Also hide quick-settings button (another way to get trapped in Settings) and
associated panel click handler. Remove clear button since we're no longer
showing notification items.
Bug: 6704080
Change-Id: If7148cde9d18f493627f8367fd4b39d22e0d5ef1
Diffstat (limited to 'packages')
5 files changed, 46 insertions, 28 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a3ec6c3..08016df 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -65,6 +65,7 @@ import com.android.systemui.recent.RecentsPanelView; import com.android.systemui.recent.RecentTasksLoader; import com.android.systemui.recent.TaskDescription; 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.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; + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 3c19ad2..eff6061 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -821,23 +821,6 @@ public class PhoneStatusBar extends BaseStatusBar { 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() { if (mPile == null) return; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java index af0f9d3..fdbfb65 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -217,7 +217,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, */ public void onClick(View v) { - if (v == mTitleArea) { + if (mSettingsButton.isEnabled() && v == mTitleArea) { swapPanels(); } } @@ -280,7 +280,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, public void updatePanelModeButtons() { 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); } @@ -421,5 +421,12 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, super.onTouchEvent(ev); return handled; } + + public void setSettingsEnabled(boolean settingsEnabled) { + if (mSettingsButton != null) { + mSettingsButton.setEnabled(settingsEnabled); + mSettingsButton.setVisibility(settingsEnabled ? View.VISIBLE : View.GONE); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java index 00cf3c5..d180ab9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanelTitle.java @@ -32,7 +32,7 @@ import com.android.systemui.R; public class NotificationPanelTitle extends RelativeLayout implements View.OnClickListener { private NotificationPanel mPanel; private ArrayList<View> buttons; - private View mNotificationsButton; + private View mSettingsButton; public NotificationPanelTitle(Context context, AttributeSet attrs) { super(context, attrs); @@ -47,7 +47,7 @@ public class NotificationPanelTitle extends RelativeLayout implements View.OnCli @Override public void 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)); } @@ -63,6 +63,8 @@ public class NotificationPanelTitle extends RelativeLayout implements View.OnCli @Override public boolean onTouchEvent(MotionEvent e) { + if (!mSettingsButton.isEnabled()) + return false; switch (e.getAction()) { case MotionEvent.ACTION_DOWN: setPressed(true); @@ -88,7 +90,7 @@ public class NotificationPanelTitle extends RelativeLayout implements View.OnCli @Override public void onClick(View v) { - if (v == this) { + if (mSettingsButton.isEnabled() && v == this) { mPanel.swapPanels(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 9b46af8..29d8c98 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -1235,7 +1235,7 @@ public class TabletStatusBar extends BaseStatusBar implements @Override protected void setAreThereNotifications() { 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 (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++) { if (i >= N) break; 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); } } @@ -1567,9 +1570,13 @@ public class TabletStatusBar extends BaseStatusBar implements 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++) { - View row = mNotificationData.get(N-i-1).row; - toShow.add(row); + Entry ent = mNotificationData.get(N-i-1); + if (provisioned || showNotificationEvenIfUnprovisioned(ent.notification)) { + toShow.add(ent.row); + } } ArrayList<View> toRemove = new ArrayList<View>(); @@ -1588,11 +1595,12 @@ public class TabletStatusBar extends BaseStatusBar implements View v = toShow.get(i); if (v.getParent() == null) { // 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 |