summaryrefslogtreecommitdiff
path: root/core/java/android/app/ActivityView.java
diff options
context:
space:
mode:
authorlumark <lumark@google.com>2019-07-23 19:29:03 +0800
committerlumark <lumark@google.com>2019-07-24 22:31:10 +0800
commit44fe4e471f8d6d10a3282a0f875d29b5ba4e9202 (patch)
treead4aa8c1eb948968182966c07c0c4719c89d75a8 /core/java/android/app/ActivityView.java
parent60bb23b14f7f7b0d58dc50c3072b9d4418fd14ae (diff)
Fix ActivityViewTest#testInputMethod failed in freeform mode
Since IMM#reportActivityView() expects a matrix that transform coordinates that maps (0, 0) in the ActivityView to the actual screen coordinates in the host process. So transform coordinates with getLocationInWindow which presents the location that inside of ActivityView will be wrong when in freeform mode. We should use getLocationOnScreen to fix this. Fix: 137566626 Test: atest ActivityViewTest#testInputMethod in freeform / desktop mode Test: manual as below steps: 0) Make sure device connected HW keyboard & set Gboard launguages as Japanese input. 1) Make and install ActivityViewTest. 2) Launch any app and enter split screen mode. 3) Launch "AV Main" with shortcut in split screen bottom stack. 4) Press "Test Scroll ActiviyView" - > "launch" 5) Scroll down ActivityView & tap EditText and then type words with HW keyboard. 6) Check if candidate view shown on the right place that aligned with EditText. Change-Id: Ia40b9aa94028592fd16e45c7226ec6e3cf07c9b1
Diffstat (limited to 'core/java/android/app/ActivityView.java')
-rw-r--r--core/java/android/app/ActivityView.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java
index 755f0476d9ba..415ec64dc126 100644
--- a/core/java/android/app/ActivityView.java
+++ b/core/java/android/app/ActivityView.java
@@ -386,9 +386,15 @@ public class ActivityView extends ViewGroup {
// Also report this geometry information to InputMethodManagerService.
// TODO(b/115693908): Unify this logic into the above WMS-based one.
+ // TODO(b/138175283): Address the location update when the host of this view is
+ // moving.
final Matrix matrix = new Matrix();
+ final int[] locationOnScreen = new int[2];
+ getLocationOnScreen(locationOnScreen);
+ final int dx = locationOnScreen[0];
+ final int dy = locationOnScreen[1];
matrix.set(getMatrix());
- matrix.postTranslate(x, y);
+ matrix.postTranslate(dx, dy);
mContext.getSystemService(InputMethodManager.class)
.reportActivityView(displayId, matrix);
}