diff options
73 files changed, 173 insertions, 107 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index eb238a6607..4674d2a28a 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -907,6 +907,31 @@ static void DoLogcat() { "-v", "uid", "-d", "*:v"}); } +static void DumpIncidentReport() { + if (!ds.IsZipping()) { + MYLOGD("Not dumping incident report because it's not a zipped bugreport\n"); + return; + } + DurationReporter duration_reporter("INCIDENT REPORT"); + const std::string path = ds.bugreport_internal_dir_ + "/tmp_incident_report"; + auto fd = android::base::unique_fd(TEMP_FAILURE_RETRY(open(path.c_str(), + O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))); + if (fd < 0) { + MYLOGE("Could not open %s to dump incident report.\n", path.c_str()); + return; + } + RunCommandToFd(fd, "", {"incident", "-u"}, CommandOptions::WithTimeout(120).Build()); + bool empty = 0 == lseek(fd, 0, SEEK_END); + if (!empty) { + // Use a different name from "incident.proto" + // /proto/incident.proto is reserved for incident service dump + // i.e. metadata for debugging. + ds.AddZipEntry(kProtoPath + "incident_report" + kProtoExt, path); + } + unlink(path.c_str()); +} + static void DumpIpTablesAsRoot() { RunCommand("IPTABLES", {"iptables", "-L", "-nvx"}); RunCommand("IP6TABLES", {"ip6tables", "-L", "-nvx"}); @@ -1046,7 +1071,7 @@ static Dumpstate::RunStatus RunDumpsysTextByPriority(const std::string& title, i std::string path(title); path.append(" - ").append(String8(service).c_str()); size_t bytes_written = 0; - status_t status = dumpsys.startDumpThread(service, /* dumpPid = */ true, args); + status_t status = dumpsys.startDumpThread(service, args); if (status == OK) { dumpsys.writeDumpHeader(STDOUT_FILENO, service, priority); std::chrono::duration<double> elapsed_seconds; @@ -1118,7 +1143,7 @@ static Dumpstate::RunStatus RunDumpsysProto(const std::string& title, int priori path.append("_HIGH"); } path.append(kProtoExt); - status_t status = dumpsys.startDumpThread(service, /* dumpPid = */ false, args); + status_t status = dumpsys.startDumpThread(service, args); if (status == OK) { status = ds.AddZipEntryFromFd(path, dumpsys.getDumpFd(), service_timeout); bool dumpTerminated = (status == OK); @@ -1479,6 +1504,9 @@ static Dumpstate::RunStatus dumpstate() { printf("========================================================\n"); // This differs from the usual dumpsys stats, which is the stats report data. RunDumpsys("STATSDSTATS", {"stats", "--metadata"}); + + RUN_SLOW_FUNCTION_WITH_CONSENT_CHECK(DumpIncidentReport); + return Dumpstate::RunStatus::OK; } diff --git a/cmds/dumpsys/TEST_MAPPING b/cmds/dumpsys/TEST_MAPPING new file mode 100644 index 0000000000..dc88ada034 --- /dev/null +++ b/cmds/dumpsys/TEST_MAPPING @@ -0,0 +1,13 @@ +{ + "presubmit": [ + { + // small test which assumes the output format of dumpsys, however + // there are many other parts of Android that expect the output + // to be a specific way (see b/141728094) + "name": "timezone_data_e2e_tests" + }, + { + "name": "dumpsys_test" + } + ] +} diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp index 68b3907102..9f65425a04 100644 --- a/cmds/dumpsys/dumpsys.cpp +++ b/cmds/dumpsys/dumpsys.cpp @@ -201,7 +201,13 @@ int Dumpsys::main(int argc, char* const argv[]) { if (i == optind) { services.add(String16(argv[i])); } else { - args.add(String16(argv[i])); + const String16 arg(argv[i]); + args.add(arg); + // For backward compatible, if the proto argument is passed to the service, the + // dump request is also considered to use proto. + if (!asProto && !arg.compare(String16(PriorityDumper::PROTO_ARG))) { + asProto = true; + } } } } @@ -236,13 +242,11 @@ int Dumpsys::main(int argc, char* const argv[]) { return 0; } - const bool dumpPid = !asProto; - for (size_t i = 0; i < N; i++) { const String16& serviceName = services[i]; if (IsSkipped(skippedServices, serviceName)) continue; - if (startDumpThread(serviceName, dumpPid, args) == OK) { + if (startDumpThread(serviceName, args) == OK) { bool addSeparator = (N > 1); if (addSeparator) { writeDumpHeader(STDOUT_FILENO, serviceName, priorityFlags); @@ -309,7 +313,7 @@ void Dumpsys::setServiceArgs(Vector<String16>& args, bool asProto, int priorityF } } -status_t Dumpsys::startDumpThread(const String16& serviceName, bool dumpPid, const Vector<String16>& args) { +status_t Dumpsys::startDumpThread(const String16& serviceName, const Vector<String16>& args) { sp<IBinder> service = sm_->checkService(serviceName); if (service == nullptr) { aerr << "Can't find service: " << serviceName << endl; @@ -329,20 +333,7 @@ status_t Dumpsys::startDumpThread(const String16& serviceName, bool dumpPid, con // dump blocks until completion, so spawn a thread.. activeThread_ = std::thread([=, remote_end{std::move(remote_end)}]() mutable { - if (dumpPid) { - pid_t pid; - status_t status = service->getDebugPid(&pid); - if (status == OK) { - std::ostringstream pidinfo; - pidinfo << "Pid: " << pid << std::endl; - WriteStringToFd(pidinfo.str(), remote_end.get()); - } else { - aerr << "Error getting pid status_t (" << status << "): " - << serviceName << endl; - } - } - - status_t err = service->dump(remote_end.get(), args); + int err = service->dump(remote_end.get(), args); // It'd be nice to be able to close the remote end of the socketpair before the dump // call returns, to terminate our reads if the other end closes their copy of the @@ -350,8 +341,8 @@ status_t Dumpsys::startDumpThread(const String16& serviceName, bool dumpPid, con // way to do this, though. remote_end.reset(); - if (err != OK) { - aerr << "Error dumping service info status_t (" << err << "): " + if (err != 0) { + aerr << "Error dumping service info: (" << strerror(err) << ") " << serviceName << endl; } }); diff --git a/cmds/dumpsys/dumpsys.h b/cmds/dumpsys/dumpsys.h index 8d1291a3b0..c48a1e959b 100644 --- a/cmds/dumpsys/dumpsys.h +++ b/cmds/dumpsys/dumpsys.h @@ -56,13 +56,12 @@ class Dumpsys { * the output to a pipe. Thread must be stopped by a subsequent callto {@code * stopDumpThread}. * @param serviceName - * @param dumpPid whether to include a header with service PID information * @param args list of arguments to pass to service dump method. * @return {@code OK} thread is started successfully. * {@code NAME_NOT_FOUND} service could not be found. * {@code != OK} error */ - status_t startDumpThread(const String16& serviceName, bool dumpPid, const Vector<String16>& args); + status_t startDumpThread(const String16& serviceName, const Vector<String16>& args); /** * Writes a section header to a file descriptor. diff --git a/cmds/dumpsys/tests/dumpsys_test.cpp b/cmds/dumpsys/tests/dumpsys_test.cpp index d0b167e6b0..cbac839e6f 100644 --- a/cmds/dumpsys/tests/dumpsys_test.cpp +++ b/cmds/dumpsys/tests/dumpsys_test.cpp @@ -188,6 +188,22 @@ class DumpsysTest : public Test { EXPECT_THAT(status, Eq(0)); } + void CallSingleService(const String16& serviceName, Vector<String16>& args, int priorityFlags, + bool supportsProto, std::chrono::duration<double>& elapsedDuration, + size_t& bytesWritten) { + CaptureStdout(); + CaptureStderr(); + dump_.setServiceArgs(args, supportsProto, priorityFlags); + status_t status = dump_.startDumpThread(serviceName, args); + EXPECT_THAT(status, Eq(0)); + status = dump_.writeDump(STDOUT_FILENO, serviceName, std::chrono::milliseconds(500), false, + elapsedDuration, bytesWritten); + EXPECT_THAT(status, Eq(0)); + dump_.stopDumpThread(/* dumpCompleted = */ true); + stdout_ = GetCapturedStdout(); + stderr_ = GetCapturedStderr(); + } + void AssertRunningServices(const std::vector<std::string>& services) { std::string expected; if (services.size() > 1) { @@ -199,13 +215,16 @@ class DumpsysTest : public Test { EXPECT_THAT(stdout_, HasSubstr(expected)); } + void AssertOutput(const std::string& expected) { + EXPECT_THAT(stdout_, StrEq(expected)); + } + void AssertOutputContains(const std::string& expected) { EXPECT_THAT(stdout_, HasSubstr(expected)); } void AssertDumped(const std::string& service, const std::string& dump) { - EXPECT_THAT(stdout_, HasSubstr("DUMP OF SERVICE " + service + ":\n")); - EXPECT_THAT(stdout_, HasSubstr(dump)); + EXPECT_THAT(stdout_, HasSubstr("DUMP OF SERVICE " + service + ":\n" + dump)); EXPECT_THAT(stdout_, HasSubstr("was the duration of dumpsys " + service + ", ending at: ")); } @@ -213,8 +232,7 @@ class DumpsysTest : public Test { const char16_t* priorityType) { std::string priority = String8(priorityType).c_str(); EXPECT_THAT(stdout_, - HasSubstr("DUMP OF SERVICE " + priority + " " + service + ":\n")); - EXPECT_THAT(stdout_, HasSubstr(dump)); + HasSubstr("DUMP OF SERVICE " + priority + " " + service + ":\n" + dump)); EXPECT_THAT(stdout_, HasSubstr("was the duration of dumpsys " + service + ", ending at: ")); } @@ -295,8 +313,7 @@ TEST_F(DumpsysTest, DumpRunningService) { CallMain({"Valet"}); - AssertOutputContains("Pid: " + std::to_string(getpid())); - AssertOutputContains("Here's your car"); + AssertOutput("Here's your car"); } // Tests 'dumpsys -t 1 service_name' on a service that times out after 2s @@ -331,7 +348,7 @@ TEST_F(DumpsysTest, DumpWithArgsRunningService) { CallMain({"SERVICE", "Y", "U", "NO", "HANDLE", "ARGS"}); - AssertOutputContains("I DO!"); + AssertOutput("I DO!"); } // Tests dumpsys passes the -a flag when called on all services @@ -522,6 +539,23 @@ TEST_F(DumpsysTest, DumpWithPriorityHighAndProto) { AssertDumpedWithPriority("runninghigh2", "dump2", PriorityDumper::PRIORITY_ARG_HIGH); } +TEST_F(DumpsysTest, GetBytesWritten) { + const char* serviceName = "service2"; + const char* dumpContents = "dump1"; + ExpectDump(serviceName, dumpContents); + + String16 service(serviceName); + Vector<String16> args; + std::chrono::duration<double> elapsedDuration; + size_t bytesWritten; + + CallSingleService(service, args, IServiceManager::DUMP_FLAG_PRIORITY_ALL, + /* as_proto = */ false, elapsedDuration, bytesWritten); + + AssertOutput(dumpContents); + EXPECT_THAT(bytesWritten, Eq(strlen(dumpContents))); +} + TEST_F(DumpsysTest, WriteDumpWithoutThreadStart) { std::chrono::duration<double> elapsedDuration; size_t bytesWritten; @@ -529,4 +563,4 @@ TEST_F(DumpsysTest, WriteDumpWithoutThreadStart) { dump_.writeDump(STDOUT_FILENO, String16("service"), std::chrono::milliseconds(500), /* as_proto = */ false, elapsedDuration, bytesWritten); EXPECT_THAT(status, Eq(INVALID_OPERATION)); -} +}
\ No newline at end of file diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index dd51898422..4026f29208 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -832,7 +832,7 @@ static int32_t copy_directory_recursive(const char* from, const char* to) { }; LOG(DEBUG) << "Copying " << from << " to " << to; - return android_fork_execvp(ARRAY_SIZE(argv), argv, nullptr, false, true); + return logwrap_fork_execvp(ARRAY_SIZE(argv), argv, nullptr, false, LOG_ALOG, false, nullptr); } binder::Status InstalldNativeService::snapshotAppData( diff --git a/libs/binder/ActivityManager.cpp b/libs/binder/ActivityManager.cpp index 49a94146db..5e4c98fc7a 100644 --- a/libs/binder/ActivityManager.cpp +++ b/libs/binder/ActivityManager.cpp @@ -114,4 +114,4 @@ status_t ActivityManager::unlinkToDeath(const sp<IBinder::DeathRecipient>& recip return INVALID_OPERATION; } -}; // namespace android +} // namespace android diff --git a/libs/binder/AppOpsManager.cpp b/libs/binder/AppOpsManager.cpp index 525685c35e..0a6685e14a 100644 --- a/libs/binder/AppOpsManager.cpp +++ b/libs/binder/AppOpsManager.cpp @@ -147,4 +147,4 @@ int32_t AppOpsManager::permissionToOpCode(const String16& permission) { } -}; // namespace android +} // namespace android diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp index 34b6ea5385..2f6e9c3a1b 100644 --- a/libs/binder/Binder.cpp +++ b/libs/binder/Binder.cpp @@ -419,4 +419,4 @@ bool BpRefBase::onIncStrongAttempted(uint32_t /*flags*/, const void* /*id*/) // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp index c5aa0075ab..50c7053b13 100644 --- a/libs/binder/BpBinder.cpp +++ b/libs/binder/BpBinder.cpp @@ -491,4 +491,4 @@ void BpBinder::setBinderProxyCountWatermarks(int high, int low) { // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/BufferedTextOutput.cpp b/libs/binder/BufferedTextOutput.cpp index a7d52409f6..fb424fdcfb 100644 --- a/libs/binder/BufferedTextOutput.cpp +++ b/libs/binder/BufferedTextOutput.cpp @@ -280,4 +280,4 @@ BufferedTextOutput::BufferState* BufferedTextOutput::getBuffer() const return mGlobalState; } -}; // namespace android +} // namespace android diff --git a/libs/binder/Debug.cpp b/libs/binder/Debug.cpp index a1c2a8be08..64c1ff68c0 100644 --- a/libs/binder/Debug.cpp +++ b/libs/binder/Debug.cpp @@ -308,5 +308,5 @@ ssize_t getBinderKernelReferences(size_t count, uintptr_t* buf) { return proc->getKernelReferences(count, buf); } -}; // namespace android +} // namespace android diff --git a/libs/binder/IActivityManager.cpp b/libs/binder/IActivityManager.cpp index 377f604d44..1eb5363ae2 100644 --- a/libs/binder/IActivityManager.cpp +++ b/libs/binder/IActivityManager.cpp @@ -110,4 +110,4 @@ public: IMPLEMENT_META_INTERFACE(ActivityManager, "android.app.IActivityManager"); -}; // namespace android +} // namespace android diff --git a/libs/binder/IAppOpsCallback.cpp b/libs/binder/IAppOpsCallback.cpp index 4c151e7a65..0ce1dd59cf 100644 --- a/libs/binder/IAppOpsCallback.cpp +++ b/libs/binder/IAppOpsCallback.cpp @@ -66,4 +66,4 @@ status_t BnAppOpsCallback::onTransact( } } -}; // namespace android +} // namespace android diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp index c426f3a31f..b2bd9e50b0 100644 --- a/libs/binder/IAppOpsService.cpp +++ b/libs/binder/IAppOpsService.cpp @@ -239,4 +239,4 @@ status_t BnAppOpsService::onTransact( } } -}; // namespace android +} // namespace android diff --git a/libs/binder/IBatteryStats.cpp b/libs/binder/IBatteryStats.cpp index cc0022a875..a47dbaccfe 100644 --- a/libs/binder/IBatteryStats.cpp +++ b/libs/binder/IBatteryStats.cpp @@ -240,4 +240,4 @@ status_t BnBatteryStats::onTransact( } } -}; // namespace android +} // namespace android diff --git a/libs/binder/IInterface.cpp b/libs/binder/IInterface.cpp index 59d51ed94a..b19004d454 100644 --- a/libs/binder/IInterface.cpp +++ b/libs/binder/IInterface.cpp @@ -46,4 +46,4 @@ sp<IBinder> IInterface::asBinder(const sp<IInterface>& iface) // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/IMediaResourceMonitor.cpp b/libs/binder/IMediaResourceMonitor.cpp index 77e3d239bc..4198e49259 100644 --- a/libs/binder/IMediaResourceMonitor.cpp +++ b/libs/binder/IMediaResourceMonitor.cpp @@ -59,4 +59,4 @@ status_t BnMediaResourceMonitor::onTransact( uint32_t code, const Parcel& data, // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp index caf2318281..094f89f7d9 100644 --- a/libs/binder/IMemory.cpp +++ b/libs/binder/IMemory.cpp @@ -510,4 +510,4 @@ void HeapCache::dump_heaps() // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index c6660973f8..4981d7a111 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -1325,4 +1325,4 @@ void IPCThreadState::freeBuffer(Parcel* parcel, const uint8_t* data, state->mOut.writePointer((uintptr_t)data); } -}; // namespace android +} // namespace android diff --git a/libs/binder/IPermissionController.cpp b/libs/binder/IPermissionController.cpp index bf2f20aa0b..d9bf3cc7b6 100644 --- a/libs/binder/IPermissionController.cpp +++ b/libs/binder/IPermissionController.cpp @@ -172,4 +172,4 @@ status_t BnPermissionController::onTransact( } } -}; // namespace android +} // namespace android diff --git a/libs/binder/IProcessInfoService.cpp b/libs/binder/IProcessInfoService.cpp index 96e1a8c239..a38a27ad39 100644 --- a/libs/binder/IProcessInfoService.cpp +++ b/libs/binder/IProcessInfoService.cpp @@ -88,4 +88,4 @@ IMPLEMENT_META_INTERFACE(ProcessInfoService, "android.os.IProcessInfoService"); // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/IResultReceiver.cpp b/libs/binder/IResultReceiver.cpp index 1e11941023..556288c5dd 100644 --- a/libs/binder/IResultReceiver.cpp +++ b/libs/binder/IResultReceiver.cpp @@ -65,4 +65,4 @@ status_t BnResultReceiver::onTransact( } } -}; // namespace android +} // namespace android diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index f3e8f45909..ee637e24bf 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -285,4 +285,4 @@ private: IMPLEMENT_META_INTERFACE(ServiceManager, "android.os.IServiceManager"); -}; // namespace android +} // namespace android diff --git a/libs/binder/IShellCallback.cpp b/libs/binder/IShellCallback.cpp index 88cc603b6f..a3e2b67bc6 100644 --- a/libs/binder/IShellCallback.cpp +++ b/libs/binder/IShellCallback.cpp @@ -85,4 +85,4 @@ status_t BnShellCallback::onTransact( } } -}; // namespace android +} // namespace android diff --git a/libs/binder/IUidObserver.cpp b/libs/binder/IUidObserver.cpp index 82f9047595..038e6bf6ea 100644 --- a/libs/binder/IUidObserver.cpp +++ b/libs/binder/IUidObserver.cpp @@ -112,4 +112,4 @@ status_t BnUidObserver::onTransact( } } -}; // namespace android +} // namespace android diff --git a/libs/binder/MemoryBase.cpp b/libs/binder/MemoryBase.cpp index 033066bea3..32300dfbb6 100644 --- a/libs/binder/MemoryBase.cpp +++ b/libs/binder/MemoryBase.cpp @@ -43,4 +43,4 @@ MemoryBase::~MemoryBase() } // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp index eacad3b6b3..ebf91f925e 100644 --- a/libs/binder/MemoryDealer.cpp +++ b/libs/binder/MemoryDealer.cpp @@ -481,4 +481,4 @@ void SimpleBestFitAllocator::dump_l(String8& result, } -}; // namespace android +} // namespace android diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp index 4c300b47c6..e4ea60f699 100644 --- a/libs/binder/MemoryHeapBase.cpp +++ b/libs/binder/MemoryHeapBase.cpp @@ -181,4 +181,4 @@ off_t MemoryHeapBase::getOffset() const { } // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index a6b41e4b5f..e5c7d74e23 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -509,7 +509,7 @@ void Parcel::updateWorkSourceRequestHeaderPosition() const { } } -#ifdef __ANDROID_VNDK__ +#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) constexpr int32_t kHeader = B_PACK_CHARS('V', 'N', 'D', 'R'); #else constexpr int32_t kHeader = B_PACK_CHARS('S', 'Y', 'S', 'T'); @@ -2777,4 +2777,4 @@ void Parcel::Blob::clear() { mMutable = false; } -}; // namespace android +} // namespace android diff --git a/libs/binder/PermissionCache.cpp b/libs/binder/PermissionCache.cpp index a4c28ad74e..75a6d22969 100644 --- a/libs/binder/PermissionCache.cpp +++ b/libs/binder/PermissionCache.cpp @@ -110,4 +110,4 @@ bool PermissionCache::checkPermission( } // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android diff --git a/libs/binder/PermissionController.cpp b/libs/binder/PermissionController.cpp index 34b2ca5170..0c8924503d 100644 --- a/libs/binder/PermissionController.cpp +++ b/libs/binder/PermissionController.cpp @@ -85,4 +85,4 @@ int PermissionController::getPackageUid(const String16& package, int flags) return service != nullptr ? service->getPackageUid(package, flags) : -1; } -}; // namespace android +} // namespace android diff --git a/libs/binder/ProcessInfoService.cpp b/libs/binder/ProcessInfoService.cpp index 5cb2033b07..00d6eefabe 100644 --- a/libs/binder/ProcessInfoService.cpp +++ b/libs/binder/ProcessInfoService.cpp @@ -101,4 +101,4 @@ void ProcessInfoService::updateBinderLocked() { ANDROID_SINGLETON_STATIC_INSTANCE(ProcessInfoService); -}; // namespace android +} // namespace android diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index eb828c3ce4..0336d3ebd4 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -387,4 +387,4 @@ ProcessState::~ProcessState() mDriverFD = -1; } -}; // namespace android +} // namespace android diff --git a/libs/binder/TextOutput.cpp b/libs/binder/TextOutput.cpp index 101eba318f..684a7dcc51 100644 --- a/libs/binder/TextOutput.cpp +++ b/libs/binder/TextOutput.cpp @@ -69,4 +69,4 @@ TextOutput& operator<<(TextOutput& to, const HexDump& val) return to; } -}; // namespace android +} // namespace android diff --git a/libs/binder/include/binder/ActivityManager.h b/libs/binder/include/binder/ActivityManager.h index 5f324c7965..9108e31758 100644 --- a/libs/binder/include/binder/ActivityManager.h +++ b/libs/binder/include/binder/ActivityManager.h @@ -89,7 +89,7 @@ private: }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/AppOpsManager.h b/libs/binder/include/binder/AppOpsManager.h index 17493b4252..b19cde75b6 100644 --- a/libs/binder/include/binder/AppOpsManager.h +++ b/libs/binder/include/binder/AppOpsManager.h @@ -133,7 +133,7 @@ private: }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/Binder.h b/libs/binder/include/binder/Binder.h index 5673d5a871..3be61f9409 100644 --- a/libs/binder/include/binder/Binder.h +++ b/libs/binder/include/binder/Binder.h @@ -114,7 +114,7 @@ private: std::atomic<int32_t> mState; }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- diff --git a/libs/binder/include/binder/BinderService.h b/libs/binder/include/binder/BinderService.h index 9230e89cdf..c17ae6f5fe 100644 --- a/libs/binder/include/binder/BinderService.h +++ b/libs/binder/include/binder/BinderService.h @@ -62,6 +62,6 @@ private: }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_BINDER_SERVICE_H diff --git a/libs/binder/include/binder/BpBinder.h b/libs/binder/include/binder/BpBinder.h index 28599f4fc2..7dca733b52 100644 --- a/libs/binder/include/binder/BpBinder.h +++ b/libs/binder/include/binder/BpBinder.h @@ -144,7 +144,7 @@ private: static bool sBinderProxyThrottleCreate; }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- diff --git a/libs/binder/include/binder/BufferedTextOutput.h b/libs/binder/include/binder/BufferedTextOutput.h index feae93dea1..1b27bb2249 100644 --- a/libs/binder/include/binder/BufferedTextOutput.h +++ b/libs/binder/include/binder/BufferedTextOutput.h @@ -62,6 +62,6 @@ private: }; // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_BUFFEREDTEXTOUTPUT_H diff --git a/libs/binder/include/binder/Debug.h b/libs/binder/include/binder/Debug.h index 58e2b32b3a..324e5c1c81 100644 --- a/libs/binder/include/binder/Debug.h +++ b/libs/binder/include/binder/Debug.h @@ -44,6 +44,6 @@ ssize_t getBinderKernelReferences(size_t count, uintptr_t* buf); __END_DECLS // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_BINDER_DEBUG_H diff --git a/libs/binder/include/binder/IActivityManager.h b/libs/binder/include/binder/IActivityManager.h index 6abc071c45..e0248f6624 100644 --- a/libs/binder/include/binder/IActivityManager.h +++ b/libs/binder/include/binder/IActivityManager.h @@ -51,7 +51,7 @@ public: // ------------------------------------------------------------------------------------ -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/IAppOpsCallback.h b/libs/binder/include/binder/IAppOpsCallback.h index b500219e37..76642606fc 100644 --- a/libs/binder/include/binder/IAppOpsCallback.h +++ b/libs/binder/include/binder/IAppOpsCallback.h @@ -52,7 +52,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/IAppOpsService.h b/libs/binder/include/binder/IAppOpsService.h index 3dbd0d9f7a..b74c623e44 100644 --- a/libs/binder/include/binder/IAppOpsService.h +++ b/libs/binder/include/binder/IAppOpsService.h @@ -79,7 +79,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/IBatteryStats.h b/libs/binder/include/binder/IBatteryStats.h index 48da865702..b786f89f74 100644 --- a/libs/binder/include/binder/IBatteryStats.h +++ b/libs/binder/include/binder/IBatteryStats.h @@ -77,7 +77,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/IBinder.h b/libs/binder/include/binder/IBinder.h index b12723446d..64f305274b 100644 --- a/libs/binder/include/binder/IBinder.h +++ b/libs/binder/include/binder/IBinder.h @@ -242,7 +242,7 @@ protected: private: }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- diff --git a/libs/binder/include/binder/IInterface.h b/libs/binder/include/binder/IInterface.h index 0d305608ca..5793a1cf6b 100644 --- a/libs/binder/include/binder/IInterface.h +++ b/libs/binder/include/binder/IInterface.h @@ -168,6 +168,6 @@ inline IBinder* BpInterface<INTERFACE>::onAsBinder() // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_IINTERFACE_H diff --git a/libs/binder/include/binder/IMediaResourceMonitor.h b/libs/binder/include/binder/IMediaResourceMonitor.h index 213ee63ea8..da2b7cf62d 100644 --- a/libs/binder/include/binder/IMediaResourceMonitor.h +++ b/libs/binder/include/binder/IMediaResourceMonitor.h @@ -52,7 +52,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/IMemory.h b/libs/binder/include/binder/IMemory.h index 071946f50c..372802978b 100644 --- a/libs/binder/include/binder/IMemory.h +++ b/libs/binder/include/binder/IMemory.h @@ -100,6 +100,6 @@ protected: // ---------------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_IMEMORY_H diff --git a/libs/binder/include/binder/IPCThreadState.h b/libs/binder/include/binder/IPCThreadState.h index b810f7e8ee..ff9244e08a 100644 --- a/libs/binder/include/binder/IPCThreadState.h +++ b/libs/binder/include/binder/IPCThreadState.h @@ -196,7 +196,7 @@ private: ProcessState::CallRestriction mCallRestriction; }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- diff --git a/libs/binder/include/binder/IPermissionController.h b/libs/binder/include/binder/IPermissionController.h index 26a1b23a9a..4b66df8d6e 100644 --- a/libs/binder/include/binder/IPermissionController.h +++ b/libs/binder/include/binder/IPermissionController.h @@ -65,7 +65,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/IProcessInfoService.h b/libs/binder/include/binder/IProcessInfoService.h index 033c145363..ca30ad3b95 100644 --- a/libs/binder/include/binder/IProcessInfoService.h +++ b/libs/binder/include/binder/IProcessInfoService.h @@ -46,7 +46,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/IResultReceiver.h b/libs/binder/include/binder/IResultReceiver.h index 00b3d8954c..70e99e7c38 100644 --- a/libs/binder/include/binder/IResultReceiver.h +++ b/libs/binder/include/binder/IResultReceiver.h @@ -50,7 +50,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_IRESULT_RECEIVER_H diff --git a/libs/binder/include/binder/IServiceManager.h b/libs/binder/include/binder/IServiceManager.h index 8ae860df38..def1bea974 100644 --- a/libs/binder/include/binder/IServiceManager.h +++ b/libs/binder/include/binder/IServiceManager.h @@ -104,7 +104,7 @@ bool checkCallingPermission(const String16& permission, int32_t* outPid, int32_t* outUid); bool checkPermission(const String16& permission, pid_t pid, uid_t uid); -}; // namespace android +} // namespace android #endif // ANDROID_ISERVICE_MANAGER_H diff --git a/libs/binder/include/binder/IShellCallback.h b/libs/binder/include/binder/IShellCallback.h index 67156787d3..b7ab6eab88 100644 --- a/libs/binder/include/binder/IShellCallback.h +++ b/libs/binder/include/binder/IShellCallback.h @@ -51,7 +51,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_ISHELL_CALLBACK_H diff --git a/libs/binder/include/binder/IUidObserver.h b/libs/binder/include/binder/IUidObserver.h index a1f530dc71..09e50a9de8 100644 --- a/libs/binder/include/binder/IUidObserver.h +++ b/libs/binder/include/binder/IUidObserver.h @@ -58,7 +58,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/MemoryBase.h b/libs/binder/include/binder/MemoryBase.h index 463e26d977..4dd363808c 100644 --- a/libs/binder/include/binder/MemoryBase.h +++ b/libs/binder/include/binder/MemoryBase.h @@ -46,6 +46,6 @@ private: }; // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_MEMORY_BASE_H diff --git a/libs/binder/include/binder/MemoryDealer.h b/libs/binder/include/binder/MemoryDealer.h index b483be0fd5..6c1c4122d8 100644 --- a/libs/binder/include/binder/MemoryDealer.h +++ b/libs/binder/include/binder/MemoryDealer.h @@ -59,6 +59,6 @@ private: // ---------------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_MEMORY_DEALER_H diff --git a/libs/binder/include/binder/MemoryHeapBase.h b/libs/binder/include/binder/MemoryHeapBase.h index 100d784a83..3fccddcc59 100644 --- a/libs/binder/include/binder/MemoryHeapBase.h +++ b/libs/binder/include/binder/MemoryHeapBase.h @@ -98,6 +98,6 @@ private: }; // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_MEMORY_HEAP_BASE_H diff --git a/libs/binder/include/binder/Parcel.h b/libs/binder/include/binder/Parcel.h index 3471e1356d..87266819e6 100644 --- a/libs/binder/include/binder/Parcel.h +++ b/libs/binder/include/binder/Parcel.h @@ -921,7 +921,7 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) return to; } -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- diff --git a/libs/binder/include/binder/PermissionCache.h b/libs/binder/include/binder/PermissionCache.h index 95eabff7ac..c2582150df 100644 --- a/libs/binder/include/binder/PermissionCache.h +++ b/libs/binder/include/binder/PermissionCache.h @@ -77,7 +77,7 @@ public: }; // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/PermissionController.h b/libs/binder/include/binder/PermissionController.h index d81f5142bc..4db522ab1f 100644 --- a/libs/binder/include/binder/PermissionController.h +++ b/libs/binder/include/binder/PermissionController.h @@ -60,7 +60,7 @@ private: }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/ProcessInfoService.h b/libs/binder/include/binder/ProcessInfoService.h index a03aae98ee..6bfd1bc17d 100644 --- a/libs/binder/include/binder/ProcessInfoService.h +++ b/libs/binder/include/binder/ProcessInfoService.h @@ -78,7 +78,7 @@ public: // ---------------------------------------------------------------------- -}; // namespace android +} // namespace android #else // __ANDROID_VNDK__ #error "This header is not visible to vendors" diff --git a/libs/binder/include/binder/ProcessState.h b/libs/binder/include/binder/ProcessState.h index 8339976567..f7c38f418d 100644 --- a/libs/binder/include/binder/ProcessState.h +++ b/libs/binder/include/binder/ProcessState.h @@ -126,7 +126,7 @@ private: CallRestriction mCallRestriction; }; -}; // namespace android +} // namespace android // --------------------------------------------------------------------------- diff --git a/libs/binder/include/binder/Stability.h b/libs/binder/include/binder/Stability.h index b84657ac56..2894482f55 100644 --- a/libs/binder/include/binder/Stability.h +++ b/libs/binder/include/binder/Stability.h @@ -81,7 +81,7 @@ private: VINTF = 0b111111, }; -#ifdef __ANDROID_VNDK__ +#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) static constexpr Level kLocalStability = Level::VENDOR; #else static constexpr Level kLocalStability = Level::SYSTEM; diff --git a/libs/binder/include/binder/TextOutput.h b/libs/binder/include/binder/TextOutput.h index 5b5f76688b..f66406f7d4 100644 --- a/libs/binder/include/binder/TextOutput.h +++ b/libs/binder/include/binder/TextOutput.h @@ -199,6 +199,6 @@ inline size_t HexDump::alignment() const { return mAlignment; } inline bool HexDump::carrayStyle() const { return mCArrayStyle; } // --------------------------------------------------------------------------- -}; // namespace android +} // namespace android #endif // ANDROID_TEXTOUTPUT_H diff --git a/libs/binder/ndk/include_platform/android/binder_stability.h b/libs/binder/ndk/include_platform/android/binder_stability.h index e6aeb04e6f..b03fce1e39 100644 --- a/libs/binder/ndk/include_platform/android/binder_stability.h +++ b/libs/binder/ndk/include_platform/android/binder_stability.h @@ -20,7 +20,7 @@ __BEGIN_DECLS -#ifdef __ANDROID_VNDK__ +#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) /** * This interface has the stability of the vendor image. @@ -31,7 +31,7 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { AIBinder_markVendorStability(binder); } -#else // ndef defined __ANDROID_VNDK__ +#else // defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) /** * This interface has the stability of the system image. @@ -42,7 +42,7 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { AIBinder_markSystemStability(binder); } -#endif // ifdef __ANDROID_VNDK__ +#endif // defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) /** * This interface has system<->vendor stability diff --git a/opengl/libagl/Android.bp b/opengl/libagl/Android.bp index 6ec24b3712..f5bf015bad 100644 --- a/opengl/libagl/Android.bp +++ b/opengl/libagl/Android.bp @@ -25,8 +25,9 @@ cc_defaults { "libnativewindow", ], - // we need to access the private Bionic header <bionic_tls.h> - include_dirs: ["bionic/libc/private"], + header_libs: [ + "bionic_libc_platform_headers", + ], arch: { arm: { diff --git a/opengl/libagl/context.h b/opengl/libagl/context.h index 18ef7d5716..6e77a2366f 100644 --- a/opengl/libagl/context.h +++ b/opengl/libagl/context.h @@ -22,7 +22,7 @@ #include <sys/types.h> #include <pthread.h> #ifdef __ANDROID__ -#include <bionic_tls.h> +#include <bionic/tls.h> #endif #include <private/pixelflinger/ggl_context.h> diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp index 342fb5983e..eb90c8b45b 100644 --- a/opengl/libs/Android.bp +++ b/opengl/libs/Android.bp @@ -72,15 +72,13 @@ cc_defaults { "libarect", ], header_libs: [ + "bionic_libc_platform_headers", "gl_headers", "libsystem_headers", "libhardware_headers", "libnativebase_headers", ], export_header_lib_headers: ["gl_headers"], - - // we need to access the private Bionic header <bionic_tls.h> - include_dirs: ["bionic/libc/private"], } //############################################################################## diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h index 63a0e140cc..86fec21bae 100644 --- a/opengl/libs/hooks.h +++ b/opengl/libs/hooks.h @@ -46,7 +46,7 @@ #define MAX_NUMBER_OF_GL_EXTENSIONS 256 -#include <bionic_tls.h> /* special private C library header */ +#include <bionic/tls.h> /* special private C library header */ // ---------------------------------------------------------------------------- namespace android { diff --git a/opengl/tests/EGLTest/Android.bp b/opengl/tests/EGLTest/Android.bp index 19c8b377ab..8bfe517812 100644 --- a/opengl/tests/EGLTest/Android.bp +++ b/opengl/tests/EGLTest/Android.bp @@ -28,9 +28,11 @@ cc_test { ], include_dirs: [ - "bionic/libc/private", "frameworks/native/opengl/libs", "frameworks/native/opengl/libs/EGL", ], + header_libs: [ + "bionic_libc_platform_headers", + ], } |