Loading include/android/surface_control.h +0 −2 Original line number Diff line number Diff line Loading @@ -496,7 +496,6 @@ void ASurfaceTransaction_setCrop(ASurfaceTransaction* _Nonnull transaction, /** * Specifies the position in the parent's space where the surface will be drawn. * Only permits finite values to be set. * * \param x The x position to render the surface. * \param y The y position to render the surface. Loading @@ -520,7 +519,6 @@ void ASurfaceTransaction_setBufferTransform(ASurfaceTransaction* _Nonnull transa /** * Sets an x and y scale of a surface with (0, 0) as the centerpoint of the scale. * Only permits finite values to be set. * * \param xScale The scale in the x direction. Must be greater than 0. * \param yScale The scale in the y direction. Must be greater than 0. Loading libs/binder/BinderStatsPusher.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -74,9 +74,11 @@ void BinderStatsPusher::aggregateStatsLocked(const std::vector<BinderCallData>& // to the VM then skip pushing. This is required since StatsBootstrap is // a Java service and needs a JNI interface to be called from native code. bool isProcessSystemServer = IInterface::asBinder(service)->localBinder() != nullptr; if (isProcessSystemServer && getJavaVM() == nullptr) { if (isProcessSystemServer) { if (!isThreadAttachedToJVM()) { return; } } // Clear calling identity if this is called from system server. This // will allow libStatsBootstrap to verify calling uid correctly. int64_t callingIdentity; Loading libs/binder/BpBinder.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -586,6 +586,9 @@ void BpBinder::sendObituary() } void BpBinder::onFrozenStateChangeListenerRemoved() { LOG_ALWAYS_FATAL_IF(isRpcBinder(), "onFrozenStateChangeListenerRemoved() is not supported for RPC Binder."); LOG_ALWAYS_FATAL_IF(!kEnableKernelIpc, "Binder kernel driver disabled at build time"); if (!waitForFrozenListenerRemovalCompletion()) { return; } Loading libs/binder/JvmUtils.h +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ namespace { static void* getJavaVM() { return nullptr; } bool isThreadAttachedToJVM() { return false; } #else static JavaVM* getJavaVM() { static auto fn = reinterpret_cast<decltype(&AndroidRuntimeGetJavaVM)>( Loading @@ -30,5 +33,14 @@ static JavaVM* getJavaVM() { if (fn == nullptr) return nullptr; return fn(); } bool isThreadAttachedToJVM() { JNIEnv* env = nullptr; JavaVM* vm = getJavaVM(); if (vm == nullptr || vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_4) < 0) { return false; } return env != nullptr; } #endif } // namespace libs/binder/RpcState.cpp +21 −14 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ #include "Utils.h" #include <random> #include <sstream> #include <string> #include <inttypes.h> Loading Loading @@ -341,10 +341,16 @@ std::string RpcState::BinderNode::toString() const { desc = "(not promotable)"; } std::stringstream ss; ss << "node{" << intptr_t(this->binder.unsafe_get()) << " times sent: " << this->timesSent << " times recd: " << this->timesRecd << " type: " << desc << "}"; return ss.str(); std::string out = "node{"; out.append(std::to_string(intptr_t(this->binder.unsafe_get()))); out.append(" times sent: "); out.append(std::to_string(this->timesSent)); out.append(" times recd: "); out.append(std::to_string(this->timesRecd)); out.append(" type: "); out.append(desc); out.append("}"); return out; } RpcState::CommandData::CommandData(size_t size) : mSize(size) { Loading Loading @@ -1372,11 +1378,11 @@ status_t RpcState::validateParcel(const sp<RpcSession>& session, const Parcel& p uint32_t protocolVersion = session->getProtocolVersion().value(); if (protocolVersion < RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_SIZE && !rpcFields->mObjectPositions.empty()) { std::stringstream ss; ss << "Parcel has attached objects but the session's protocol version (" << protocolVersion << ") is too old, must be at least " << RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_SIZE; *errorMsg = ss.str(); *errorMsg = "Parcel has attached objects but the session's protocol version "; errorMsg->append(std::to_string(protocolVersion)); errorMsg->append(" is too old, must be at least "); errorMsg->append( std::to_string(RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_SIZE)); return BAD_VALUE; } Loading @@ -1388,10 +1394,11 @@ status_t RpcState::validateParcel(const sp<RpcSession>& session, const Parcel& p return FDS_NOT_ALLOWED; } if (rpcFields->mFds->size() > maxFdsPerMsg) { std::stringstream ss; ss << "Too many file descriptors in Parcel: " << rpcFields->mFds->size() << " (max is " << maxFdsPerMsg << ")"; *errorMsg = ss.str(); *errorMsg = "Too many file descriptors in Parcel: "; errorMsg->append(std::to_string(rpcFields->mFds->size())); errorMsg->append(" (max is "); errorMsg->append(std::to_string(maxFdsPerMsg)); errorMsg->append(")"); return BAD_VALUE; } } Loading Loading
include/android/surface_control.h +0 −2 Original line number Diff line number Diff line Loading @@ -496,7 +496,6 @@ void ASurfaceTransaction_setCrop(ASurfaceTransaction* _Nonnull transaction, /** * Specifies the position in the parent's space where the surface will be drawn. * Only permits finite values to be set. * * \param x The x position to render the surface. * \param y The y position to render the surface. Loading @@ -520,7 +519,6 @@ void ASurfaceTransaction_setBufferTransform(ASurfaceTransaction* _Nonnull transa /** * Sets an x and y scale of a surface with (0, 0) as the centerpoint of the scale. * Only permits finite values to be set. * * \param xScale The scale in the x direction. Must be greater than 0. * \param yScale The scale in the y direction. Must be greater than 0. Loading
libs/binder/BinderStatsPusher.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -74,9 +74,11 @@ void BinderStatsPusher::aggregateStatsLocked(const std::vector<BinderCallData>& // to the VM then skip pushing. This is required since StatsBootstrap is // a Java service and needs a JNI interface to be called from native code. bool isProcessSystemServer = IInterface::asBinder(service)->localBinder() != nullptr; if (isProcessSystemServer && getJavaVM() == nullptr) { if (isProcessSystemServer) { if (!isThreadAttachedToJVM()) { return; } } // Clear calling identity if this is called from system server. This // will allow libStatsBootstrap to verify calling uid correctly. int64_t callingIdentity; Loading
libs/binder/BpBinder.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -586,6 +586,9 @@ void BpBinder::sendObituary() } void BpBinder::onFrozenStateChangeListenerRemoved() { LOG_ALWAYS_FATAL_IF(isRpcBinder(), "onFrozenStateChangeListenerRemoved() is not supported for RPC Binder."); LOG_ALWAYS_FATAL_IF(!kEnableKernelIpc, "Binder kernel driver disabled at build time"); if (!waitForFrozenListenerRemovalCompletion()) { return; } Loading
libs/binder/JvmUtils.h +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ namespace { static void* getJavaVM() { return nullptr; } bool isThreadAttachedToJVM() { return false; } #else static JavaVM* getJavaVM() { static auto fn = reinterpret_cast<decltype(&AndroidRuntimeGetJavaVM)>( Loading @@ -30,5 +33,14 @@ static JavaVM* getJavaVM() { if (fn == nullptr) return nullptr; return fn(); } bool isThreadAttachedToJVM() { JNIEnv* env = nullptr; JavaVM* vm = getJavaVM(); if (vm == nullptr || vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_4) < 0) { return false; } return env != nullptr; } #endif } // namespace
libs/binder/RpcState.cpp +21 −14 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ #include "Utils.h" #include <random> #include <sstream> #include <string> #include <inttypes.h> Loading Loading @@ -341,10 +341,16 @@ std::string RpcState::BinderNode::toString() const { desc = "(not promotable)"; } std::stringstream ss; ss << "node{" << intptr_t(this->binder.unsafe_get()) << " times sent: " << this->timesSent << " times recd: " << this->timesRecd << " type: " << desc << "}"; return ss.str(); std::string out = "node{"; out.append(std::to_string(intptr_t(this->binder.unsafe_get()))); out.append(" times sent: "); out.append(std::to_string(this->timesSent)); out.append(" times recd: "); out.append(std::to_string(this->timesRecd)); out.append(" type: "); out.append(desc); out.append("}"); return out; } RpcState::CommandData::CommandData(size_t size) : mSize(size) { Loading Loading @@ -1372,11 +1378,11 @@ status_t RpcState::validateParcel(const sp<RpcSession>& session, const Parcel& p uint32_t protocolVersion = session->getProtocolVersion().value(); if (protocolVersion < RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_SIZE && !rpcFields->mObjectPositions.empty()) { std::stringstream ss; ss << "Parcel has attached objects but the session's protocol version (" << protocolVersion << ") is too old, must be at least " << RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_SIZE; *errorMsg = ss.str(); *errorMsg = "Parcel has attached objects but the session's protocol version "; errorMsg->append(std::to_string(protocolVersion)); errorMsg->append(" is too old, must be at least "); errorMsg->append( std::to_string(RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_SIZE)); return BAD_VALUE; } Loading @@ -1388,10 +1394,11 @@ status_t RpcState::validateParcel(const sp<RpcSession>& session, const Parcel& p return FDS_NOT_ALLOWED; } if (rpcFields->mFds->size() > maxFdsPerMsg) { std::stringstream ss; ss << "Too many file descriptors in Parcel: " << rpcFields->mFds->size() << " (max is " << maxFdsPerMsg << ")"; *errorMsg = ss.str(); *errorMsg = "Too many file descriptors in Parcel: "; errorMsg->append(std::to_string(rpcFields->mFds->size())); errorMsg->append(" (max is "); errorMsg->append(std::to_string(maxFdsPerMsg)); errorMsg->append(")"); return BAD_VALUE; } } Loading