Skip to content

Commit b7f4327

Browse files
committed
Fix: never show recents over lock screen
Bug # 5150985 Change-Id: I0672c5e2562f1d4a7e45eba444ca186901236af3
1 parent c4f09e0 commit b7f4327

File tree

1 file changed

+54
-9
lines changed

1 file changed

+54
-9
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
import android.animation.LayoutTransition;
2424
import android.animation.ObjectAnimator;
2525
import android.app.ActivityManagerNative;
26-
import android.app.Dialog;
2726
import android.app.KeyguardManager;
28-
import android.app.PendingIntent;
2927
import android.app.Notification;
28+
import android.app.PendingIntent;
3029
import android.app.StatusBarManager;
30+
import android.content.BroadcastReceiver;
3131
import android.content.Context;
3232
import android.content.Intent;
33+
import android.content.IntentFilter;
3334
import android.content.SharedPreferences;
3435
import android.content.res.Configuration;
3536
import android.content.res.Resources;
@@ -38,7 +39,6 @@
3839
import android.graphics.Point;
3940
import android.graphics.Rect;
4041
import android.graphics.drawable.LayerDrawable;
41-
import android.provider.Settings;
4242
import android.os.Handler;
4343
import android.os.IBinder;
4444
import android.os.Message;
@@ -68,17 +68,19 @@
6868

6969
import com.android.internal.statusbar.StatusBarIcon;
7070
import com.android.internal.statusbar.StatusBarNotification;
71-
7271
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;
7478
import com.android.systemui.statusbar.policy.BatteryController;
7579
import com.android.systemui.statusbar.policy.BluetoothController;
7680
import com.android.systemui.statusbar.policy.CompatModeButton;
7781
import com.android.systemui.statusbar.policy.LocationController;
7882
import com.android.systemui.statusbar.policy.NetworkController;
7983
import com.android.systemui.statusbar.policy.Prefs;
80-
import com.android.systemui.recent.RecentTasksLoader;
81-
import com.android.systemui.recent.RecentsPanelView;
8284

8385
public class TabletStatusBar extends StatusBar implements
8486
HeightReceiver.OnBarHeightChangedListener,
@@ -600,6 +602,12 @@ public boolean onTouch(View v, MotionEvent ev) {
600602

601603
mHeightReceiver.addOnBarHeightChangedListener(this);
602604

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+
603611
return sb;
604612
}
605613

@@ -974,6 +982,12 @@ public void disable(int state) {
974982
| StatusBarManager.DISABLE_BACK
975983
| StatusBarManager.DISABLE_HOME)) != 0) {
976984
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+
}
977991
}
978992
}
979993

@@ -1033,10 +1047,16 @@ public void animateExpand() {
10331047
}
10341048

10351049
public void animateCollapse() {
1050+
animateCollapse(false);
1051+
}
1052+
1053+
private void animateCollapse(boolean excludeRecents) {
10361054
mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PANEL);
10371055
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+
}
10401060
mHandler.removeMessages(MSG_CLOSE_INPUT_METHODS_PANEL);
10411061
mHandler.sendEmptyMessage(MSG_CLOSE_INPUT_METHODS_PANEL);
10421062
mHandler.removeMessages(MSG_CLOSE_COMPAT_MODE_PANEL);
@@ -1814,6 +1834,31 @@ public void toggleRecentApps() {
18141834
mHandler.sendEmptyMessage(msg);
18151835
}
18161836

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+
18171862
public class TouchOutsideListener implements View.OnTouchListener {
18181863
private int mMsg;
18191864
private StatusBarPanel mPanel;

0 commit comments

Comments
 (0)