aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-05-10 16:04:30 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-05-10 16:04:30 +0000
commit65241e83d9ea19a6e0f3893bb6f8b2cc69afe4e8 (patch)
treed6266e39f6226b302e7c675439d9b82c51f36733
parent7c15037b1e41d1c3de2ca9c22ea31bc42ed03888 (diff)
parent6d9ecb42e4b0f21ee2165cb7d8f97da435ec5dc9 (diff)
downloadrecovery-65241e83d9ea19a6e0f3893bb6f8b2cc69afe4e8.tar.gz
Snap for 10103804 from 6d9ecb42e4b0f21ee2165cb7d8f97da435ec5dc9 to mainline-tzdata5-release
Change-Id: I14ec2782bd512f54f240822de17a3b80fb285ca9
-rw-r--r--Android.bp1
-rw-r--r--README.md2
-rw-r--r--etc/init.rc2
-rw-r--r--install/include/install/wipe_device.h1
-rw-r--r--install/install.cpp36
-rw-r--r--install/wipe_device.cpp8
-rw-r--r--tools/recovery_l10n/res/values-as/strings.xml4
-rw-r--r--tools/recovery_l10n/res/values-te/strings.xml2
-rw-r--r--tools/recovery_l10n/res/values-zh-rHK/strings.xml2
9 files changed, 50 insertions, 8 deletions
diff --git a/Android.bp b/Android.bp
index d7139426..fba358fd 100644
--- a/Android.bp
+++ b/Android.bp
@@ -117,6 +117,7 @@ cc_defaults {
"libsnapshot_nobinder",
"libsnapshot_cow",
"liblz4",
+ "libzstd",
"update_metadata-protos",
],
}
diff --git a/README.md b/README.md
index 5ab19d14..507b2bd5 100644
--- a/README.md
+++ b/README.md
@@ -137,7 +137,7 @@ added to `$ADB_VENDOR_KEYS`.
Note that this mechanism applies to both of normal boot and recovery modes.
* **Option 2:** Allow `adbd` to connect without authentication.
- * `adbd` is compiled with `ALLOW_ADBD_NO_AUTH` (only on debuggable builds).
+ * bootloader is unlocked (`ro.boot.verifiedbootstate` is `orange`) or debuggable build.
* `ro.adb.secure` has a value of `0`.
Both of the two conditions need to be satisfied. Although `ro.adb.secure` is a runtime property, its
diff --git a/etc/init.rc b/etc/init.rc
index 03df27b0..c7ff2b2b 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -110,6 +110,8 @@ on fs && property:sys.usb.configfs=1
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/ffs.fastboot
mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell
+ # Set current limit to 900mA (b/277022505)
+ write /config/usb_gadget/g1/configs/b.1/MaxPower 0x384
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
on fs && property:sys.usb.configfs=0
diff --git a/install/include/install/wipe_device.h b/install/include/install/wipe_device.h
index 903ddfdc..19e7c65b 100644
--- a/install/include/install/wipe_device.h
+++ b/install/include/install/wipe_device.h
@@ -24,6 +24,7 @@
// Wipes the current A/B device, with a secure wipe of all the partitions in RECOVERY_WIPE.
bool WipeAbDevice(Device* device, size_t wipe_package_size);
+bool WipeAbDevice(Device* device, Package* wipe_package);
// Reads the "recovery.wipe" entry in the zip archive returns a list of partitions to wipe.
std::vector<std::string> GetWipePartitionList(Package* wipe_package);
diff --git a/install/install.cpp b/install/install.cpp
index 044856b6..a9786cfd 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -48,6 +48,7 @@
#include "install/spl_check.h"
#include "install/wipe_data.h"
+#include "install/wipe_device.h"
#include "otautil/error_code.h"
#include "otautil/package.h"
#include "otautil/paths.h"
@@ -70,6 +71,10 @@ static constexpr int VERIFICATION_PROGRESS_TIME = 60;
static constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25;
// The charater used to separate dynamic fingerprints. e.x. sargo|aosp-sargo
static const char* FINGERPRING_SEPARATOR = "|";
+static constexpr auto&& RELEASE_KEYS_TAG = "release-keys";
+// If brick packages are smaller than |MEMORY_PACKAGE_LIMIT|, read the entire package into memory
+static constexpr size_t MEMORY_PACKAGE_LIMIT = 1024 * 1024;
+
static std::condition_variable finish_log_temperature;
static bool isInStringList(const std::string& target_token, const std::string& str_list,
const std::string& deliminator);
@@ -213,6 +218,7 @@ bool CheckPackageMetadata(const std::map<std::string, std::string>& metadata, Ot
// We allow the package to not have any serialno; and we also allow it to carry multiple serial
// numbers split by "|"; e.g. serialno=serialno1|serialno2|serialno3 ... We will fail the
// verification if the device's serialno doesn't match any of these carried numbers.
+
auto pkg_serial_no = get_value(metadata, "serialno");
if (!pkg_serial_no.empty()) {
auto device_serial_no = android::base::GetProperty("ro.serialno", "");
@@ -226,6 +232,21 @@ bool CheckPackageMetadata(const std::map<std::string, std::string>& metadata, Ot
LOG(ERROR) << "Package is for serial " << pkg_serial_no;
return false;
}
+ } else if (ota_type == OtaType::BRICK) {
+ const auto device_build_tag = android::base::GetProperty("ro.build.tags", "");
+ if (device_build_tag.empty()) {
+ LOG(ERROR) << "Unable to determine device build tags, serial number is missing from package. "
+ "Rejecting the brick OTA package.";
+ return false;
+ }
+ if (device_build_tag == RELEASE_KEYS_TAG) {
+ LOG(ERROR) << "Device is release key build, serial number is missing from package. "
+ "Rejecting the brick OTA package.";
+ return false;
+ }
+ LOG(INFO)
+ << "Serial number is missing from brick OTA package, permitting anyway because device is "
+ << device_build_tag;
}
if (ota_type == OtaType::AB) {
@@ -364,7 +385,20 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
return INSTALL_CORRUPT;
}
- bool package_is_ab = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::AB);
+ const bool package_is_ab = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::AB);
+ const bool package_is_brick = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::BRICK);
+ if (package_is_brick) {
+ LOG(INFO) << "Installing a brick package";
+ if (package->GetType() == PackageType::kFile &&
+ package->GetPackageSize() < MEMORY_PACKAGE_LIMIT) {
+ std::vector<uint8_t> content(package->GetPackageSize());
+ if (package->ReadFullyAtOffset(content.data(), content.size(), 0)) {
+ auto memory_package = Package::CreateMemoryPackage(std::move(content), {});
+ return WipeAbDevice(device, memory_package.get()) ? INSTALL_SUCCESS : INSTALL_ERROR;
+ }
+ }
+ return WipeAbDevice(device, package) ? INSTALL_SUCCESS : INSTALL_ERROR;
+ }
bool device_supports_ab = android::base::GetBoolProperty("ro.build.ab_update", false);
bool ab_device_supports_nonab =
android::base::GetBoolProperty("ro.virtual_ab.allow_non_ab", false);
diff --git a/install/wipe_device.cpp b/install/wipe_device.cpp
index 0a525fa9..2656580f 100644
--- a/install/wipe_device.cpp
+++ b/install/wipe_device.cpp
@@ -182,13 +182,17 @@ bool WipeAbDevice(Device* device, size_t wipe_package_size) {
LOG(ERROR) << "Failed to open wipe package";
return false;
}
+ return WipeAbDevice(device, wipe_package.get());
+}
- if (!CheckWipePackage(wipe_package.get(), ui)) {
+bool WipeAbDevice(Device* device, Package* wipe_package) {
+ auto ui = device->GetUI();
+ if (!CheckWipePackage(wipe_package, ui)) {
LOG(ERROR) << "Failed to verify wipe package";
return false;
}
- auto partition_list = GetWipePartitionList(wipe_package.get());
+ auto partition_list = GetWipePartitionList(wipe_package);
if (partition_list.empty()) {
LOG(ERROR) << "Empty wipe ab partition list";
return false;
diff --git a/tools/recovery_l10n/res/values-as/strings.xml b/tools/recovery_l10n/res/values-as/strings.xml
index d956b9a3..8119090b 100644
--- a/tools/recovery_l10n/res/values-as/strings.xml
+++ b/tools/recovery_l10n/res/values-as/strings.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="recovery_installing" msgid="2013591905463558223">"আপডেইট ইনষ্টল কৰি থকা হৈছে"</string>
+ <string name="recovery_installing" msgid="2013591905463558223">"আপডে’ট ইনষ্টল কৰি থকা হৈছে"</string>
<string name="recovery_erasing" msgid="7334826894904037088">"মচি থকা হৈছে"</string>
<string name="recovery_no_command" msgid="4465476568623024327">"কোনো আদেশ নাই"</string>
<string name="recovery_error" msgid="5748178989622716736">"ত্ৰুটি!"</string>
- <string name="recovery_installing_security" msgid="9184031299717114342">"সুৰক্ষা আপডেইট ইনষ্টল কৰি থকা হৈছে"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"সুৰক্ষা আপডে’ট ইনষ্টল কৰি থকা হৈছে"</string>
<string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Android ছিষ্টেম ল\'ড কৰিব নোৱাৰি। আপোনাৰ ডেটাত কিবা আসোঁৱাহ থকা যেন লাগিছে। আপুনি যদি এই বাৰ্তাটো পায়েই থাকে, আপুনি নিজৰ ডিভাইচটো ফেক্টৰী ডেটা ৰিছেট কৰি সেইটোত থকা ব্যৱহাৰকাৰীৰ আটাইবোৰ ডেটা মচিব লগা হ\'ব পাৰে।"</string>
<string name="recovery_try_again" msgid="7168248750158873496">"আকৌ চেষ্টা কৰক"</string>
<string name="recovery_factory_data_reset" msgid="7321351565602894783">"ফেক্টৰী ডেটা ৰিছেট"</string>
diff --git a/tools/recovery_l10n/res/values-te/strings.xml b/tools/recovery_l10n/res/values-te/strings.xml
index 57470752..513ae9d5 100644
--- a/tools/recovery_l10n/res/values-te/strings.xml
+++ b/tools/recovery_l10n/res/values-te/strings.xml
@@ -6,7 +6,7 @@
<string name="recovery_no_command" msgid="4465476568623024327">"ఆదేశం లేదు"</string>
<string name="recovery_error" msgid="5748178989622716736">"ఎర్రర్ ఏర్పడింది!"</string>
<string name="recovery_installing_security" msgid="9184031299717114342">"సెక్యూరిటీ అప్‌డేట్‌ను ఇన్‌స్టాల్ చేస్తోంది"</string>
- <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Android సిస్టమ్‌ని లోడ్ చేయడం సాధ్యం కాదు. మీ డేటా పాడై ఉండవచ్చు. మీకు ఈ మెసేజ్‌ వస్తూనే ఉంటే, మీరు ఫ్యాక్టరీ డేటా రీసెట్ చేసి, పరికరంలో నిల్వ అయిన వినియోగదారు డేటా మొత్తాన్ని తొలగించాల్సి రావచ్చు."</string>
+ <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Android సిస్టమ్‌ని లోడ్ చేయడం సాధ్యం కాదు. మీ డేటా పాడై ఉండవచ్చు. మీకు ఈ మెసేజ్‌ వస్తూనే ఉంటే, మీరు ఫ్యాక్టరీ డేటా రీసెట్ చేసి, పరికరంలో స్టోరేజ్‌ అయిన వినియోగదారు డేటా మొత్తాన్ని తొలగించాల్సి రావచ్చు."</string>
<string name="recovery_try_again" msgid="7168248750158873496">"మళ్లీ ప్రయత్నించు"</string>
<string name="recovery_factory_data_reset" msgid="7321351565602894783">"ఫ్యాక్టరీ డేటా రీసెట్"</string>
<string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"వినియోగదారు డేటా మొత్తాన్ని తొలగించాలా?\n\n ఈ చర్యను రద్దు చేయలేరు!"</string>
diff --git a/tools/recovery_l10n/res/values-zh-rHK/strings.xml b/tools/recovery_l10n/res/values-zh-rHK/strings.xml
index 55ce31e9..0f5b7d90 100644
--- a/tools/recovery_l10n/res/values-zh-rHK/strings.xml
+++ b/tools/recovery_l10n/res/values-zh-rHK/strings.xml
@@ -6,7 +6,7 @@
<string name="recovery_no_command" msgid="4465476568623024327">"沒有指令"</string>
<string name="recovery_error" msgid="5748178989622716736">"錯誤!"</string>
<string name="recovery_installing_security" msgid="9184031299717114342">"正在安裝安全性更新"</string>
- <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"無法載入 Android 系統。您的資料可能已損壞。如您繼續收到此訊息,則可能需要將裝置回復原廠設定,並清除儲存在裝置上的所有使用者資料。"</string>
+ <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"無法載入 Android 系統。你的資料可能已損壞。如你繼續收到此訊息,則可能需要將裝置回復原廠設定,並清除儲存在裝置上的所有使用者資料。"</string>
<string name="recovery_try_again" msgid="7168248750158873496">"再試一次"</string>
<string name="recovery_factory_data_reset" msgid="7321351565602894783">"回復原廠設定"</string>
<string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"要清除所有使用者資料嗎?\n\n這項操作無法復原!"</string>