diff options
| author | 2017-10-04 00:50:44 +0000 | |
|---|---|---|
| committer | 2017-10-04 00:50:44 +0000 | |
| commit | 1daecf91e38e3dedac579b0ee53c8400c6db5785 (patch) | |
| tree | 67db16be8d68fb62e540901dfab9f5ace3a7af03 | |
| parent | d2768c67235d060616860db8475b7c1571b7fd72 (diff) | |
| parent | 114a441554ea9cd2e278d37ad8723357f0742508 (diff) | |
Merge "Added ViewNode.getWebScheme()."
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/test-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/app/assist/AssistStructure.java | 25 | ||||
| -rw-r--r-- | core/java/android/view/ViewStructure.java | 2 |
5 files changed, 26 insertions, 4 deletions
diff --git a/api/current.txt b/api/current.txt index 97c5927b028a..58523f797fa1 100644 --- a/api/current.txt +++ b/api/current.txt @@ -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(); diff --git a/api/system-current.txt b/api/system-current.txt index 4583eb79191e..4396dc419701 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -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(); diff --git a/api/test-current.txt b/api/test-current.txt index c7cfaf2efb6e..935219fc544c 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -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(); diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index c208f1dbba8a..d9b7cd7e9e45 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -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,13 +1268,26 @@ 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. * * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes, @@ -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 diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java index 0ecd20da21c5..f671c34997d2 100644 --- a/core/java/android/view/ViewStructure.java +++ b/core/java/android/view/ViewStructure.java @@ -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); |