android_packages_modules_Co.../nearby
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Krzysztof Kosiński 739ed22507 Clean up obsolete aliases for Truth.
Bug: 255714762
Test: presubmit
Change-Id: If91e9af5409fed9d5ccdd13749a0f562c545d589
2023-10-07 00:48:10 +00:00
..
apex Move nearby apex to tethering 2022-01-26 18:08:14 +09:00
framework [nearby][clean up] Delete all Fast Pair AOSP and HalfSheetUX code 2023-09-05 18:53:04 +00:00
service [nearby][clean up] Delete all Fast Pair AOSP and HalfSheetUX code 2023-09-05 18:53:04 +00:00
tests Clean up obsolete aliases for Truth. 2023-10-07 00:48:10 +00:00
.gitignore Add upload check hook and propose code structure. 2021-06-01 16:14:28 -07:00
OWNERS Add more owners for Nearby code. 2022-07-20 19:30:36 -07:00
PREUPLOAD.cfg Add upload check hook and propose code structure. 2021-06-01 16:14:28 -07:00
README.md Add instructions for APEX to be bulit from mutliple branches and support 2022-10-28 23:23:14 +00:00
TEST_MAPPING [nearby] Move NearbyIntegrationUntrustedTests and NearbyIntegrationPrivilegedTests from presubmit to postsubmit 2023-09-01 19:30:18 +00:00

Nearby Mainline Module

This directory contains code for the AOSP Nearby mainline module.

##Directory Structure

apex

  • Files associated with the Nearby mainline module APEX.

framework

  • Contains client side APIs and AIDL files.

jni

  • JNI wrapper for invoking Android APIs from native code.

native

  • Native code implementation for nearby module services.

service

  • Server side implementation for nearby module services.

tests

  • Unit/Multi devices tests for Nearby module (both Java and native code).

IDE setup

$ source build/envsetup.sh && lunch <TARGET>
$ cd packages/modules/Nearby
$ aidegen .
# This will launch Intellij project for Nearby module.

Note, the setup above may fail to index classes defined in proto, such that all classes defined in proto shows red in IDE and cannot be auto-completed. To fix, you can mannually add jar files generated from proto to the class path as below. First, find the jar file of presence proto with

ls $ANDROID_BUILD_TOP/out/soong/.intermediates/packages/modules/Connectivity/nearby/service/proto/presence-lite-protos/android_common/combined/presence-lite-protos.jar

Then, add the jar in IDE as below.

  1. Menu: File > Project Structure
  2. Select Modules at the left panel and select the Dependencies tab.
  3. Select the + icon and select 1 JARs or Directories option.
  4. Select the JAR file found above, make sure it is checked in the beginning square.
  5. Click the OK button.
  6. Restart the IDE to re-index.

Build and Install

$ source build/envsetup.sh && lunch <TARGET>
$ m com.google.android.tethering.next deapexer
$ $ANDROID_BUILD_TOP/out/host/linux-x86/bin/deapexer decompress --input \
    ${ANDROID_PRODUCT_OUT}/system/apex/com.google.android.tethering.next.capex \
    --output /tmp/tethering.apex
$ adb install -r /tmp/tethering.apex

Build and Install from tm-mainline-prod branch

When build and flash the APEX from tm-mainline-prod, you may see the error below.

[INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade of APEX package com.google.android.tethering is not allowed. Active version: 990090000 attempted: 339990000])

This is because the device is flashed with AOSP built from master or other branches, which has prebuilt APEX with higher version. We can use root access to replace the prebuilt APEX with the APEX built from tm-mainline-prod as below.

  1. adb root && adb remount; adb shell mount -orw,remount /system/apex
  2. cp tethering.next.apex com.google.android.tethering.apex
  3. adb push com.google.android.tethering.apex /system/apex/
  4. adb reboot After the steps above, the APEX can be reinstalled with adb install -r. (More APEX background can be found in https://source.android.com/docs/core/ota/apex#using-an-apex.)

Build APEX to support multiple platforms

If you need to flash the APEX to different devices, Pixel 6, Pixel 7, or even devices from OEM, you can share the APEX by source build/envsetup.sh && lunch aosp_arm64-userdebug. This can avoid re-compiling for different targets.