Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
apex/ | 15-Dec-2024 | - | 30 | 26 | ||
framework/ | 15-Dec-2024 | - | 4,882 | 2,807 | ||
service/ | 15-Dec-2024 | - | 7,744 | 5,220 | ||
tests/ | 15-Dec-2024 | - | 8,247 | 5,950 | ||
.gitignore | D | 14-Jan-2024 | 90 | 8 | 7 | |
OWNERS | D | 14-Jan-2024 | 107 | 7 | 6 | |
PREUPLOAD.cfg | D | 14-Jan-2024 | 297 | 10 | 8 | |
README.md | D | 15-Dec-2024 | 3.7 KiB | 94 | 77 | |
TEST_MAPPING | D | 15-Dec-2024 | 430 | 25 | 24 |
README.md
1 # Nearby Mainline Module 2 This directory contains code for the AOSP Nearby mainline module. 3 4 ##Directory Structure 5 6 `apex` 7 - Files associated with the Nearby mainline module APEX. 8 9 `framework` 10 - Contains client side APIs and AIDL files. 11 12 `jni` 13 - JNI wrapper for invoking Android APIs from native code. 14 15 `native` 16 - Native code implementation for nearby module services. 17 18 `service` 19 - Server side implementation for nearby module services. 20 21 `tests` 22 - Unit/Multi devices tests for Nearby module (both Java and native code). 23 24 ## IDE setup 25 26 ```sh 27 $ source build/envsetup.sh && lunch <TARGET> 28 $ cd packages/modules/Nearby 29 $ aidegen . 30 # This will launch Intellij project for Nearby module. 31 ``` 32 Note, the setup above may fail to index classes defined in proto, such 33 that all classes defined in proto shows red in IDE and cannot be auto-completed. 34 To fix, you can mannually add jar files generated from proto to the class path 35 as below. First, find the jar file of presence proto with 36 ```sh 37 ls $ANDROID_BUILD_TOP/out/soong/.intermediates/packages/modules/Connectivity/nearby/service/proto/presence-lite-protos/android_common/combined/presence-lite-protos.jar 38 ``` 39 Then, add the jar in IDE as below. 40 1. Menu: File > Project Structure 41 2. Select Modules at the left panel and select the Dependencies tab. 42 3. Select the + icon and select 1 JARs or Directories option. 43 4. Select the JAR file found above, make sure it is checked in the beginning square. 44 5. Click the OK button. 45 6. Restart the IDE to re-index. 46 47 ## Build and Install 48 49 ```sh 50 For master on AOSP (Android) host 51 $ source build/envsetup.sh 52 $ lunch aosp_oriole-trunk_staging-userdebug 53 $ m com.android.tethering 54 $ $ANDROID_BUILD_TOP/out/host/linux-x86/bin/deapexer decompress --input $ANDROID_PRODUCT_OUT/system/apex/com.android.tethering.capex --output /tmp/tethering.apex 55 $ adb install /tmp/tethering.apex 56 $ adb reboot 57 58 NOTE: Developers should use AOSP by default, udc-mainline-prod should not be used unless for Google internal features. 59 For udc-mainline-prod on Google internal host 60 Build unbundled module using banchan 61 $ source build/envsetup.sh 62 $ banchan com.google.android.tethering mainline_modules_arm64 63 $ m apps_only dist 64 $ adb install out/dist/com.google.android.tethering.apex 65 $ adb reboot 66 Ensure that the module you are installing is compatible with the module currently preloaded on the phone (in /system/apex/com.google.android.tethering.apex). Compatible means: 67 68 1. Same package name 69 2. Same keys used to sign the apex and the payload 70 3. Higher version 71 72 See go/mainline-local-build#build-install-local-module for more information 73 ``` 74 75 ## Build and Install from tm-mainline-prod branch 76 When build and flash the APEX from tm-mainline-prod, you may see the error below. 77 ``` 78 [INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade of APEX package com.google.android.tethering is not allowed. Active version: 990090000 attempted: 339990000]) 79 ``` 80 This is because the device is flashed with AOSP built from master or other branches, which has 81 prebuilt APEX with higher version. We can use root access to replace the prebuilt APEX with the APEX 82 built from tm-mainline-prod as below. 83 1. adb root && adb remount -R 84 2. cp tethering.next.apex com.google.android.tethering.apex 85 3. adb push com.google.android.tethering.apex /system/apex/ 86 4. adb reboot 87 After the steps above, the APEX can be reinstalled with adb install -r. 88 (More APEX background can be found in https://source.android.com/docs/core/ota/apex#using-an-apex.) 89 90 ## Build APEX to support multiple platforms 91 If you need to flash the APEX to different devices, Pixel 6, Pixel 7, or even devices from OEM, you 92 can share the APEX by ```source build/envsetup.sh && lunch aosp_arm64-userdebug```. This can avoid 93 re-compiling for different targets. 94