diff options
| author | 2015-12-21 19:05:01 +0000 | |
|---|---|---|
| committer | 2015-12-21 19:05:01 +0000 | |
| commit | 3d27be827b5146b4c9bc0dd0747c0f41c036fe3d (patch) | |
| tree | 64fea15ebce9f13fd9c3f281c39fcca688517ea7 | |
| parent | 5fa4d15d27d1a4610c0202b5ce89e41a13aa331f (diff) | |
| parent | c642e052f095d42882f46c2667d609136e269069 (diff) | |
Merge "Add hostname aware isCleartextTrafficPermitted" am: a2f2c5c340
am: c642e052f0
* commit 'c642e052f095d42882f46c2667d609136e269069':
Add hostname aware isCleartextTrafficPermitted
| -rw-r--r-- | core/java/android/security/FrameworkNetworkSecurityPolicy.java | 5 | ||||
| -rw-r--r-- | core/java/android/security/NetworkSecurityPolicy.java | 14 |
2 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/security/FrameworkNetworkSecurityPolicy.java b/core/java/android/security/FrameworkNetworkSecurityPolicy.java index e3dac5ee4a5e..83f173ec2938 100644 --- a/core/java/android/security/FrameworkNetworkSecurityPolicy.java +++ b/core/java/android/security/FrameworkNetworkSecurityPolicy.java @@ -32,4 +32,9 @@ public class FrameworkNetworkSecurityPolicy extends libcore.net.NetworkSecurityP public boolean isCleartextTrafficPermitted() { return mCleartextTrafficPermitted; } + + @Override + public boolean isCleartextTrafficPermitted(String hostname) { + return isCleartextTrafficPermitted(); + } } diff --git a/core/java/android/security/NetworkSecurityPolicy.java b/core/java/android/security/NetworkSecurityPolicy.java index 7991d373b49f..46aa1af247de 100644 --- a/core/java/android/security/NetworkSecurityPolicy.java +++ b/core/java/android/security/NetworkSecurityPolicy.java @@ -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 @@ -64,6 +64,18 @@ public class NetworkSecurityPolicy { } /** + * 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. * * <p>This method is used by the platform early on in the application's initialization to set |