forked from LeddaZ/frameworks_base
Merge "Fix handwriting trigger fail even isAutoHandwritingEnabled is true" into main
This commit is contained in:
commit
22802400fd
|
@ -168,3 +168,13 @@ flag {
|
||||||
description: "Decouple variation settings, weight and style information from Typeface class"
|
description: "Decouple variation settings, weight and style information from Typeface class"
|
||||||
bug: "361260253"
|
bug: "361260253"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag {
|
||||||
|
name: "handwriting_track_disabled"
|
||||||
|
namespace: "text"
|
||||||
|
description: "Handwriting initiator tracks focused view even if handwriting is disabled to fix initiation bug."
|
||||||
|
bug: "361256391"
|
||||||
|
metadata {
|
||||||
|
purpose: PURPOSE_BUGFIX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package android.view;
|
package android.view;
|
||||||
|
|
||||||
import static com.android.text.flags.Flags.handwritingCursorPosition;
|
import static com.android.text.flags.Flags.handwritingCursorPosition;
|
||||||
|
import static com.android.text.flags.Flags.handwritingTrackDisabled;
|
||||||
import static com.android.text.flags.Flags.handwritingUnsupportedMessage;
|
import static com.android.text.flags.Flags.handwritingUnsupportedMessage;
|
||||||
|
|
||||||
import android.annotation.FlaggedApi;
|
import android.annotation.FlaggedApi;
|
||||||
|
@ -352,7 +353,7 @@ public class HandwritingInitiator {
|
||||||
|
|
||||||
final View focusedView = getFocusedView();
|
final View focusedView = getFocusedView();
|
||||||
|
|
||||||
if (!view.isAutoHandwritingEnabled()) {
|
if (!handwritingTrackDisabled() && !view.isAutoHandwritingEnabled()) {
|
||||||
clearFocusedView(focusedView);
|
clearFocusedView(focusedView);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +364,8 @@ public class HandwritingInitiator {
|
||||||
updateFocusedView(view);
|
updateFocusedView(view);
|
||||||
|
|
||||||
if (mState != null && mState.mPendingFocusedView != null
|
if (mState != null && mState.mPendingFocusedView != null
|
||||||
&& mState.mPendingFocusedView.get() == view) {
|
&& mState.mPendingFocusedView.get() == view
|
||||||
|
&& (!handwritingTrackDisabled() || view.isAutoHandwritingEnabled())) {
|
||||||
startHandwriting(view);
|
startHandwriting(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,7 +418,7 @@ public class HandwritingInitiator {
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public boolean updateFocusedView(@NonNull View view) {
|
public boolean updateFocusedView(@NonNull View view) {
|
||||||
if (!view.shouldInitiateHandwriting()) {
|
if (!handwritingTrackDisabled() && !view.shouldInitiateHandwriting()) {
|
||||||
mFocusedView = null;
|
mFocusedView = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -424,9 +426,11 @@ public class HandwritingInitiator {
|
||||||
final View focusedView = getFocusedView();
|
final View focusedView = getFocusedView();
|
||||||
if (focusedView != view) {
|
if (focusedView != view) {
|
||||||
mFocusedView = new WeakReference<>(view);
|
mFocusedView = new WeakReference<>(view);
|
||||||
|
if (!handwritingTrackDisabled() || view.shouldInitiateHandwriting()) {
|
||||||
// A new view just gain focus. By default, we should show hover icon for it.
|
// A new view just gain focus. By default, we should show hover icon for it.
|
||||||
mShowHoverIconForConnectedView = true;
|
mShowHoverIconForConnectedView = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue