Loading cmds/dumpstate/dumpstate.cpp +15 −5 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <unistd.h> #include <chrono> #include <fstream> #include <functional> #include <future> #include <memory> Loading Loading @@ -194,6 +195,15 @@ static bool UnlinkAndLogOnError(const std::string& file) { return true; } static bool IsFileEmpty(const std::string& file_path) { std::ifstream file(file_path, std::ios::binary | std::ios::ate); if(file.bad()) { MYLOGE("Cannot open file: %s\n", file_path.c_str()); return true; } return file.tellg() <= 0; } } // namespace } // namespace os } // namespace android Loading Loading @@ -2149,7 +2159,7 @@ static void SendBugreportFinishedBroadcast() { "--es", "android.intent.extra.DUMPSTATE_LOG", ds.log_path_ }; // clang-format on if (ds.options_->do_fb) { if (ds.options_->do_fb && !android::os::IsFileEmpty(ds.screenshot_path_)) { am_args.push_back("--es"); am_args.push_back("android.intent.extra.SCREENSHOT"); am_args.push_back(ds.screenshot_path_); Loading Loading @@ -2225,13 +2235,13 @@ static void SetOptionsFromMode(Dumpstate::BugreportMode mode, Dumpstate::DumpOpt break; case Dumpstate::BugreportMode::BUGREPORT_TELEPHONY: options->telephony_only = true; options->do_fb = true; options->do_fb = false; options->do_broadcast = true; break; case Dumpstate::BugreportMode::BUGREPORT_WIFI: options->wifi_only = true; options->do_zip_file = true; options->do_fb = true; options->do_fb = false; options->do_broadcast = true; break; case Dumpstate::BugreportMode::BUGREPORT_DEFAULT: Loading Loading @@ -2735,8 +2745,8 @@ void Dumpstate::CheckUserConsent(int32_t calling_uid, const android::String16& c if (ics != nullptr) { MYLOGD("Checking user consent via incidentcompanion service\n"); android::interface_cast<android::os::IIncidentCompanion>(ics)->authorizeReport( calling_uid, calling_package, 0x1 /* FLAG_CONFIRMATION_DIALOG */, consent_callback_.get()); calling_uid, calling_package, String16(), String16(), 0x1 /* FLAG_CONFIRMATION_DIALOG */, consent_callback_.get()); } else { MYLOGD("Unable to check user consent; incidentcompanion service unavailable\n"); } Loading cmds/dumpstate/tests/dumpstate_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -373,7 +373,7 @@ TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { EXPECT_EQ(status, Dumpstate::RunStatus::OK); EXPECT_TRUE(options_.do_add_date); EXPECT_TRUE(options_.do_fb); EXPECT_FALSE(options_.do_fb); EXPECT_TRUE(options_.do_broadcast); EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.telephony_only); Loading Loading @@ -404,7 +404,7 @@ TEST_F(DumpOptionsTest, InitializeWifiBugReport) { EXPECT_EQ(status, Dumpstate::RunStatus::OK); EXPECT_TRUE(options_.do_add_date); EXPECT_TRUE(options_.do_fb); EXPECT_FALSE(options_.do_fb); EXPECT_TRUE(options_.do_broadcast); EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.wifi_only); Loading libs/gui/IGraphicBufferProducer.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -781,6 +781,10 @@ status_t BnGraphicBufferProducer::onTransact( int result = dequeueBuffer(&buf, &fence, width, height, format, usage, &bufferAge, getTimestamps ? &frameTimestamps : nullptr); if (fence == nullptr) { ALOGE("dequeueBuffer returned a NULL fence, setting to Fence::NO_FENCE"); fence = Fence::NO_FENCE; } reply->writeInt32(buf); reply->write(*fence); reply->writeUint64(bufferAge); Loading Loading @@ -963,6 +967,10 @@ status_t BnGraphicBufferProducer::onTransact( ALOGE("getLastQueuedBuffer failed to write buffer: %d", result); return result; } if (fence == nullptr) { ALOGE("getLastQueuedBuffer returned a NULL fence, setting to Fence::NO_FENCE"); fence = Fence::NO_FENCE; } result = reply->write(*fence); if (result != NO_ERROR) { ALOGE("getLastQueuedBuffer failed to write fence: %d", result); Loading libs/gui/ISurfaceComposer.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ public: const sp<IBinder>& applyToken, const InputWindowCommands& commands, int64_t desiredPresentTime, const cached_buffer_t& uncacheBuffer) { const cached_buffer_t& uncacheBuffer, const std::vector<ListenerCallbacks>& listenerCallbacks) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading @@ -89,6 +90,14 @@ public: data.writeInt64(desiredPresentTime); data.writeStrongBinder(uncacheBuffer.token); data.writeUint64(uncacheBuffer.cacheId); if (data.writeVectorSize(listenerCallbacks) == NO_ERROR) { for (const auto& [listener, callbackIds] : listenerCallbacks) { data.writeStrongBinder(IInterface::asBinder(listener)); data.writeInt64Vector(callbackIds); } } remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply); } Loading Loading @@ -978,8 +987,18 @@ status_t BnSurfaceComposer::onTransact( uncachedBuffer.token = data.readStrongBinder(); uncachedBuffer.cacheId = data.readUint64(); std::vector<ListenerCallbacks> listenerCallbacks; int32_t listenersSize = data.readInt32(); for (int32_t i = 0; i < listenersSize; i++) { auto listener = interface_cast<ITransactionCompletedListener>(data.readStrongBinder()); std::vector<CallbackId> callbackIds; data.readInt64Vector(&callbackIds); listenerCallbacks.emplace_back(listener, callbackIds); } setTransactionState(state, displays, stateFlags, applyToken, inputWindowCommands, desiredPresentTime, uncachedBuffer); desiredPresentTime, uncachedBuffer, listenerCallbacks); return NO_ERROR; } case BOOT_FINISHED: { Loading libs/gui/LayerState.cpp +5 −20 Original line number Diff line number Diff line Loading @@ -86,14 +86,7 @@ status_t layer_state_t::write(Parcel& output) const memcpy(output.writeInplace(16 * sizeof(float)), colorTransform.asArray(), 16 * sizeof(float)); output.writeFloat(cornerRadius); if (output.writeVectorSize(listenerCallbacks) == NO_ERROR) { for (const auto& [listener, callbackIds] : listenerCallbacks) { output.writeStrongBinder(IInterface::asBinder(listener)); output.writeInt64Vector(callbackIds); } } output.writeBool(hasListenerCallbacks); output.writeStrongBinder(cachedBuffer.token); output.writeUint64(cachedBuffer.cacheId); output.writeParcelable(metadata); Loading Loading @@ -163,15 +156,7 @@ status_t layer_state_t::read(const Parcel& input) colorTransform = mat4(static_cast<const float*>(input.readInplace(16 * sizeof(float)))); cornerRadius = input.readFloat(); int32_t listenersSize = input.readInt32(); for (int32_t i = 0; i < listenersSize; i++) { auto listener = interface_cast<ITransactionCompletedListener>(input.readStrongBinder()); std::vector<CallbackId> callbackIds; input.readInt64Vector(&callbackIds); listenerCallbacks.emplace_back(listener, callbackIds); } hasListenerCallbacks = input.readBool(); cachedBuffer.token = input.readStrongBinder(); cachedBuffer.cacheId = input.readUint64(); input.readParcelable(&metadata); Loading Loading @@ -376,9 +361,9 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eColorTransformChanged; colorTransform = other.colorTransform; } if (other.what & eListenerCallbacksChanged) { what |= eListenerCallbacksChanged; listenerCallbacks = other.listenerCallbacks; if (other.what & eHasListenerCallbacksChanged) { what |= eHasListenerCallbacksChanged; hasListenerCallbacks = other.hasListenerCallbacks; } #ifndef NO_INPUT Loading Loading
cmds/dumpstate/dumpstate.cpp +15 −5 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <unistd.h> #include <chrono> #include <fstream> #include <functional> #include <future> #include <memory> Loading Loading @@ -194,6 +195,15 @@ static bool UnlinkAndLogOnError(const std::string& file) { return true; } static bool IsFileEmpty(const std::string& file_path) { std::ifstream file(file_path, std::ios::binary | std::ios::ate); if(file.bad()) { MYLOGE("Cannot open file: %s\n", file_path.c_str()); return true; } return file.tellg() <= 0; } } // namespace } // namespace os } // namespace android Loading Loading @@ -2149,7 +2159,7 @@ static void SendBugreportFinishedBroadcast() { "--es", "android.intent.extra.DUMPSTATE_LOG", ds.log_path_ }; // clang-format on if (ds.options_->do_fb) { if (ds.options_->do_fb && !android::os::IsFileEmpty(ds.screenshot_path_)) { am_args.push_back("--es"); am_args.push_back("android.intent.extra.SCREENSHOT"); am_args.push_back(ds.screenshot_path_); Loading Loading @@ -2225,13 +2235,13 @@ static void SetOptionsFromMode(Dumpstate::BugreportMode mode, Dumpstate::DumpOpt break; case Dumpstate::BugreportMode::BUGREPORT_TELEPHONY: options->telephony_only = true; options->do_fb = true; options->do_fb = false; options->do_broadcast = true; break; case Dumpstate::BugreportMode::BUGREPORT_WIFI: options->wifi_only = true; options->do_zip_file = true; options->do_fb = true; options->do_fb = false; options->do_broadcast = true; break; case Dumpstate::BugreportMode::BUGREPORT_DEFAULT: Loading Loading @@ -2735,8 +2745,8 @@ void Dumpstate::CheckUserConsent(int32_t calling_uid, const android::String16& c if (ics != nullptr) { MYLOGD("Checking user consent via incidentcompanion service\n"); android::interface_cast<android::os::IIncidentCompanion>(ics)->authorizeReport( calling_uid, calling_package, 0x1 /* FLAG_CONFIRMATION_DIALOG */, consent_callback_.get()); calling_uid, calling_package, String16(), String16(), 0x1 /* FLAG_CONFIRMATION_DIALOG */, consent_callback_.get()); } else { MYLOGD("Unable to check user consent; incidentcompanion service unavailable\n"); } Loading
cmds/dumpstate/tests/dumpstate_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -373,7 +373,7 @@ TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { EXPECT_EQ(status, Dumpstate::RunStatus::OK); EXPECT_TRUE(options_.do_add_date); EXPECT_TRUE(options_.do_fb); EXPECT_FALSE(options_.do_fb); EXPECT_TRUE(options_.do_broadcast); EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.telephony_only); Loading Loading @@ -404,7 +404,7 @@ TEST_F(DumpOptionsTest, InitializeWifiBugReport) { EXPECT_EQ(status, Dumpstate::RunStatus::OK); EXPECT_TRUE(options_.do_add_date); EXPECT_TRUE(options_.do_fb); EXPECT_FALSE(options_.do_fb); EXPECT_TRUE(options_.do_broadcast); EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.wifi_only); Loading
libs/gui/IGraphicBufferProducer.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -781,6 +781,10 @@ status_t BnGraphicBufferProducer::onTransact( int result = dequeueBuffer(&buf, &fence, width, height, format, usage, &bufferAge, getTimestamps ? &frameTimestamps : nullptr); if (fence == nullptr) { ALOGE("dequeueBuffer returned a NULL fence, setting to Fence::NO_FENCE"); fence = Fence::NO_FENCE; } reply->writeInt32(buf); reply->write(*fence); reply->writeUint64(bufferAge); Loading Loading @@ -963,6 +967,10 @@ status_t BnGraphicBufferProducer::onTransact( ALOGE("getLastQueuedBuffer failed to write buffer: %d", result); return result; } if (fence == nullptr) { ALOGE("getLastQueuedBuffer returned a NULL fence, setting to Fence::NO_FENCE"); fence = Fence::NO_FENCE; } result = reply->write(*fence); if (result != NO_ERROR) { ALOGE("getLastQueuedBuffer failed to write fence: %d", result); Loading
libs/gui/ISurfaceComposer.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ public: const sp<IBinder>& applyToken, const InputWindowCommands& commands, int64_t desiredPresentTime, const cached_buffer_t& uncacheBuffer) { const cached_buffer_t& uncacheBuffer, const std::vector<ListenerCallbacks>& listenerCallbacks) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading @@ -89,6 +90,14 @@ public: data.writeInt64(desiredPresentTime); data.writeStrongBinder(uncacheBuffer.token); data.writeUint64(uncacheBuffer.cacheId); if (data.writeVectorSize(listenerCallbacks) == NO_ERROR) { for (const auto& [listener, callbackIds] : listenerCallbacks) { data.writeStrongBinder(IInterface::asBinder(listener)); data.writeInt64Vector(callbackIds); } } remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply); } Loading Loading @@ -978,8 +987,18 @@ status_t BnSurfaceComposer::onTransact( uncachedBuffer.token = data.readStrongBinder(); uncachedBuffer.cacheId = data.readUint64(); std::vector<ListenerCallbacks> listenerCallbacks; int32_t listenersSize = data.readInt32(); for (int32_t i = 0; i < listenersSize; i++) { auto listener = interface_cast<ITransactionCompletedListener>(data.readStrongBinder()); std::vector<CallbackId> callbackIds; data.readInt64Vector(&callbackIds); listenerCallbacks.emplace_back(listener, callbackIds); } setTransactionState(state, displays, stateFlags, applyToken, inputWindowCommands, desiredPresentTime, uncachedBuffer); desiredPresentTime, uncachedBuffer, listenerCallbacks); return NO_ERROR; } case BOOT_FINISHED: { Loading
libs/gui/LayerState.cpp +5 −20 Original line number Diff line number Diff line Loading @@ -86,14 +86,7 @@ status_t layer_state_t::write(Parcel& output) const memcpy(output.writeInplace(16 * sizeof(float)), colorTransform.asArray(), 16 * sizeof(float)); output.writeFloat(cornerRadius); if (output.writeVectorSize(listenerCallbacks) == NO_ERROR) { for (const auto& [listener, callbackIds] : listenerCallbacks) { output.writeStrongBinder(IInterface::asBinder(listener)); output.writeInt64Vector(callbackIds); } } output.writeBool(hasListenerCallbacks); output.writeStrongBinder(cachedBuffer.token); output.writeUint64(cachedBuffer.cacheId); output.writeParcelable(metadata); Loading Loading @@ -163,15 +156,7 @@ status_t layer_state_t::read(const Parcel& input) colorTransform = mat4(static_cast<const float*>(input.readInplace(16 * sizeof(float)))); cornerRadius = input.readFloat(); int32_t listenersSize = input.readInt32(); for (int32_t i = 0; i < listenersSize; i++) { auto listener = interface_cast<ITransactionCompletedListener>(input.readStrongBinder()); std::vector<CallbackId> callbackIds; input.readInt64Vector(&callbackIds); listenerCallbacks.emplace_back(listener, callbackIds); } hasListenerCallbacks = input.readBool(); cachedBuffer.token = input.readStrongBinder(); cachedBuffer.cacheId = input.readUint64(); input.readParcelable(&metadata); Loading Loading @@ -376,9 +361,9 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eColorTransformChanged; colorTransform = other.colorTransform; } if (other.what & eListenerCallbacksChanged) { what |= eListenerCallbacksChanged; listenerCallbacks = other.listenerCallbacks; if (other.what & eHasListenerCallbacksChanged) { what |= eHasListenerCallbacksChanged; hasListenerCallbacks = other.hasListenerCallbacks; } #ifndef NO_INPUT Loading