From 7cb000ff56babf18d39ab0aa31dfc5dcac0bf11e Mon Sep 17 00:00:00 2001 From: Alex Klyubin Date: Thu, 26 Mar 2015 11:00:04 -0700 Subject: Unhide public API about cleartext traffic policy. Bug: 19215516 Change-Id: I5da81a36c2f3d0edcf715a5f1b14b0a56c7abc6d --- api/current.txt | 7 ++++++ api/system-current.txt | 7 ++++++ core/java/android/content/pm/ApplicationInfo.java | 5 ++-- .../android/security/NetworkSecurityPolicy.java | 8 +++---- core/res/res/values/attrs_manifest.xml | 27 +++++++++++----------- core/res/res/values/public.xml | 1 + 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/api/current.txt b/api/current.txt index 7828f2a60217..bedf7ac1ba8d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -1361,6 +1361,7 @@ package android { field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310 field public static final int useLevel = 16843167; // 0x101019f field public static final int userVisible = 16843409; // 0x1010291 + field public static final int usesCleartextTraffic = 16844009; // 0x10104e9 field public static final int value = 16842788; // 0x1010024 field public static final int valueFrom = 16843486; // 0x10102de field public static final int valueTo = 16843487; // 0x10102df @@ -8728,6 +8729,7 @@ package android.content.pm { field public static final int FLAG_SYSTEM = 1; // 0x1 field public static final int FLAG_TEST_ONLY = 256; // 0x100 field public static final int FLAG_UPDATED_SYSTEM_APP = 128; // 0x80 + field public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 134217728; // 0x8000000 field public static final int FLAG_VM_SAFE_MODE = 16384; // 0x4000 field public java.lang.String backupAgentName; field public java.lang.String className; @@ -27742,6 +27744,11 @@ package android.security { method public android.security.KeyStoreParameter.Builder setEncryptionRequired(boolean); } + public class NetworkSecurityPolicy { + method public static android.security.NetworkSecurityPolicy getInstance(); + method public boolean isCleartextTrafficPermitted(); + } + } package android.service.carrier { diff --git a/api/system-current.txt b/api/system-current.txt index 2cce10fb0bcb..acefd9d505ea 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1436,6 +1436,7 @@ package android { field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310 field public static final int useLevel = 16843167; // 0x101019f field public static final int userVisible = 16843409; // 0x1010291 + field public static final int usesCleartextTraffic = 16844009; // 0x10104e9 field public static final int value = 16842788; // 0x1010024 field public static final int valueFrom = 16843486; // 0x10102de field public static final int valueTo = 16843487; // 0x10102df @@ -8946,6 +8947,7 @@ package android.content.pm { field public static final int FLAG_SYSTEM = 1; // 0x1 field public static final int FLAG_TEST_ONLY = 256; // 0x100 field public static final int FLAG_UPDATED_SYSTEM_APP = 128; // 0x80 + field public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 134217728; // 0x8000000 field public static final int FLAG_VM_SAFE_MODE = 16384; // 0x4000 field public java.lang.String backupAgentName; field public java.lang.String className; @@ -29613,6 +29615,11 @@ package android.security { method public android.security.KeyStoreParameter.Builder setEncryptionRequired(boolean); } + public class NetworkSecurityPolicy { + method public static android.security.NetworkSecurityPolicy getInstance(); + method public boolean isCleartextTrafficPermitted(); + } + } package android.service.carrier { diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 8f17845b3781..0e43858f20ec 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -340,8 +340,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * cleartext network traffic, in which case platform components (e.g., HTTP stacks, * {@code WebView}, {@code MediaPlayer}) will refuse app's requests to use cleartext traffic. * Third-party libraries are encouraged to honor this flag as well. - * - * @hide */ public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27; @@ -379,7 +377,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED}, * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED}, * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME}, - * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_MULTIARCH}. + * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC}, + * {@link #FLAG_MULTIARCH}. */ public int flags = 0; diff --git a/core/java/android/security/NetworkSecurityPolicy.java b/core/java/android/security/NetworkSecurityPolicy.java index 0626bbc5fd16..0b3bf453fd9c 100644 --- a/core/java/android/security/NetworkSecurityPolicy.java +++ b/core/java/android/security/NetworkSecurityPolicy.java @@ -24,8 +24,6 @@ package android.security; * *

The policy currently consists of a single flag: whether cleartext network traffic is * permitted. See {@link #isCleartextTrafficPermitted()}. - * - * @hide */ public class NetworkSecurityPolicy { @@ -48,9 +46,9 @@ public class NetworkSecurityPolicy { * without TLS or STARTTLS) is permitted for this process. * *

When cleartext network traffic is not permitted, the platform's components (e.g. HTTP and - * FTP stacks, {@code WebView}, {@code MediaPlayer}) will refuse this process's requests to use - * cleartext traffic. Third-party libraries are strongly encouraged to honor this setting as - * well. + * FTP stacks, {@link android.webkit.WebView}, {@link android.media.MediaPlayer}) will refuse + * this process's requests to use cleartext traffic. Third-party libraries are strongly + * encouraged to honor this setting as well. * *

This flag is honored on a best effort basis because it's impossible to prevent all * cleartext traffic from Android applications given the level of access provided to them. For diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index aefb67c2fe83..283c23738073 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -389,13 +389,12 @@ with the same {@link android.R.attr#taskAffinity} as it has. --> - + - + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 5e4b039e00e8..ef7bfaff4246 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2652,4 +2652,5 @@ + -- cgit v1.2.3-59-g8ed1b