Eliminate some redundant synchronization on Android

* java/org/gnu/emacs/EmacsService.java (resetIC): Return on all
versions of Android if the connection need not be reset.

* java/org/gnu/emacs/EmacsView.java (getICMode, setICMode):
Remove needless synchronization.
This commit is contained in:
Po Lu 2024-06-11 14:39:40 +08:00
parent bac8a70f45
commit 677f082b0f
2 changed files with 15 additions and 7 deletions

View file

@ -899,11 +899,19 @@ invocation of app_process (through android-emacs) can
if (DEBUG_IC)
Log.d (TAG, "resetIC: " + window + ", " + icMode);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
&& (oldMode = window.view.getICMode ()) == icMode
/* Don't do this if there is currently no input
connection. */
&& oldMode != IC_MODE_NULL)
oldMode = window.view.getICMode ();
/* If it's not necessary to reset the input connection for ICMODE to
take effect, return immediately. */
if (oldMode == IC_MODE_NULL && icMode == IC_MODE_NULL)
{
if (DEBUG_IC)
Log.d (TAG, "resetIC: redundant invocation ignored");
return;
}
if (oldMode == icMode
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
{
if (DEBUG_IC)
Log.d (TAG, "resetIC: calling invalidateInput");

View file

@ -891,13 +891,13 @@ else if (child.getVisibility () != GONE)
return true;
}
public synchronized void
public void
setICMode (int icMode)
{
this.icMode = icMode;
}
public synchronized int
public int
getICMode ()
{
return icMode;