Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a25b235a authored by Roopa Sattiraju's avatar Roopa Sattiraju
Browse files

Pulling in BluetoothProtoEnums into the BT apex

Bug: 211851706
Test: Compile against apk and apex
Change-Id: I3e8fd6e8b66d5459fe57d6488ba6ecabd34de98e
parent 2b27f321
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ android_app {
    srcs: [
        "src/**/*.java",
        ":statslog-bluetooth-java-gen",
        ":bluetooth-proto-enums-java-gen",
    ],
    platform_apis: true,
    certificate: "platform",
@@ -134,6 +135,32 @@ android_app {
    },
}

gensrcs {
    name: "bluetooth-proto-enums-java-gen",
    depfile: true,

    tools: [
        "aprotoc",
        "protoc-gen-javastream",
        "soong_zip",
    ],

    cmd: "mkdir -p $(genDir)/$(in) " +
        "&& $(location aprotoc) " +
        "  --plugin=$(location protoc-gen-javastream) " +
        "  --dependency_out=$(depfile) " +
        "  --javastream_out=$(genDir)/$(in) " +
        "  -Iexternal/protobuf/src " +
        "  -I . " +
        "  $(in) " +
        "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",

    srcs: [
        ":srcs_bluetooth_protos",
    ],
    output_extension: "srcjar",
}

genrule {
    name: "statslog-bluetooth-java-gen",
    tools: ["stats-log-api-gen"],
+12 −1
Original line number Diff line number Diff line
@@ -39,6 +39,18 @@ java_defaults {
    ],
}

// bluetooth-service needs pre-jarjared version of framework-bluetooth so it can reference copied utility
// classes before they are renamed.
java_library {
    name: "framework-bluetooth-pre-jarjar",
    defaults: ["framework-bluetooth-defaults"],
    sdk_version: "module_current",
    libs: ["framework-annotations-lib"],
    // java_api_finder must accompany `srcs` (`srcs` defined in `framework-bluetooth-defaults`)
    plugins: ["java_api_finder"],
    installable: false,
}

// post-jarjar version of framework-bluetooth
java_sdk_library {
    name: "framework-bluetooth",
@@ -48,7 +60,6 @@ java_sdk_library {
    ],

    jarjar_rules: ":bluetooth-jarjar-rules",
    api_only: true,
    installable: true,
    optimize: {
        enabled: false
+100 −0
Original line number Diff line number Diff line
@@ -27,3 +27,103 @@ filegroup {
    ],
}

java_defaults {
    name: "service-bluetooth-common-defaults",
    defaults: ["bluetooth-module-sdk-version-defaults"],
    errorprone: {
        javacflags: ["-Xep:CheckReturnValue:ERROR"],
    },
    product_variables: {
        pdk: {
            enabled: false,
        },
    },
}

// pre-jarjar version of service-uwb that builds against pre-jarjar version of framework-bluetooth
java_library {
    name: "service-bluetooth-pre-jarjar",
    installable: false,
    defaults: ["service-bluetooth-common-defaults"],
    srcs: [
        ":services.bluetooth-sources",
        ":bluetooth-proto-enums-java-gen",
        ":bluetooth-manager-service-proto-java-gen",
    ],
    // java_api_finder must accompany `srcs`
    plugins: ["java_api_finder"],

    sdk_version: "system_server_current",

    lint: {
        strict_updatability_linting: true,
    },
    libs: [
        "framework-annotations-lib",
        "framework-bluetooth-pre-jarjar",
    ],

    static_libs: [
        "androidx.annotation_annotation",
    ],

    apex_available: [
        "com.android.bluetooth",
    ],
}

// service-bluetooth static library
// ==============================================================
java_library {
    name: "service-bluetooth",
    defaults: ["service-bluetooth-common-defaults"],
    installable: true,
    static_libs: ["service-bluetooth-pre-jarjar"],

    libs: [
        "framework-bluetooth.impl",
    ],
    sdk_version: "system_server_current",

    optimize: {
        enabled: true,
        shrink: true,
        proguard_flags_files: ["proguard.flags"],
    },
    dex_preopt: {
        enabled: false,
        app_image: false,
    },
    visibility: [
        "//packages/modules/Bluetooth/apex",
    ],
    apex_available: [
        "com.android.bluetooth",
    ],
}

gensrcs {
    name: "bluetooth-manager-service-proto-java-gen",
    depfile: true,

    tools: [
        "aprotoc",
        "protoc-gen-javastream",
        "soong_zip",
    ],

    cmd: "mkdir -p $(genDir)/$(in) " +
        "&& $(location aprotoc) " +
        "  --plugin=$(location protoc-gen-javastream) " +
        "  --dependency_out=$(depfile) " +
        "  --javastream_out=$(genDir)/$(in) " +
        "  -Iexternal/protobuf/src " +
        "  -I . " +
        "  $(in) " +
        "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",

    srcs: [
        ":srcs_bluetooth_manager_service_proto",
    ],
    output_extension: "srcjar",
}

service/proguard.flags

0 → 100644
+6 −0
Original line number Diff line number Diff line
# Prevent proguard from stripping out any service-bluetooth.
# TODO: This could be optimized in the future to only keep the critical
# entry points and then let proguard strip out any unused code within
# the service.
-keep class com.android.bluetooth.** { *; }
-keep class com.android.server.bluetooth.** { *; }