Loading core/api/current.txt +3 −0 Original line number Original line Diff line number Diff line Loading @@ -362,6 +362,7 @@ package android { field public static final int authorities = 16842776; // 0x1010018 field public static final int authorities = 16842776; // 0x1010018 field public static final int autoAdvanceViewId = 16843535; // 0x101030f field public static final int autoAdvanceViewId = 16843535; // 0x101030f field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b field public static final int autoHandwritingEnabled; field public static final int autoLink = 16842928; // 0x10100b0 field public static final int autoLink = 16842928; // 0x10100b0 field public static final int autoMirrored = 16843754; // 0x10103ea field public static final int autoMirrored = 16843754; // 0x10103ea field public static final int autoRemoveFromRecents = 16843847; // 0x1010447 field public static final int autoRemoveFromRecents = 16843847; // 0x1010447 Loading Loading @@ -49421,6 +49422,7 @@ package android.view { method public boolean isAccessibilityHeading(); method public boolean isAccessibilityHeading(); method public boolean isActivated(); method public boolean isActivated(); method public boolean isAttachedToWindow(); method public boolean isAttachedToWindow(); method public boolean isAutoHandwritingEnabled(); method public boolean isClickable(); method public boolean isClickable(); method public boolean isContextClickable(); method public boolean isContextClickable(); method public boolean isDirty(); method public boolean isDirty(); Loading Loading @@ -49604,6 +49606,7 @@ package android.view { method public void setAlpha(@FloatRange(from=0.0, to=1.0) float); method public void setAlpha(@FloatRange(from=0.0, to=1.0) float); method public void setAnimation(android.view.animation.Animation); method public void setAnimation(android.view.animation.Animation); method public void setAnimationMatrix(@Nullable android.graphics.Matrix); method public void setAnimationMatrix(@Nullable android.graphics.Matrix); method public void setAutoHandwritingEnabled(boolean); method public void setAutofillHints(@Nullable java.lang.String...); method public void setAutofillHints(@Nullable java.lang.String...); method public void setAutofillId(@Nullable android.view.autofill.AutofillId); method public void setAutofillId(@Nullable android.view.autofill.AutofillId); method public void setBackground(android.graphics.drawable.Drawable); method public void setBackground(android.graphics.drawable.Drawable); core/java/android/view/HandwritingInitiator.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -161,6 +161,11 @@ public class HandwritingInitiator { return mConnectedView.get(); return mConnectedView.get(); } } private void clearConnectedView() { mConnectedView = null; mConnectionCount = 0; } /** /** * Notify HandwritingInitiator that a new InputConnection is created. * Notify HandwritingInitiator that a new InputConnection is created. * The caller of this method should guarantee that each onInputConnectionCreated call * The caller of this method should guarantee that each onInputConnectionCreated call Loading @@ -169,6 +174,10 @@ public class HandwritingInitiator { * @see #onInputConnectionClosed(View) * @see #onInputConnectionClosed(View) */ */ public void onInputConnectionCreated(@NonNull View view) { public void onInputConnectionCreated(@NonNull View view) { if (!view.isAutoHandwritingEnabled()) { clearConnectedView(); return; } final View connectedView = getConnectedView(); final View connectedView = getConnectedView(); if (connectedView == view) { if (connectedView == view) { ++mConnectionCount; ++mConnectionCount; Loading @@ -187,15 +196,15 @@ public class HandwritingInitiator { */ */ public void onInputConnectionClosed(@NonNull View view) { public void onInputConnectionClosed(@NonNull View view) { final View connectedView = getConnectedView(); final View connectedView = getConnectedView(); if (connectedView == null) return; if (connectedView == view) { if (connectedView == view) { --mConnectionCount; --mConnectionCount; if (mConnectionCount == 0) { if (mConnectionCount == 0) { mConnectedView = null; clearConnectedView(); } } } else { } else { // Unexpected branch, set mConnectedView to null to avoid further problem. // Unexpected branch, set mConnectedView to null to avoid further problem. mConnectedView = null; clearConnectedView(); mConnectionCount = 0; } } } } Loading @@ -218,6 +227,12 @@ public class HandwritingInitiator { if (connectedView == null) { if (connectedView == null) { return; return; } } if (!connectedView.isAutoHandwritingEnabled()) { clearConnectedView(); return; } final ViewParent viewParent = connectedView.getParent(); final ViewParent viewParent = connectedView.getParent(); // Do a final check before startHandwriting. // Do a final check before startHandwriting. if (viewParent != null && connectedView.isAttachedToWindow()) { if (viewParent != null && connectedView.isAttachedToWindow()) { Loading core/java/android/view/View.java +45 −0 Original line number Original line Diff line number Diff line Loading @@ -3517,6 +3517,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * 1 PFLAG4_DETACHED * 1 PFLAG4_DETACHED * 1 PFLAG4_HAS_TRANSLATION_TRANSIENT_STATE * 1 PFLAG4_HAS_TRANSLATION_TRANSIENT_STATE * 1 PFLAG4_DRAG_A11Y_STARTED * 1 PFLAG4_DRAG_A11Y_STARTED * 1 PFLAG4_AUTO_HANDWRITING_INITIATION_ENABLED * |-------|-------|-------|-------| * |-------|-------|-------|-------| */ */ Loading Loading @@ -3593,6 +3594,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ */ private static final int PFLAG4_DRAG_A11Y_STARTED = 0x000008000; private static final int PFLAG4_DRAG_A11Y_STARTED = 0x000008000; /** * Indicates that the view enables auto handwriting initiation. */ private static final int PFLAG4_AUTO_HANDWRITING_ENABLED = 0x000010000; /* End of masks for mPrivateFlags4 */ /* End of masks for mPrivateFlags4 */ /** @hide */ /** @hide */ Loading Loading @@ -5321,6 +5326,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, (TEXT_ALIGNMENT_DEFAULT << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) | (TEXT_ALIGNMENT_DEFAULT << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) | (PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT) | (PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT) | (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT); (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT); mPrivateFlags4 = PFLAG4_AUTO_HANDWRITING_ENABLED; final ViewConfiguration configuration = ViewConfiguration.get(context); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mTouchSlop = configuration.getScaledTouchSlop(); Loading Loading @@ -6034,6 +6040,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, case R.styleable.View_preferKeepClear: case R.styleable.View_preferKeepClear: setPreferKeepClear(a.getBoolean(attr, false)); setPreferKeepClear(a.getBoolean(attr, false)); break; break; case R.styleable.View_autoHandwritingEnabled: setAutoHandwritingEnabled(a.getBoolean(attr, true)); break; } } } } Loading Loading @@ -31117,6 +31126,42 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } } } /** * Set whether this view enables automatic handwriting initiation. * * For a view with an active {@link InputConnection}, if auto handwriting is enabled then * stylus movement within its view boundary will automatically trigger the handwriting mode. * Check {@link android.view.inputmethod.InputMethodManager#startStylusHandwriting(View)} for * more details about handwriting mode. * * If the View wants to initiate handwriting mode by itself, it can set this field to * {@code false} and call * {@link android.view.inputmethod.InputMethodManager#startStylusHandwriting(View)} when there * is stylus movement detected. * * @see #onCreateInputConnection(EditorInfo) * @see android.view.inputmethod.InputMethodManager#startStylusHandwriting(View) * @param enabled whether auto handwriting initiation is enabled for this view. * @attr ref android.R.styleable#View_autoHandwritingEnabled */ public void setAutoHandwritingEnabled(boolean enabled) { if (enabled) { mPrivateFlags4 |= PFLAG4_AUTO_HANDWRITING_ENABLED; } else { mPrivateFlags4 &= ~PFLAG4_AUTO_HANDWRITING_ENABLED; } } /** * Return whether the View allows automatic handwriting initiation. Returns true if automatic * handwriting initiation is enabled, and verse visa. * @see #setAutoHandwritingEnabled(boolean) */ public boolean isAutoHandwritingEnabled() { return (mPrivateFlags4 & PFLAG4_AUTO_HANDWRITING_ENABLED) == PFLAG4_AUTO_HANDWRITING_ENABLED; } /** /** * Collects a {@link ViewTranslationRequest} which represents the content to be translated in * Collects a {@link ViewTranslationRequest} which represents the content to be translated in * the view. * the view. core/res/res/values/attrs.xml +8 −0 Original line number Original line Diff line number Diff line Loading @@ -3355,6 +3355,14 @@ <p>The system will try to respect this, but when not possible will ignore it. <p>The system will try to respect this, but when not possible will ignore it. See {@link android.view.View#setPreferKeepClear}. --> See {@link android.view.View#setPreferKeepClear}. --> <attr name="preferKeepClear" format="boolean" /> <attr name="preferKeepClear" format="boolean" /> <!-- <p>Whether or not the auto handwriting initiation is enabled in this View. <p>For a view with active {@link android.view.inputmethod.InputConnection}, if auto handwriting initiation is enabled stylus movement within its view boundary will automatically trigger the handwriting mode. <p>This is true by default. See {@link android.view.View#setAutoHandwritingEnabled}. --> <attr name="autoHandwritingEnabled" format="boolean" /> </declare-styleable> </declare-styleable> <!-- Attributes that can be assigned to a tag for a particular View. --> <!-- Attributes that can be assigned to a tag for a particular View. --> Loading core/res/res/values/public.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3259,6 +3259,7 @@ <public name="showBackground" /> <public name="showBackground" /> <public name="inheritKeyStoreKeys" /> <public name="inheritKeyStoreKeys" /> <public name="preferKeepClear" /> <public name="preferKeepClear" /> <public name="autoHandwritingEnabled" /> </staging-public-group> </staging-public-group> <staging-public-group type="id" first-id="0x01de0000"> <staging-public-group type="id" first-id="0x01de0000"> Loading Loading
core/api/current.txt +3 −0 Original line number Original line Diff line number Diff line Loading @@ -362,6 +362,7 @@ package android { field public static final int authorities = 16842776; // 0x1010018 field public static final int authorities = 16842776; // 0x1010018 field public static final int autoAdvanceViewId = 16843535; // 0x101030f field public static final int autoAdvanceViewId = 16843535; // 0x101030f field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b field public static final int autoHandwritingEnabled; field public static final int autoLink = 16842928; // 0x10100b0 field public static final int autoLink = 16842928; // 0x10100b0 field public static final int autoMirrored = 16843754; // 0x10103ea field public static final int autoMirrored = 16843754; // 0x10103ea field public static final int autoRemoveFromRecents = 16843847; // 0x1010447 field public static final int autoRemoveFromRecents = 16843847; // 0x1010447 Loading Loading @@ -49421,6 +49422,7 @@ package android.view { method public boolean isAccessibilityHeading(); method public boolean isAccessibilityHeading(); method public boolean isActivated(); method public boolean isActivated(); method public boolean isAttachedToWindow(); method public boolean isAttachedToWindow(); method public boolean isAutoHandwritingEnabled(); method public boolean isClickable(); method public boolean isClickable(); method public boolean isContextClickable(); method public boolean isContextClickable(); method public boolean isDirty(); method public boolean isDirty(); Loading Loading @@ -49604,6 +49606,7 @@ package android.view { method public void setAlpha(@FloatRange(from=0.0, to=1.0) float); method public void setAlpha(@FloatRange(from=0.0, to=1.0) float); method public void setAnimation(android.view.animation.Animation); method public void setAnimation(android.view.animation.Animation); method public void setAnimationMatrix(@Nullable android.graphics.Matrix); method public void setAnimationMatrix(@Nullable android.graphics.Matrix); method public void setAutoHandwritingEnabled(boolean); method public void setAutofillHints(@Nullable java.lang.String...); method public void setAutofillHints(@Nullable java.lang.String...); method public void setAutofillId(@Nullable android.view.autofill.AutofillId); method public void setAutofillId(@Nullable android.view.autofill.AutofillId); method public void setBackground(android.graphics.drawable.Drawable); method public void setBackground(android.graphics.drawable.Drawable);
core/java/android/view/HandwritingInitiator.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -161,6 +161,11 @@ public class HandwritingInitiator { return mConnectedView.get(); return mConnectedView.get(); } } private void clearConnectedView() { mConnectedView = null; mConnectionCount = 0; } /** /** * Notify HandwritingInitiator that a new InputConnection is created. * Notify HandwritingInitiator that a new InputConnection is created. * The caller of this method should guarantee that each onInputConnectionCreated call * The caller of this method should guarantee that each onInputConnectionCreated call Loading @@ -169,6 +174,10 @@ public class HandwritingInitiator { * @see #onInputConnectionClosed(View) * @see #onInputConnectionClosed(View) */ */ public void onInputConnectionCreated(@NonNull View view) { public void onInputConnectionCreated(@NonNull View view) { if (!view.isAutoHandwritingEnabled()) { clearConnectedView(); return; } final View connectedView = getConnectedView(); final View connectedView = getConnectedView(); if (connectedView == view) { if (connectedView == view) { ++mConnectionCount; ++mConnectionCount; Loading @@ -187,15 +196,15 @@ public class HandwritingInitiator { */ */ public void onInputConnectionClosed(@NonNull View view) { public void onInputConnectionClosed(@NonNull View view) { final View connectedView = getConnectedView(); final View connectedView = getConnectedView(); if (connectedView == null) return; if (connectedView == view) { if (connectedView == view) { --mConnectionCount; --mConnectionCount; if (mConnectionCount == 0) { if (mConnectionCount == 0) { mConnectedView = null; clearConnectedView(); } } } else { } else { // Unexpected branch, set mConnectedView to null to avoid further problem. // Unexpected branch, set mConnectedView to null to avoid further problem. mConnectedView = null; clearConnectedView(); mConnectionCount = 0; } } } } Loading @@ -218,6 +227,12 @@ public class HandwritingInitiator { if (connectedView == null) { if (connectedView == null) { return; return; } } if (!connectedView.isAutoHandwritingEnabled()) { clearConnectedView(); return; } final ViewParent viewParent = connectedView.getParent(); final ViewParent viewParent = connectedView.getParent(); // Do a final check before startHandwriting. // Do a final check before startHandwriting. if (viewParent != null && connectedView.isAttachedToWindow()) { if (viewParent != null && connectedView.isAttachedToWindow()) { Loading
core/java/android/view/View.java +45 −0 Original line number Original line Diff line number Diff line Loading @@ -3517,6 +3517,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * 1 PFLAG4_DETACHED * 1 PFLAG4_DETACHED * 1 PFLAG4_HAS_TRANSLATION_TRANSIENT_STATE * 1 PFLAG4_HAS_TRANSLATION_TRANSIENT_STATE * 1 PFLAG4_DRAG_A11Y_STARTED * 1 PFLAG4_DRAG_A11Y_STARTED * 1 PFLAG4_AUTO_HANDWRITING_INITIATION_ENABLED * |-------|-------|-------|-------| * |-------|-------|-------|-------| */ */ Loading Loading @@ -3593,6 +3594,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ */ private static final int PFLAG4_DRAG_A11Y_STARTED = 0x000008000; private static final int PFLAG4_DRAG_A11Y_STARTED = 0x000008000; /** * Indicates that the view enables auto handwriting initiation. */ private static final int PFLAG4_AUTO_HANDWRITING_ENABLED = 0x000010000; /* End of masks for mPrivateFlags4 */ /* End of masks for mPrivateFlags4 */ /** @hide */ /** @hide */ Loading Loading @@ -5321,6 +5326,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, (TEXT_ALIGNMENT_DEFAULT << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) | (TEXT_ALIGNMENT_DEFAULT << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) | (PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT) | (PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT) | (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT); (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT); mPrivateFlags4 = PFLAG4_AUTO_HANDWRITING_ENABLED; final ViewConfiguration configuration = ViewConfiguration.get(context); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mTouchSlop = configuration.getScaledTouchSlop(); Loading Loading @@ -6034,6 +6040,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, case R.styleable.View_preferKeepClear: case R.styleable.View_preferKeepClear: setPreferKeepClear(a.getBoolean(attr, false)); setPreferKeepClear(a.getBoolean(attr, false)); break; break; case R.styleable.View_autoHandwritingEnabled: setAutoHandwritingEnabled(a.getBoolean(attr, true)); break; } } } } Loading Loading @@ -31117,6 +31126,42 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } } } /** * Set whether this view enables automatic handwriting initiation. * * For a view with an active {@link InputConnection}, if auto handwriting is enabled then * stylus movement within its view boundary will automatically trigger the handwriting mode. * Check {@link android.view.inputmethod.InputMethodManager#startStylusHandwriting(View)} for * more details about handwriting mode. * * If the View wants to initiate handwriting mode by itself, it can set this field to * {@code false} and call * {@link android.view.inputmethod.InputMethodManager#startStylusHandwriting(View)} when there * is stylus movement detected. * * @see #onCreateInputConnection(EditorInfo) * @see android.view.inputmethod.InputMethodManager#startStylusHandwriting(View) * @param enabled whether auto handwriting initiation is enabled for this view. * @attr ref android.R.styleable#View_autoHandwritingEnabled */ public void setAutoHandwritingEnabled(boolean enabled) { if (enabled) { mPrivateFlags4 |= PFLAG4_AUTO_HANDWRITING_ENABLED; } else { mPrivateFlags4 &= ~PFLAG4_AUTO_HANDWRITING_ENABLED; } } /** * Return whether the View allows automatic handwriting initiation. Returns true if automatic * handwriting initiation is enabled, and verse visa. * @see #setAutoHandwritingEnabled(boolean) */ public boolean isAutoHandwritingEnabled() { return (mPrivateFlags4 & PFLAG4_AUTO_HANDWRITING_ENABLED) == PFLAG4_AUTO_HANDWRITING_ENABLED; } /** /** * Collects a {@link ViewTranslationRequest} which represents the content to be translated in * Collects a {@link ViewTranslationRequest} which represents the content to be translated in * the view. * the view.
core/res/res/values/attrs.xml +8 −0 Original line number Original line Diff line number Diff line Loading @@ -3355,6 +3355,14 @@ <p>The system will try to respect this, but when not possible will ignore it. <p>The system will try to respect this, but when not possible will ignore it. See {@link android.view.View#setPreferKeepClear}. --> See {@link android.view.View#setPreferKeepClear}. --> <attr name="preferKeepClear" format="boolean" /> <attr name="preferKeepClear" format="boolean" /> <!-- <p>Whether or not the auto handwriting initiation is enabled in this View. <p>For a view with active {@link android.view.inputmethod.InputConnection}, if auto handwriting initiation is enabled stylus movement within its view boundary will automatically trigger the handwriting mode. <p>This is true by default. See {@link android.view.View#setAutoHandwritingEnabled}. --> <attr name="autoHandwritingEnabled" format="boolean" /> </declare-styleable> </declare-styleable> <!-- Attributes that can be assigned to a tag for a particular View. --> <!-- Attributes that can be assigned to a tag for a particular View. --> Loading
core/res/res/values/public.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3259,6 +3259,7 @@ <public name="showBackground" /> <public name="showBackground" /> <public name="inheritKeyStoreKeys" /> <public name="inheritKeyStoreKeys" /> <public name="preferKeepClear" /> <public name="preferKeepClear" /> <public name="autoHandwritingEnabled" /> </staging-public-group> </staging-public-group> <staging-public-group type="id" first-id="0x01de0000"> <staging-public-group type="id" first-id="0x01de0000"> Loading