Merge "Replaced getUrl() by getWebDomain()." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ffef2ad2b0
@@ -6660,8 +6660,8 @@ package android.app.assist {
|
||||
method public int getTextStyle();
|
||||
method public int getTop();
|
||||
method public android.graphics.Matrix getTransformation();
|
||||
method public java.lang.String getUrl();
|
||||
method public int getVisibility();
|
||||
method public java.lang.String getWebDomain();
|
||||
method public int getWidth();
|
||||
method public boolean isAccessibilityFocused();
|
||||
method public boolean isActivated();
|
||||
@@ -46592,8 +46592,9 @@ package android.view {
|
||||
method public abstract void setTextLines(int[], int[]);
|
||||
method public abstract void setTextStyle(float, int, int, int);
|
||||
method public abstract void setTransformation(android.graphics.Matrix);
|
||||
method public abstract void setUrl(java.lang.String);
|
||||
method public abstract deprecated void setUrl(java.lang.String);
|
||||
method public abstract void setVisibility(int);
|
||||
method public abstract void setWebDomain(java.lang.String);
|
||||
}
|
||||
|
||||
public static abstract class ViewStructure.HtmlInfo {
|
||||
|
||||
@@ -6905,8 +6905,8 @@ package android.app.assist {
|
||||
method public int getTextStyle();
|
||||
method public int getTop();
|
||||
method public android.graphics.Matrix getTransformation();
|
||||
method public java.lang.String getUrl();
|
||||
method public int getVisibility();
|
||||
method public java.lang.String getWebDomain();
|
||||
method public int getWidth();
|
||||
method public boolean isAccessibilityFocused();
|
||||
method public boolean isActivated();
|
||||
@@ -50170,8 +50170,9 @@ package android.view {
|
||||
method public abstract void setTextLines(int[], int[]);
|
||||
method public abstract void setTextStyle(float, int, int, int);
|
||||
method public abstract void setTransformation(android.graphics.Matrix);
|
||||
method public abstract void setUrl(java.lang.String);
|
||||
method public abstract deprecated void setUrl(java.lang.String);
|
||||
method public abstract void setVisibility(int);
|
||||
method public abstract void setWebDomain(java.lang.String);
|
||||
}
|
||||
|
||||
public static abstract class ViewStructure.HtmlInfo {
|
||||
|
||||
@@ -6690,8 +6690,8 @@ package android.app.assist {
|
||||
method public int getTextStyle();
|
||||
method public int getTop();
|
||||
method public android.graphics.Matrix getTransformation();
|
||||
method public java.lang.String getUrl();
|
||||
method public int getVisibility();
|
||||
method public java.lang.String getWebDomain();
|
||||
method public int getWidth();
|
||||
method public boolean isAccessibilityFocused();
|
||||
method public boolean isActivated();
|
||||
@@ -46967,8 +46967,9 @@ package android.view {
|
||||
method public abstract void setTextLines(int[], int[]);
|
||||
method public abstract void setTextStyle(float, int, int, int);
|
||||
method public abstract void setTransformation(android.graphics.Matrix);
|
||||
method public abstract void setUrl(java.lang.String);
|
||||
method public abstract deprecated void setUrl(java.lang.String);
|
||||
method public abstract void setVisibility(int);
|
||||
method public abstract void setWebDomain(java.lang.String);
|
||||
}
|
||||
|
||||
public static abstract class ViewStructure.HtmlInfo {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.os.BadParcelableException;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
@@ -666,7 +667,7 @@ public class AssistStructure implements Parcelable {
|
||||
|
||||
ViewNodeText mText;
|
||||
int mInputType;
|
||||
String mUrl;
|
||||
String mWebDomain;
|
||||
Bundle mExtras;
|
||||
LocaleList mLocaleList;
|
||||
|
||||
@@ -743,7 +744,7 @@ public class AssistStructure implements Parcelable {
|
||||
mInputType = in.readInt();
|
||||
}
|
||||
if ((flags&FLAGS_HAS_URL) != 0) {
|
||||
mUrl = in.readString();
|
||||
mWebDomain = in.readString();
|
||||
}
|
||||
if ((flags&FLAGS_HAS_LOCALE_LIST) != 0) {
|
||||
mLocaleList = in.readParcelable(null);
|
||||
@@ -805,7 +806,7 @@ public class AssistStructure implements Parcelable {
|
||||
if (mInputType != 0) {
|
||||
flags |= FLAGS_HAS_INPUT_TYPE;
|
||||
}
|
||||
if (mUrl != null) {
|
||||
if (mWebDomain != null) {
|
||||
flags |= FLAGS_HAS_URL;
|
||||
}
|
||||
if (mLocaleList != null) {
|
||||
@@ -900,7 +901,7 @@ public class AssistStructure implements Parcelable {
|
||||
out.writeInt(mInputType);
|
||||
}
|
||||
if ((flags&FLAGS_HAS_URL) != 0) {
|
||||
out.writeString(mUrl);
|
||||
out.writeString(mWebDomain);
|
||||
}
|
||||
if ((flags&FLAGS_HAS_LOCALE_LIST) != 0) {
|
||||
out.writeParcelable(mLocaleList, 0);
|
||||
@@ -1237,17 +1238,20 @@ public class AssistStructure implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL represented by this view.
|
||||
* Returns the domain 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.
|
||||
*
|
||||
* <strong>WARNING:</strong> a {@link android.service.autofill.AutofillService} should only
|
||||
* use this URL for Autofill purposes when it trusts the app generating it (i.e., the app
|
||||
* use this domain for Autofill purposes when it trusts the app generating it (i.e., the app
|
||||
* defined by {@link AssistStructure#getActivityComponent()}).
|
||||
*
|
||||
* @return domain-only part of the document. For example, if the full URL is
|
||||
* {@code http://my.site/login?user=my_user}, it returns {@code my.site}.
|
||||
*/
|
||||
@Nullable public String getUrl() {
|
||||
return mUrl;
|
||||
@Nullable public String getWebDomain() {
|
||||
return mWebDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1724,7 +1728,18 @@ public class AssistStructure implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void setUrl(String url) {
|
||||
mNode.mUrl = url;
|
||||
if (url == null) return;
|
||||
|
||||
setWebDomain(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWebDomain(@Nullable String domain) {
|
||||
if (domain == null) {
|
||||
mNode.mWebDomain = null;
|
||||
return;
|
||||
}
|
||||
mNode.mWebDomain = Uri.parse(domain).getHost();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1946,9 +1961,9 @@ public class AssistStructure implements Parcelable {
|
||||
Log.i(TAG, prefix + " Text color fg: #" + Integer.toHexString(node.getTextColor())
|
||||
+ ", bg: #" + Integer.toHexString(node.getTextBackgroundColor()));
|
||||
}
|
||||
CharSequence url = node.getUrl();
|
||||
if (url != null) {
|
||||
Log.i(TAG, prefix + " URL: " + url);
|
||||
String webDomain = node.getWebDomain();
|
||||
if (webDomain != null) {
|
||||
Log.i(TAG, prefix + " Web domain: " + webDomain);
|
||||
}
|
||||
HtmlInfo htmlInfo = node.getHtmlInfo();
|
||||
if (htmlInfo != null) {
|
||||
|
||||
@@ -362,11 +362,19 @@ public abstract class ViewStructure {
|
||||
public abstract AutofillId getAutofillId();
|
||||
|
||||
/**
|
||||
* Sets the URL represented by this node.
|
||||
* @deprecated - use {@link #setWebDomain(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void setUrl(String url);
|
||||
|
||||
/**
|
||||
* Sets the Web domain represented by this node.
|
||||
*
|
||||
* <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.
|
||||
*/
|
||||
public abstract void setUrl(String url);
|
||||
public abstract void setWebDomain(@Nullable String domain);
|
||||
|
||||
/**
|
||||
* Sets the the list of locales associated with this node.
|
||||
|
||||
Reference in New Issue
Block a user