From 1a0f36f42de36aa0a6799b57bc063ebf57cdac6b Mon Sep 17 00:00:00 2001 From: Peeyush Agarwal Date: Fri, 6 Jan 2017 14:41:35 +0000 Subject: [PATCH] Fix KeyboardShortcuts show The keyboard shortcuts should be shown only if they have not been dismissed already (by using the dismiss method). Check that sInstance is not null in the onKeyboardShortcutsReceived callback before displaying the dialog. Earlier, a call to activity's dismissKeyboardShortcutsHelper right after a call to requestShowKeyboardShortcuts would not dismiss the popup which is not the case now. Test: Manual Change-Id: I544708b003d6baab92cac2b6fce71698dbbdaf0c --- .../com/android/systemui/statusbar/KeyboardShortcuts.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index f43fc4065766e..bd5fb923cb840 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -381,7 +381,12 @@ public final class KeyboardShortcuts { if (appShortcuts != null) { result.add(appShortcuts); } - showKeyboardShortcutsDialog(result); + synchronized (sLock) { + // showKeyboardShortcutsDialog only if it has not been dismissed already + if (sInstance != null) { + showKeyboardShortcutsDialog(result); + } + } } }, deviceId); }