Merge changes from topic "revert-20437706-revert-20313761-IME tracking - hide-HZXGDCCPOZ-XOCVITMXNR"

* changes:
  Revert^2 "Input latency & reliability tracking - hide flow"
  Revert^2 "Input latency & reliability tracking"
This commit is contained in:
Cosmin Băieș
2022-11-14 14:36:36 +00:00
committed by Android (Google) Code Review
44 changed files with 1189 additions and 268 deletions

View File

@@ -21,6 +21,7 @@ import android.os.ResultReceiver;
import android.view.InputChannel;
import android.view.MotionEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputMethodSubtype;
import android.window.ImeOnBackInvokedDispatcher;
@@ -69,9 +70,11 @@ oneway interface IInputMethod {
void setSessionEnabled(IInputMethodSession session, boolean enabled);
void showSoftInput(in IBinder showInputToken, int flags, in ResultReceiver resultReceiver);
void showSoftInput(in IBinder showInputToken, in @nullable ImeTracker.Token statsToken,
int flags, in ResultReceiver resultReceiver);
void hideSoftInput(in IBinder hideInputToken, int flags, in ResultReceiver resultReceiver);
void hideSoftInput(in IBinder hideInputToken, in @nullable ImeTracker.Token statsToken,
int flags, in ResultReceiver resultReceiver);
void updateEditorToolType(int toolType);

View File

@@ -17,6 +17,7 @@
package com.android.internal.inputmethod;
import android.net.Uri;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodSubtype;
import com.android.internal.infra.AndroidFuture;
@@ -41,7 +42,8 @@ oneway interface IInputMethodPrivilegedOperations {
void switchToNextInputMethod(boolean onlyCurrentIme, in AndroidFuture future /* T=Boolean */);
void shouldOfferSwitchingToNextInputMethod(in AndroidFuture future /* T=Boolean */);
void notifyUserActionAsync();
void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible);
void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible,
in @nullable ImeTracker.Token statsToken);
void onStylusHandwritingReady(int requestId, int pid);
void resetStylusHandwriting(int requestId);
}

View File

@@ -25,6 +25,7 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodSubtype;
import com.android.internal.annotations.GuardedBy;
@@ -100,7 +101,7 @@ public final class InputMethodPrivilegedOperations {
}
/**
* Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatusAsync(int, int}.
* Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatusAsync(int, int)}.
*
* @param vis visibility flags
* @param backDisposition disposition flags
@@ -250,7 +251,7 @@ public final class InputMethodPrivilegedOperations {
}
/**
* Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, IVoidResultCallback)}
* Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, int, AndroidFuture)}
*
* @param flags additional operating flags
* @param reason the reason to hide soft input
@@ -316,7 +317,7 @@ public final class InputMethodPrivilegedOperations {
/**
* Calls {@link IInputMethodPrivilegedOperations#switchToNextInputMethod(boolean,
* IBooleanResultCallback)}
* AndroidFuture)}
*
* @param onlyCurrentIme {@code true} to switch to a {@link InputMethodSubtype} within the same
* IME
@@ -375,22 +376,25 @@ public final class InputMethodPrivilegedOperations {
}
/**
* Calls {@link IInputMethodPrivilegedOperations#applyImeVisibilityAsync(IBinder, boolean)}.
* Calls {@link IInputMethodPrivilegedOperations#applyImeVisibilityAsync(IBinder, boolean,
* ImeTracker.Token)}.
*
* @param showOrHideInputToken placeholder token that maps to window requesting
* {@link android.view.inputmethod.InputMethodManager#showSoftInput(View, int)} or
* {@link android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow
* (IBinder, int)}
* {@link android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow(IBinder,
* int)}
* @param setVisible {@code true} to set IME visible, else hidden.
* @param statsToken the token tracking the current IME request or {@code null} otherwise.
*/
@AnyThread
public void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible) {
public void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible,
@Nullable ImeTracker.Token statsToken) {
final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull();
if (ops == null) {
return;
}
try {
ops.applyImeVisibilityAsync(showOrHideInputToken, setVisible);
ops.applyImeVisibilityAsync(showOrHideInputToken, setVisible, statsToken);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -16,6 +16,7 @@
package com.android.internal.view;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.input.InputManager;
import android.os.Bundle;
@@ -31,6 +32,7 @@ import android.view.InsetsState;
import android.view.PointerIcon;
import android.view.ScrollCaptureResponse;
import android.view.WindowInsets.Type.InsetsType;
import android.view.inputmethod.ImeTracker;
import android.window.ClientWindowFrames;
import com.android.internal.os.IResultReceiver;
@@ -66,11 +68,13 @@ public class BaseIWindow extends IWindow.Stub {
}
@Override
public void showInsets(@InsetsType int types, boolean fromIme) {
public void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
}
@Override
public void hideInsets(@InsetsType int types, boolean fromIme) {
public void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
}
@Override

View File

@@ -17,6 +17,7 @@
package com.android.internal.view;
import android.os.ResultReceiver;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
import android.view.inputmethod.EditorInfo;
@@ -54,11 +55,12 @@ interface IInputMethodManager {
+ "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
InputMethodSubtype getLastInputMethodSubtype(int userId);
boolean showSoftInput(in IInputMethodClient client, @nullable IBinder windowToken, int flags,
int lastClickToolType, in @nullable ResultReceiver resultReceiver, int reason);
boolean hideSoftInput(in IInputMethodClient client, @nullable IBinder windowToken, int flags,
boolean showSoftInput(in IInputMethodClient client, @nullable IBinder windowToken,
in @nullable ImeTracker.Token statsToken, int flags, int lastClickToolType,
in @nullable ResultReceiver resultReceiver, int reason);
boolean hideSoftInput(in IInputMethodClient client, @nullable IBinder windowToken,
in @nullable ImeTracker.Token statsToken, int flags,
in @nullable ResultReceiver resultReceiver, int reason);
// If windowToken is null, this just does startInput(). Otherwise this reports that a window
// has gained focus, and if 'editorInfo' is non-null then also does startInput.
// @NonNull