Update KeyboardQuickSwitch for TAPL testing

- Added a res id to KeyboardQuickSwitchView for TAPL testing
- Updated KeyboardQuickSwitch focus and scroll initialization
- Logging KeyEvents for TAPL testing
- Updated scrolling logic to wait for initial layout
- Fixed activity leak in KeyboardQuickSwitchViewController

Flag: ENABLE_KEYBOARD_QUICK_SWITCH
Bug: 267520665
Test: TaplTestsKeyboardQuickSwitch
Change-Id: I1d45d948c0e185504d994f7ef1d34f173c2243a9
This commit is contained in:
Schneider Victor-tulias
2023-09-21 10:14:40 -04:00
parent f5099749be
commit e95326dfdd
3 changed files with 84 additions and 44 deletions

View File

@@ -24,7 +24,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer;
import com.android.quickstep.SystemUiProxy;
@@ -92,27 +92,19 @@ public class KeyboardQuickSwitchViewController {
protected void closeQuickSwitchView(boolean animate) {
if (mCloseAnimation != null) {
if (animate) {
// Let currently-running animation finish.
return;
} else {
mCloseAnimation.cancel();
// Let currently-running animation finish.
if (!animate) {
mCloseAnimation.end();
}
return;
}
if (!animate) {
mCloseAnimation = null;
onCloseComplete();
return;
}
mCloseAnimation = mKeyboardQuickSwitchView.getCloseAnimation();
mCloseAnimation.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
mCloseAnimation = null;
onCloseComplete();
}
});
mCloseAnimation.addListener(AnimatorListeners.forEndCallback(this::onCloseComplete));
mCloseAnimation.start();
}
@@ -160,6 +152,7 @@ public class KeyboardQuickSwitchViewController {
}
private void onCloseComplete() {
mCloseAnimation = null;
mOverlayContext.getDragLayer().removeView(mKeyboardQuickSwitchView);
mControllerCallbacks.onCloseComplete();
}