Introduce KeyboardStateManager to maintain keyboardstate as show or hide.

- Add a feature flag for IME Latency logging.

- Removed mShowImeAfterFirstLayout from ExtendedEditText.

   http://ag/1414509 added `mShowImeAfterFirstLayout`and cl description
   says "Show IME when search query != null after rotation".

   I verified the behavior by turning on "Allow home screen rotation".
   Keyboard is not getting dismissed on rotation in AA+ screen in a-z list
   or even in the search screen.
   Video : https://drive.google.com/file/d/1BWUTrW9OSEo6ojErj8INMwjFCPArVD4B/view?usp=sharing&resourcekey=0-SXTcKyUw1wCSi8Bm37ktow

Bug: 240192346
Test: Manual.

Verified by setting `ENABLE_KEYBOARD_TRANSITION_SYNC` to false and for
following usecases.

- All apps entry with ime enabled, scrolling a-z list to hide keyboard
- Folder name change - showing and dismissing keyboard
- Toast entry from Allapps and QSB - showing and dismissing keyboard

Change-Id: I1a6b5759b8e71e77744f58677b6d1b73e2f633e8
This commit is contained in:
Anushree Ganjam
2022-07-25 22:20:18 +00:00
parent 94a54203f3
commit a461660fa8
6 changed files with 92 additions and 17 deletions

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2022 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.launcher3.logging;
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.NO_IME_ACTION;
import android.os.SystemClock;
/**
* Class to maintain keyboard states.
*/
public class KeyboardStateManager {
private long mUpdatedTime;
public enum KeyboardState {
NO_IME_ACTION,
SHOW,
HIDE,
}
private KeyboardState mKeyboardState;
public KeyboardStateManager() {
mKeyboardState = NO_IME_ACTION;
}
/**
* Returns time when keyboard state was updated.
*/
public long getLastUpdatedTime() {
return mUpdatedTime;
}
/**
* Returns current keyboard state.
*/
public KeyboardState getKeyboardState() {
return mKeyboardState;
}
/**
* Setter method to set keyboard state.
*/
public void setKeyboardState(KeyboardState keyboardState) {
mUpdatedTime = SystemClock.elapsedRealtime();
mKeyboardState = keyboardState;
}
}