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

Commit d7fa4148 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Convert statsd and incidentd to Android.bp"

parents e0076e41 05c9e5c2
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -223,8 +223,7 @@ java_defaults {
        "core/java/android/os/IDeviceIdentifiersPolicyService.aidl",
        "core/java/android/os/IDeviceIdleController.aidl",
        "core/java/android/os/IHardwarePropertiesManager.aidl",
        "core/java/android/os/IIncidentManager.aidl",
        "core/java/android/os/IIncidentReportStatusListener.aidl",
        ":libincident_aidl",
        "core/java/android/os/IMaintenanceActivityListener.aidl",
        "core/java/android/os/IMessenger.aidl",
        "core/java/android/os/INetworkActivityListener.aidl",
@@ -237,8 +236,7 @@ java_defaults {
        "core/java/android/os/IRecoverySystemProgressListener.aidl",
        "core/java/android/os/IRemoteCallback.aidl",
        "core/java/android/os/ISchedulingPolicyService.aidl",
        "core/java/android/os/IStatsCompanionService.aidl",
        "core/java/android/os/IStatsManager.aidl",
        ":statsd_aidl",
        "core/java/android/os/ISystemUpdateManager.aidl",
        "core/java/android/os/IThermalEventListener.aidl",
        "core/java/android/os/IThermalService.aidl",
@@ -707,6 +705,22 @@ java_defaults {

}

filegroup {
    name: "libincident_aidl",
    srcs: [
        "core/java/android/os/IIncidentManager.aidl",
        "core/java/android/os/IIncidentReportStatusListener.aidl",
    ],
}

filegroup {
    name: "statsd_aidl",
    srcs: [
        "core/java/android/os/IStatsCompanionService.aidl",
        "core/java/android/os/IStatsManager.aidl",
    ],
}

java_library {
    name: "framework",
    defaults: ["framework-defaults"],
@@ -913,12 +927,14 @@ gensrcs {
        "core/proto/android/os/batterytype.proto",
        "core/proto/android/os/cpufreq.proto",
        "core/proto/android/os/cpuinfo.proto",
        "core/proto/android/os/data.proto",
        "core/proto/android/os/kernelwake.proto",
        "core/proto/android/os/pagetypeinfo.proto",
        "core/proto/android/os/procrank.proto",
        "core/proto/android/os/ps.proto",
        "core/proto/android/os/system_properties.proto",
        "core/proto/android/util/event_log_tags.proto",
        "core/proto/android/util/log.proto",
    ],

    // Append protoc-gen-cppstream tool's PATH otherwise aprotoc can't find the plugin tool
+46 −0
Original line number Diff line number Diff line
// Copyright (C) 2016 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.

cc_binary {
    name: "incident",

    srcs: [
        "main.cpp",
        ":incident_sections",
    ],

    shared_libs: [
        "libbase",
        "libbinder",
        "libcutils",
        "liblog",
        "libutils",
        "libincident",
    ],

    cflags: [
        "-Wall",
        "-Werror",
        "-Wno-missing-field-initializers",
        "-Wno-unused-variable",
        "-Wunused-parameter",
    ],
}

genrule {
    name: "incident_sections",
    tools: ["incident-section-gen"],
    out: ["incident_sections.cpp"],
    cmd: "$(location incident-section-gen) incident > $(out)",
}

cmds/incident/Android.mk

deleted100644 → 0
+0 −48
Original line number Diff line number Diff line
# Copyright (C) 2016 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.

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES := \
        main.cpp

LOCAL_MODULE := incident

LOCAL_SHARED_LIBRARIES := \
        libbase \
        libbinder \
        libcutils \
        liblog \
        libutils \
        libincident

LOCAL_CFLAGS += \
        -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter

LOCAL_MODULE_CLASS := EXECUTABLES
gen_src_dir := $(local-generated-sources-dir)

gen := $(gen_src_dir)/incident_sections.cpp
$(gen): $(HOST_OUT_EXECUTABLES)/incident-section-gen
$(gen): PRIVATE_CUSTOM_TOOL = \
    $(HOST_OUT_EXECUTABLES)/incident-section-gen incident > $@
$(gen): $(HOST_OUT_EXECUTABLES)/incident-section-gen
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(gen)

gen_src_dir:=
gen:=

include $(BUILD_EXECUTABLE)
+117 −0
Original line number Diff line number Diff line
// Copyright (C) 2016 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.

// =========
// incidentd
// =========

cc_binary {
    name: "incidentd",

    srcs: [
        "src/**/*.cpp",
        ":incidentd_section_list",
    ],

    cflags: [
        "-Wall",
        "-Werror",
        "-Wno-missing-field-initializers",
        "-Wno-unused-variable",
        "-Wunused-parameter",

        // Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
        "-Wno-error=implicit-fallthrough",

        // optimize for size (protobuf glop can get big)
        "-Os",
        //"-g",
        //"-O0",
    ],

    local_include_dirs: ["src"],
    generated_headers: ["gen-platform-proto-constants"],

    shared_libs: [
        "libbase",
        "libbinder",
        "libdebuggerd_client",
        "libdumputils",
        "libincident",
        "liblog",
        "libprotoutil",
        "libservices",
        "libutils",
    ],

    init_rc: ["incidentd.rc"],
}

// ==============
// incidentd_test
// ==============

cc_test {
    name: "incidentd_test",
    test_suites: ["device-tests"],

    cflags: [
        "-Werror",
        "-Wall",
        "-Wno-unused-variable",
        "-Wunused-parameter",

        // Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
        "-Wno-error=implicit-fallthrough",
    ],

    local_include_dirs: ["src"],
    generated_headers: ["gen-platform-proto-constants"],

    srcs: [
        "tests/**/*.cpp",
        "src/PrivacyBuffer.cpp",
        "src/FdBuffer.cpp",
        "src/Privacy.cpp",
        "src/Reporter.cpp",
        "src/Section.cpp",
        "src/Throttler.cpp",
        "src/incidentd_util.cpp",
        "src/report_directory.cpp",
    ],

    data: ["testdata/**/*"],

    static_libs: ["libgmock"],

    shared_libs: [
        "libbase",
        "libbinder",
        "libdebuggerd_client",
        "libdumputils",
        "libincident",
        "liblog",
        "libprotobuf-cpp-lite",
        "libprotoutil",
        "libservices",
        "libutils",
    ],
}

genrule {
    name: "incidentd_section_list",
    tools: ["incident-section-gen"],
    out: ["section_list.cpp"],
    cmd: "$(location incident-section-gen) incidentd > $(out)",
}

cmds/incidentd/Android.mk

deleted100644 → 0
+0 −156
Original line number Diff line number Diff line
# Copyright (C) 2016 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.

LOCAL_PATH:= $(call my-dir)

# proto files used in incidentd to generate cppstream proto headers.
PROTO_FILES:= \
        frameworks/base/core/proto/android/os/backtrace.proto \
        frameworks/base/core/proto/android/os/data.proto \
        frameworks/base/core/proto/android/util/log.proto

# ========= #
# incidentd #
# ========= #

include $(CLEAR_VARS)

LOCAL_MODULE := incidentd

LOCAL_SRC_FILES := $(call all-cpp-files-under, src) \

LOCAL_CFLAGS += \
        -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter

# Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
LOCAL_CFLAGS += -Wno-error=implicit-fallthrough

ifeq (debug,)
    LOCAL_CFLAGS += \
            -g -O0
else
    # optimize for size (protobuf glop can get big)
    LOCAL_CFLAGS += \
            -Os
endif
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src

LOCAL_SHARED_LIBRARIES := \
        libbase \
        libbinder \
        libdebuggerd_client \
        libdumputils \
        libincident \
        liblog \
        libprotoutil \
        libservices \
        libutils

LOCAL_MODULE_CLASS := EXECUTABLES

gen_src_dir := $(local-generated-sources-dir)

# generate section_list.cpp
GEN_LIST := $(gen_src_dir)/src/section_list.cpp
$(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen
$(GEN_LIST): PRIVATE_CUSTOM_TOOL = \
    $(HOST_OUT_EXECUTABLES)/incident-section-gen incidentd > $@
$(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN_LIST)
GEN_LIST:=

# generate cppstream proto, add proto files to PROTO_FILES
GEN_PROTO := $(gen_src_dir)/proto.timestamp
$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES)
$(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir)
$(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \
    $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \
        --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \
        $(PROTO_FILES) \
    && touch $@
$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN_PROTO)
GEN_PROTO:=

gen_src_dir:=

LOCAL_INIT_RC := incidentd.rc

include $(BUILD_EXECUTABLE)

# ============== #
# incidentd_test #
# ============== #

include $(CLEAR_VARS)

LOCAL_MODULE := incidentd_test
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_MODULE_TAGS := tests

LOCAL_CFLAGS := -Werror -Wall -Wno-unused-variable -Wunused-parameter

# Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
LOCAL_CFLAGS += -Wno-error=implicit-fallthrough

LOCAL_C_INCLUDES += $(LOCAL_PATH)/src

LOCAL_SRC_FILES := $(call all-cpp-files-under, tests) \
    src/PrivacyBuffer.cpp \
    src/FdBuffer.cpp \
    src/Privacy.cpp \
    src/Reporter.cpp \
    src/Section.cpp \
    src/Throttler.cpp \
    src/incidentd_util.cpp \
    src/report_directory.cpp \

LOCAL_STATIC_LIBRARIES := \
    libgmock \

LOCAL_SHARED_LIBRARIES := \
    libbase \
    libbinder \
    libdebuggerd_client \
    libdumputils \
    libincident \
    liblog \
    libprotobuf-cpp-lite \
    libprotoutil \
    libservices \
    libutils \

LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, testdata)

LOCAL_MODULE_CLASS := NATIVE_TESTS
gen_src_dir := $(local-generated-sources-dir)
# generate cppstream proto for testing
GEN_PROTO := $(gen_src_dir)/test.proto.timestamp
$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES)
$(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir)
$(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \
    $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \
        --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \
        $(PROTO_FILES) \
    && touch $@
$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN_PROTO)
GEN_PROTO:=

gen_src_dir:=

include $(BUILD_NATIVE_TEST)
Loading