Request hiding IME before starting next activity transition
Since legacy hideSoftInputFromWindow() for IME hiding animation will be scheduled on the focus app's UI thread, so if activity transition has running the animation on UI thread, the IME hiding animation will be delayed until the animation finish. Make sure calling WindowInsetsController#hide(ime()) before starting activity transition to prevent flicker issue. Bug: 204732064 Test: adb shell am start -a android.settings.BIOMETRIC_ENROLL Test: SUW set/confirm pin and move to setup fingerprint(back and forth) Test: make -j RunSettingsRoboTests Change-Id: I33278dd5c993c0bc299ebd065011e5d18c7242e0
This commit is contained in:
@@ -954,6 +954,9 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfirmDeviceCredentialUtils.hideImeImmediately(
|
||||||
|
getActivity().getWindow().getDecorView());
|
||||||
|
|
||||||
mPasswordEntryInputDisabler.setInputEnabled(false);
|
mPasswordEntryInputDisabler.setInputEnabled(false);
|
||||||
setNextEnabled(false);
|
setNextEnabled(false);
|
||||||
|
|
||||||
|
@@ -25,6 +25,11 @@ import android.content.Intent;
|
|||||||
import android.content.IntentSender;
|
import android.content.IntentSender;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.WindowInsets;
|
||||||
|
import android.view.WindowInsetsController;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
@@ -67,4 +72,16 @@ public class ConfirmDeviceCredentialUtils {
|
|||||||
utils.userPresent(userId);
|
utils.userPresent(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request hiding soft-keyboard before animating away credential UI, in case IME
|
||||||
|
* insets animation get delayed by dismissing animation.
|
||||||
|
* @param view used to get root {@link WindowInsets} and {@link WindowInsetsController}.
|
||||||
|
*/
|
||||||
|
public static void hideImeImmediately(@NonNull View view) {
|
||||||
|
if (view.isAttachedToWindow()
|
||||||
|
&& view.getRootWindowInsets().isVisible(WindowInsets.Type.ime())) {
|
||||||
|
view.getWindowInsetsController().hide(WindowInsets.Type.ime());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -493,6 +493,9 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startDisappearAnimation(final Intent intent) {
|
private void startDisappearAnimation(final Intent intent) {
|
||||||
|
ConfirmDeviceCredentialUtils.hideImeImmediately(
|
||||||
|
getActivity().getWindow().getDecorView());
|
||||||
|
|
||||||
if (mDisappearing) {
|
if (mDisappearing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -121,9 +120,8 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
|
|||||||
forFace,
|
forFace,
|
||||||
forBiometrics);
|
forBiometrics);
|
||||||
|
|
||||||
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
|
ConfirmDeviceCredentialUtils.hideImeImmediately(
|
||||||
Context.INPUT_METHOD_SERVICE);
|
getActivity().getWindow().getDecorView());
|
||||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
|
||||||
|
|
||||||
dialog.show(getFragmentManager());
|
dialog.show(getFragmentManager());
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user