Loading system/btif/avrcp/avrcp_service.cc +2 −5 Original line number Diff line number Diff line Loading @@ -682,11 +682,8 @@ void AvrcpService::DebugDump(int fd) { device_list.size()); std::stringstream stream; { ScopedIndent indent(stream); for (const auto& device : device_list) { stream << *device << std::endl; } stream << " " << *device << std::endl; } dprintf(fd, "%s", stream.str().c_str()); Loading system/internal_include/bt_trace.h +0 −49 Original line number Diff line number Diff line Loading @@ -95,53 +95,4 @@ inline std::string& AppendField(std::string* p_result, bool append, return *p_result; } // This object puts the stream in a state where every time that a new line // occurs, the next line is indented a certain number of spaces. The stream is // reset to its previous state when the object is destroyed. class ScopedIndent { public: ScopedIndent(std::ostream& stream, int indent_size = DEFAULT_TAB) : indented_buf_(stream, indent_size) { old_stream_ = &stream; old_stream_buf_ = stream.rdbuf(); stream.rdbuf(&indented_buf_); } ~ScopedIndent() { old_stream_->rdbuf(old_stream_buf_); } static const size_t DEFAULT_TAB = 2; private: class IndentedStreamBuf : public std::streambuf { public: IndentedStreamBuf(std::ostream& stream, int indent_size) : wrapped_buf_(stream.rdbuf()), indent_size_(indent_size), indent_next_line_(true){}; protected: virtual int overflow(int character) override { if (indent_next_line_ && character != '\n') { for (int i = 0; i < indent_size_; i++) wrapped_buf_->sputc(' '); } indent_next_line_ = false; if (character == '\n') { indent_next_line_ = true; } return wrapped_buf_->sputc(character); } private: std::streambuf* wrapped_buf_; int indent_size_; bool indent_next_line_; }; std::ostream* old_stream_; std::streambuf* old_stream_buf_; IndentedStreamBuf indented_buf_; }; #endif system/profile/avrcp/device.cc +16 −20 Original line number Diff line number Diff line Loading @@ -1878,16 +1878,13 @@ static std::string volumeToStr(int8_t volume) { std::ostream& operator<<(std::ostream& out, const Device& d) { // TODO: whether this should be turned into LOGGABLE STRING? out << ADDRESS_TO_LOGGABLE_STR(d.address_); out << " " << ADDRESS_TO_LOGGABLE_STR(d.address_); if (d.IsActive()) out << " <Active>"; out << std::endl; ScopedIndent indent(out); out << " Current Volume: " << volumeToStr(d.volume_) << std::endl; out << " Current Browsed Player ID: " << d.curr_browsed_player_id_ << std::endl; out << " Registered Notifications:\n"; { ScopedIndent indent(out); if (d.track_changed_.first) out << " Track Changed\n"; if (d.play_status_changed_.first) out << " Play Status\n"; if (d.play_pos_changed_.first) out << " Play Position\n"; Loading @@ -1896,7 +1893,6 @@ std::ostream& operator<<(std::ostream& out, const Device& d) { if (d.addr_player_changed_.first) out << " Addressed Player\n"; if (d.avail_players_changed_.first) out << " Available Players\n"; if (d.uids_changed_.first) out << " UIDs Changed\n"; } out << " Last Play State: " << d.last_play_status_.state << std::endl; out << " Last Song Sent ID: \"" << d.last_song_info_.media_id << "\"\n"; out << " Current Folder: \"" << d.CurrentFolder() << "\"\n"; Loading Loading
system/btif/avrcp/avrcp_service.cc +2 −5 Original line number Diff line number Diff line Loading @@ -682,11 +682,8 @@ void AvrcpService::DebugDump(int fd) { device_list.size()); std::stringstream stream; { ScopedIndent indent(stream); for (const auto& device : device_list) { stream << *device << std::endl; } stream << " " << *device << std::endl; } dprintf(fd, "%s", stream.str().c_str()); Loading
system/internal_include/bt_trace.h +0 −49 Original line number Diff line number Diff line Loading @@ -95,53 +95,4 @@ inline std::string& AppendField(std::string* p_result, bool append, return *p_result; } // This object puts the stream in a state where every time that a new line // occurs, the next line is indented a certain number of spaces. The stream is // reset to its previous state when the object is destroyed. class ScopedIndent { public: ScopedIndent(std::ostream& stream, int indent_size = DEFAULT_TAB) : indented_buf_(stream, indent_size) { old_stream_ = &stream; old_stream_buf_ = stream.rdbuf(); stream.rdbuf(&indented_buf_); } ~ScopedIndent() { old_stream_->rdbuf(old_stream_buf_); } static const size_t DEFAULT_TAB = 2; private: class IndentedStreamBuf : public std::streambuf { public: IndentedStreamBuf(std::ostream& stream, int indent_size) : wrapped_buf_(stream.rdbuf()), indent_size_(indent_size), indent_next_line_(true){}; protected: virtual int overflow(int character) override { if (indent_next_line_ && character != '\n') { for (int i = 0; i < indent_size_; i++) wrapped_buf_->sputc(' '); } indent_next_line_ = false; if (character == '\n') { indent_next_line_ = true; } return wrapped_buf_->sputc(character); } private: std::streambuf* wrapped_buf_; int indent_size_; bool indent_next_line_; }; std::ostream* old_stream_; std::streambuf* old_stream_buf_; IndentedStreamBuf indented_buf_; }; #endif
system/profile/avrcp/device.cc +16 −20 Original line number Diff line number Diff line Loading @@ -1878,16 +1878,13 @@ static std::string volumeToStr(int8_t volume) { std::ostream& operator<<(std::ostream& out, const Device& d) { // TODO: whether this should be turned into LOGGABLE STRING? out << ADDRESS_TO_LOGGABLE_STR(d.address_); out << " " << ADDRESS_TO_LOGGABLE_STR(d.address_); if (d.IsActive()) out << " <Active>"; out << std::endl; ScopedIndent indent(out); out << " Current Volume: " << volumeToStr(d.volume_) << std::endl; out << " Current Browsed Player ID: " << d.curr_browsed_player_id_ << std::endl; out << " Registered Notifications:\n"; { ScopedIndent indent(out); if (d.track_changed_.first) out << " Track Changed\n"; if (d.play_status_changed_.first) out << " Play Status\n"; if (d.play_pos_changed_.first) out << " Play Position\n"; Loading @@ -1896,7 +1893,6 @@ std::ostream& operator<<(std::ostream& out, const Device& d) { if (d.addr_player_changed_.first) out << " Addressed Player\n"; if (d.avail_players_changed_.first) out << " Available Players\n"; if (d.uids_changed_.first) out << " UIDs Changed\n"; } out << " Last Play State: " << d.last_play_status_.state << std::endl; out << " Last Song Sent ID: \"" << d.last_song_info_.media_id << "\"\n"; out << " Current Folder: \"" << d.CurrentFolder() << "\"\n"; Loading