Skip to content

Commit 92d3318

Browse files
committed
Exit the keyguard when the user clicks a notification.
(This only works if the keyguard is not secure, but then again, the user can't access the notification panel in that case anyway.) Bug: 5173952 Change-Id: I8a6081d26c52843822b381d8ebe0fae94a03bef9
1 parent fd19906 commit 92d3318

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import android.app.ActivityManager;
2121
import android.app.ActivityManagerNative;
2222
import android.app.Dialog;
23+
import android.app.KeyguardManager;
2324
import android.app.Notification;
2425
import android.app.PendingIntent;
2526
import android.app.StatusBarManager;
@@ -1647,6 +1648,10 @@ public void onClick(View v) {
16471648
// the stack trace isn't very helpful here. Just log the exception message.
16481649
Slog.w(TAG, "Sending contentIntent failed: " + e);
16491650
}
1651+
1652+
KeyguardManager kgm =
1653+
(KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
1654+
if (kgm != null) kgm.exitKeyguardSecurely(null);
16501655
}
16511656

16521657
try {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.animation.ObjectAnimator;
2525
import android.app.ActivityManagerNative;
2626
import android.app.Dialog;
27+
import android.app.KeyguardManager;
2728
import android.app.PendingIntent;
2829
import android.app.Notification;
2930
import android.app.StatusBarManager;
@@ -1318,10 +1319,15 @@ public void onClick(View v) {
13181319
new Rect(pos[0], pos[1], pos[0]+v.getWidth(), pos[1]+v.getHeight()));
13191320
try {
13201321
mIntent.send(mContext, 0, overlay);
1322+
13211323
} catch (PendingIntent.CanceledException e) {
13221324
// the stack trace isn't very helpful here. Just log the exception message.
13231325
Slog.w(TAG, "Sending contentIntent failed: " + e);
13241326
}
1327+
1328+
KeyguardManager kgm =
1329+
(KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
1330+
if (kgm != null) kgm.exitKeyguardSecurely(null);
13251331
}
13261332

13271333
try {

0 commit comments

Comments
 (0)