Expose AStatsSocket_close() from the statsd apex

As part of statsd becoming a Mainline module in R, we need to formalize
the statsd APIs called from outside the statsd apex.

Bug: 145923416
Test: m
Change-Id: I296a018cc93d95bda77d95f8161acbbe983a5d51
This commit is contained in:
Muhammad Qureshi 2020-02-11 14:12:59 -08:00
parent fd0edb7ca6
commit 2ebc2e3d8f
4 changed files with 57 additions and 0 deletions

View file

@ -25,6 +25,7 @@ cc_library {
// TODO(b/145573568): Remove stats_event_list once stats_event
// migration is complete.
"stats_event_list.c",
"stats_socket.c",
"statsd_writer.c",
],
host_supported: true,

View file

@ -0,0 +1,33 @@
/*
* Copyright (C) 2020 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.
*/
#pragma once
/**
* Helpers to manage the statsd socket.
**/
#ifdef __cplusplus
extern "C" {
#endif // __CPLUSPLUS
/**
* Closes the statsd socket file descriptor.
**/
void AStatsSocket_close();
#ifdef __cplusplus
}
#endif // __CPLUSPLUS

View file

@ -14,6 +14,7 @@ LIBSTATSSOCKET {
AStatsEvent_writeAttributionChain; # apex # introduced=30
AStatsEvent_addBoolAnnotation; # apex # introduced=30
AStatsEvent_addInt32Annotation; # apex # introduced=30
AStatsSocket_close; # apex # introduced=30
local:
*;
};

View file

@ -0,0 +1,22 @@
/*
* Copyright (C) 2020 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.
*/
#include "include/stats_socket.h"
#include "stats_buffer_writer.h"
void AStatsSocket_close() {
stats_log_close();
}