From aaff325854ce2e5a6776058d1fae2b166b962e5b Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Sat, 6 Mar 2021 00:26:09 +0000 Subject: libbinder: hide Debug.h header This is all an implementation detail for TextOutput which we want to delete anyway. Since I'm working on binder sockets (and I don't want to expand the usage of alog), I might add some other functions here, which I don't want to expose from libbinder. Bug: 148676615 Bug: 167966510 Test: N/A Change-Id: Id5677c9ac195dac046becc5d36b02bbdd1f7c339 --- libs/binder/BufferedTextOutput.cpp | 2 +- libs/binder/Debug.cpp | 3 +- libs/binder/Debug.h | 46 ++++++++++++++++++++++++++++ libs/binder/TextOutput.cpp | 2 +- libs/binder/include/binder/Debug.h | 46 ---------------------------- libs/binder/tests/binderTextOutputTest.cpp | 1 - libs/binder/tests/fuzzers/TextOutputFuzz.cpp | 1 - 7 files changed, 50 insertions(+), 51 deletions(-) create mode 100644 libs/binder/Debug.h delete mode 100644 libs/binder/include/binder/Debug.h diff --git a/libs/binder/BufferedTextOutput.cpp b/libs/binder/BufferedTextOutput.cpp index 88c85bfadc..349658ecfa 100644 --- a/libs/binder/BufferedTextOutput.cpp +++ b/libs/binder/BufferedTextOutput.cpp @@ -15,7 +15,6 @@ */ #include "BufferedTextOutput.h" -#include #include #include @@ -26,6 +25,7 @@ #include #include +#include "Debug.h" #include "Static.h" // --------------------------------------------------------------------------- diff --git a/libs/binder/Debug.cpp b/libs/binder/Debug.cpp index 3a620590ab..e4ac4b49a4 100644 --- a/libs/binder/Debug.cpp +++ b/libs/binder/Debug.cpp @@ -14,7 +14,8 @@ * limitations under the License. */ -#include +#include "Debug.h" + #include #include diff --git a/libs/binder/Debug.h b/libs/binder/Debug.h new file mode 100644 index 0000000000..ac71e003c4 --- /dev/null +++ b/libs/binder/Debug.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2005 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 + +#include +#include +#include + +namespace android { +// --------------------------------------------------------------------------- + +__BEGIN_DECLS + +const char* stringForIndent(int32_t indentLevel); + +typedef void (*debugPrintFunc)(void* cookie, const char* txt); + +void printTypeCode(uint32_t typeCode, + debugPrintFunc func = nullptr, void* cookie = nullptr); + +void printHexData(int32_t indent, const void *buf, size_t length, + size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, + size_t alignment=0, bool cArrayStyle=false, + debugPrintFunc func = nullptr, void* cookie = nullptr); + + +ssize_t getBinderKernelReferences(size_t count, uintptr_t* buf); + +__END_DECLS + +// --------------------------------------------------------------------------- +} // namespace android diff --git a/libs/binder/TextOutput.cpp b/libs/binder/TextOutput.cpp index 684a7dcc51..a0ade50efb 100644 --- a/libs/binder/TextOutput.cpp +++ b/libs/binder/TextOutput.cpp @@ -16,7 +16,7 @@ #include -#include +#include "Debug.h" #include #include diff --git a/libs/binder/include/binder/Debug.h b/libs/binder/include/binder/Debug.h deleted file mode 100644 index ac71e003c4..0000000000 --- a/libs/binder/include/binder/Debug.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2005 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 - -#include -#include -#include - -namespace android { -// --------------------------------------------------------------------------- - -__BEGIN_DECLS - -const char* stringForIndent(int32_t indentLevel); - -typedef void (*debugPrintFunc)(void* cookie, const char* txt); - -void printTypeCode(uint32_t typeCode, - debugPrintFunc func = nullptr, void* cookie = nullptr); - -void printHexData(int32_t indent, const void *buf, size_t length, - size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, - size_t alignment=0, bool cArrayStyle=false, - debugPrintFunc func = nullptr, void* cookie = nullptr); - - -ssize_t getBinderKernelReferences(size_t count, uintptr_t* buf); - -__END_DECLS - -// --------------------------------------------------------------------------- -} // namespace android diff --git a/libs/binder/tests/binderTextOutputTest.cpp b/libs/binder/tests/binderTextOutputTest.cpp index ce99f59d7c..b37030e7d7 100644 --- a/libs/binder/tests/binderTextOutputTest.cpp +++ b/libs/binder/tests/binderTextOutputTest.cpp @@ -26,7 +26,6 @@ #include #include -#include static void CheckMessage(CapturedStderr& cap, const char* expected, diff --git a/libs/binder/tests/fuzzers/TextOutputFuzz.cpp b/libs/binder/tests/fuzzers/TextOutputFuzz.cpp index c9500205df..5e3502aace 100644 --- a/libs/binder/tests/fuzzers/TextOutputFuzz.cpp +++ b/libs/binder/tests/fuzzers/TextOutputFuzz.cpp @@ -16,7 +16,6 @@ #include -#include #include #include #include "android-base/file.h" -- cgit v1.2.3-59-g8ed1b