OSDN Git Service

Fix cleartext default for the manifest value
authorChad Brubaker <cbrubaker@google.com>
Wed, 14 Mar 2018 16:00:04 +0000 (09:00 -0700)
committerChad Brubaker <cbrubaker@google.com>
Wed, 14 Mar 2018 16:45:52 +0000 (09:45 -0700)
If no network security config is set the default value of
cleartextTrafficPermitted comes from the legacy
android:cleartextTrafficPermitted, default this to false for apps
targeting P to track the network security config behavior as was
intended.

Bug: 74587672
Test: atest CtsNetSecPolicyUsesCleartextTrafficUnspecifiedTestCases
Change-Id: I6367723befa1b947063554c9c061bdfc5be3d116

core/java/android/content/pm/PackageParser.java

index 5d5a978..bc7540f 100644 (file)
@@ -3492,7 +3492,7 @@ public class PackageParser {
 
         if (sa.getBoolean(
                 com.android.internal.R.styleable.AndroidManifestApplication_usesCleartextTraffic,
-                true)) {
+                owner.applicationInfo.targetSdkVersion < Build.VERSION_CODES.P)) {
             ai.flags |= ApplicationInfo.FLAG_USES_CLEARTEXT_TRAFFIC;
         }