Skip to content

Commit 8ae6af8

Browse files
committed
Enforce clang-format on host/libs/confui
Bug: b/512215781
1 parent b545852 commit 8ae6af8

12 files changed

Lines changed: 40 additions & 43 deletions

File tree

base/cvd/cuttlefish/host/libs/confui/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ cf_cc_library(
7171
"sign.h",
7272
"sign_utils.h",
7373
],
74-
clang_format_enabled = False,
7574
deps = [
7675
"//cuttlefish/common/libs/concurrency",
7776
"//cuttlefish/common/libs/confui:protocol",

base/cvd/cuttlefish/host/libs/confui/confui_cbor.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ void Cbor::Init() {
4545
return;
4646
}
4747
auto success = cbor_map_add(
48-
cb_map_.get(), (struct cbor_pair){.key = cbor_move(cbor_build_string("prompt")),
49-
.value = cbor_move(cb_prompt)});
48+
cb_map_.get(),
49+
(struct cbor_pair){.key = cbor_move(cbor_build_string("prompt")),
50+
.value = cbor_move(cb_prompt)});
5051
if (!success) {
5152
// Shouldn't happen, the map has capacity for 2.
5253
buffer_status_ = Error::OUT_OF_DATA;
@@ -59,8 +60,9 @@ void Cbor::Init() {
5960
return;
6061
}
6162
success = cbor_map_add(
62-
cb_map_.get(), (struct cbor_pair){.key = cbor_move(cbor_build_string("extra")),
63-
.value = cbor_move(cb_extra_data)});
63+
cb_map_.get(),
64+
(struct cbor_pair){.key = cbor_move(cbor_build_string("extra")),
65+
.value = cbor_move(cb_extra_data)});
6466
if (!success) {
6567
// Shouldn't happen, the map has capacity for 2.
6668
buffer_status_ = Error::MALFORMED;

base/cvd/cuttlefish/host/libs/confui/generate_font_cc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ set -o pipefail
55
fontfile="$1"
66
varname="$2"
77

8+
echo "// clang-format off"
9+
810
# The array variable name is followed by [], while the length variable name ends
911
# in _len. This would be much easier with the -n option, but it's not present in
1012
# all platforms.
1113
xxd -i "${fontfile}" | \
1214
sed -e "s|[^ ]*\\[|${varname}\\[|" | \
1315
sed -e "s|[^ ]*_len |${varname}_length |"
16+
17+
echo "// clang-format on"

base/cvd/cuttlefish/host/libs/confui/host_mode_ctrl.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <functional>
2424
#include <mutex>
2525

26-
#include <fruit/fruit.h>
26+
#include "fruit/fruit.h"
2727

2828
#include "cuttlefish/common/libs/confui/utils.h"
2929
#include "cuttlefish/host/libs/confui/host_utils.h"
@@ -62,10 +62,10 @@ class HostModeCtrl {
6262
*/
6363
void WaitAndroidMode() {
6464
ConfUiLogDebug << cuttlefish::confui::thread::GetName()
65-
<< "checking atomic Android mode";
65+
<< "checking atomic Android mode";
6666
if (atomic_mode_ == ModeType::kAndroidMode) {
6767
ConfUiLogDebug << cuttlefish::confui::thread::GetName()
68-
<< "returns as it is already Android mode";
68+
<< "returns as it is already Android mode";
6969
return;
7070
}
7171
auto check = [this]() -> bool {
@@ -74,24 +74,24 @@ class HostModeCtrl {
7474
std::unique_lock<std::mutex> lock(mode_mtx_);
7575
and_mode_cv_.wait(lock, check);
7676
ConfUiLogDebug << cuttlefish::confui::thread::GetName()
77-
<< "awakes from cond var waiting for Android mode";
77+
<< "awakes from cond var waiting for Android mode";
7878
}
7979

8080
void SetMode(const ModeType mode) {
8181
ConfUiLogDebug << cuttlefish::confui::thread::GetName()
82-
<< " tries to acquire the lock in SetMode";
82+
<< " tries to acquire the lock in SetMode";
8383
std::lock_guard<std::mutex> lock(mode_mtx_);
8484
ConfUiLogDebug << cuttlefish::confui::thread::GetName()
85-
<< " acquired the lock in SetMode";
85+
<< " acquired the lock in SetMode";
8686
atomic_mode_ = mode;
8787
if (atomic_mode_ == ModeType::kAndroidMode) {
8888
ConfUiLogDebug << cuttlefish::confui::thread::GetName()
89-
<< " signals kAndroidMode in SetMode";
89+
<< " signals kAndroidMode in SetMode";
9090
and_mode_cv_.notify_all();
9191
return;
9292
}
9393
ConfUiLogDebug << cuttlefish::confui::thread::GetName()
94-
<< "signals kConfUI_Mode in SetMode";
94+
<< "signals kConfUI_Mode in SetMode";
9595
confui_mode_cv_.notify_all();
9696
}
9797

base/cvd/cuttlefish/host/libs/confui/host_renderer.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include <string>
2222
#include <vector>
2323

24-
#include <drm/drm_fourcc.h>
2524
#include "absl/log/check.h"
25+
#include "drm/drm_fourcc.h"
2626

2727
#include "cuttlefish/common/libs/confui/utils.h"
2828
#include "cuttlefish/host/libs/config/cuttlefish_config.h"
@@ -85,8 +85,8 @@ class ConfUiRendererImpl {
8585
ConfUiRendererImpl(uint32_t display, const std::string& confirmation_msg,
8686
const std::string& locale, bool inverted, bool magnified);
8787

88-
struct Boundary { // inclusive but.. LayoutElement's size is float
89-
uint32_t x, y, w, h; // (x, y) is the top left
88+
struct Boundary { // inclusive but.. LayoutElement's size is float
89+
uint32_t x, y, w, h; // (x, y) is the top left
9090
};
9191

9292
template <typename LayoutElement>
@@ -285,8 +285,7 @@ teeui::Error ConfUiRendererImpl::UpdateTranslations() {
285285

286286
void ConfUiRendererImpl::SetDeviceContext(unsigned long long w,
287287
const unsigned long long h,
288-
bool is_inverted,
289-
bool is_magnified) {
288+
bool is_inverted, bool is_magnified) {
290289
using namespace teeui;
291290
const auto screen_width = pxs(w);
292291
const auto screen_height = pxs(h);
@@ -366,8 +365,8 @@ std::unique_ptr<TeeUiFrameWrapper>& ConfUiRendererImpl::RenderRawFrame() {
366365
return raw_frame_;
367366
}
368367

369-
std::unique_ptr<TeeUiFrameWrapper> ConfUiRendererImpl::RepaintRawFrame(
370-
int w, int h) {
368+
std::unique_ptr<TeeUiFrameWrapper> ConfUiRendererImpl::RepaintRawFrame(int w,
369+
int h) {
371370
std::get<teeui::LabelOK>(layout_).setTextColor(kColorEnabled);
372371
std::get<teeui::LabelCancel>(layout_).setTextColor(kColorEnabled);
373372

base/cvd/cuttlefish/host/libs/confui/host_renderer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#include <tuple>
2525
#include <vector>
2626

27-
#include <freetype/ftglyph.h> // $(croot)/external/freetype
28-
#include <fruit/fruit.h>
29-
#include <teeui/utils.h> // $(croot)/system/teeui/libteeui/.../include
27+
#include "freetype/ftglyph.h" // $(croot)/external/freetype
28+
#include "fruit/fruit.h"
29+
#include "teeui/utils.h" // $(croot)/system/teeui/libteeui/.../include
3030

3131
#include "cuttlefish/host/libs/confui/layouts/layout.h"
3232
#include "cuttlefish/host/libs/confui/server_common.h"

base/cvd/cuttlefish/host/libs/confui/host_virtual_input.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,3 @@ std::unique_ptr<InputConnector::EventSink> HostVirtualInput::CreateSink() {
157157

158158
} // namespace confui
159159
} // namespace cuttlefish
160-

base/cvd/cuttlefish/host/libs/confui/host_virtual_input.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <memory>
2222

23-
#include <fruit/fruit.h>
23+
#include "fruit/fruit.h"
2424

2525
#include "cuttlefish/host/libs/confui/host_server.h"
2626
#include "cuttlefish/host/libs/input_connector/input_connector.h"

base/cvd/cuttlefish/host/libs/confui/layouts/fonts.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ extern unsigned int RobotoRegular_length;
2525

2626
extern unsigned char Shield[];
2727
extern unsigned int Shield_length;
28-

base/cvd/cuttlefish/host/libs/confui/session.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
#include "absl/log/log.h"
2626

27-
#include "cuttlefish/common/libs/confui/utils.h"
2827
#include "cuttlefish/common/libs/confui/protocol.h"
28+
#include "cuttlefish/common/libs/confui/utils.h"
2929
#include "cuttlefish/host/libs/confui/secure_input.h"
3030

3131
namespace cuttlefish {
@@ -159,7 +159,7 @@ bool Session::HandleInit(SharedFD hal_cli, const FsmInput fsm_input,
159159

160160
// Start Session
161161
ConfUiLogVerbose << "Sending ack to hal_cli: "
162-
<< Enum2Base(ConfUiCmd::kCliAck);
162+
<< Enum2Base(ConfUiCmd::kCliAck);
163163
host_mode_ctrl_.SetMode(HostModeCtrl::ModeType::kConfUI_Mode);
164164

165165
auto start_cmd_msg = static_cast<const ConfUiStartMessage&>(conf_ui_message);

0 commit comments

Comments
 (0)