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

Commit 758bc85b authored by Joe Onorato's avatar Joe Onorato Committed by Android (Google) Code Review
Browse files

Merge changes from topic "b_144187174"

* changes:
  Remove this TEST_MAPPING file until I can figure out what this error means
  Make libincident into a stable C API.
parents f6849b27 d1d1aeb4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ cc_binary {
        "libcutils",
        "liblog",
        "libutils",
        "libincident",
        "libincidentpriv",
    ],

    static_libs: [
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ cc_binary {
        "libbinder",
        "libdebuggerd_client",
        "libdumputils",
        "libincident",
        "libincidentpriv",
        "liblog",
        "libprotoutil",
        "libservices",
@@ -128,7 +128,7 @@ cc_test {
        "libbinder",
        "libdebuggerd_client",
        "libdumputils",
        "libincident",
        "libincidentpriv",
        "liblog",
        "libprotobuf-cpp-full",
        "libprotoutil",
+0 −1
Original line number Diff line number Diff line
@@ -279,7 +279,6 @@ cc_test {
        "tests/e2e/ValueMetric_pull_e2e_test.cpp",
        "tests/e2e/WakelockDuration_e2e_test.cpp",
        "tests/external/GpuStatsPuller_test.cpp",
        "tests/external/IncidentReportArgs_test.cpp",
        "tests/external/puller_util_test.cpp",
        "tests/external/StatsCallbackPuller_test.cpp",
        "tests/external/StatsPuller_test.cpp",
+8 −19
Original line number Diff line number Diff line
@@ -21,10 +21,8 @@
#include "packages/UidMap.h"
#include "stats_log_util.h"

#include <android/os/IIncidentManager.h>
#include <android/os/IncidentReportArgs.h>
#include <android/util/ProtoOutputStream.h>
#include <binder/IServiceManager.h>
#include <incident/incident_report.h>

#include <vector>

@@ -132,7 +130,7 @@ bool GenerateIncidentReport(const IncidentdDetails& config, int64_t rule_id, int
        return false;
    }

    IncidentReportArgs incidentReport;
    android::os::IncidentReportRequest incidentReport;

    vector<uint8_t> protoData;
    getProtoData(rule_id, metricId, dimensionKey, metricValue, configKey,
@@ -146,30 +144,21 @@ bool GenerateIncidentReport(const IncidentdDetails& config, int64_t rule_id, int
    uint8_t dest;
    switch (config.dest()) {
        case IncidentdDetails_Destination_AUTOMATIC:
            dest = android::os::PRIVACY_POLICY_AUTOMATIC;
            dest = INCIDENT_REPORT_PRIVACY_POLICY_AUTOMATIC;
            break;
        case IncidentdDetails_Destination_EXPLICIT:
            dest = android::os::PRIVACY_POLICY_EXPLICIT;
            dest = INCIDENT_REPORT_PRIVACY_POLICY_EXPLICIT;
            break;
        default:
            dest = android::os::PRIVACY_POLICY_AUTOMATIC;
            dest = INCIDENT_REPORT_PRIVACY_POLICY_AUTOMATIC;
    }
    incidentReport.setPrivacyPolicy(dest);

    incidentReport.setReceiverPkg(config.receiver_pkg());
    incidentReport.setReceiverPackage(config.receiver_pkg());

    incidentReport.setReceiverCls(config.receiver_cls());
    incidentReport.setReceiverClass(config.receiver_cls());

    sp<IIncidentManager> service = interface_cast<IIncidentManager>(
            defaultServiceManager()->getService(android::String16("incident")));
    if (service == nullptr) {
        ALOGW("Failed to fetch incident service.");
        return false;
    }
    VLOG("Calling incidentd %p", service.get());
    binder::Status s = service->reportIncident(incidentReport);
    VLOG("Report incident status: %s", s.toString8().string());
    return s.isOk();
    return incidentReport.takeReport() == NO_ERROR;
}

}  // namespace statsd
+67 −2
Original line number Diff line number Diff line
@@ -12,8 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

cc_library_shared {
    name: "libincident",

cc_defaults {
    name: "libincidentpriv_defaults",

    cflags: [
        "-Wall",
@@ -50,6 +51,70 @@ cc_library_shared {
        ":libincident_aidl",
        "src/IncidentReportArgs.cpp",
    ],
}

cc_library_shared {
    name: "libincidentpriv",
    defaults: ["libincidentpriv_defaults"],
    export_include_dirs: ["include_priv"],
}

cc_library_shared {
    name: "libincident",

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

    shared_libs: [
        "libbinder",
        "liblog",
        "libutils",
        "libincidentpriv",
    ],

    srcs: [
        "src/incident_report.cpp",
    ],

    export_include_dirs: ["include"],

    stubs: {
        symbol_file: "libincident.map.txt",
        versions: [
            "30",
        ],
    },
}

cc_test {
    name: "libincident_test",
    defaults: ["libincidentpriv_defaults"],
    test_suites: ["device-tests"],

    include_dirs: [
        "frameworks/base/libs/incident/include",
        "frameworks/base/libs/incident/include_priv",
    ],

    srcs: [
        "tests/IncidentReportArgs_test.cpp",
        "tests/IncidentReportRequest_test.cpp",
        "tests/c_api_compile_test.c",
    ],

    shared_libs: [
        "libincident",
    ],

    static_libs: [
        "libgmock",
    ],
}


Loading