Skip to content
Snippets Groups Projects
Commit f872f692 authored by Tiger's avatar Tiger
Browse files

Add proper padding to PerfTestActivity

Since Android V, apps targeting SDK 35+ will be forced to go
edge-to-edge. This CL adds proper padding to the content view of
PerfTestActivity, so the EditText within it won't be obscured by system
bars. Otherwise, there would be unexpected scrolling while showing or
hiding IME.

This CL also removes the action bar from the activity, so that the
content won't be obscured by it.

Fix: 331025926
Bug: 309578419
Flag: com.android.window.flags.enforce_edge_to_edge
Test: ImePerfTest
Change-Id: I212ef4862b4249e288267fb8fb4448b9100107c1
parent 869e636a
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,8 @@
<application>
<uses-library android:name="android.test.runner" />
<activity android:name="android.perftests.utils.PerfTestActivity"
android:exported="true">
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
android:exported="true">
<intent-filter>
<action android:name="com.android.perftests.core.PERFTEST" />
</intent-filter>
......
......@@ -19,7 +19,9 @@ package android.perftests.utils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Insets;
import android.os.Bundle;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.LinearLayout;
......@@ -42,6 +44,11 @@ public class PerfTestActivity extends Activity {
if (getIntent().getBooleanExtra(INTENT_EXTRA_ADD_EDIT_TEXT, false)) {
final LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setOnApplyWindowInsetsListener((v, w) -> {
final Insets insets = w.getSystemWindowInsets();
v.setPadding(insets.left, insets.top, insets.right, insets.bottom);
return WindowInsets.CONSUMED;
});
final EditText editText = new EditText(this);
editText.setId(ID_EDITOR);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment