diff options
| author | Amit Mahajan <amitmahajan@google.com> | 2019-12-03 00:59:13 -0800 |
|---|---|---|
| committer | Hall Liu <hallliu@google.com> | 2020-01-08 16:21:33 -0800 |
| commit | c939f17c059788fecefb47d3f23d36b907aa8531 (patch) | |
| tree | 90fd470b4d9889b2b2047bae252a5b7b3ac5644f | |
| parent | 9059f47038749743de2995430f849ee1fac59103 (diff) | |
| download | platform_packages_services_AlternativeNetworkAccess-c939f17c059788fecefb47d3f23d36b907aa8531.tar.gz platform_packages_services_AlternativeNetworkAccess-c939f17c059788fecefb47d3f23d36b907aa8531.tar.bz2 platform_packages_services_AlternativeNetworkAccess-c939f17c059788fecefb47d3f23d36b907aa8531.zip | |
Split ONS into a client apk and a lib.
The client apk has the manifest and the lib has the code
and resources. This is being done so that the apk can run
under the phone shareduid, while the lib can be part of telephony
mainline module and be updatable.
Test: basic ONS sanity
Bug: 144806641
Change-Id: I25608b4c0fdfcd2015eabedc21d4f358c54ec288
| -rw-r--r-- | Android.bp | 17 | ||||
| -rw-r--r-- | AndroidManifest.xml | 26 | ||||
| -rw-r--r-- | client/Android.bp | 34 | ||||
| -rw-r--r-- | client/AndroidManifest.xml | 45 | ||||
| -rw-r--r-- | client/proguard.flags | 3 | ||||
| -rw-r--r-- | client/src/com/android/ons/OnsStub.java | 5 | ||||
| -rw-r--r-- | proguard.proguard | 7 | ||||
| -rw-r--r-- | tests/Android.bp | 2 | ||||
| -rw-r--r-- | tests/AndroidManifest.xml | 2 |
9 files changed, 111 insertions, 30 deletions
@@ -12,11 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// -// Mms service -// android_app { - name: "ONS", + name: "ONSLib", platform_apis: true, privileged: true, libs: [ @@ -24,9 +21,17 @@ android_app { "app-compat-annotations", ], srcs: ["src/**/*.java"], - aaptflags: ["--auto-add-overlay"], + aaptflags: [ + "--auto-add-overlay", + "--shared-lib", + "--extra-packages com.android.ons", + ], certificate: "platform", optimize: { - proguard_flags_files: ["proguard.flags"], + proguard_flags_files: [ + "proguard.flags", + "proguard.proguard", + ], }, + export_package_resources: true, } diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 92fd67d..c9e7bc7 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -15,28 +15,10 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" - package="com.android.ons" - coreApp="true" - android:process="com.android.phone" - android:sharedUserId="android.uid.phone"> - - <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> - <application - android:process="com.android.phone" - android:persistent="true"> - - <receiver android:name="ONSAutoBoot" - android:directBootAware="true"> - <intent-filter> - <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /> - </intent-filter> - </receiver> - - <service android:name=".OpportunisticNetworkService" - android:enabled="true" - android:exported="true" - android:directBootAware="true"/> + package="com.android.ons.lib"> + <application> + <library android:name="com.android.ons.lib" /> </application> + </manifest> diff --git a/client/Android.bp b/client/Android.bp new file mode 100644 index 0000000..5c56e3d --- /dev/null +++ b/client/Android.bp @@ -0,0 +1,34 @@ +// Copyright (C) 2018 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +android_app { + name: "ONS", + platform_apis: true, + privileged: true, + libs: [ + "telephony-common", + "ONSLib", + ], + srcs: [ + "src/**/*.java", + ], + required: ["ONSLib"], + certificate: "platform", + + optimize: { + proguard_flags_files: [ + "proguard.flags", + ], + }, +} diff --git a/client/AndroidManifest.xml b/client/AndroidManifest.xml new file mode 100644 index 0000000..69cc55d --- /dev/null +++ b/client/AndroidManifest.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" + package="com.android.ons" + coreApp="true" + android:process="com.android.phone" + android:sharedUserId="android.uid.phone"> + + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + <application + android:process="com.android.phone" + android:directBootAware="true" + android:persistent="true"> + + <uses-library android:name="com.android.ons.lib" /> + + <receiver android:name="ONSAutoBoot" + android:directBootAware="true"> + <intent-filter> + <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /> + </intent-filter> + </receiver> + + <service android:name=".OpportunisticNetworkService" + android:enabled="true" + android:exported="true" + android:directBootAware="true"/> + + </application> +</manifest> diff --git a/client/proguard.flags b/client/proguard.flags new file mode 100644 index 0000000..915ae2c --- /dev/null +++ b/client/proguard.flags @@ -0,0 +1,3 @@ +# Keep the stub class +-keep class com.android.ons.OnsStub {*;} +-verbose diff --git a/client/src/com/android/ons/OnsStub.java b/client/src/com/android/ons/OnsStub.java new file mode 100644 index 0000000..ddc8289 --- /dev/null +++ b/client/src/com/android/ons/OnsStub.java @@ -0,0 +1,5 @@ +package com.android.ons; + +public class OnsStub { + // Empty class +} diff --git a/proguard.proguard b/proguard.proguard new file mode 100644 index 0000000..2a823d8 --- /dev/null +++ b/proguard.proguard @@ -0,0 +1,7 @@ +-keepparameternames +-keepattributes Exceptions,InnerClasses,Signature,Deprecated, + SourceFile,LineNumberTable,*Annotation*,EnclosingMethod + +-keep public class * { + public protected *; +}
\ No newline at end of file diff --git a/tests/Android.bp b/tests/Android.bp index a38bbf8..180d925 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -28,6 +28,6 @@ android_test { ], platform_apis: true, certificate: "platform", - instrumentation_for: "ONS", + instrumentation_for: "ONSLib", test_suites: ["device-tests"], } diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml index fb35b0b..1dcb8a9 100644 --- a/tests/AndroidManifest.xml +++ b/tests/AndroidManifest.xml @@ -26,7 +26,7 @@ </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.ons" + android:targetPackage="com.android.ons.lib" android:label="Tests for ONS"> </instrumentation> </manifest> |
