From 4d0df88d88db381422ee912f2609258d72eca4cf Mon Sep 17 00:00:00 2001 From: Hongguang Chen Date: Tue, 21 Apr 2020 20:58:04 -0700 Subject: Add EthernetDevice to manage ethernet connection. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current fastbootd only supports USB protocol. But some Android TV devices are built without USB port. The fastbootd cannot be used on those ATV devices due to it. aosp/1295566 enables fastbootd over ethernet. This change adds an EthernetDevice to manage ethernet connection and set fastbootd protcol property fastbootd.protocol to enable fastbootd over ethernet in recovery mode. It uses IPv6 link-local address to not expose the devices out of the network segment. The devices who want to use this EthernetDevice should add “TARGET_RECOVERY_UI_LIB := librecovery_ui_ethernet” into BoardConfig.mk. BUG: 152544169 BUG: 155198345 Test: Enter and exit fastboot mode and check eth0 IPv6 link-local address on screen UI. Change-Id: I73fe44be3790bdba5a6059fbba3f7264b21eed99 Merged-In: I73fe44be3790bdba5a6059fbba3f7264b21eed99 --- recovery_ui/ethernet_ui.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 recovery_ui/ethernet_ui.cpp (limited to 'recovery_ui/ethernet_ui.cpp') diff --git a/recovery_ui/ethernet_ui.cpp b/recovery_ui/ethernet_ui.cpp new file mode 100644 index 000000000..535d407f9 --- /dev/null +++ b/recovery_ui/ethernet_ui.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "recovery_ui/ethernet_ui.h" + +#include + +void EthernetRecoveryUI::SetTitle(const std::vector& lines) { + ScreenRecoveryUI::SetTitle(lines); + + // Append IP address, if any + if (!address_.empty()) { + title_lines_.push_back("IPv6 link-local address - " + address_); + } +} + +void EthernetRecoveryUI::SetIPv6LinkLocalAddress(const std::string& address) { + address_ = address; +} -- cgit v1.2.3