Add build targets for non-mainline NetworkStack

Add PlatformCaptivePortalLogin and PlatformNetworkPermissionConfig build
targets to override CaptivePortalLogin and NetworkPermissionConfig with
platform-key-signed packages easily. The added packages are unused by
default but can simplify setup for OEMs that use InProcessNetworkStack.

Bug: 132635211
Test: Added the new packages to sailfish build, built image: device has
      the proper packages signed with the right keys, networking and
      captive portal working fine.

Change-Id: I09656deb6ba928f56b478adebb60268fa6f484b0
This commit is contained in:
Remi NGUYEN VAN
2019-05-15 16:14:51 +09:00
parent 4e1078e291
commit fc4a83bd4b
3 changed files with 38 additions and 9 deletions

View File

@@ -14,12 +14,11 @@
// limitations under the License. // limitations under the License.
// //
android_app { java_defaults {
name: "CaptivePortalLogin", name: "CaptivePortalLoginDefaults",
srcs: ["src/**/*.java"], srcs: ["src/**/*.java"],
sdk_version: "system_current", sdk_version: "system_current",
min_sdk_version: "28", min_sdk_version: "28",
certificate: "networkstack",
static_libs: [ static_libs: [
"androidx.legacy_legacy-support-v4", "androidx.legacy_legacy-support-v4",
"metrics-constants-protos", "metrics-constants-protos",
@@ -27,3 +26,18 @@ android_app {
], ],
manifest: "AndroidManifest.xml", manifest: "AndroidManifest.xml",
} }
android_app {
name: "CaptivePortalLogin",
defaults: ["CaptivePortalLoginDefaults"],
certificate: "networkstack",
}
// Alternative CaptivePortalLogin signed with the platform cert, to use
// with InProcessNetworkStack.
android_app {
name: "PlatformCaptivePortalLogin",
defaults: ["CaptivePortalLoginDefaults"],
certificate: "platform",
overrides: ["CaptivePortalLogin"],
}

View File

@@ -14,15 +14,28 @@
// limitations under the License. // limitations under the License.
// //
// Stub APK to define permissions for NetworkStack java_defaults {
android_app { name: "NetworkPermissionConfigDefaults",
name: "NetworkPermissionConfig",
// TODO: mark app as hasCode=false in manifest once soong stops complaining about apps without // TODO: mark app as hasCode=false in manifest once soong stops complaining about apps without
// a classes.dex. // a classes.dex.
srcs: ["src/**/*.java"], srcs: ["src/**/*.java"],
platform_apis: true, platform_apis: true,
min_sdk_version: "28", min_sdk_version: "28",
certificate: "networkstack",
privileged: true, privileged: true,
manifest: "AndroidManifest.xml", manifest: "AndroidManifest.xml",
} }
// Stub APK to define permissions for NetworkStack
android_app {
name: "NetworkPermissionConfig",
defaults: ["NetworkPermissionConfigDefaults"],
certificate: "networkstack",
}
// Alternative stub APK signed with platform certificate. To use with InProcessNetworkStack.
android_app {
name: "PlatformNetworkPermissionConfig",
defaults: ["NetworkPermissionConfigDefaults"],
certificate: "platform",
overrides: ["NetworkPermissionConfig"],
}

View File

@@ -98,8 +98,6 @@ java_defaults {
optimize: { optimize: {
proguard_flags_files: ["proguard.flags"], proguard_flags_files: ["proguard.flags"],
}, },
// The permission configuration *must* be included to ensure security of the device
required: ["NetworkPermissionConfig"],
} }
// Non-updatable network stack running in the system server process for devices not using the module // Non-updatable network stack running in the system server process for devices not using the module
@@ -110,6 +108,8 @@ android_app {
manifest: "AndroidManifest_InProcess.xml", manifest: "AndroidManifest_InProcess.xml",
// InProcessNetworkStack is a replacement for NetworkStack // InProcessNetworkStack is a replacement for NetworkStack
overrides: ["NetworkStack"], overrides: ["NetworkStack"],
// The permission configuration *must* be included to ensure security of the device
required: ["PlatformNetworkPermissionConfig"],
} }
// Updatable network stack packaged as an application // Updatable network stack packaged as an application
@@ -119,6 +119,8 @@ android_app {
certificate: "networkstack", certificate: "networkstack",
manifest: "AndroidManifest.xml", manifest: "AndroidManifest.xml",
use_embedded_native_libs: true, use_embedded_native_libs: true,
// The permission configuration *must* be included to ensure security of the device
required: ["NetworkPermissionConfig"],
} }
genrule { genrule {