|
23 | 23 | import android.animation.LayoutTransition; |
24 | 24 | import android.animation.ObjectAnimator; |
25 | 25 | import android.app.ActivityManagerNative; |
26 | | -import android.app.Dialog; |
27 | 26 | import android.app.KeyguardManager; |
28 | | -import android.app.PendingIntent; |
29 | 27 | import android.app.Notification; |
| 28 | +import android.app.PendingIntent; |
30 | 29 | import android.app.StatusBarManager; |
| 30 | +import android.content.BroadcastReceiver; |
31 | 31 | import android.content.Context; |
32 | 32 | import android.content.Intent; |
| 33 | +import android.content.IntentFilter; |
33 | 34 | import android.content.SharedPreferences; |
34 | 35 | import android.content.res.Configuration; |
35 | 36 | import android.content.res.Resources; |
|
38 | 39 | import android.graphics.Point; |
39 | 40 | import android.graphics.Rect; |
40 | 41 | import android.graphics.drawable.LayerDrawable; |
41 | | -import android.provider.Settings; |
42 | 42 | import android.os.Handler; |
43 | 43 | import android.os.IBinder; |
44 | 44 | import android.os.Message; |
|
68 | 68 |
|
69 | 69 | import com.android.internal.statusbar.StatusBarIcon; |
70 | 70 | import com.android.internal.statusbar.StatusBarNotification; |
71 | | - |
72 | 71 | import com.android.systemui.R; |
73 | | -import com.android.systemui.statusbar.*; |
| 72 | +import com.android.systemui.recent.RecentTasksLoader; |
| 73 | +import com.android.systemui.recent.RecentsPanelView; |
| 74 | +import com.android.systemui.statusbar.NotificationData; |
| 75 | +import com.android.systemui.statusbar.SignalClusterView; |
| 76 | +import com.android.systemui.statusbar.StatusBar; |
| 77 | +import com.android.systemui.statusbar.StatusBarIconView; |
74 | 78 | import com.android.systemui.statusbar.policy.BatteryController; |
75 | 79 | import com.android.systemui.statusbar.policy.BluetoothController; |
76 | 80 | import com.android.systemui.statusbar.policy.CompatModeButton; |
77 | 81 | import com.android.systemui.statusbar.policy.LocationController; |
78 | 82 | import com.android.systemui.statusbar.policy.NetworkController; |
79 | 83 | import com.android.systemui.statusbar.policy.Prefs; |
80 | | -import com.android.systemui.recent.RecentTasksLoader; |
81 | | -import com.android.systemui.recent.RecentsPanelView; |
82 | 84 |
|
83 | 85 | public class TabletStatusBar extends StatusBar implements |
84 | 86 | HeightReceiver.OnBarHeightChangedListener, |
@@ -600,6 +602,12 @@ public boolean onTouch(View v, MotionEvent ev) { |
600 | 602 |
|
601 | 603 | mHeightReceiver.addOnBarHeightChangedListener(this); |
602 | 604 |
|
| 605 | + // receive broadcasts |
| 606 | + IntentFilter filter = new IntentFilter(); |
| 607 | + filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); |
| 608 | + filter.addAction(Intent.ACTION_SCREEN_OFF); |
| 609 | + context.registerReceiver(mBroadcastReceiver, filter); |
| 610 | + |
603 | 611 | return sb; |
604 | 612 | } |
605 | 613 |
|
@@ -974,6 +982,12 @@ public void disable(int state) { |
974 | 982 | | StatusBarManager.DISABLE_BACK |
975 | 983 | | StatusBarManager.DISABLE_HOME)) != 0) { |
976 | 984 | setNavigationVisibility(state); |
| 985 | + |
| 986 | + if ((state & StatusBarManager.DISABLE_RECENT) != 0) { |
| 987 | + // close recents if it's visible |
| 988 | + mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL); |
| 989 | + mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL); |
| 990 | + } |
977 | 991 | } |
978 | 992 | } |
979 | 993 |
|
@@ -1033,10 +1047,16 @@ public void animateExpand() { |
1033 | 1047 | } |
1034 | 1048 |
|
1035 | 1049 | public void animateCollapse() { |
| 1050 | + animateCollapse(false); |
| 1051 | + } |
| 1052 | + |
| 1053 | + private void animateCollapse(boolean excludeRecents) { |
1036 | 1054 | mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PANEL); |
1037 | 1055 | mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PANEL); |
1038 | | - mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL); |
1039 | | - mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL); |
| 1056 | + if (!excludeRecents) { |
| 1057 | + mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL); |
| 1058 | + mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL); |
| 1059 | + } |
1040 | 1060 | mHandler.removeMessages(MSG_CLOSE_INPUT_METHODS_PANEL); |
1041 | 1061 | mHandler.sendEmptyMessage(MSG_CLOSE_INPUT_METHODS_PANEL); |
1042 | 1062 | mHandler.removeMessages(MSG_CLOSE_COMPAT_MODE_PANEL); |
@@ -1814,6 +1834,31 @@ public void toggleRecentApps() { |
1814 | 1834 | mHandler.sendEmptyMessage(msg); |
1815 | 1835 | } |
1816 | 1836 |
|
| 1837 | + private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { |
| 1838 | + public void onReceive(Context context, Intent intent) { |
| 1839 | + String action = intent.getAction(); |
| 1840 | + if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action) |
| 1841 | + || Intent.ACTION_SCREEN_OFF.equals(action)) { |
| 1842 | + boolean excludeRecents = false; |
| 1843 | + if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) { |
| 1844 | + String reason = intent.getStringExtra("reason"); |
| 1845 | + if (reason != null) { |
| 1846 | + excludeRecents = reason.equals("recentapps"); |
| 1847 | + } |
| 1848 | + } |
| 1849 | + if (Intent.ACTION_SCREEN_OFF.equals(action)) { |
| 1850 | + // If we're turning the screen off, we want to hide the |
| 1851 | + // recents panel with no animation |
| 1852 | + // TODO: hide other things, like the notification tray, |
| 1853 | + // with no animation as well |
| 1854 | + mRecentsPanel.show(false, false); |
| 1855 | + excludeRecents = true; |
| 1856 | + } |
| 1857 | + animateCollapse(excludeRecents); |
| 1858 | + } |
| 1859 | + } |
| 1860 | + }; |
| 1861 | + |
1817 | 1862 | public class TouchOutsideListener implements View.OnTouchListener { |
1818 | 1863 | private int mMsg; |
1819 | 1864 | private StatusBarPanel mPanel; |
|
0 commit comments