Merge "Add hostname aware isCleartextTrafficPermitted"

am: a2f2c5c340

* commit 'a2f2c5c340b552b92088966734097845b76ea310':
  Add hostname aware isCleartextTrafficPermitted
This commit is contained in:
Chad Brubaker
2015-12-21 19:01:01 +00:00
committed by android-build-merger
2 changed files with 18 additions and 1 deletions

View File

@@ -32,4 +32,9 @@ public class FrameworkNetworkSecurityPolicy extends libcore.net.NetworkSecurityP
public boolean isCleartextTrafficPermitted() {
return mCleartextTrafficPermitted;
}
@Override
public boolean isCleartextTrafficPermitted(String hostname) {
return isCleartextTrafficPermitted();
}
}

View File

@@ -43,7 +43,7 @@ public class NetworkSecurityPolicy {
/**
* Returns whether cleartext network traffic (e.g. HTTP, FTP, WebSockets, XMPP, IMAP, SMTP --
* without TLS or STARTTLS) is permitted for this process.
* without TLS or STARTTLS) is permitted for all network communication from this process.
*
* <p>When cleartext network traffic is not permitted, the platform's components (e.g. HTTP and
* FTP stacks, {@link android.app.DownloadManager}, {@link android.media.MediaPlayer}) will
@@ -63,6 +63,18 @@ public class NetworkSecurityPolicy {
return libcore.net.NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted();
}
/**
* Returns whether cleartext network traffic (e.g. HTTP, FTP, XMPP, IMAP, SMTP -- without
* TLS or STARTTLS) is permitted for communicating with {@code hostname} for this process.
*
* @see #isCleartextTrafficPermitted()
* @hide
*/
public boolean isCleartextTrafficPermitted(String hostname) {
return libcore.net.NetworkSecurityPolicy.getInstance()
.isCleartextTrafficPermitted(hostname);
}
/**
* Sets whether cleartext network traffic is permitted for this process.
*