Skip to content

Commit f4b783f

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Exit the keyguard when the user clicks a notification."
2 parents 8dbdee5 + 92d3318 commit f4b783f

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;
@@ -1640,6 +1641,10 @@ public void onClick(View v) {
16401641
// the stack trace isn't very helpful here. Just log the exception message.
16411642
Slog.w(TAG, "Sending contentIntent failed: " + e);
16421643
}
1644+
1645+
KeyguardManager kgm =
1646+
(KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
1647+
if (kgm != null) kgm.exitKeyguardSecurely(null);
16431648
}
16441649

16451650
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)