Merge "Introduce Stylus handwriting developer option" into tm-dev

This commit is contained in:
Taran Singh
2022-03-04 18:21:20 +00:00
committed by Android (Google) Code Review
4 changed files with 23 additions and 1 deletions

View File

@@ -2163,6 +2163,7 @@ package android.provider {
field @Deprecated public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
field public static final String SHOW_FIRST_CRASH_DIALOG = "show_first_crash_dialog";
field public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled";
field public static final String USER_DISABLED_HDR_FORMATS = "user_disabled_hdr_formats";
field public static final String USER_PREFERRED_REFRESH_RATE = "user_preferred_refresh_rate";
field public static final String USER_PREFERRED_RESOLUTION_HEIGHT = "user_preferred_resolution_height";

View File

@@ -85,8 +85,10 @@ import android.util.ArraySet;
import android.util.Log;
import android.util.MemoryIntArray;
import android.view.Display;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.Editor;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.Preconditions;
@@ -15517,6 +15519,17 @@ public final class Settings {
@Readable
public static final String AUTOFILL_MAX_VISIBLE_DATASETS = "autofill_max_visible_datasets";
/**
* Toggle for enabling stylus handwriting. When enabled, current Input method receives
* stylus {@link MotionEvent}s if an {@link Editor} is focused.
*
* @hide
*/
@TestApi
@Readable
@SuppressLint("NoSettingsProvider")
public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled";
/**
* Exemptions to the hidden API blacklist.
*

View File

@@ -1919,10 +1919,17 @@ public final class InputMethodManager {
if (fallbackImm != null) {
fallbackImm.startStylusHandwriting(view);
}
Objects.requireNonNull(view);
if (Settings.Global.getInt(view.getContext().getContentResolver(),
Settings.Global.STYLUS_HANDWRITING_ENABLED, 0) == 0) {
Log.d(TAG, "Ignoring startStylusHandwriting(view) as stylus handwriting is disabled");
return;
}
checkFocus();
synchronized (mH) {
if (view == null || !hasServedByInputMethodLocked(view)) {
if (!hasServedByInputMethodLocked(view)) {
Log.w(TAG,
"Ignoring startStylusHandwriting() as view=" + view + " is not served.");
return;

View File

@@ -271,6 +271,7 @@ public class SettingsBackupTest {
Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS,
Settings.Global.STYLUS_HANDWRITING_ENABLED,
Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT,
Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS,
Settings.Global.ENHANCED_4G_MODE_ENABLED,