summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/SoftInputWindow.java
diff options
context:
space:
mode:
authorAnmol Gupta <guanmol@google.com>2020-04-30 21:06:56 -0700
committerIoana Stefan <ioanastefan@google.com>2020-10-07 20:27:32 +0200
commit5e68eeac86cc0179e25a1719bb5182ea9405ee78 (patch)
tree4820b04dd36ff97b165c94fb6ccbc20211445f86 /core/java/android/inputmethodservice/SoftInputWindow.java
parent48acf101c3289ebf4b468418c9755d608b076ad4 (diff)
Add proto-based InputMethodService and server side dumping for IME
This CL implements a mechanism to dump InputMethodService and IME related server states into a proto file which can later be imported to Winscope to allow easy debugging. The Design Doc for the IME tracing project is: go/ime-tracing Bug: 154348613 Test: start trace by calling "adb shell ime tracing start" end trace by calling "adb shell ime tracing stop" pull trace using "adb pull /data/misc/wmtrace/ime_trace.pb ime_trace.pb" Change-Id: Icbfb8c11e882f29eb45dea9d4c23315c48e9d619
Diffstat (limited to 'core/java/android/inputmethodservice/SoftInputWindow.java')
-rw-r--r--core/java/android/inputmethodservice/SoftInputWindow.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/SoftInputWindow.java b/core/java/android/inputmethodservice/SoftInputWindow.java
index 6efd03c44b9f..bc0b37ed626d 100644
--- a/core/java/android/inputmethodservice/SoftInputWindow.java
+++ b/core/java/android/inputmethodservice/SoftInputWindow.java
@@ -16,6 +16,13 @@
package android.inputmethodservice;
+import static android.inputmethodservice.SoftInputWindowProto.BOUNDS;
+import static android.inputmethodservice.SoftInputWindowProto.GRAVITY;
+import static android.inputmethodservice.SoftInputWindowProto.NAME;
+import static android.inputmethodservice.SoftInputWindowProto.TAKES_FOCUS;
+import static android.inputmethodservice.SoftInputWindowProto.WINDOW_STATE;
+import static android.inputmethodservice.SoftInputWindowProto.WINDOW_TYPE;
+
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.IntDef;
@@ -25,6 +32,7 @@ import android.graphics.Rect;
import android.os.Debug;
import android.os.IBinder;
import android.util.Log;
+import android.util.proto.ProtoOutputStream;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -362,4 +370,15 @@ public class SoftInputWindow extends Dialog {
throw new IllegalStateException("Unknown state=" + state);
}
}
+
+ void dumpDebug(ProtoOutputStream proto, long fieldId) {
+ final long token = proto.start(fieldId);
+ proto.write(NAME, mName);
+ proto.write(WINDOW_TYPE, mWindowType);
+ proto.write(GRAVITY, mGravity);
+ proto.write(TAKES_FOCUS, mTakesFocus);
+ mBounds.dumpDebug(proto, BOUNDS);
+ proto.write(WINDOW_STATE, mWindowState);
+ proto.end(token);
+ }
}