Merge "Added inputType to Assist API."
This commit is contained in:
committed by
Android (Google) Code Review
commit
1bef83f613
@@ -6565,6 +6565,7 @@ package android.app.assist {
|
||||
method public java.lang.String getIdEntry();
|
||||
method public java.lang.String getIdPackage();
|
||||
method public java.lang.String getIdType();
|
||||
method public int getInputType();
|
||||
method public int getLeft();
|
||||
method public int getScrollX();
|
||||
method public int getScrollY();
|
||||
@@ -45936,6 +45937,7 @@ package android.view {
|
||||
method public abstract void setFocused(boolean);
|
||||
method public abstract void setHint(java.lang.CharSequence);
|
||||
method public abstract void setId(int, java.lang.String, java.lang.String, java.lang.String);
|
||||
method public abstract void setInputType(int);
|
||||
method public abstract void setLongClickable(boolean);
|
||||
method public abstract void setSanitized(boolean);
|
||||
method public abstract void setSelected(boolean);
|
||||
|
||||
@@ -6804,6 +6804,7 @@ package android.app.assist {
|
||||
method public java.lang.String getIdEntry();
|
||||
method public java.lang.String getIdPackage();
|
||||
method public java.lang.String getIdType();
|
||||
method public int getInputType();
|
||||
method public int getLeft();
|
||||
method public int getScrollX();
|
||||
method public int getScrollY();
|
||||
@@ -49284,6 +49285,7 @@ package android.view {
|
||||
method public abstract void setFocused(boolean);
|
||||
method public abstract void setHint(java.lang.CharSequence);
|
||||
method public abstract void setId(int, java.lang.String, java.lang.String, java.lang.String);
|
||||
method public abstract void setInputType(int);
|
||||
method public abstract void setLongClickable(boolean);
|
||||
method public abstract void setSanitized(boolean);
|
||||
method public abstract void setSelected(boolean);
|
||||
|
||||
@@ -6591,6 +6591,7 @@ package android.app.assist {
|
||||
method public java.lang.String getIdEntry();
|
||||
method public java.lang.String getIdPackage();
|
||||
method public java.lang.String getIdType();
|
||||
method public int getInputType();
|
||||
method public int getLeft();
|
||||
method public int getScrollX();
|
||||
method public int getScrollY();
|
||||
@@ -46298,6 +46299,7 @@ package android.view {
|
||||
method public abstract void setFocused(boolean);
|
||||
method public abstract void setHint(java.lang.CharSequence);
|
||||
method public abstract void setId(int, java.lang.String, java.lang.String, java.lang.String);
|
||||
method public abstract void setInputType(int);
|
||||
method public abstract void setLongClickable(boolean);
|
||||
method public abstract void setSanitized(boolean);
|
||||
method public abstract void setSelected(boolean);
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.view.autofill.AutoFillType;
|
||||
import android.view.autofill.AutoFillValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Assist data automatically created by the platform's implementation
|
||||
@@ -533,6 +534,7 @@ public class AssistStructure implements Parcelable {
|
||||
String mIdPackage;
|
||||
String mIdType;
|
||||
String mIdEntry;
|
||||
|
||||
// TODO(b/33197203): once we have more flags, it might be better to store the individual
|
||||
// fields (viewId and childId) of the field.
|
||||
AutoFillId mAutoFillId;
|
||||
@@ -540,6 +542,7 @@ public class AssistStructure implements Parcelable {
|
||||
AutoFillValue mAutoFillValue;
|
||||
String[] mAutoFillOptions;
|
||||
boolean mSanitized;
|
||||
|
||||
int mX;
|
||||
int mY;
|
||||
int mScrollX;
|
||||
@@ -581,6 +584,7 @@ public class AssistStructure implements Parcelable {
|
||||
static final int FLAGS_HAS_ID = 0x00200000;
|
||||
static final int FLAGS_HAS_CHILDREN = 0x00100000;
|
||||
static final int FLAGS_HAS_URL = 0x00080000;
|
||||
static final int FLAGS_HAS_INPUT_TYPE = 0x00040000;
|
||||
static final int FLAGS_ALL_CONTROL = 0xfff00000;
|
||||
|
||||
int mFlags;
|
||||
@@ -589,6 +593,7 @@ public class AssistStructure implements Parcelable {
|
||||
CharSequence mContentDescription;
|
||||
|
||||
ViewNodeText mText;
|
||||
int mInputType;
|
||||
String mUrl;
|
||||
Bundle mExtras;
|
||||
|
||||
@@ -655,6 +660,9 @@ public class AssistStructure implements Parcelable {
|
||||
if ((flags&FLAGS_HAS_TEXT) != 0) {
|
||||
mText = new ViewNodeText(in, (flags&FLAGS_HAS_COMPLEX_TEXT) == 0);
|
||||
}
|
||||
if ((flags&FLAGS_HAS_INPUT_TYPE) != 0) {
|
||||
mInputType = in.readInt();
|
||||
}
|
||||
if ((flags&FLAGS_HAS_URL) != 0) {
|
||||
mUrl = in.readString();
|
||||
}
|
||||
@@ -711,6 +719,9 @@ public class AssistStructure implements Parcelable {
|
||||
flags |= FLAGS_HAS_COMPLEX_TEXT;
|
||||
}
|
||||
}
|
||||
if (mInputType != 0) {
|
||||
flags |= FLAGS_HAS_INPUT_TYPE;
|
||||
}
|
||||
if (mUrl != null) {
|
||||
flags |= FLAGS_HAS_URL;
|
||||
}
|
||||
@@ -778,6 +789,10 @@ public class AssistStructure implements Parcelable {
|
||||
if ((flags&FLAGS_HAS_TEXT) != 0) {
|
||||
mText.writeToParcel(out, (flags&FLAGS_HAS_COMPLEX_TEXT) == 0, writeSensitive);
|
||||
}
|
||||
if ((flags&FLAGS_HAS_INPUT_TYPE) != 0) {
|
||||
out.writeInt(mInputType);
|
||||
}
|
||||
|
||||
if ((flags&FLAGS_HAS_URL) != 0) {
|
||||
out.writeString(mUrl);
|
||||
}
|
||||
@@ -867,6 +882,15 @@ public class AssistStructure implements Parcelable {
|
||||
return mAutoFillOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link android.text.InputType} bits of this structure.
|
||||
*
|
||||
* @return bits as defined by {@link android.text.InputType}.
|
||||
*/
|
||||
public int getInputType() {
|
||||
return mInputType;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public boolean isSanitized() {
|
||||
return mSanitized;
|
||||
@@ -1534,6 +1558,11 @@ public class AssistStructure implements Parcelable {
|
||||
mNode.mAutoFillOptions = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputType(int inputType) {
|
||||
mNode.mInputType = inputType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -1664,6 +1693,8 @@ public class AssistStructure implements Parcelable {
|
||||
} else {
|
||||
Log.i(TAG, prefix + "AutoFill info: id= " + autoFillId
|
||||
+ ", type=" + node.getAutoFillType()
|
||||
+ ", options=" + Arrays.toString(node.getAutoFillOptions())
|
||||
+ ", inputType=" + node.getInputType()
|
||||
+ ", value=" + node.getAutoFillValue()
|
||||
+ ", sanitized=" + node.isSanitized());
|
||||
}
|
||||
|
||||
@@ -315,6 +315,13 @@ public abstract class ViewStructure {
|
||||
// TODO(b/33197203, b/33802548): add CTS/unit test
|
||||
public abstract void setAutoFillOptions(String[] options);
|
||||
|
||||
/**
|
||||
* Sets the {@link android.text.InputType} bits of this node.
|
||||
*
|
||||
* @param inputType inputType bits as defined by {@link android.text.InputType}.
|
||||
*/
|
||||
public abstract void setInputType(int inputType);
|
||||
|
||||
/**
|
||||
* Marks this node as sanitized so its content are sent on {@link
|
||||
* android.service.autofill.AutoFillService#onFillRequest(android.app.assist.AssistStructure,
|
||||
|
||||
@@ -10002,6 +10002,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
AssistStructure.ViewNode.TEXT_COLOR_UNDEFINED /* bgColor */, style);
|
||||
}
|
||||
structure.setHint(getHint());
|
||||
structure.setInputType(getInputType());
|
||||
}
|
||||
|
||||
// TODO(b/33197203): add unit/CTS tests for auto-fill methods
|
||||
|
||||
Reference in New Issue
Block a user