diff options
18 files changed, 219 insertions, 140 deletions
diff --git a/api/current.txt b/api/current.txt index e96b8f9..f8329f2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2066,6 +2066,7 @@ package android.accessibilityservice { field public static final int GLOBAL_ACTION_BACK = 1; // 0x1 field public static final int GLOBAL_ACTION_HOME = 2; // 0x2 field public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; // 0x4 + field public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; // 0x5 field public static final int GLOBAL_ACTION_RECENTS = 3; // 0x3 field public static final java.lang.String SERVICE_INTERFACE = "android.accessibilityservice.AccessibilityService"; field public static final java.lang.String SERVICE_META_DATA = "android.accessibilityservice"; diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index 81ee192..b0bad07 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -323,7 +323,7 @@ public abstract class AccessibilityService extends Service { public static final int GLOBAL_ACTION_HOME = 2; /** - * Action to open the recents. + * Action to open the recent apps. */ public static final int GLOBAL_ACTION_RECENTS = 3; @@ -332,6 +332,11 @@ public abstract class AccessibilityService extends Service { */ public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; + /** + * Action to open the quick settings. + */ + public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; + private static final String LOG_TAG = "AccessibilityService"; interface Callbacks { diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index dd9f337..1e61e10 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -97,13 +97,13 @@ public class StatusBarManager { } /** - * Expand the status bar. + * Expand the notifications. */ - public void expand() { + public void expandNotifications() { try { final IStatusBarService svc = getService(); if (svc != null) { - svc.expand(); + svc.expandNotifications(); } } catch (RemoteException ex) { // system process is dead anyway. @@ -112,13 +112,43 @@ public class StatusBarManager { } /** - * Collapse the status bar. + * Collapse the notifications. */ - public void collapse() { + public void collapseNotifications() { try { final IStatusBarService svc = getService(); if (svc != null) { - svc.collapse(); + svc.collapseNotifications(); + } + } catch (RemoteException ex) { + // system process is dead anyway. + throw new RuntimeException(ex); + } + } + + /** + * Expand the quick settings. + */ + public void expandQuickSettings() { + try { + final IStatusBarService svc = getService(); + if (svc != null) { + svc.expandQuickSettings(); + } + } catch (RemoteException ex) { + // system process is dead anyway. + throw new RuntimeException(ex); + } + } + + /** + * Collapse the quick settings. + */ + public void collapseQuickSettings() { + try { + final IStatusBarService svc = getService(); + if (svc != null) { + svc.collapseQuickSettings(); } } catch (RemoteException ex) { // system process is dead anyway. diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 294d4c4..0737b52 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -28,8 +28,10 @@ oneway interface IStatusBar void updateNotification(IBinder key, in StatusBarNotification notification); void removeNotification(IBinder key); void disable(int state); - void animateExpand(); - void animateCollapse(); + void animateExpandNotifications(); + void animateCollapseNotifications(); + void animateExpandQuickSettings(); + void animateCollapseQuickSettings(); void setSystemUiVisibility(int vis, int mask); void topAppWindowChanged(boolean menuVisible); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index c64f170..60e2b34 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -24,8 +24,10 @@ import com.android.internal.statusbar.StatusBarNotification; /** @hide */ interface IStatusBarService { - void expand(); - void collapse(); + void expandNotifications(); + void collapseNotifications(); + void expandQuickSettings(); + void collapseQuickSettings(); void disable(int what, IBinder token, String pkg); void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); void setIconVisibility(String slot, boolean visible); diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java index 281f25f..b0879fc 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java @@ -72,7 +72,7 @@ public class SearchPanelView extends FrameLayout implements private void startAssistActivity() { // Close Recent Apps if needed - mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL); + mBar.animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL); // Launch Assist Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(mContext, UserHandle.USER_CURRENT); @@ -220,7 +220,7 @@ public class SearchPanelView extends FrameLayout implements public void hide(boolean animate) { if (mBar != null) { // This will indirectly cause show(false, ...) to get called - mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + mBar.animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } else { setVisibility(View.INVISIBLE); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 6b75364..c1104d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -184,7 +184,7 @@ public abstract class BaseStatusBar extends SystemUI implements if (isActivity && handled) { // close the shade if it was open - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); } return handled; @@ -361,7 +361,7 @@ public abstract class BaseStatusBar extends SystemUI implements public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.notification_inspect_item) { startApplicationDetailsActivity(packageNameF); - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } else { return false; } @@ -793,7 +793,7 @@ public abstract class BaseStatusBar extends SystemUI implements } // close the shade if it was open - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); // If this click was on the intruder alert, hide that instead diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index a00d95a..39e49b8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -33,38 +33,30 @@ import com.android.internal.statusbar.StatusBarNotification; * are coalesced, note that they are all idempotent. */ public class CommandQueue extends IStatusBar.Stub { - private static final String TAG = "StatusBar.CommandQueue"; - private static final int INDEX_MASK = 0xffff; private static final int MSG_SHIFT = 16; private static final int MSG_MASK = 0xffff << MSG_SHIFT; - - private static final int MSG_ICON = 1 << MSG_SHIFT; private static final int OP_SET_ICON = 1; private static final int OP_REMOVE_ICON = 2; - private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; - private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; - private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; - - private static final int MSG_DISABLE = 5 << MSG_SHIFT; - - private static final int MSG_SET_VISIBILITY = 6 << MSG_SHIFT; - private static final int OP_EXPAND = 1; - private static final int OP_COLLAPSE = 2; - - private static final int MSG_SET_SYSTEMUI_VISIBILITY = 7 << MSG_SHIFT; - - private static final int MSG_TOP_APP_WINDOW_CHANGED = 8 << MSG_SHIFT; - private static final int MSG_SHOW_IME_BUTTON = 9 << MSG_SHIFT; - private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT; - - private static final int MSG_TOGGLE_RECENT_APPS = 11 << MSG_SHIFT; - private static final int MSG_PRELOAD_RECENT_APPS = 12 << MSG_SHIFT; - private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 13 << MSG_SHIFT; - - private static final int MSG_SET_NAVIGATION_ICON_HINTS = 14 << MSG_SHIFT; + private static final int MSG_ICON = 1 << MSG_SHIFT; + private static final int MSG_ADD_NOTIFICATION = 2 << MSG_SHIFT; + private static final int MSG_UPDATE_NOTIFICATION = 3 << MSG_SHIFT; + private static final int MSG_REMOVE_NOTIFICATION = 4 << MSG_SHIFT; + private static final int MSG_DISABLE = 5 << MSG_SHIFT; + private static final int MSG_EXPAND_NOTIFICATIONS = 6 << MSG_SHIFT; + private static final int MSG_COLLAPSE_NOTIFICATIONS = 7 << MSG_SHIFT; + private static final int MSG_EXPAND_QUICK_SETTINGS = 8 << MSG_SHIFT; + private static final int MSG_COLLAPSE_QUICK_SETTINGS = 9 << MSG_SHIFT; + private static final int MSG_SET_SYSTEMUI_VISIBILITY = 10 << MSG_SHIFT; + private static final int MSG_TOP_APP_WINDOW_CHANGED = 11 << MSG_SHIFT; + private static final int MSG_SHOW_IME_BUTTON = 12 << MSG_SHIFT; + private static final int MSG_SET_HARD_KEYBOARD_STATUS = 13 << MSG_SHIFT; + private static final int MSG_TOGGLE_RECENT_APPS = 14 << MSG_SHIFT; + private static final int MSG_PRELOAD_RECENT_APPS = 15 << MSG_SHIFT; + private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 16 << MSG_SHIFT; + private static final int MSG_SET_NAVIGATION_ICON_HINTS = 17 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; @@ -94,8 +86,10 @@ public class CommandQueue extends IStatusBar.Stub { public void updateNotification(IBinder key, StatusBarNotification notification); public void removeNotification(IBinder key); public void disable(int state); - public void animateExpand(); - public void animateCollapse(int flags); + public void animateExpandNotifications(); + public void animateCollapseNotifications(int flags); + public void animateExpandQuickSettings(); + public void animateCollapseQuickSettings(); public void setSystemUiVisibility(int vis, int mask); public void topAppWindowChanged(boolean visible); public void setImeWindowStatus(IBinder token, int vis, int backDisposition); @@ -160,21 +154,31 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void animateExpand() { + public void animateExpandNotifications() { + synchronized (mList) { + mHandler.removeMessages(MSG_EXPAND_NOTIFICATIONS); + mHandler.sendEmptyMessage(MSG_EXPAND_NOTIFICATIONS); + } + } + + public void animateCollapseNotifications() { synchronized (mList) { - mHandler.removeMessages(MSG_SET_VISIBILITY); - mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_EXPAND, 0, null).sendToTarget(); + mHandler.removeMessages(MSG_COLLAPSE_NOTIFICATIONS); + mHandler.sendEmptyMessage(MSG_COLLAPSE_NOTIFICATIONS); } } - public void animateCollapse() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + public void animateExpandQuickSettings() { + synchronized (mList) { + mHandler.removeMessages(MSG_EXPAND_QUICK_SETTINGS); + mHandler.sendEmptyMessage(MSG_EXPAND_QUICK_SETTINGS); + } } - public void animateCollapse(int flags) { + public void animateCollapseQuickSettings() { synchronized (mList) { - mHandler.removeMessages(MSG_SET_VISIBILITY); - mHandler.obtainMessage(MSG_SET_VISIBILITY, OP_COLLAPSE, flags, null).sendToTarget(); + mHandler.removeMessages(MSG_COLLAPSE_QUICK_SETTINGS); + mHandler.sendEmptyMessage(MSG_COLLAPSE_QUICK_SETTINGS); } } @@ -284,12 +288,17 @@ public class CommandQueue extends IStatusBar.Stub { case MSG_DISABLE: mCallbacks.disable(msg.arg1); break; - case MSG_SET_VISIBILITY: - if (msg.arg1 == OP_EXPAND) { - mCallbacks.animateExpand(); - } else { - mCallbacks.animateCollapse(msg.arg2); - } + case MSG_EXPAND_NOTIFICATIONS: + mCallbacks.animateExpandNotifications(); + break; + case MSG_COLLAPSE_NOTIFICATIONS: + mCallbacks.animateCollapseNotifications(0); + break; + case MSG_EXPAND_QUICK_SETTINGS: + mCallbacks.animateExpandQuickSettings(); + break; + case MSG_COLLAPSE_QUICK_SETTINGS: + mCallbacks.animateCollapseQuickSettings(); break; case MSG_SET_SYSTEMUI_VISIBILITY: mCallbacks.setSystemUiVisibility(msg.arg1, msg.arg2); 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 2f30a38..e6aa632 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; -import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import android.app.ActivityManager; import android.app.ActivityManagerNative; @@ -52,7 +51,6 @@ import android.util.Log; import android.util.Slog; import android.view.Display; import android.view.Gravity; -import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; @@ -77,7 +75,6 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.GestureRecorder; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationData.Entry; -import com.android.systemui.statusbar.RotationToggle; import com.android.systemui.statusbar.SignalClusterView; import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.policy.BatteryController; @@ -298,7 +295,7 @@ public class PhoneStatusBar extends BaseStatusBar { public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (mExpandedVisible && !mAnimating) { - animateCollapse(); + animateCollapseNotifications(); } } return mStatusBarWindow.onTouchEvent(event); @@ -780,7 +777,7 @@ public class PhoneStatusBar extends BaseStatusBar { } if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0 && !mAnimating) { - animateCollapse(); + animateCollapseNotifications(); } } @@ -1053,7 +1050,7 @@ public class PhoneStatusBar extends BaseStatusBar { } if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) { if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { - animateCollapse(); + animateCollapseNotifications(); } } @@ -1113,10 +1110,10 @@ public class PhoneStatusBar extends BaseStatusBar { super.handleMessage(m); switch (m.what) { case MSG_OPEN_NOTIFICATION_PANEL: - animateExpand(); + animateExpandNotifications(); break; case MSG_CLOSE_NOTIFICATION_PANEL: - animateCollapse(); + animateCollapseNotifications(); break; case MSG_SHOW_INTRUDER: setIntruderAlertVisibility(true); @@ -1169,11 +1166,11 @@ public class PhoneStatusBar extends BaseStatusBar { visibilityChanged(true); } - public void animateCollapse() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + public void animateCollapseNotifications() { + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } - public void animateCollapse(int flags) { + public void animateCollapseNotifications(int flags) { if (SPEW) { Slog.d(TAG, "animateCollapse():" + " mExpandedVisible=" + mExpandedVisible @@ -1198,7 +1195,7 @@ public class PhoneStatusBar extends BaseStatusBar { } @Override - public void animateExpand() { + public void animateExpandNotifications() { if (SPEW) Slog.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible); if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) { return ; @@ -1209,6 +1206,22 @@ public class PhoneStatusBar extends BaseStatusBar { if (false) postStartTracing(); } + @Override + public void animateExpandQuickSettings() { + if (SPEW) Slog.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible); + if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) { + return; + } + + mSettingsPanel.expand(); + + if (false) postStartTracing(); + } + + public void animateCollapseQuickSettings() { + mStatusBarView.collapseAllPanels(true); + } + void makeExpandedInvisible() { if (SPEW) Slog.d(TAG, "makeExpandedInvisible: mExpandedVisible=" + mExpandedVisible + " mExpandedVisible=" + mExpandedVisible); @@ -1338,7 +1351,7 @@ public class PhoneStatusBar extends BaseStatusBar { if (0 != (diff & View.SYSTEM_UI_FLAG_LOW_PROFILE)) { final boolean lightsOut = (0 != (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE)); if (lightsOut) { - animateCollapse(); + animateCollapseNotifications(); if (mTicking) { mTicker.halt(); } @@ -1664,7 +1677,7 @@ public class PhoneStatusBar extends BaseStatusBar { } } if (snapshot.isEmpty()) { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); return; } new Thread(new Runnable() { @@ -1715,7 +1728,7 @@ public class PhoneStatusBar extends BaseStatusBar { mHandler.postDelayed(new Runnable() { @Override public void run() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } }, totalDelay + 225); } @@ -1737,7 +1750,7 @@ public class PhoneStatusBar extends BaseStatusBar { v.getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), new UserHandle(UserHandle.USER_CURRENT)); - animateCollapse(); + animateCollapseNotifications(); } }; @@ -1753,7 +1766,7 @@ public class PhoneStatusBar extends BaseStatusBar { flags |= CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL; } } - animateCollapse(flags); + animateCollapseNotifications(flags); } else if (Intent.ACTION_SCREEN_OFF.equals(action)) { // no waiting! @@ -1778,7 +1791,7 @@ public class PhoneStatusBar extends BaseStatusBar { @Override public void userSwitched(int newUserId) { if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId); - animateCollapse(); + animateCollapseNotifications(); updateNotificationIcons(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index f83517b..85b91d1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -70,7 +70,7 @@ public class StatusBarWindowView extends FrameLayout switch (event.getKeyCode()) { case KeyEvent.KEYCODE_BACK: if (!down) { - mService.animateCollapse(); + mService.animateCollapseNotifications(); } return true; } 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 c1ea50d..73d1c7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -204,14 +204,14 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, // We exclusively handle the back key by hiding this panel. case KeyEvent.KEYCODE_BACK: { if (event.getAction() == KeyEvent.ACTION_UP) { - mBar.animateCollapse(); + mBar.animateCollapseNotifications(); } return true; } // We react to the home key but let the system handle it. case KeyEvent.KEYCODE_HOME: { if (event.getAction() == KeyEvent.ACTION_UP) { - mBar.animateCollapse(); + mBar.animateCollapseNotifications(); } } break; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java index c45ac3f..ab4ef75 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java @@ -112,7 +112,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { private void onClickNetwork() { getContext().startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - getStatusBarManager().collapse(); + getStatusBarManager().collapseNotifications(); } // Settings @@ -121,7 +121,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), new UserHandle(UserHandle.USER_CURRENT)); - getStatusBarManager().collapse(); + getStatusBarManager().collapseNotifications(); } } 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 3335dfd..d1dd3c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -38,12 +38,10 @@ import android.inputmethodservice.InputMethodService; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; -import android.os.ServiceManager; import android.text.TextUtils; import android.util.Slog; import android.view.Display; import android.view.Gravity; -import android.view.IWindowManager; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SoundEffectConstants; @@ -742,7 +740,7 @@ public class TabletStatusBar extends BaseStatusBar implements SharedPreferences.Editor editor = Prefs.edit(mContext); editor.putBoolean(Prefs.DO_NOT_DISTURB_PREF, false); editor.apply(); - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); } }); @@ -823,7 +821,7 @@ public class TabletStatusBar extends BaseStatusBar implements break; case MSG_HIDE_CHROME: if (DEBUG) Slog.d(TAG, "showing shadows (lights out)"); - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); mBarContents.setVisibility(View.GONE); mShadow.setVisibility(View.VISIBLE); @@ -909,7 +907,7 @@ public class TabletStatusBar extends BaseStatusBar implements if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) { if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { Slog.i(TAG, "DISABLE_EXPAND: yes"); - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); } } @@ -990,16 +988,16 @@ public class TabletStatusBar extends BaseStatusBar implements mFeedbackIconArea.setVisibility(View.VISIBLE); } - public void animateExpand() { + public void animateExpandNotifications() { mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PANEL); mHandler.sendEmptyMessage(MSG_OPEN_NOTIFICATION_PANEL); } - public void animateCollapse() { - animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + public void animateCollapseNotifications() { + animateCollapseNotifications(CommandQueue.FLAG_EXCLUDE_NONE); } - public void animateCollapse(int flags) { + public void animateCollapseNotifications(int flags) { if ((flags & CommandQueue.FLAG_EXCLUDE_NOTIFICATION_PANEL) == 0) { mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PANEL); mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PANEL); @@ -1023,6 +1021,16 @@ public class TabletStatusBar extends BaseStatusBar implements } + @Override + public void animateExpandQuickSettings() { + // TODO: Implement when TabletStatusBar begins to be used. + } + + @Override + public void animateCollapseQuickSettings() { + // TODO: Implement when TabletStatusBar begins to be used. + } + @Override // CommandQueue public void setNavigationIconHints(int hints) { if (hints == mNavigationIconHints) return; @@ -1291,7 +1299,7 @@ public class TabletStatusBar extends BaseStatusBar implements mVT.computeCurrentVelocity(1000); // pixels per second // require a little more oomph once we're already in peekaboo mode if (mVT.getYVelocity() < -mNotificationFlingVelocity) { - animateExpand(); + animateExpandNotifications(); visibilityChanged(true); hilite(false); mVT.recycle(); @@ -1309,7 +1317,7 @@ public class TabletStatusBar extends BaseStatusBar implements && Math.abs(event.getY() - mInitialTouchY) < (mTouchSlop / 3) // dragging off the bottom doesn't count && (int)event.getY() < v.getBottom()) { - animateExpand(); + animateExpandNotifications(); visibilityChanged(true); v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); v.playSoundEffect(SoundEffectConstants.CLICK); @@ -1485,7 +1493,7 @@ public class TabletStatusBar extends BaseStatusBar implements } catch (RemoteException ex) { // system process is dead if we're here. } - animateCollapse(); + animateCollapseNotifications(); visibilityChanged(false); } @@ -1501,7 +1509,7 @@ public class TabletStatusBar extends BaseStatusBar implements flags |= CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL; } } - animateCollapse(flags); + animateCollapseNotifications(flags); } } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java index 6022fd2..fd2ee38 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java @@ -30,7 +30,6 @@ import android.view.WindowManager; */ public class TvStatusBar extends BaseStatusBar { - View mView; @Override public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) { @@ -62,11 +61,11 @@ public class TvStatusBar extends BaseStatusBar { } @Override - public void animateExpand() { + public void animateExpandNotifications() { } @Override - public void animateCollapse(int flags) { + public void animateCollapseNotifications(int flags) { } @Override @@ -139,28 +138,15 @@ public class TvStatusBar extends BaseStatusBar { return true; } - protected View makeStatusBarView() { - synchronized (this) { - if (mView == null) { - mView = new View(mContext); - } - } - return mView; - } - public View getStatusBarView() { return null; } - protected int getStatusBarGravity() { - return 0; - } - - public int getStatusBarHeight() { - return 0; + @Override + public void animateExpandQuickSettings() { } - public void animateCollapse() { + @Override + public void animateCollapseQuickSettings() { } - } diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 7034264..fe8e45b 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2916,7 +2916,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { try { IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { - statusbar.collapse(); + statusbar.collapseNotifications(); + statusbar.collapseQuickSettings(); } } catch (RemoteException ex) { // re-acquire status bar service next time it is needed. diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java index 46dcedc..b567992 100644 --- a/services/java/com/android/server/StatusBarManagerService.java +++ b/services/java/com/android/server/StatusBarManagerService.java @@ -117,23 +117,45 @@ public class StatusBarManagerService extends IStatusBarService.Stub // ================================================================================ // From IStatusBarService // ================================================================================ - public void expand() { + public void expandNotifications() { enforceExpandStatusBar(); if (mBar != null) { try { - mBar.animateExpand(); + mBar.animateExpandNotifications(); } catch (RemoteException ex) { } } } - public void collapse() { + public void collapseNotifications() { enforceExpandStatusBar(); if (mBar != null) { try { - mBar.animateCollapse(); + mBar.animateCollapseNotifications(); + } catch (RemoteException ex) { + } + } + } + + public void expandQuickSettings() { + enforceExpandStatusBar(); + + if (mBar != null) { + try { + mBar.animateExpandQuickSettings(); + } catch (RemoteException ex) { + } + } + } + + public void collapseQuickSettings() { + enforceExpandStatusBar(); + + if (mBar != null) { + try { + mBar.animateCollapseQuickSettings(); } catch (RemoteException ex) { } } @@ -598,7 +620,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub String action = intent.getAction(); if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action) || Intent.ACTION_SCREEN_OFF.equals(action)) { - collapse(); + collapseNotifications(); + collapseQuickSettings(); } /* else if (Telephony.Intents.SPN_STRINGS_UPDATED_ACTION.equals(action)) { diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java index 117f6b7..25f98de 100644 --- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -1738,7 +1738,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { return true; } - public boolean performGlobalAction(int action) throws RemoteException { + public boolean performGlobalAction(int action) { synchronized (mLock) { final int resolvedUserId = mSecurityPolicy .resolveCallingUserIdEnforcingPermissionsLocked( @@ -1760,7 +1760,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { openRecents(); } return true; case AccessibilityService.GLOBAL_ACTION_NOTIFICATIONS: { - expandStatusBar(); + expandNotifications(); + } return true; + case AccessibilityService.GLOBAL_ACTION_QUICK_SETTINGS: { + expandQuickSettings(); } return true; } return false; @@ -1932,12 +1935,22 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { Binder.restoreCallingIdentity(token); } - private void expandStatusBar() { + private void expandNotifications() { + final long token = Binder.clearCallingIdentity(); + + StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService( + android.app.Service.STATUS_BAR_SERVICE); + statusBarManager.expandNotifications(); + + Binder.restoreCallingIdentity(token); + } + + private void expandQuickSettings() { final long token = Binder.clearCallingIdentity(); StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService( android.app.Service.STATUS_BAR_SERVICE); - statusBarManager.expand(); + statusBarManager.expandQuickSettings(); Binder.restoreCallingIdentity(token); } diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index 94ad620..3b6e107 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -16,29 +16,15 @@ package com.android.statusbartest; -import android.app.ListActivity; import android.app.Notification; import android.app.NotificationManager; -import android.widget.ArrayAdapter; import android.view.View; -import android.widget.ListView; import android.content.Intent; import android.app.PendingIntent; -import android.app.Notification; -import android.app.NotificationManager; import android.app.StatusBarManager; -import android.content.Context; -import android.util.AttributeSet; -import android.os.Vibrator; -import android.os.Bundle; import android.os.Handler; import android.util.Log; -import android.net.Uri; import android.os.SystemClock; -import android.widget.RemoteViews; -import android.widget.Toast; -import android.os.PowerManager; -import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -300,14 +286,14 @@ public class StatusBarTest extends TestActivity }, new Test("Expand") { public void run() { - mStatusBarManager.expand(); + mStatusBarManager.expandNotifications(); } }, new Test("Expand in 3 sec.") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.expand(); + mStatusBarManager.expandNotifications(); } }, 3000); } @@ -316,7 +302,7 @@ public class StatusBarTest extends TestActivity public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.collapse(); + mStatusBarManager.collapseNotifications(); } }, 3000); } |