Merge "Added ViewNode.getWebScheme()."

This commit is contained in:
TreeHugger Robot
2017-10-04 00:50:44 +00:00
committed by Android (Google) Code Review
5 changed files with 26 additions and 4 deletions

View File

@@ -6683,6 +6683,7 @@ package android.app.assist {
method public android.graphics.Matrix getTransformation();
method public int getVisibility();
method public java.lang.String getWebDomain();
method public java.lang.String getWebScheme();
method public int getWidth();
method public boolean isAccessibilityFocused();
method public boolean isActivated();

View File

@@ -6933,6 +6933,7 @@ package android.app.assist {
method public android.graphics.Matrix getTransformation();
method public int getVisibility();
method public java.lang.String getWebDomain();
method public java.lang.String getWebScheme();
method public int getWidth();
method public boolean isAccessibilityFocused();
method public boolean isActivated();

View File

@@ -6754,6 +6754,7 @@ package android.app.assist {
method public android.graphics.Matrix getTransformation();
method public int getVisibility();
method public java.lang.String getWebDomain();
method public java.lang.String getWebScheme();
method public int getWidth();
method public boolean isAccessibilityFocused();
method public boolean isActivated();

View File

@@ -674,6 +674,7 @@ public class AssistStructure implements Parcelable {
ViewNodeText mText;
int mInputType;
String mWebScheme;
String mWebDomain;
Bundle mExtras;
LocaleList mLocaleList;
@@ -751,6 +752,7 @@ public class AssistStructure implements Parcelable {
mInputType = in.readInt();
}
if ((flags&FLAGS_HAS_URL) != 0) {
mWebScheme = in.readString();
mWebDomain = in.readString();
}
if ((flags&FLAGS_HAS_LOCALE_LIST) != 0) {
@@ -813,7 +815,7 @@ public class AssistStructure implements Parcelable {
if (mInputType != 0) {
flags |= FLAGS_HAS_INPUT_TYPE;
}
if (mWebDomain != null) {
if (mWebScheme != null || mWebDomain != null) {
flags |= FLAGS_HAS_URL;
}
if (mLocaleList != null) {
@@ -908,6 +910,7 @@ public class AssistStructure implements Parcelable {
out.writeInt(mInputType);
}
if ((flags&FLAGS_HAS_URL) != 0) {
out.writeString(mWebScheme);
out.writeString(mWebDomain);
}
if ((flags&FLAGS_HAS_LOCALE_LIST) != 0) {
@@ -1265,12 +1268,25 @@ public class AssistStructure implements Parcelable {
* {@link android.service.autofill.AutofillService} for more details.
*
* @return domain-only part of the document. For example, if the full URL is
* {@code https://my.site/login?user=my_user}, it returns {@code my.site}.
* {@code https://example.com/login?user=my_user}, it returns {@code example.com}.
*/
@Nullable public String getWebDomain() {
return mWebDomain;
}
/**
* Returns the scheme of the HTML document represented by this view.
*
* <p>Typically used when the view associated with the view is a container for an HTML
* document.
*
* @return scheme-only part of the document. For example, if the full URL is
* {@code https://example.com/login?user=my_user}, it returns {@code https}.
*/
@Nullable public String getWebScheme() {
return mWebScheme;
}
/**
* Returns the HTML properties associated with this view.
*
@@ -1767,10 +1783,13 @@ public class AssistStructure implements Parcelable {
@Override
public void setWebDomain(@Nullable String domain) {
if (domain == null) {
mNode.mWebScheme = null;
mNode.mWebDomain = null;
return;
}
mNode.mWebDomain = Uri.parse(domain).getHost();
Uri uri = Uri.parse(domain);
mNode.mWebScheme = uri.getScheme();
mNode.mWebDomain = uri.getHost();
}
@Override

View File

@@ -378,7 +378,7 @@ public abstract class ViewStructure {
*
* <p>Typically used when the view is a container for an HTML document.
*
* @param domain URL representing the domain; only the host part will be used.
* @param domain RFC 2396-compliant URI representing the domain.
*/
public abstract void setWebDomain(@Nullable String domain);