diff options
author | Jorim Jaggi <jjaggi@google.com> | 2020-04-16 16:01:44 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2020-04-16 16:02:05 +0200 |
commit | d3781268868cf458707e96975da861f07920b0f6 (patch) | |
tree | 1b2ba1f435f2c4081cb248a8c2c51beaf8d17310 /tests/UiBench | |
parent | 2bf744abe11277387eecefe2e8a8032872da3bd0 (diff) |
Add jank test for IME animations
Test: atest UiBenchEditTextTypingMicrobenchmark
Fixes: 151951757
Change-Id: Iae61c04a242dfdc733206c2a017a47af1b9b0b34
Diffstat (limited to 'tests/UiBench')
-rw-r--r-- | tests/UiBench/AndroidManifest.xml | 9 | ||||
-rw-r--r-- | tests/UiBench/src/com/android/test/uibench/WindowInsetsControllerActivity.java | 53 |
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/UiBench/AndroidManifest.xml b/tests/UiBench/AndroidManifest.xml index c6b4a54f3b0b..dd255ef5233b 100644 --- a/tests/UiBench/AndroidManifest.xml +++ b/tests/UiBench/AndroidManifest.xml @@ -306,5 +306,14 @@ <category android:name="com.android.test.uibench.TEST" /> </intent-filter> </activity> + + <activity + android:name="WindowInsetsControllerActivity" + android:label="WindowInsetsControllerActivity" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="com.android.test.uibench.TEST" /> + </intent-filter> + </activity> </application> </manifest> diff --git a/tests/UiBench/src/com/android/test/uibench/WindowInsetsControllerActivity.java b/tests/UiBench/src/com/android/test/uibench/WindowInsetsControllerActivity.java new file mode 100644 index 000000000000..e4b89cdd5c8d --- /dev/null +++ b/tests/UiBench/src/com/android/test/uibench/WindowInsetsControllerActivity.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2020 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 com.android.test.uibench; + +import static android.view.WindowInsetsAnimation.Callback.DISPATCH_MODE_STOP; + +import android.os.Bundle; +import android.os.PersistableBundle; +import android.view.WindowInsets; +import android.view.WindowInsetsAnimation; +import android.widget.EditText; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import java.util.List; + +public class WindowInsetsControllerActivity extends AppCompatActivity { + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + EditText text = new EditText(this); + text.setText("WindowInsetsController"); + setContentView(text); + getWindow().setDecorFitsSystemWindows(false); + + text.setWindowInsetsAnimationCallback( + new WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) { + @NonNull + @Override + public WindowInsets onProgress(@NonNull WindowInsets insets, + @NonNull List<WindowInsetsAnimation> runningAnimations) { + return WindowInsets.CONSUMED; + } + }); + } +} |