diff options
29 files changed, 395 insertions, 322 deletions
diff --git a/Android.bp b/Android.bp index 22c90bd3e..630c7965e 100644 --- a/Android.bp +++ b/Android.bp @@ -16,14 +16,48 @@ cc_defaults { name: "recovery_defaults", cflags: [ + "-D_FILE_OFFSET_BITS=64", + + // Must be the same as RECOVERY_API_VERSION. + "-DRECOVERY_API_VERSION=3", + "-Wall", "-Werror", ], } +cc_library { + name: "librecovery_ui", + recovery_available: true, + + defaults: [ + "recovery_defaults", + ], + + srcs: [ + "device.cpp", + "screen_ui.cpp", + "ui.cpp", + "vr_ui.cpp", + "wear_ui.cpp" + ], + + static_libs: [ + "libminui", + "libotautil", + ], + + shared_libs: [ + "libbase", + "libpng", + "libz", + ], +} + // Generic device that uses ScreenRecoveryUI. cc_library_static { name: "librecovery_ui_default", + recovery_available: true, defaults: [ "recovery_defaults", @@ -37,6 +71,7 @@ cc_library_static { // The default wear device that uses WearRecoveryUI. cc_library_static { name: "librecovery_ui_wear", + recovery_available: true, defaults: [ "recovery_defaults", @@ -50,6 +85,7 @@ cc_library_static { // The default VR device that uses VrRecoveryUI. cc_library_static { name: "librecovery_ui_vr", + recovery_available: true, defaults: [ "recovery_defaults", @@ -60,8 +96,79 @@ cc_library_static { ], } +cc_defaults { + name: "librecovery_defaults", + + defaults: [ + "recovery_defaults", + ], + + shared_libs: [ + "libbase", + "libbootloader_message", + "libcrypto", + "libcrypto_utils", + "libcutils", + "libext4_utils", + "libfs_mgr", + "libfusesideload", + "libhidl-gen-utils", + "liblog", + "libpng", + "libselinux", + "libsparse", + "libtinyxml2", + "libutils", + "libz", + "libziparchive", + ], + + static_libs: [ + "libminui", + "libverifier", + "libotautil", + "libvintf_recovery", + "libvintf", + + // TODO(b/80132328): Remove the dependency on static health HAL. + "libhealthd.default", + "android.hardware.health@2.0-impl", + "android.hardware.health@2.0", + "android.hardware.health@1.0", + "android.hardware.health@1.0-convert", + "libhealthstoragedefault", + "libhidltransport", + "libhidlbase", + "libhwbinder_noltopgo", + "libbatterymonitor", + ], +} + +cc_library_static { + name: "librecovery", + recovery_available: true, + + defaults: [ + "librecovery_defaults", + ], + + srcs: [ + "adb_install.cpp", + "fsck_unshare_blocks.cpp", + "fuse_sdcard_provider.cpp", + "install.cpp", + "recovery.cpp", + "roots.cpp", + ], + + include_dirs: [ + "system/vold", + ], +} + cc_library_static { name: "libverifier", + recovery_available: true, defaults: [ "recovery_defaults", @@ -72,14 +179,49 @@ cc_library_static { "verifier.cpp", ], - static_libs: [ + shared_libs: [ "libbase", "libcrypto", "libcrypto_utils", + ], + + static_libs: [ "libotautil", ], } +cc_binary { + name: "recovery", + recovery: true, + + defaults: [ + "librecovery_defaults", + ], + + srcs: [ + "logging.cpp", + "recovery_main.cpp", + ], + + shared_libs: [ + "libminadbd_services", + "librecovery_ui", + ], + + static_libs: [ + "librecovery", + "librecovery_ui_default", + ], + + required: [ + "e2fsdroid.recovery", + "librecovery_ui_ext", + "mke2fs.conf", + "mke2fs.recovery", + "recovery_deps", + ], +} + // The dynamic executable that runs after /data mounts. cc_binary { name: "recovery-persist", diff --git a/Android.mk b/Android.mk index 9542080ca..9888f8616 100644 --- a/Android.mk +++ b/Android.mk @@ -23,11 +23,6 @@ RECOVERY_FSTAB_VERSION := 2 # librecovery_ui_default, which uses ScreenRecoveryUI. TARGET_RECOVERY_UI_LIB ?= librecovery_ui_default -recovery_common_cflags := \ - -Wall \ - -Werror \ - -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) - # librecovery_ui_ext (shared library) # =================================== include $(CLEAR_VARS) @@ -49,151 +44,16 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \ libbase \ liblog \ - librecovery_ui - -include $(BUILD_SHARED_LIBRARY) - -# librecovery_ui (shared library) -# =============================== -include $(CLEAR_VARS) -LOCAL_SRC_FILES := \ - device.cpp \ - screen_ui.cpp \ - ui.cpp \ - vr_ui.cpp \ - wear_ui.cpp - -LOCAL_MODULE := librecovery_ui - -LOCAL_CFLAGS := $(recovery_common_cflags) - -LOCAL_MULTILIB := first - -ifeq ($(TARGET_IS_64_BIT),true) -LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/lib64 -else -LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/lib -endif - -LOCAL_STATIC_LIBRARIES := \ - libminui \ - libotautil \ - -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libpng \ - libz \ + librecovery_ui.recovery include $(BUILD_SHARED_LIBRARY) -# librecovery_ui (static library) -# =============================== +# recovery_deps: A phony target that's depended on by `recovery`, which +# builds additional modules conditionally based on Makefile variables. +# ====================================================================== include $(CLEAR_VARS) -LOCAL_SRC_FILES := \ - device.cpp \ - screen_ui.cpp \ - ui.cpp \ - vr_ui.cpp \ - wear_ui.cpp - -LOCAL_MODULE := librecovery_ui -LOCAL_CFLAGS := $(recovery_common_cflags) - -LOCAL_STATIC_LIBRARIES := \ - libminui \ - libotautil \ - -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libpng \ - libz \ - -include $(BUILD_STATIC_LIBRARY) - -librecovery_static_libraries := \ - libbootloader_message \ - libfusesideload \ - libminadbd \ - libminui \ - libverifier \ - libotautil \ - libasyncio \ - libbatterymonitor \ - libcrypto_utils \ - libcrypto \ - libext4_utils \ - libfs_mgr \ - libpng \ - libsparse \ - libvintf_recovery \ - libvintf \ - libhidl-gen-utils \ - libtinyxml2 \ - libziparchive \ - libbase \ - libutils \ - libcutils \ - liblog \ - libselinux \ - libz \ - -# librecovery (static library) -# =============================== -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - adb_install.cpp \ - fsck_unshare_blocks.cpp \ - fuse_sdcard_provider.cpp \ - install.cpp \ - recovery.cpp \ - roots.cpp \ - -LOCAL_C_INCLUDES := \ - system/vold \ - -LOCAL_CFLAGS := $(recovery_common_cflags) - -LOCAL_MODULE := librecovery - -LOCAL_STATIC_LIBRARIES := \ - $(librecovery_static_libraries) - -include $(BUILD_STATIC_LIBRARY) - -# recovery (static executable) -# =============================== -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - logging.cpp \ - recovery_main.cpp \ - -LOCAL_MODULE := recovery - -LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/bin - -# Cannot link with LLD: undefined symbol: UsbNoPermissionsLongHelpText -# http://b/77543887, lld does not handle -Wl,--gc-sections as well as ld. -LOCAL_USE_CLANG_LLD := false - -LOCAL_CFLAGS := $(recovery_common_cflags) - -LOCAL_STATIC_LIBRARIES := \ - librecovery \ - librecovery_ui_default \ - $(librecovery_static_libraries) - -LOCAL_SHARED_LIBRARIES := \ - librecovery_ui \ - -LOCAL_HAL_STATIC_LIBRARIES := libhealthd - -LOCAL_REQUIRED_MODULES := \ - e2fsdroid.recovery \ - mke2fs.recovery \ - mke2fs.conf +LOCAL_MODULE := recovery_deps ifeq ($(TARGET_USERIMAGES_USE_F2FS),true) ifeq ($(HOST_OS),linux) @@ -206,7 +66,8 @@ endif # e2fsck is needed for adb remount -R. ifeq ($(BOARD_EXT4_SHARE_DUP_BLOCKS),true) ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) -LOCAL_REQUIRED_MODULES += e2fsck_static +LOCAL_REQUIRED_MODULES += \ + e2fsck_static endif endif @@ -216,21 +77,8 @@ LOCAL_REQUIRED_MODULES += \ recovery-refresh endif -LOCAL_REQUIRED_MODULES += \ - librecovery_ui_ext - -# TODO(b/110380063): Explicitly install the following shared libraries to recovery, until `recovery` -# module is built with Soong (with `recovery: true` flag). -LOCAL_REQUIRED_MODULES += \ - libbase.recovery \ - liblog.recovery \ - libpng.recovery \ - libz.recovery \ - -include $(BUILD_EXECUTABLE) +include $(BUILD_PHONY_PACKAGE) include \ - $(LOCAL_PATH)/boot_control/Android.mk \ $(LOCAL_PATH)/tests/Android.mk \ $(LOCAL_PATH)/updater/Android.mk \ - $(LOCAL_PATH)/updater_sample/Android.mk \ diff --git a/boot_control/Android.bp b/boot_control/Android.bp new file mode 100644 index 000000000..7720ead50 --- /dev/null +++ b/boot_control/Android.bp @@ -0,0 +1,37 @@ +// +// Copyright (C) 2018 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. +// + +cc_library_shared { + name: "bootctrl.default", + recovery_available: true, + relative_install_path: "hw", + + srcs: ["boot_control.cpp"], + + cflags: [ + "-D_FILE_OFFSET_BITS=64", + "-Werror", + "-Wall", + "-Wextra", + ], + + shared_libs: [ + "libbase", + "libbootloader_message", + "libfs_mgr", + "liblog", + ], +} diff --git a/boot_control/Android.mk b/boot_control/Android.mk deleted file mode 100644 index 9814d7122..000000000 --- a/boot_control/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (C) 2017 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. -# - -LOCAL_PATH := $(my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := bootctrl.bcb -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SRC_FILES := boot_control.cpp -LOCAL_CFLAGS := \ - -D_FILE_OFFSET_BITS=64 \ - -Werror \ - -Wall \ - -Wextra -LOCAL_SHARED_LIBRARIES := liblog -LOCAL_STATIC_LIBRARIES := libbootloader_message libfs_mgr libbase -LOCAL_POST_INSTALL_CMD := \ - $(hide) mkdir -p $(TARGET_OUT_SHARED_LIBRARIES)/hw && \ - ln -sf bootctrl.bcb.so $(TARGET_OUT_SHARED_LIBRARIES)/hw/bootctrl.default.so -include $(BUILD_SHARED_LIBRARY) diff --git a/etc/init.rc b/etc/init.rc index 8e18438b5..3821eb6a8 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -77,7 +77,7 @@ on late-init trigger early-boot trigger boot -service ueventd /sbin/ueventd +service ueventd /system/bin/ueventd critical seclabel u:r:ueventd:s0 diff --git a/fuse_sideload/Android.bp b/fuse_sideload/Android.bp index 76bc16df9..90c4c22c3 100644 --- a/fuse_sideload/Android.bp +++ b/fuse_sideload/Android.bp @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -cc_library_static { +cc_library { name: "libfusesideload", + recovery_available: true, cflags: [ "-D_XOPEN_SOURCE", @@ -30,7 +31,7 @@ cc_library_static { "include", ], - static_libs: [ + shared_libs: [ "libbase", "libcrypto", ], diff --git a/minadbd/Android.bp b/minadbd/Android.bp index 432b2f0f5..00244ee7e 100644 --- a/minadbd/Android.bp +++ b/minadbd/Android.bp @@ -26,8 +26,11 @@ cc_defaults { ], } -cc_library_static { - name: "libminadbd", +// `libminadbd_services` is analogous to the `libadbd_services` for regular `adbd`, but providing +// the sideload service only. +cc_library { + name: "libminadbd_services", + recovery_available: true, defaults: [ "minadbd_defaults", @@ -39,14 +42,11 @@ cc_library_static { "minadbd_services.cpp", ], - static_libs: [ - "libfusesideload", + shared_libs: [ + "libadbd", "libbase", "libcrypto", - ], - - whole_static_libs: [ - "libadbd", + "libfusesideload", ], } @@ -62,8 +62,9 @@ cc_test { ], static_libs: [ + "libminadbd_services", + "libadbd", "libBionicGtestMain", - "libminadbd", ], shared_libs: [ diff --git a/minui/Android.bp b/minui/Android.bp index 19d28be62..fff3a8ec9 100644 --- a/minui/Android.bp +++ b/minui/Android.bp @@ -14,6 +14,7 @@ cc_library { name: "libminui", + recovery_available: true, defaults: [ "recovery_defaults", @@ -35,7 +36,7 @@ cc_library { whole_static_libs: [ "libadf", "libdrm", - "libsync_recovery", + "libsync", ], shared_libs: [ diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp index 9336a1e63..630b80180 100644 --- a/minui/graphics_drm.cpp +++ b/minui/graphics_drm.cpp @@ -117,12 +117,16 @@ GRSurfaceDrm* MinuiBackendDrm::DrmCreateSurface(int width, int height) { uint32_t format; PixelFormat pixel_format = gr_pixel_format(); + // PixelFormat comes in byte order, whereas DRM_FORMAT_* uses little-endian + // (external/libdrm/include/drm/drm_fourcc.h). Note that although drm_fourcc.h also defines a + // macro of DRM_FORMAT_BIG_ENDIAN, it doesn't seem to be actually supported (see the discussion + // in https://lists.freedesktop.org/archives/amd-gfx/2017-May/008560.html). if (pixel_format == PixelFormat::ABGR) { - format = DRM_FORMAT_ABGR8888; + format = DRM_FORMAT_RGBA8888; } else if (pixel_format == PixelFormat::BGRA) { - format = DRM_FORMAT_BGRA8888; + format = DRM_FORMAT_ARGB8888; } else if (pixel_format == PixelFormat::RGBX) { - format = DRM_FORMAT_RGBX8888; + format = DRM_FORMAT_XBGR8888; } else { format = DRM_FORMAT_RGB565; } diff --git a/otautil/Android.bp b/otautil/Android.bp index b058f7b35..56c7c9e89 100644 --- a/otautil/Android.bp +++ b/otautil/Android.bp @@ -16,6 +16,11 @@ cc_library_static { name: "libotautil", host_supported: true, + recovery_available: true, + + defaults: [ + "recovery_defaults", + ], // Minimal set of files to support host build. srcs: [ @@ -23,16 +28,10 @@ cc_library_static { "rangeset.cpp", ], - static_libs: [ + shared_libs: [ "libbase", ], - cflags: [ - "-D_FILE_OFFSET_BITS=64", - "-Werror", - "-Wall", - ], - export_include_dirs: [ "include", ], @@ -46,9 +45,9 @@ cc_library_static { "thermalutil.cpp", ], - static_libs: [ - "libselinux", + shared_libs: [ "libcutils", + "libselinux", ], }, }, diff --git a/recovery.cpp b/recovery.cpp index 3828e29b3..cc30035df 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -49,7 +49,7 @@ #include <android-base/unique_fd.h> #include <bootloader_message/bootloader_message.h> #include <cutils/properties.h> /* for property_list */ -#include <healthd/BatteryMonitor.h> +#include <health2/Health.h> #include <ziparchive/zip_archive.h> #include "adb_install.h" @@ -876,6 +876,11 @@ void ui_print(const char* format, ...) { } static bool is_battery_ok(int* required_battery_level) { + using android::hardware::health::V1_0::BatteryStatus; + using android::hardware::health::V2_0::Result; + using android::hardware::health::V2_0::toString; + using android::hardware::health::V2_0::implementation::Health; + struct healthd_config healthd_config = { .batteryStatusPath = android::String8(android::String8::kEmptyString), .batteryHealthPath = android::String8(android::String8::kEmptyString), @@ -893,37 +898,52 @@ static bool is_battery_ok(int* required_battery_level) { .boot_min_cap = 0, .screen_on = nullptr }; - healthd_board_init(&healthd_config); - android::BatteryMonitor monitor; - monitor.init(&healthd_config); + auto health = + android::hardware::health::V2_0::implementation::Health::initInstance(&healthd_config); static constexpr int BATTERY_READ_TIMEOUT_IN_SEC = 10; int wait_second = 0; while (true) { - int charge_status = monitor.getChargeStatus(); + auto charge_status = BatteryStatus::UNKNOWN; + health + ->getChargeStatus([&charge_status](auto res, auto out_status) { + if (res == Result::SUCCESS) { + charge_status = out_status; + } + }) + .isOk(); // should not have transport error + // Treat unknown status as charged. - bool charged = (charge_status != android::BATTERY_STATUS_DISCHARGING && - charge_status != android::BATTERY_STATUS_NOT_CHARGING); - android::BatteryProperty capacity; - android::status_t status = monitor.getProperty(android::BATTERY_PROP_CAPACITY, &capacity); - ui_print("charge_status %d, charged %d, status %d, capacity %" PRId64 "\n", charge_status, - charged, status, capacity.valueInt64); + bool charged = (charge_status != BatteryStatus::DISCHARGING && + charge_status != BatteryStatus::NOT_CHARGING); + + Result res = Result::UNKNOWN; + int32_t capacity = INT32_MIN; + health + ->getCapacity([&res, &capacity](auto out_res, auto out_capacity) { + res = out_res; + capacity = out_capacity; + }) + .isOk(); // should not have transport error + + ui_print("charge_status %d, charged %d, status %s, capacity %" PRId32 "\n", charge_status, + charged, toString(res).c_str(), capacity); // At startup, the battery drivers in devices like N5X/N6P take some time to load // the battery profile. Before the load finishes, it reports value 50 as a fake // capacity. BATTERY_READ_TIMEOUT_IN_SEC is set that the battery drivers are expected // to finish loading the battery profile earlier than 10 seconds after kernel startup. - if (status == 0 && capacity.valueInt64 == 50) { + if (res == Result::SUCCESS && capacity == 50) { if (wait_second < BATTERY_READ_TIMEOUT_IN_SEC) { sleep(1); wait_second++; continue; } } - // If we can't read battery percentage, it may be a device without battery. In this situation, - // use 100 as a fake battery percentage. - if (status != 0) { - capacity.valueInt64 = 100; + // If we can't read battery percentage, it may be a device without battery. In this + // situation, use 100 as a fake battery percentage. + if (res != Result::SUCCESS) { + capacity = 100; } // GmsCore enters recovery mode to install package when having enough battery percentage. @@ -932,7 +952,7 @@ static bool is_battery_ok(int* required_battery_level) { static constexpr int BATTERY_OK_PERCENTAGE = 20; static constexpr int BATTERY_WITH_CHARGER_OK_PERCENTAGE = 15; *required_battery_level = charged ? BATTERY_WITH_CHARGER_OK_PERCENTAGE : BATTERY_OK_PERCENTAGE; - return capacity.valueInt64 >= *required_battery_level; + return capacity >= *required_battery_level; } } @@ -327,6 +327,7 @@ int format_volume(const char* volume, const char* directory) { "-f", "-O", "encrypt", "-O", "quota", + "-O", "verity", "-w", std::to_string(kSectorSize), v->blk_device, }; diff --git a/tests/Android.mk b/tests/Android.mk index daf4853b9..b6f5b451f 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -154,18 +154,28 @@ libupdater_static_libraries := \ libbrotli \ $(tune2fs_static_libraries) +health_hal_static_libraries := \ + android.hardware.health@2.0-impl \ + android.hardware.health@2.0 \ + android.hardware.health@1.0 \ + android.hardware.health@1.0-convert \ + libhealthstoragedefault \ + libhidltransport \ + libhidlbase \ + libhwbinder_noltopgo \ + libvndksupport \ + libbatterymonitor + librecovery_static_libraries := \ librecovery \ libbootloader_message \ libfusesideload \ - libminadbd \ librecovery_ui_default \ librecovery_ui \ libminui \ libverifier \ libotautil \ - libasyncio \ - libbatterymonitor \ + $(health_hal_static_libraries) \ libcrypto_utils \ libcrypto \ libext4_utils \ @@ -196,7 +206,7 @@ LOCAL_STATIC_LIBRARIES := \ LOCAL_TEST_DATA := \ $(call find-test-data-in-subdirs, $(LOCAL_PATH), "*", testdata) \ - $(call find-test-data-in-subdirs, bootable/recovery, "*_text.png", res-*) + $(call find-test-data-in-subdirs, $(LOCAL_PATH), "*_text.png", res-testdata) include $(BUILD_NATIVE_TEST) # Host tests diff --git a/tests/component/resources_test.cpp b/tests/component/resources_test.cpp index 618d5a4dd..b00c3d528 100644 --- a/tests/component/resources_test.cpp +++ b/tests/component/resources_test.cpp @@ -32,10 +32,11 @@ static const std::string kLocale = "zu"; -static const std::vector<std::string> kResourceImagesDirs{ "res-mdpi/images/", "res-hdpi/images/", - "res-xhdpi/images/", - "res-xxhdpi/images/", - "res-xxxhdpi/images/" }; +static const std::vector<std::string> kResourceImagesDirs{ + "res-testdata/res-mdpi/images/", "res-testdata/res-hdpi/images/", + "res-testdata/res-xhdpi/images/", "res-testdata/res-xxhdpi/images/", + "res-testdata/res-xxxhdpi/images/", +}; static int png_filter(const dirent* de) { if (de->d_type != DT_REG || !android::base::EndsWith(de->d_name, "_text.png")) { diff --git a/tests/res-testdata/res-hdpi b/tests/res-testdata/res-hdpi new file mode 120000 index 000000000..c339b1df4 --- /dev/null +++ b/tests/res-testdata/res-hdpi @@ -0,0 +1 @@ +../../res-hdpi
\ No newline at end of file diff --git a/tests/res-testdata/res-mdpi b/tests/res-testdata/res-mdpi new file mode 120000 index 000000000..4be630d6f --- /dev/null +++ b/tests/res-testdata/res-mdpi @@ -0,0 +1 @@ +../../res-mdpi
\ No newline at end of file diff --git a/tests/res-testdata/res-xhdpi b/tests/res-testdata/res-xhdpi new file mode 120000 index 000000000..429eead83 --- /dev/null +++ b/tests/res-testdata/res-xhdpi @@ -0,0 +1 @@ +../../res-xhdpi
\ No newline at end of file diff --git a/tests/res-testdata/res-xxhdpi b/tests/res-testdata/res-xxhdpi new file mode 120000 index 000000000..304cc28b3 --- /dev/null +++ b/tests/res-testdata/res-xxhdpi @@ -0,0 +1 @@ +../../res-xxhdpi
\ No newline at end of file diff --git a/tests/res-testdata/res-xxxhdpi b/tests/res-testdata/res-xxxhdpi new file mode 120000 index 000000000..2236ad8cc --- /dev/null +++ b/tests/res-testdata/res-xxxhdpi @@ -0,0 +1 @@ +../../res-xxxhdpi
\ No newline at end of file diff --git a/tools/recovery_l10n/res/values-as/strings.xml b/tools/recovery_l10n/res/values-as/strings.xml new file mode 100644 index 000000000..2624cebe4 --- /dev/null +++ b/tools/recovery_l10n/res/values-as/strings.xml @@ -0,0 +1,9 @@ +<?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_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> +</resources> diff --git a/tools/recovery_l10n/res/values-en-rCA/strings.xml b/tools/recovery_l10n/res/values-en-rCA/strings.xml new file mode 100644 index 000000000..dc75c2374 --- /dev/null +++ b/tools/recovery_l10n/res/values-en-rCA/strings.xml @@ -0,0 +1,9 @@ +<?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">"Installing system update"</string> + <string name="recovery_erasing" msgid="7334826894904037088">"Erasing"</string> + <string name="recovery_no_command" msgid="4465476568623024327">"No command"</string> + <string name="recovery_error" msgid="5748178989622716736">"Error!"</string> + <string name="recovery_installing_security" msgid="9184031299717114342">"Installing security update"</string> +</resources> diff --git a/tools/recovery_l10n/res/values-en-rXC/strings.xml b/tools/recovery_l10n/res/values-en-rXC/strings.xml new file mode 100644 index 000000000..2d528b3fb --- /dev/null +++ b/tools/recovery_l10n/res/values-en-rXC/strings.xml @@ -0,0 +1,9 @@ +<?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">"Installing system update"</string> + <string name="recovery_erasing" msgid="7334826894904037088">"Erasing"</string> + <string name="recovery_no_command" msgid="4465476568623024327">"No command"</string> + <string name="recovery_error" msgid="5748178989622716736">"Error!"</string> + <string name="recovery_installing_security" msgid="9184031299717114342">"Installing security update"</string> +</resources> diff --git a/tools/recovery_l10n/res/values-or/strings.xml b/tools/recovery_l10n/res/values-or/strings.xml new file mode 100644 index 000000000..2b0851cdd --- /dev/null +++ b/tools/recovery_l10n/res/values-or/strings.xml @@ -0,0 +1,9 @@ +<?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_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> +</resources> diff --git a/updater/install.cpp b/updater/install.cpp index 088d24b31..f9333459b 100644 --- a/updater/install.cpp +++ b/updater/install.cpp @@ -497,12 +497,10 @@ Value* FormatFn(const char* name, State* state, const std::vector<std::unique_pt const char* f2fs_argv[] = { "mkfs.f2fs", "-d1", "-f", - "-O", - "encrypt", - "-O", - "quota", - "-w", - "512", + "-O", "encrypt", + "-O", "quota", + "-O", "verity", + "-w", "512", location.c_str(), (size < 512) ? nullptr : num_sectors.c_str(), nullptr }; diff --git a/updater_sample/Android.bp b/updater_sample/Android.bp new file mode 100644 index 000000000..845e07b70 --- /dev/null +++ b/updater_sample/Android.bp @@ -0,0 +1,33 @@ +// Copyright (C) 2018 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. + +android_app { + name: "SystemUpdaterSample", + sdk_version: "system_current", + privileged: true, + + srcs: ["src/**/*.java"], + + static_libs: [ + "guava", + ], + + optimize: { + proguard_flags_files: [ + "proguard.flags", + ], + }, + + resource_dirs: ["res"], +} diff --git a/updater_sample/Android.mk b/updater_sample/Android.mk deleted file mode 100644 index cff5b0c1f..000000000 --- a/updater_sample/Android.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2018 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. -# - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PACKAGE_NAME := SystemUpdaterSample -LOCAL_SDK_VERSION := system_current -LOCAL_PRIVILEGED_MODULE := true - -LOCAL_PROGUARD_FLAG_FILES := proguard.flags - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_STATIC_JAVA_LIBRARIES += guava - -LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res - -include $(BUILD_PACKAGE) - -# Use the following include to make our test apk. -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/updater_sample/README.md b/updater_sample/README.md index 306e71e5b..69e8e244f 100644 --- a/updater_sample/README.md +++ b/updater_sample/README.md @@ -227,7 +227,7 @@ privileged system app, so it's granted the required permissions to access 1. Build `mmma bootable/recovery/updater_sample/` 2. Install app - `adb install $OUT/system/app/SystemUpdaterSample/SystemUpdaterSample.apk` + `adb install $OUT/system/priv-app/SystemUpdaterSample/SystemUpdaterSample.apk` 3. Install tests `adb install $OUT/testcases/SystemUpdaterSampleTests/SystemUpdaterSampleTests.apk` 4. Run tests diff --git a/updater_sample/tests/Android.bp b/updater_sample/tests/Android.bp new file mode 100644 index 000000000..c2783ef88 --- /dev/null +++ b/updater_sample/tests/Android.bp @@ -0,0 +1,40 @@ +// Copyright (C) 2018 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. + +android_test { + name: "SystemUpdaterSampleTests", + sdk_version: "system_current", + + libs: [ + "android.test.base.stubs", + "android.test.runner.stubs", + "SystemUpdaterSample", + ], + + static_libs: [ + "android-support-test", + "mockito-target-minus-junit4", + "guava", + ], + + instrumentation_for: "com.example.android.systemupdatersample", + + optimize: { + enabled: false, + }, + + resource_dirs: ["res"], + + srcs: ["src/**/*.java"], +} diff --git a/updater_sample/tests/Android.mk b/updater_sample/tests/Android.mk deleted file mode 100644 index 415760454..000000000 --- a/updater_sample/tests/Android.mk +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (C) 2018 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. -# - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PACKAGE_NAME := SystemUpdaterSampleTests -LOCAL_SDK_VERSION := system_current -LOCAL_MODULE_TAGS := tests -LOCAL_JAVA_LIBRARIES := \ - android.test.base.stubs \ - android.test.runner.stubs -LOCAL_STATIC_JAVA_LIBRARIES := android-support-test \ - mockito-target-minus-junit4 \ - guava -LOCAL_INSTRUMENTATION_FOR := SystemUpdaterSample -LOCAL_PROGUARD_ENABLED := disabled - -LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -include $(BUILD_PACKAGE) |