summaryrefslogtreecommitdiff
path: root/tests/utils
diff options
context:
space:
mode:
authorTarandeep Singh <tarandeep@google.com>2019-01-11 19:50:46 -0800
committerJorim Jaggi <jjaggi@google.com>2019-02-07 15:56:21 +0100
commita6f3561667befbef3cdc160a4097c6e653c530a2 (patch)
tree95a76158145b7a9ddbbb154d58d02173e344073d /tests/utils
parent437ed07bb1435857b45f9324e0514dc788c45982 (diff)
Reparent IME window and handle non-fullscreen windows correctly
IME window is attached to the IME target if possible. This ensures a smooth enter/exit animation when the activity is coming in/going away. Furthermore, if the controlling window doesn't span the entire display, we can't offer controlling it in a frame-by-frame manner, and we need to do the inset calculations relative to the display frame. Test: adb shell setprop persist.wm.new_insets 1 adb shell setprop persist.pre_render_ime_views 0 Test: Open IME, go home, reopen app Test: Show dialog with EditText Bug: 111084606 Change-Id: Id40470f6f8284b48acfa4719049afd14fde332d6
Diffstat (limited to 'tests/utils')
-rw-r--r--tests/utils/testutils/java/android/view/test/InsetsModeSession.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/utils/testutils/java/android/view/test/InsetsModeSession.java b/tests/utils/testutils/java/android/view/test/InsetsModeSession.java
new file mode 100644
index 000000000000..c83dfa41d260
--- /dev/null
+++ b/tests/utils/testutils/java/android/view/test/InsetsModeSession.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.test;
+
+import android.view.ViewRootImpl;
+
+/**
+ * Session to set insets mode for {@link ViewRootImpl#sNewInsetsMode}.
+ */
+public class InsetsModeSession implements AutoCloseable {
+
+ private int mOldMode;
+
+ public InsetsModeSession(int flag) {
+ mOldMode = ViewRootImpl.sNewInsetsMode;
+ ViewRootImpl.sNewInsetsMode = flag;
+ }
+
+ @Override
+ public void close() throws Exception {
+ ViewRootImpl.sNewInsetsMode = mOldMode;
+ }
+}