1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wm.flicker.testapp;
18 
19 import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
20 
21 import android.app.Activity;
22 import android.app.AlertDialog;
23 import android.os.Bundle;
24 import android.view.WindowManager;
25 import android.widget.EditText;
26 import android.widget.LinearLayout;
27 
28 public class ImeEditorPopupDialogActivity extends Activity {
29     @Override
onCreate(Bundle savedInstanceState)30     public void onCreate(Bundle savedInstanceState) {
31         super.onCreate(savedInstanceState);
32         WindowManager.LayoutParams p = getWindow().getAttributes();
33         p.layoutInDisplayCutoutMode = WindowManager.LayoutParams
34                 .LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
35         p.softInputMode = SOFT_INPUT_STATE_ALWAYS_HIDDEN;
36         getWindow().setAttributes(p);
37         LinearLayout layout = new LinearLayout(this);
38         layout.setOrientation(LinearLayout.VERTICAL);
39         setContentView(R.layout.activity_simple);
40 
41         final EditText editText = new EditText(this);
42         editText.setHint("focused editText");
43         final AlertDialog dialog = new AlertDialog.Builder(this)
44                 .setView(editText)
45                 .setPositiveButton("Dismiss", (d, which) -> d.dismiss())
46                 .create();
47         dialog.show();
48     }
49 }
50