summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Charles Chen <charlesccchen@google.com> 2018-10-05 05:44:38 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-10-05 05:44:38 +0000
commit403fc7e80dd64d49675f11d5ed6f6d07add4bc57 (patch)
tree9ae32317b00164696957ca43e6ff7ba68df73bb5
parent06b503599955610c291d808f1246d992d883a895 (diff)
parentf7150f61e5be704cef6f4010655177726a6af36b (diff)
Merge "Make KeybuttonView respect display id"
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index 12b6f9de61ed..298a93eed55c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.policy;
+import static android.view.Display.INVALID_DISPLAY;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK;
@@ -33,6 +34,7 @@ import android.os.Bundle;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.TypedValue;
+import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
import android.view.KeyCharacterMap;
@@ -307,6 +309,14 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
flags | KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY,
InputDevice.SOURCE_KEYBOARD);
+ //Make KeyEvent work on multi-display environment
+ if (getDisplay() != null) {
+ final int displayId = getDisplay().getDisplayId();
+
+ if (displayId != INVALID_DISPLAY) {
+ ev.setDisplayId(displayId);
+ }
+ }
InputManager.getInstance().injectInputEvent(ev,
InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
}