AOSP10 TWRP Merge: fix conflicts and update libraries needed
This allows flame to boot TWRP. Still will need to work on super partition for vendor and system access. The plan will be to cherry-pick any updates to android-9.0 through gerrit.twrp.me to this branch as a WIP.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
.*.swp
|
||||
*~
|
||||
tags
|
||||
.vscode
|
||||
|
||||
Regular → Executable
+1
-186
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
subdirs = [
|
||||
// "applypatch",
|
||||
"bootloader_message",
|
||||
@@ -7,199 +6,15 @@ subdirs = [
|
||||
// "otautil",
|
||||
// "uncrypt",
|
||||
]
|
||||
=======
|
||||
// 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_defaults {
|
||||
name: "recovery_defaults",
|
||||
|
||||
cflags: [
|
||||
"-D_FILE_OFFSET_BITS=64",
|
||||
|
||||
// Must be the same as RECOVERY_API_VERSION.
|
||||
"-DRECOVERY_API_VERSION=3",
|
||||
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
],
|
||||
cpp_std: "c++17",
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "librecovery_fastboot",
|
||||
recovery_available: true,
|
||||
defaults: [
|
||||
"recovery_defaults",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"fastboot/fastboot.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbootloader_message",
|
||||
"libcutils",
|
||||
"liblog",
|
||||
"librecovery_ui",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
"librecovery_ui_default",
|
||||
],
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "librecovery_defaults",
|
||||
|
||||
defaults: [
|
||||
"recovery_defaults",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.health@2.0",
|
||||
"libbase",
|
||||
"libbootloader_message",
|
||||
"libcrypto",
|
||||
"libcutils",
|
||||
"libfs_mgr",
|
||||
"liblog",
|
||||
"libziparchive",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
"libinstall",
|
||||
"librecovery_fastboot",
|
||||
"libminui",
|
||||
"libotautil",
|
||||
|
||||
// external dependencies
|
||||
"libhealthhalutils",
|
||||
"libfstab",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "librecovery",
|
||||
recovery_available: true,
|
||||
|
||||
defaults: [
|
||||
"librecovery_defaults",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"fsck_unshare_blocks.cpp",
|
||||
"recovery.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"librecovery_ui",
|
||||
],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "recovery",
|
||||
recovery: true,
|
||||
|
||||
defaults: [
|
||||
"libinstall_defaults",
|
||||
"librecovery_defaults",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"recovery_main.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"librecovery_ui",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
"librecovery",
|
||||
"librecovery_ui_default",
|
||||
],
|
||||
|
||||
required: [
|
||||
"e2fsdroid.recovery",
|
||||
"librecovery_ui_ext",
|
||||
"minadbd",
|
||||
"mke2fs.conf.recovery",
|
||||
"mke2fs.recovery",
|
||||
"recovery_deps",
|
||||
],
|
||||
}
|
||||
|
||||
// The dynamic executable that runs after /data mounts.
|
||||
cc_binary {
|
||||
name: "recovery-persist",
|
||||
|
||||
defaults: [
|
||||
"recovery_defaults",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"recovery-persist.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
"libmetricslogger",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
"libotautil",
|
||||
"libfstab",
|
||||
],
|
||||
|
||||
init_rc: [
|
||||
"recovery-persist.rc",
|
||||
],
|
||||
}
|
||||
|
||||
// The dynamic executable that runs at init.
|
||||
cc_binary {
|
||||
name: "recovery-refresh",
|
||||
|
||||
defaults: [
|
||||
"recovery_defaults",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"recovery-refresh.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
"libotautil",
|
||||
"libfstab",
|
||||
],
|
||||
|
||||
init_rc: [
|
||||
"recovery-refresh.rc",
|
||||
],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "res-testdata",
|
||||
|
||||
srcs: [
|
||||
"res-*/images/*_text.png",
|
||||
],
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
+182
-168
@@ -15,7 +15,6 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
commands_TWRP_local_path := $(LOCAL_PATH)
|
||||
|
||||
<<<<<<< HEAD
|
||||
ifneq ($(project-path-for),)
|
||||
ifeq ($(LOCAL_PATH),$(call project-path-for,recovery))
|
||||
PROJECT_PATH_AGREES := true
|
||||
@@ -123,13 +122,25 @@ LOCAL_C_INCLUDES += \
|
||||
system/core/adb \
|
||||
system/core/libsparse \
|
||||
external/zlib \
|
||||
$(LOCAL_PATH)/bootloader_message_twrp/include
|
||||
system/core/libpixelflinger/include \
|
||||
external/freetype/include \
|
||||
$(LOCAL_PATH)/bootloader_message_twrp/include \
|
||||
$(LOCAL_PATH)/recovery_ui/include \
|
||||
$(LOCAL_PATH)/otautil/include \
|
||||
$(LOCAL_PATH)/install/include
|
||||
|
||||
LOCAL_C_INCLUDES += bionic
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += external/stlport/stlport external/openssl/include
|
||||
LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22
|
||||
else
|
||||
ifeq ($shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/fuse_sideload28/
|
||||
else
|
||||
LOCAL_C_FLAGS += -DUSE_OLD_LOAD_KEYS
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/fuse_sideload/include \
|
||||
$(LOCAL_PATH)/install/include
|
||||
endif
|
||||
LOCAL_C_INCLUDES += external/boringssl/include external/libcxx/include
|
||||
endif
|
||||
|
||||
@@ -137,8 +148,8 @@ LOCAL_STATIC_LIBRARIES :=
|
||||
LOCAL_SHARED_LIBRARIES :=
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += libguitwrp
|
||||
LOCAL_SHARED_LIBRARIES += libaosprecovery libz libc libcutils libstdc++ libtar libblkid libminuitwrp libminadbd libmtdutils libtwadbbu libbootloader_message_twrp
|
||||
LOCAL_SHARED_LIBRARIES += libcrecovery libtwadbbu libtwrpdigest libc++
|
||||
LOCAL_SHARED_LIBRARIES += libz libc libcutils libstdc++ libtar libblkid libminuitwrp libminadbd libmtdutils libtwadbbu libbootloader_message_twrp
|
||||
LOCAL_SHARED_LIBRARIES += libcrecovery libtwadbbu libtwrpdigest libc++ libaosprecovery
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_SHARED_LIBRARIES += libstlport
|
||||
@@ -149,6 +160,12 @@ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/libmincrypt/includes
|
||||
LOCAL_CFLAGS += -DUSE_OLD_VERIFIER
|
||||
else
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 29; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/verifier28/
|
||||
LOCAL_CFLAGS += -DUSE_28_VERIFIER
|
||||
else
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/install/include
|
||||
endif
|
||||
LOCAL_SHARED_LIBRARIES += libcrypto
|
||||
endif
|
||||
|
||||
@@ -157,8 +174,14 @@ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
|
||||
endif
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
LOCAL_SHARED_LIBRARIES += libziparchive
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
LOCAL_SHARED_LIBRARIES += libziparchive
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include system/core/libziparchive/include
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libziparchive
|
||||
LOCAL_C_INCLUDES += system/core/libziparchive/include
|
||||
LOCAL_C_FLAGS += -DUSE_
|
||||
endif
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libminzip
|
||||
LOCAL_CFLAGS += -DUSE_MINZIP
|
||||
@@ -212,34 +235,9 @@ LOCAL_C_INCLUDES += system/extras/ext4_utils
|
||||
tw_git_revision := $(shell git -C $(LOCAL_PATH) rev-parse --short=8 HEAD 2>/dev/null)
|
||||
ifeq ($(shell git -C $(LOCAL_PATH) diff --quiet; echo $$?),1)
|
||||
tw_git_revision := $(tw_git_revision)-dirty
|
||||
=======
|
||||
# Needed by build/make/core/Makefile. Must be consistent with the value in Android.bp.
|
||||
RECOVERY_API_VERSION := 3
|
||||
RECOVERY_FSTAB_VERSION := 2
|
||||
|
||||
# TARGET_RECOVERY_UI_LIB should be one of librecovery_ui_{default,wear,vr} or a device-specific
|
||||
# module that defines make_device() and the exact RecoveryUI class for the target. It defaults to
|
||||
# librecovery_ui_default, which uses ScreenRecoveryUI.
|
||||
TARGET_RECOVERY_UI_LIB ?= librecovery_ui_default
|
||||
|
||||
# librecovery_ui_ext (shared library)
|
||||
# ===================================
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := librecovery_ui_ext
|
||||
|
||||
# LOCAL_MODULE_PATH for shared libraries is unsupported in multiarch builds.
|
||||
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
|
||||
>>>>>>> android-10.0.0_r25
|
||||
endif
|
||||
LOCAL_CFLAGS += -DTW_GIT_REVISION='"$(tw_git_revision)"'
|
||||
|
||||
<<<<<<< HEAD
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
|
||||
ifeq ($(TW_EXCLUDE_MTP),)
|
||||
LOCAL_SHARED_LIBRARIES += libtwrpmtp-ffs
|
||||
@@ -425,13 +423,14 @@ ifneq ($(TW_CLOCK_OFFSET),)
|
||||
LOCAL_CFLAGS += -DTW_CLOCK_OFFSET=$(TW_CLOCK_OFFSET)
|
||||
endif
|
||||
TWRP_REQUIRED_MODULES += \
|
||||
relink \
|
||||
relink_init \
|
||||
dump_image \
|
||||
erase_image \
|
||||
flash_image \
|
||||
mke2fs.conf \
|
||||
pigz \
|
||||
teamwin \
|
||||
toolbox_symlinks \
|
||||
twrp \
|
||||
fsck.fat \
|
||||
fatlabel \
|
||||
@@ -537,16 +536,30 @@ ifeq ($(shell test $(CM_PLATFORM_SDK_VERSION) -ge 3; echo $$?),0)
|
||||
mkfs.f2fs
|
||||
endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
|
||||
TWRP_REQUIRED_MODULES += sload.f2fs
|
||||
TWRP_REQUIRED_MODULES += sload.f2fs \
|
||||
libfs_mgr \
|
||||
fs_mgr \
|
||||
libinit
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
TWRP_REQUIRED_MODULES += ld.config.txt
|
||||
TWRP_REQUIRED_MODULES += init.recovery.ldconfig.rc
|
||||
LOCAL_POST_INSTALL_CMD += \
|
||||
sed 's/\(namespace.default.search.paths\)\s\{1,\}=/namespace.default.search.paths = \/sbin\n\1 +=/' \
|
||||
$(TARGET_OUT_ETC)/ld.config*.txt > $(TARGET_RECOVERY_ROOT_OUT)/sbin/ld.config.txt;
|
||||
ifeq ($(BOARD_VNDK_RUNTIME_DISABLE),true)
|
||||
LOCAL_POST_INSTALL_CMD += \
|
||||
sed 's/\(namespace.default.search.paths\)\s\{1,\}=/namespace.default.search.paths = \/sbin\n\1 +=/' \
|
||||
$(TARGET_OUT_ETC)/ld.config.vndk_lite.txt > $(TARGET_RECOVERY_ROOT_OUT)/sbin/ld.config.txt;
|
||||
else
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
|
||||
LOCAL_POST_INSTALL_CMD += \
|
||||
sed 's/\(namespace.default.search.paths\)\s\{1,\}=/namespace.default.search.paths = \/sbin\n\1 +=/' \
|
||||
$(TARGET_RECOVERY_ROOT_OUT)/system/etc/ld.config.txt > $(TARGET_RECOVERY_ROOT_OUT)/sbin/ld.config.txt;
|
||||
else
|
||||
LOCAL_POST_INSTALL_CMD += \
|
||||
sed 's/\(namespace.default.search.paths\)\s\{1,\}=/namespace.default.search.paths = \/sbin\n\1 +=/' \
|
||||
$(TARGET_OUT_ETC)/ld.config.txt > $(TARGET_RECOVERY_ROOT_OUT)/sbin/ld.config.txt;
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 25; echo $$?),0)
|
||||
@@ -580,7 +593,7 @@ endif
|
||||
LOCAL_POST_INSTALL_CMD := \
|
||||
$(hide) cp -f $(PRODUCT_OUT)/obj/ETC/file_contexts.bin_intermediates/file_contexts.concat.tmp $(TARGET_RECOVERY_ROOT_OUT)/file_contexts
|
||||
|
||||
include $(BUILD_PHONY_PACKAGE)
|
||||
#include $(BUILD_PHONY_PACKAGE)
|
||||
|
||||
ifneq ($(TW_USE_TOOLBOX), true)
|
||||
include $(CLEAR_VARS)
|
||||
@@ -620,7 +633,7 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(RECOVERY_BUSYBOX_SYMLINKS)
|
||||
ifneq (,$(filter $(PLATFORM_SDK_VERSION),16 17 18))
|
||||
ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS)
|
||||
endif
|
||||
include $(BUILD_PHONY_PACKAGE)
|
||||
#include $(BUILD_PHONY_PACKAGE)
|
||||
RECOVERY_BUSYBOX_SYMLINKS :=
|
||||
endif # !TW_USE_TOOLBOX
|
||||
|
||||
@@ -629,10 +642,15 @@ endif # !TW_USE_TOOLBOX
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := \
|
||||
recovery-persist.cpp \
|
||||
rotate_logs.cpp
|
||||
recovery-persist.cpp
|
||||
LOCAL_MODULE := recovery-persist
|
||||
LOCAL_SHARED_LIBRARIES := liblog libbase
|
||||
LOCAL_SHARED_LIBRARIES := liblog libbase libmetricslogger
|
||||
LOCAL_STATIC_LIBRARIES := libotautil
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += system/core/libmetricslogger/include \
|
||||
system/core/libstats/include
|
||||
endif
|
||||
LOCAL_CFLAGS := -Werror
|
||||
LOCAL_INIT_RC := recovery-persist.rc
|
||||
include $(BUILD_EXECUTABLE)
|
||||
@@ -643,10 +661,11 @@ endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := \
|
||||
recovery-refresh.cpp \
|
||||
rotate_logs.cpp
|
||||
recovery-refresh.cpp
|
||||
LOCAL_MODULE := recovery-refresh
|
||||
LOCAL_SHARED_LIBRARIES := liblog libbase
|
||||
LOCAL_STATIC_LIBRARIES := libotautil
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
|
||||
LOCAL_CFLAGS := -Werror
|
||||
LOCAL_INIT_RC := recovery-refresh.rc
|
||||
include $(BUILD_EXECUTABLE)
|
||||
@@ -654,90 +673,61 @@ endif
|
||||
|
||||
# shared libfusesideload
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CLANG := true
|
||||
LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
|
||||
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CLANG := true
|
||||
LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
|
||||
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := libfusesideload
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libc
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
|
||||
LOCAL_SHARED_LIBRARIES += libmincrypttwrp
|
||||
LOCAL_CFLAGS += -DUSE_MINCRYPT
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libcrypto
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := libfusesideload
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libc
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
|
||||
LOCAL_SHARED_LIBRARIES += libmincrypttwrp
|
||||
LOCAL_CFLAGS += -DUSE_MINCRYPT
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libcrypto libbase
|
||||
endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_SRC_FILES := fuse_sideload22.cpp
|
||||
LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22
|
||||
else
|
||||
# ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
LOCAL_SRC_FILES := fuse_sideload28/fuse_sideload.cpp
|
||||
# else
|
||||
# LOCAL_SRC_FILES := fuse_sideload/fuse_sideload.cpp \
|
||||
fuse_sideload/fuse_provider.cpp
|
||||
# endif
|
||||
endif
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_SRC_FILES := fuse_sideload22.cpp
|
||||
LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22
|
||||
else
|
||||
LOCAL_SRC_FILES := fuse_sideload.cpp
|
||||
=======
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
$(TARGET_RECOVERY_UI_LIB)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libbase \
|
||||
liblog \
|
||||
librecovery_ui.recovery
|
||||
# # static libfusesideload
|
||||
# # =============================== (required to fix build errors in 8.1 due to use by tests)
|
||||
# include $(CLEAR_VARS)
|
||||
# LOCAL_CLANG := true
|
||||
# LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
|
||||
# LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
# LOCAL_MODULE_TAGS := optional
|
||||
# LOCAL_MODULE := libfusesideload
|
||||
# LOCAL_SHARED_LIBRARIES := libcutils libc
|
||||
# ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
# LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
|
||||
# LOCAL_STATIC_LIBRARIES += libmincrypttwrp
|
||||
# LOCAL_CFLAGS += -DUSE_MINCRYPT
|
||||
# else
|
||||
# LOCAL_STATIC_LIBRARIES += libcrypto_static
|
||||
# endif
|
||||
# ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
# LOCAL_SRC_FILES := fuse_sideload22.cpp
|
||||
# LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22
|
||||
# else
|
||||
# LOCAL_SRC_FILES := fuse_sideload.cpp
|
||||
# endif
|
||||
# include $(BUILD_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_MODULE := recovery_deps
|
||||
|
||||
ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
|
||||
ifeq ($(HOST_OS),linux)
|
||||
LOCAL_REQUIRED_MODULES += \
|
||||
make_f2fs.recovery \
|
||||
sload_f2fs.recovery
|
||||
endif
|
||||
>>>>>>> android-10.0.0_r25
|
||||
endif
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
# static libfusesideload
|
||||
# =============================== (required to fix build errors in 8.1 due to use by tests)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CLANG := true
|
||||
LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
|
||||
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
|
||||
|
||||
<<<<<<< HEAD
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := libfusesideload
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libc
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
|
||||
LOCAL_STATIC_LIBRARIES += libmincrypttwrp
|
||||
LOCAL_CFLAGS += -DUSE_MINCRYPT
|
||||
else
|
||||
LOCAL_STATIC_LIBRARIES += libcrypto_static
|
||||
=======
|
||||
# On A/B devices recovery-persist reads the recovery related file from the persist storage and
|
||||
# copies them into /data/misc/recovery. Then, for both A/B and non-A/B devices, recovery-persist
|
||||
# parses the last_install file and reports the embedded update metrics. Also, the last_install file
|
||||
# will be deteleted after the report.
|
||||
LOCAL_REQUIRED_MODULES += recovery-persist
|
||||
ifeq ($(BOARD_CACHEIMAGE_PARTITION_SIZE),)
|
||||
LOCAL_REQUIRED_MODULES += recovery-refresh
|
||||
>>>>>>> android-10.0.0_r25
|
||||
endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_SRC_FILES := fuse_sideload22.cpp
|
||||
LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22
|
||||
else
|
||||
LOCAL_SRC_FILES := fuse_sideload.cpp
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
<<<<<<< HEAD
|
||||
# libmounts (static library)
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
@@ -779,10 +769,19 @@ include $(CLEAR_VARS)
|
||||
|
||||
|
||||
LOCAL_MODULE := libaosprecovery
|
||||
LOCAL_MODULE_TAGS := eng optional
|
||||
LOCAL_CFLAGS := -std=gnu++0x
|
||||
LOCAL_SRC_FILES := adb_install.cpp legacy_property_service.cpp set_metadata.cpp tw_atomic.cpp installcommand.cpp zipwrap.cpp
|
||||
LOCAL_SHARED_LIBRARIES += libc liblog libcutils libmtdutils libfusesideload libselinux libminzip
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
LOCAL_SRC_FILES := install28/adb_install.cpp legacy_property_service.cpp set_metadata.cpp tw_atomic.cpp \
|
||||
installcommand.cpp zipwrap.cpp
|
||||
else
|
||||
LOCAL_SRC_FILES := install/adb_install.cpp install/asn1_decoder.cpp install/fuse_sdcard_install.cpp\
|
||||
install/install.cpp install/installcommand.cpp install/legacy_property_service.cpp \
|
||||
install/package.cpp install/verifier.cpp install/wipe_data.cpp install/tw_atomic.cpp \
|
||||
install/set_metadata.cpp verifier28/verifier.cpp install/zipwrap.cpp install/ZipUtil.cpp
|
||||
endif
|
||||
LOCAL_SHARED_LIBRARIES += libbase libbootloader_message libcrypto libext4_utils \
|
||||
libfs_mgr libfusesideload libhidl-gen-utils libhidlbase libhidltransport \
|
||||
liblog libselinux libtinyxml2 libutils libz libziparchive libcutils
|
||||
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_SHARED_LIBRARIES += libstdc++ libstlport
|
||||
@@ -797,30 +796,51 @@ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
LOCAL_SRC_FILES += verifier24/verifier.cpp verifier24/asn1_decoder.cpp
|
||||
LOCAL_CFLAGS += -DUSE_OLD_VERIFIER
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libcrypto libbase
|
||||
LOCAL_SRC_FILES += verifier.cpp asn1_decoder.cpp
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 24; echo $$?),0)
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 28; echo $$?),0)
|
||||
LOCAL_CFLAGS := -std=gnu++2a
|
||||
LOCAL_C_INCLUDES += $(commands_TWRP_local_path)/install/include \
|
||||
$(commands_TWRP_local_path)/recovery_ui/include \
|
||||
$(commands_TWRP_local_path)/otautil/include \
|
||||
$(commands_TWRP_local_path)/minadbd \
|
||||
$(commands_TWRP_local_path)/minzip \
|
||||
system/libvintf/include
|
||||
LOCAL_STATIC_LIBRARIES += libotautil libvintf_recovery libvintf
|
||||
else
|
||||
LOCAL_C_INCLUDES += $(commands_TWRP_local_path)/install28/
|
||||
LOCAL_CFLAGS += -DUSE_28_INSTALL
|
||||
endif
|
||||
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libcrypto libbase
|
||||
LOCAL_SRC_FILES += verifier28/verifier.cpp verifier28/asn1_decoder.cpp
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include $(LOCAL_PATH)/verifier28 \
|
||||
system/libvintf/include
|
||||
LOCAL_CFLAGS += -DUSE_28_VERIFIER
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(AB_OTA_UPDATER),true)
|
||||
LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
|
||||
endif
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
LOCAL_SRC_FILES += otautil/ZipUtil.cpp otautil/SysUtil.cpp otautil/DirUtil.cpp
|
||||
LOCAL_SHARED_LIBRARIES += libziparchive libext4_utils libcrypto libcrypto_utils
|
||||
LOCAL_STATIC_LIBRARIES += libvintf_recovery libfs_mgr liblogwrap libavb libvintf libtinyxml2 libz
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27; echo $$?),0)
|
||||
# Android 9.0 needs c++17 for libvintf
|
||||
LOCAL_CPPFLAGS += -std=c++17
|
||||
# Android 9.0's libvintf also needs this library
|
||||
LOCAL_STATIC_LIBRARIES += libhidl-gen-utils
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
# LOCAL_SRC_FILES += otautil/ZipUtil.cpp otautil/SysUtil.cpp otautil/DirUtil.cpp
|
||||
LOCAL_SHARED_LIBRARIES += libziparchive libext4_utils libcrypto libcrypto_utils libfs_mgr
|
||||
LOCAL_STATIC_LIBRARIES += libvintf_recovery liblogwrap libavb libvintf libtinyxml2 libz
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/otautil/include
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27; echo $$?),0)
|
||||
# Android 9.0's libvintf also needs this library
|
||||
LOCAL_STATIC_LIBRARIES += libhidl-gen-utils
|
||||
endif
|
||||
endif
|
||||
else
|
||||
LOCAL_CFLAGS += -DUSE_MINZIP
|
||||
endif
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
# libverifier (static library)
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
@@ -837,44 +857,41 @@ LOCAL_STATIC_LIBRARIES := \
|
||||
LOCAL_CFLAGS := -Wall -Werror
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# Wear default device
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := wear_device.cpp
|
||||
LOCAL_CFLAGS := -Wall -Werror
|
||||
# # Wear default device
|
||||
# # ===============================
|
||||
# include $(CLEAR_VARS)
|
||||
# LOCAL_SRC_FILES := wear_device.cpp
|
||||
# LOCAL_CFLAGS := -Wall -Werror
|
||||
|
||||
# Should match TARGET_RECOVERY_UI_LIB in BoardConfig.mk.
|
||||
LOCAL_MODULE := librecovery_ui_wear
|
||||
# # Should match TARGET_RECOVERY_UI_LIB in BoardConfig.mk.
|
||||
# LOCAL_MODULE := librecovery_ui_wear
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
# include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# vr headset default device
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
# # vr headset default device
|
||||
# # ===============================
|
||||
# include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := vr_device.cpp
|
||||
LOCAL_CFLAGS := -Wall -Werror
|
||||
# LOCAL_SRC_FILES := vr_device.cpp
|
||||
# LOCAL_CFLAGS := -Wall -Werror
|
||||
|
||||
# should match TARGET_RECOVERY_UI_LIB set in BoardConfig.mk
|
||||
LOCAL_MODULE := librecovery_ui_vr
|
||||
# # should match TARGET_RECOVERY_UI_LIB set in BoardConfig.mk
|
||||
# LOCAL_MODULE := librecovery_ui_vr
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
=======
|
||||
include $(BUILD_PHONY_PACKAGE)
|
||||
>>>>>>> android-10.0.0_r25
|
||||
# include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
commands_recovery_local_path := $(LOCAL_PATH)
|
||||
|
||||
# $(LOCAL_PATH)/edify/Android.mk
|
||||
# $(LOCAL_PATH)/otafault/Android.mk
|
||||
# $(LOCAL_PATH)/bootloader_message/Android.mk
|
||||
|
||||
# $(commands_TWRP_local_path)/boot_control/Android.bp
|
||||
# $(commands_TWRP_local_path)/tests/Android.mk
|
||||
# $(commands_TWRP_local_path)/tools/Android.mk
|
||||
# $(commands_TWRP_local_path)/update_verifier/Android.mk
|
||||
include \
|
||||
<<<<<<< HEAD
|
||||
$(commands_TWRP_local_path)/boot_control/Android.mk \
|
||||
$(commands_TWRP_local_path)/tests/Android.mk \
|
||||
$(commands_TWRP_local_path)/tools/Android.mk \
|
||||
$(commands_TWRP_local_path)/updater/Android.mk \
|
||||
$(commands_TWRP_local_path)/update_verifier/Android.mk \
|
||||
$(commands_TWRP_local_path)/bootloader_message_twrp/Android.mk
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 25; echo $$?),0)
|
||||
@@ -904,7 +921,8 @@ else
|
||||
$(commands_TWRP_local_path)/minui21/Android.mk
|
||||
endif
|
||||
|
||||
#$(commands_TWRP_local_path)/otautil/Android.mk
|
||||
# $(commands_TWRP_local_path)/otautil/Android.mk \
|
||||
|
||||
#includes for TWRP
|
||||
include $(commands_TWRP_local_path)/injecttwrp/Android.mk \
|
||||
$(commands_TWRP_local_path)/htcdumlock/Android.mk \
|
||||
@@ -920,7 +938,6 @@ include $(commands_TWRP_local_path)/injecttwrp/Android.mk \
|
||||
$(commands_TWRP_local_path)/libblkid/Android.mk \
|
||||
$(commands_TWRP_local_path)/minuitwrp/Android.mk \
|
||||
$(commands_TWRP_local_path)/openaes/Android.mk \
|
||||
$(commands_TWRP_local_path)/toolbox/Android.mk \
|
||||
$(commands_TWRP_local_path)/twrpTarMain/Android.mk \
|
||||
$(commands_TWRP_local_path)/minzip/Android.mk \
|
||||
$(commands_TWRP_local_path)/dosfstools/Android.mk \
|
||||
@@ -973,6 +990,3 @@ endif
|
||||
endif
|
||||
|
||||
commands_TWRP_local_path :=
|
||||
=======
|
||||
$(LOCAL_PATH)/updater/Android.mk \
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
@@ -1,136 +1,3 @@
|
||||
**Team Win Recovery Project (TWRP)**
|
||||
|
||||
<<<<<<< HEAD
|
||||
You can find a compiling guide [here](http://forum.xda-developers.com/showthread.php?t=1943625 "Guide").
|
||||
=======
|
||||
Quick turn-around testing
|
||||
-------------------------
|
||||
|
||||
mm -j && m ramdisk-nodeps && m recoveryimage-nodeps
|
||||
|
||||
# To boot into the new recovery image
|
||||
# without flashing the recovery partition:
|
||||
adb reboot bootloader
|
||||
fastboot boot $ANDROID_PRODUCT_OUT/recovery.img
|
||||
|
||||
Running the tests
|
||||
-----------------
|
||||
# After setting up environment and lunch.
|
||||
mmma -j bootable/recovery
|
||||
|
||||
# Running the tests on device.
|
||||
adb root
|
||||
adb sync data
|
||||
|
||||
# 32-bit device
|
||||
adb shell /data/nativetest/recovery_unit_test/recovery_unit_test
|
||||
adb shell /data/nativetest/recovery_component_test/recovery_component_test
|
||||
|
||||
# Or 64-bit device
|
||||
adb shell /data/nativetest64/recovery_unit_test/recovery_unit_test
|
||||
adb shell /data/nativetest64/recovery_component_test/recovery_component_test
|
||||
|
||||
Running the manual tests
|
||||
------------------------
|
||||
|
||||
`recovery-refresh` and `recovery-persist` executables exist only on systems without
|
||||
/cache partition. And we need to follow special steps to run tests for them.
|
||||
|
||||
- Execute the test on an A/B device first. The test should fail but it will log
|
||||
some contents to pmsg.
|
||||
|
||||
- Reboot the device immediately and run the test again. The test should save the
|
||||
contents of pmsg buffer into /data/misc/recovery/inject.txt. Test will pass if
|
||||
this file has expected contents.
|
||||
|
||||
Using `adb` under recovery
|
||||
--------------------------
|
||||
|
||||
When running recovery image from debuggable builds (i.e. `-eng` or `-userdebug` build variants, or
|
||||
`ro.debuggable=1` in `/prop.default`), `adbd` service is enabled and started by default, which
|
||||
allows `adb` communication. A device should be listed under `adb devices`, either in `recovery` or
|
||||
`sideload` state.
|
||||
|
||||
$ adb devices
|
||||
List of devices attached
|
||||
1234567890abcdef recovery
|
||||
|
||||
Although `/system/bin/adbd` is built from the same code base as the one in the normal boot, only a
|
||||
subset of `adb` commands are meaningful under recovery, such as `adb root`, `adb shell`, `adb push`,
|
||||
`adb pull` etc. Since Android Q, `adb shell` no longer requires manually mounting `/system` from
|
||||
recovery menu.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### `adb devices` doesn't show the device.
|
||||
|
||||
$ adb devices
|
||||
List of devices attached
|
||||
|
||||
* Ensure `adbd` is built and running.
|
||||
|
||||
By default, `adbd` is always included into recovery image, as `/system/bin/adbd`. `init` starts
|
||||
`adbd` service automatically only in debuggable builds. This behavior is controlled by the recovery
|
||||
specific `/init.rc`, whose source code is at `bootable/recovery/etc/init.rc`.
|
||||
|
||||
The best way to confirm a running `adbd` is by checking the serial output, which shows a service
|
||||
start log as below.
|
||||
|
||||
[ 18.961986] c1 1 init: starting service 'adbd'...
|
||||
|
||||
* Ensure USB gadget has been enabled.
|
||||
|
||||
If `adbd` service has been started but device not shown under `adb devices`, use `lsusb(8)` (on
|
||||
host) to check if the device is visible to the host.
|
||||
|
||||
`bootable/recovery/etc/init.rc` disables Android USB gadget (via sysfs) as part of the `fs` action
|
||||
trigger, and will only re-enable it in debuggable builds (the `on property` rule will always run
|
||||
_after_ `on fs`).
|
||||
|
||||
on fs
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
|
||||
# Always start adbd on userdebug and eng builds
|
||||
on property:ro.debuggable=1
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
start adbd
|
||||
|
||||
If device is using [configfs](https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt),
|
||||
check if configfs has been properly set up in init rc scripts. See the [example
|
||||
configuration](https://android.googlesource.com/device/google/wahoo/+/master/init.recovery.hardware.rc)
|
||||
for Pixel 2 devices. Note that the flag set via sysfs (i.e. the one above) is no-op when using
|
||||
configfs.
|
||||
|
||||
### `adb devices` shows the device, but in `unauthorized` state.
|
||||
|
||||
$ adb devices
|
||||
List of devices attached
|
||||
1234567890abcdef unauthorized
|
||||
|
||||
recovery image doesn't honor the USB debugging toggle and the authorizations added under normal boot
|
||||
(because such authorization data stays in /data, which recovery doesn't mount), nor does it support
|
||||
authorizing a host device under recovery. We can use one of the following options instead.
|
||||
|
||||
* **Option 1 (Recommended):** Authorize a host device with adb vendor keys.
|
||||
|
||||
For debuggable builds, an RSA keypair can be used to authorize a host device that has the private
|
||||
key. The public key, defined via `PRODUCT_ADB_KEYS`, will be copied to `/adb_keys`. When starting
|
||||
the host-side `adbd`, make sure the filename (or the directory) of the matching private key has been
|
||||
added to `$ADB_VENDOR_KEYS`.
|
||||
|
||||
$ export ADB_VENDOR_KEYS=/path/to/adb/private/key
|
||||
$ adb kill-server
|
||||
$ adb devices
|
||||
|
||||
`-user` builds filter out `PRODUCT_ADB_KEYS`, so no `/adb_keys` will be included there.
|
||||
|
||||
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).
|
||||
* `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
|
||||
value is set at build time (written into `/prop.default`). It defaults to `1` on `-user` builds, and
|
||||
`0` for other build variants. The value is overridable via `PRODUCT_DEFAULT_PROPERTY_OVERRIDES`.
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ LOCAL_C_INCLUDES += bionic external/zlib
|
||||
LOCAL_CFLAGS:= -c -W
|
||||
LOCAL_MODULE:= twrpbu
|
||||
LOCAL_MODULE_STEM := bu
|
||||
LOCAL_MODULE_TAGS:= eng
|
||||
LOCAL_MODULE_TAGS:= optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
@@ -23,7 +23,7 @@ LOCAL_SRC_FILES := \
|
||||
freecache.cpp \
|
||||
imgpatch.cpp
|
||||
LOCAL_MODULE := libapplypatch
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(commands_recovery_local_path)
|
||||
|
||||
Regular → Executable
-387
@@ -49,23 +49,8 @@
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
<<<<<<< HEAD
|
||||
static bool mtd_partitions_scanned = false;
|
||||
|
||||
// Read a file into memory; store the file contents and associated metadata in *file.
|
||||
// Return 0 on success.
|
||||
int LoadFileContents(const char* filename, FileContents* file) {
|
||||
// A special 'filename' beginning with "MTD:" or "EMMC:" means to
|
||||
// load the contents of a partition.
|
||||
if (strncmp(filename, "MTD:", 4) == 0 ||
|
||||
strncmp(filename, "EMMC:", 5) == 0 ||
|
||||
strncmp(filename, "BML:", 4) == 0) {
|
||||
return LoadPartitionContents(filename, file);
|
||||
}
|
||||
=======
|
||||
static bool GenerateTarget(const Partition& target, const FileContents& source_file,
|
||||
const Value& patch, const Value* bonus_data);
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
bool LoadFileContents(const std::string& filename, FileContents* file) {
|
||||
// No longer allow loading contents from eMMC partitions.
|
||||
@@ -84,62 +69,6 @@ bool LoadFileContents(const std::string& filename, FileContents* file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Load the contents of an EMMC partition into the provided
|
||||
// FileContents. filename should be a string of the form
|
||||
// "EMMC:<partition_device>:...". The smallest size_n bytes for
|
||||
// which that prefix of the partition contents has the corresponding
|
||||
// sha1 hash will be loaded. It is acceptable for a size value to be
|
||||
// repeated with different sha1s. Will return 0 on success.
|
||||
//
|
||||
// This complexity is needed because if an OTA installation is
|
||||
// interrupted, the partition might contain either the source or the
|
||||
// target data, which might be of different lengths. We need to know
|
||||
// the length in order to read from a partition (there is no
|
||||
// "end-of-file" marker), so the caller must specify the possible
|
||||
// lengths and the hash of the data, and we'll do the load expecting
|
||||
// to find one of those hashes.
|
||||
enum PartitionType { MTD, EMMC };
|
||||
|
||||
static int LoadPartitionContents(const std::string& filename, FileContents* file) {
|
||||
std::vector<std::string> pieces = android::base::Split(filename, ":");
|
||||
if (pieces.size() < 4 || pieces.size() % 2 != 0) {
|
||||
printf("LoadPartitionContents called with bad filename \"%s\"\n", filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
enum PartitionType type;
|
||||
if (pieces[0] == "MTD") {
|
||||
type = MTD;
|
||||
} else if (pieces[0] == "EMMC") {
|
||||
type = EMMC;
|
||||
} else if (pieces[0] == "BML") {
|
||||
type = EMMC;
|
||||
} else {
|
||||
printf("LoadPartitionContents called with bad filename (%s)\n", filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t pair_count = (pieces.size() - 2) / 2; // # of (size, sha1) pairs in filename
|
||||
std::vector<std::pair<size_t, std::string>> pairs;
|
||||
for (size_t i = 0; i < pair_count; ++i) {
|
||||
size_t size;
|
||||
if (!android::base::ParseUint(pieces[i * 2 + 2], &size) || size == 0) {
|
||||
printf("LoadPartitionContents called with bad size \"%s\"\n", pieces[i * 2 + 2].c_str());
|
||||
return -1;
|
||||
}
|
||||
pairs.push_back({ size, pieces[i * 2 + 3] });
|
||||
}
|
||||
|
||||
// Sort the pairs array so that they are in order of increasing size.
|
||||
std::sort(pairs.begin(), pairs.end());
|
||||
|
||||
const char* partition = pieces[1].c_str();
|
||||
unique_file dev(ota_fopen(partition, "rb"));
|
||||
if (!dev) {
|
||||
printf("failed to open emmc partition \"%s\": %s\n", partition, strerror(errno));
|
||||
return -1;
|
||||
=======
|
||||
// Reads the contents of a Partition to the given FileContents buffer.
|
||||
static bool ReadPartitionToBuffer(const Partition& partition, FileContents* out,
|
||||
bool check_backup) {
|
||||
@@ -147,7 +76,6 @@ static bool ReadPartitionToBuffer(const Partition& partition, FileContents* out,
|
||||
if (ParseSha1(partition.hash, expected_sha1) != 0) {
|
||||
LOG(ERROR) << "Failed to parse target hash \"" << partition.hash << "\"";
|
||||
return false;
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
android::base::unique_fd dev(open(partition.name.c_str(), O_RDONLY));
|
||||
@@ -164,40 +92,6 @@ static bool ReadPartitionToBuffer(const Partition& partition, FileContents* out,
|
||||
out->data = std::move(buffer);
|
||||
return true;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
SHA1_Update(&sha_ctx, buffer_ptr, read);
|
||||
buffer_size += read;
|
||||
buffer_ptr += read;
|
||||
}
|
||||
|
||||
if (pieces[0] == "BML") {
|
||||
if (strcmp(partition, "boot") == 0) {
|
||||
partition = BOARD_BML_BOOT;
|
||||
} else if (strcmp(partition, "recovery") == 0) {
|
||||
partition = BOARD_BML_RECOVERY;
|
||||
}
|
||||
}
|
||||
|
||||
// Duplicate the SHA context and finalize the duplicate so we can
|
||||
// check it against this pair's expected hash.
|
||||
SHA_CTX temp_ctx;
|
||||
memcpy(&temp_ctx, &sha_ctx, sizeof(SHA_CTX));
|
||||
uint8_t sha_so_far[SHA_DIGEST_LENGTH];
|
||||
SHA1_Final(sha_so_far, &temp_ctx);
|
||||
|
||||
uint8_t parsed_sha[SHA_DIGEST_LENGTH];
|
||||
if (ParseSha1(current_sha1.c_str(), parsed_sha) != 0) {
|
||||
printf("failed to parse SHA-1 %s in %s\n", current_sha1.c_str(), filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (memcmp(sha_so_far, parsed_sha, SHA_DIGEST_LENGTH) == 0) {
|
||||
// We have a match. Stop reading the partition; we'll return the data we've read so far.
|
||||
printf("partition read matched size %zu SHA-1 %s\n", current_size, current_sha1.c_str());
|
||||
found = true;
|
||||
break;
|
||||
=======
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,34 +122,6 @@ bool SaveFileContents(const std::string& filename, const FileContents* file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Write a memory buffer to 'target' partition, a string of the form
|
||||
// "EMMC:<partition_device>[:...]". The target name
|
||||
// might contain multiple colons, but WriteToPartition() only uses the first
|
||||
// two and ignores the rest. Return 0 on success.
|
||||
int WriteToPartition(const unsigned char* data, size_t len, const std::string& target) {
|
||||
std::string copy(target);
|
||||
std::vector<std::string> pieces = android::base::Split(copy, ":");
|
||||
|
||||
if (pieces.size() < 2) {
|
||||
printf("WriteToPartition called with bad target (%s)\n", target.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
enum PartitionType type;
|
||||
if (pieces[0] == "MTD") {
|
||||
type = MTD;
|
||||
} else if (pieces[0] == "EMMC") {
|
||||
type = EMMC;
|
||||
} else if (pieces[0] == "BML") {
|
||||
type = EMMC;
|
||||
} else {
|
||||
printf("WriteToPartition called with bad target (%s)\n", target.c_str());
|
||||
return -1;
|
||||
=======
|
||||
if (fsync(fd) != 0) {
|
||||
PLOG(ERROR) << "Failed to fsync \"" << filename << "\"";
|
||||
return false;
|
||||
@@ -321,228 +187,10 @@ static bool WriteBufferToPartition(const FileContents& file_contents, const Part
|
||||
if (TEMP_FAILURE_RETRY(lseek(fd, 0, SEEK_SET)) == -1) {
|
||||
PLOG(ERROR) << "Failed to seek to 0 on " << partition;
|
||||
return false;
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
const char* partition = pieces[1].c_str();
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (pieces[0] == "BML") {
|
||||
if (strcmp(partition, "boot") == 0) {
|
||||
partition = BOARD_BML_BOOT;
|
||||
} else if (strcmp(partition, "recovery") == 0) {
|
||||
partition = BOARD_BML_RECOVERY;
|
||||
}
|
||||
|
||||
int bmlpartition = open(partition, O_RDWR | O_LARGEFILE);
|
||||
if (bmlpartition < 0)
|
||||
return -1;
|
||||
if (ioctl(bmlpartition, BML_UNLOCK_ALL, 0)) {
|
||||
printf("failed to unlock BML partition: (%s)\n", partition);
|
||||
return -1;
|
||||
}
|
||||
close(bmlpartition);
|
||||
}
|
||||
|
||||
if (partition == NULL) {
|
||||
printf("bad partition target name \"%s\"\n", target.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case MTD: {
|
||||
if (!mtd_partitions_scanned) {
|
||||
mtd_scan_partitions();
|
||||
mtd_partitions_scanned = true;
|
||||
}
|
||||
|
||||
const MtdPartition* mtd = mtd_find_partition_by_name(partition);
|
||||
if (mtd == NULL) {
|
||||
printf("mtd partition \"%s\" not found for writing\n", partition);
|
||||
return -1;
|
||||
}
|
||||
|
||||
MtdWriteContext* ctx = mtd_write_partition(mtd);
|
||||
if (ctx == NULL) {
|
||||
printf("failed to init mtd partition \"%s\" for writing\n", partition);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t written = mtd_write_data(ctx, reinterpret_cast<const char*>(data), len);
|
||||
if (written != len) {
|
||||
printf("only wrote %zu of %zu bytes to MTD %s\n", written, len, partition);
|
||||
mtd_write_close(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mtd_erase_blocks(ctx, -1) < 0) {
|
||||
printf("error finishing mtd write of %s\n", partition);
|
||||
mtd_write_close(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mtd_write_close(ctx)) {
|
||||
printf("error closing mtd write of %s\n", partition);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EMMC: {
|
||||
size_t start = 0;
|
||||
bool success = false;
|
||||
unique_fd fd(ota_open(partition, O_RDWR | O_SYNC));
|
||||
if (fd < 0) {
|
||||
printf("failed to open %s: %s\n", partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (size_t attempt = 0; attempt < 2; ++attempt) {
|
||||
if (TEMP_FAILURE_RETRY(lseek(fd, start, SEEK_SET)) == -1) {
|
||||
printf("failed seek on %s: %s\n", partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
while (start < len) {
|
||||
size_t to_write = len - start;
|
||||
if (to_write > 1<<20) to_write = 1<<20;
|
||||
|
||||
ssize_t written = TEMP_FAILURE_RETRY(ota_write(fd, data+start, to_write));
|
||||
if (written == -1) {
|
||||
printf("failed write writing to %s: %s\n", partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
start += written;
|
||||
}
|
||||
if (ota_fsync(fd) != 0) {
|
||||
printf("failed to sync to %s (%s)\n", partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (ota_close(fd) != 0) {
|
||||
printf("failed to close %s (%s)\n", partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
unique_fd fd(ota_open(partition, O_RDONLY));
|
||||
if (fd < 0) {
|
||||
printf("failed to reopen %s for verify (%s)\n", partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Drop caches so our subsequent verification read
|
||||
// won't just be reading the cache.
|
||||
sync();
|
||||
unique_fd dc(ota_open("/proc/sys/vm/drop_caches", O_WRONLY));
|
||||
if (TEMP_FAILURE_RETRY(ota_write(dc, "3\n", 2)) == -1) {
|
||||
printf("write to /proc/sys/vm/drop_caches failed: %s\n", strerror(errno));
|
||||
} else {
|
||||
printf(" caches dropped\n");
|
||||
}
|
||||
ota_close(dc);
|
||||
sleep(1);
|
||||
|
||||
// verify
|
||||
if (TEMP_FAILURE_RETRY(lseek(fd, 0, SEEK_SET)) == -1) {
|
||||
printf("failed to seek back to beginning of %s: %s\n",
|
||||
partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
unsigned char buffer[4096];
|
||||
start = len;
|
||||
for (size_t p = 0; p < len; p += sizeof(buffer)) {
|
||||
size_t to_read = len - p;
|
||||
if (to_read > sizeof(buffer)) {
|
||||
to_read = sizeof(buffer);
|
||||
}
|
||||
|
||||
size_t so_far = 0;
|
||||
while (so_far < to_read) {
|
||||
ssize_t read_count =
|
||||
TEMP_FAILURE_RETRY(ota_read(fd, buffer+so_far, to_read-so_far));
|
||||
if (read_count == -1) {
|
||||
printf("verify read error %s at %zu: %s\n",
|
||||
partition, p, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (static_cast<size_t>(read_count) < to_read) {
|
||||
printf("short verify read %s at %zu: %zd %zu %s\n",
|
||||
partition, p, read_count, to_read, strerror(errno));
|
||||
}
|
||||
so_far += read_count;
|
||||
}
|
||||
|
||||
if (memcmp(buffer, data+p, to_read) != 0) {
|
||||
printf("verification failed starting at %zu\n", p);
|
||||
start = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (start == len) {
|
||||
printf("verification read succeeded (attempt %zu)\n", attempt+1);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
printf("failed to verify after all attempts\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ota_close(fd) != 0) {
|
||||
printf("error closing %s (%s)\n", partition, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Take a string 'str' of 40 hex digits and parse it into the 20
|
||||
// byte array 'digest'. 'str' may contain only the digest or be of
|
||||
// the form "<digest>:<anything>". Return 0 on success, -1 on any
|
||||
// error.
|
||||
int ParseSha1(const char* str, uint8_t* digest) {
|
||||
const char* ps = str;
|
||||
uint8_t* pd = digest;
|
||||
for (int i = 0; i < SHA_DIGEST_LENGTH * 2; ++i, ++ps) {
|
||||
int digit;
|
||||
if (*ps >= '0' && *ps <= '9') {
|
||||
digit = *ps - '0';
|
||||
} else if (*ps >= 'a' && *ps <= 'f') {
|
||||
digit = *ps - 'a' + 10;
|
||||
} else if (*ps >= 'A' && *ps <= 'F') {
|
||||
digit = *ps - 'A' + 10;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
if (i % 2 == 0) {
|
||||
*pd = digit << 4;
|
||||
} else {
|
||||
*pd |= digit;
|
||||
++pd;
|
||||
}
|
||||
}
|
||||
if (*ps != '\0') return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Search an array of sha1 strings for one matching the given sha1.
|
||||
// Return the index of the match on success, or -1 if no match is
|
||||
// found.
|
||||
static int FindMatchingPatch(uint8_t* sha1, const std::vector<std::string>& patch_sha1_str) {
|
||||
for (size_t i = 0; i < patch_sha1_str.size(); ++i) {
|
||||
uint8_t patch_sha1[SHA_DIGEST_LENGTH];
|
||||
if (ParseSha1(patch_sha1_str[i].c_str(), patch_sha1) == 0 &&
|
||||
memcmp(patch_sha1, sha1, SHA_DIGEST_LENGTH) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
=======
|
||||
if (!android::base::ReadFully(fd, buffer, to_read)) {
|
||||
PLOG(ERROR) << "Failed to verify-read " << partition << " at " << p;
|
||||
return false;
|
||||
}
|
||||
@@ -574,7 +222,6 @@ static int FindMatchingPatch(uint8_t* sha1, const std::vector<std::string>& patc
|
||||
sync();
|
||||
|
||||
return true;
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
int ParseSha1(const std::string& str, uint8_t* digest) {
|
||||
@@ -758,40 +405,6 @@ static bool GenerateTarget(const Partition& target, const FileContents& source_f
|
||||
LOG(INFO) << " now " << short_sha1(expected_sha1);
|
||||
|
||||
// Write back the temp file to the partition.
|
||||
if (!WriteBufferToPartition(patched, target)) {
|
||||
LOG(ERROR) << "Failed to write patched data to " << target.name;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete the backup copy of the source.
|
||||
unlink(Paths::Get().cache_temp_source().c_str());
|
||||
|
||||
// Success!
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckPartition(const Partition& partition) {
|
||||
FileContents target_file;
|
||||
return ReadPartitionToBuffer(partition, &target_file, false);
|
||||
}
|
||||
|
||||
Partition Partition::Parse(const std::string& input_str, std::string* err) {
|
||||
std::vector<std::string> pieces = android::base::Split(input_str, ":");
|
||||
if (pieces.size() != 4 || pieces[0] != "EMMC") {
|
||||
*err = "Invalid number of tokens or non-eMMC target";
|
||||
return {};
|
||||
}
|
||||
|
||||
size_t size;
|
||||
if (!android::base::ParseUint(pieces[2], &size) || size == 0) {
|
||||
*err = "Failed to parse \"" + pieces[2] + "\" as byte count";
|
||||
return {};
|
||||
}
|
||||
|
||||
return Partition(pieces[1], size, pieces[3]);
|
||||
}
|
||||
|
||||
std::string Partition::ToString() const {
|
||||
if (*this) {
|
||||
return "EMMC:"s + name + ":" + std::to_string(size) + ":" + hash;
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := listxattr.c
|
||||
LOCAL_CFLAGS := -c -W
|
||||
LOCAL_MODULE := listxattr
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
LOCAL_PACK_MODULE_RELOCATIONS := false
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
|
||||
|
||||
LOCAL_SRC_FILES := bmlutils.c
|
||||
LOCAL_MODULE := libbmlutils
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
#Added for building TWRP dynamic:
|
||||
@@ -30,5 +30,5 @@ $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
|
||||
|
||||
LOCAL_SRC_FILES := bmlutils.c
|
||||
LOCAL_MODULE := libbmlutils
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# Copyright (C) 2016 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_CLANG := true
|
||||
LOCAL_SRC_FILES := bootloader_message.cpp
|
||||
LOCAL_MODULE := libbootloader_message
|
||||
LOCAL_STATIC_LIBRARIES := libbase libfs_mgr
|
||||
LOCAL_CFLAGS := -Werror
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 26; echo $$?),0)
|
||||
TARGET_GLOBAL_CFLAGS += -DUSE_OLD_BOOTLOADER_MESSAGE
|
||||
CLANG_TARGET_GLOBAL_CFLAGS += -DUSE_OLD_BOOTLOADER_MESSAGE
|
||||
endif
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <fstab/fstab.h>
|
||||
@@ -39,47 +40,7 @@ void SetMiscBlockDeviceForTest(std::string_view misc_device) {
|
||||
g_misc_device_for_test = misc_device;
|
||||
}
|
||||
|
||||
#ifdef USE_OLD_BOOTLOADER_MESSAGE
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
static struct fstab* read_fstab(std::string* err) {
|
||||
// The fstab path is always "/fstab.${ro.hardware}".
|
||||
std::string fstab_path = "/fstab.";
|
||||
char value[PROP_VALUE_MAX];
|
||||
if (__system_property_get("ro.hardware", value) == 0) {
|
||||
*err = "failed to get ro.hardware";
|
||||
return nullptr;
|
||||
}
|
||||
fstab_path += value;
|
||||
struct fstab* fstab = fs_mgr_read_fstab(fstab_path.c_str());
|
||||
if (fstab == nullptr) {
|
||||
*err = "failed to read " + fstab_path;
|
||||
}
|
||||
return fstab;
|
||||
}
|
||||
#endif
|
||||
|
||||
static std::string get_misc_blk_device(std::string* err) {
|
||||
<<<<<<< HEAD
|
||||
#ifdef USE_OLD_BOOTLOADER_MESSAGE
|
||||
struct fstab* fstab = read_fstab(err);
|
||||
#else
|
||||
std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
|
||||
fs_mgr_free_fstab);
|
||||
#endif
|
||||
if (!fstab) {
|
||||
*err = "failed to read default fstab";
|
||||
return "";
|
||||
}
|
||||
#ifdef USE_OLD_BOOTLOADER_MESSAGE
|
||||
fstab_rec* record = fs_mgr_get_entry_for_mount_point(fstab, "/misc");
|
||||
#else
|
||||
fstab_rec* record = fs_mgr_get_entry_for_mount_point(fstab.get(), "/misc");
|
||||
#endif
|
||||
if (record == nullptr) {
|
||||
*err = "failed to find /misc partition";
|
||||
return "";
|
||||
=======
|
||||
if (!g_misc_device_for_test.empty()) {
|
||||
return g_misc_device_for_test;
|
||||
}
|
||||
@@ -92,7 +53,6 @@ static std::string get_misc_blk_device(std::string* err) {
|
||||
if (entry.mount_point == "/misc") {
|
||||
return entry.blk_device;
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
*err = "failed to find /misc partition";
|
||||
|
||||
@@ -66,16 +66,6 @@ struct bootloader_message {
|
||||
char status[32];
|
||||
char recovery[768];
|
||||
|
||||
#ifdef USE_OLD_BOOTLOADER_MESSAGE
|
||||
// The 'recovery' field used to be 1024 bytes. It has only ever
|
||||
// been used to store the recovery command line, so 768 bytes
|
||||
// should be plenty. We carve off the last 256 bytes to store the
|
||||
// stage string (for multistage packages) and possible future
|
||||
// expansion.
|
||||
char stage[32];
|
||||
char slot_suffix[32];
|
||||
char reserved[192];
|
||||
#else
|
||||
// The 'recovery' field used to be 1024 bytes. It has only ever
|
||||
// been used to store the recovery command line, so 768 bytes
|
||||
// should be plenty. We carve off the last 256 bytes to store the
|
||||
@@ -88,14 +78,13 @@ struct bootloader_message {
|
||||
// 1184-byte so that the entire bootloader_message struct rounds up
|
||||
// to 2048-byte.
|
||||
char reserved[1184];
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* We must be cautious when changing the bootloader_message struct size,
|
||||
* because A/B-specific fields may end up with different offsets.
|
||||
*/
|
||||
#if !defined(USE_OLD_BOOTLOADER_MESSAGE) && ((__STDC_VERSION__ >= 201112L) || defined(__cplusplus))
|
||||
#if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus)
|
||||
static_assert(sizeof(struct bootloader_message) == 2048,
|
||||
"struct bootloader_message size changes, which may break A/B devices");
|
||||
#endif
|
||||
@@ -132,7 +121,7 @@ struct bootloader_message_ab {
|
||||
* Be cautious about the struct size change, in case we put anything post
|
||||
* bootloader_message_ab struct (b/29159185).
|
||||
*/
|
||||
#if !defined(USE_OLD_BOOTLOADER_MESSAGE) && ((__STDC_VERSION__ >= 201112L) || defined(__cplusplus))
|
||||
#if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus)
|
||||
static_assert(sizeof(struct bootloader_message_ab) == 4096,
|
||||
"struct bootloader_message_ab size changes");
|
||||
#endif
|
||||
|
||||
@@ -14,19 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
<<<<<<< HEAD
|
||||
#ifndef RECOVERY_COMMON_H
|
||||
#define RECOVERY_COMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
=======
|
||||
#pragma once
|
||||
|
||||
>>>>>>> android-10.0.0_r25
|
||||
#include <string>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -54,12 +46,7 @@ struct selabel_handle;
|
||||
|
||||
extern struct selabel_handle* sehandle;
|
||||
extern RecoveryUI* ui;
|
||||
<<<<<<< HEAD
|
||||
extern bool modified_flash;
|
||||
//typedef struct fstab_rec Volume;
|
||||
=======
|
||||
extern bool has_cache;
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
// The current stage, e.g. "1/2".
|
||||
extern std::string stage;
|
||||
@@ -67,21 +54,4 @@ extern std::string stage;
|
||||
// The reason argument provided in "--reason=".
|
||||
extern const char* reason;
|
||||
|
||||
<<<<<<< HEAD
|
||||
// fopen a file, mounting volumes and making parent dirs as necessary.
|
||||
FILE* fopen_path(const char *path, const char *mode);
|
||||
|
||||
void ui_print(const char* format, ...);
|
||||
|
||||
//static bool is_ro_debuggable();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
bool reboot(const std::string& command);
|
||||
|
||||
#endif // RECOVERY_COMMON_H
|
||||
=======
|
||||
bool is_ro_debuggable();
|
||||
>>>>>>> android-10.0.0_r25
|
||||
// static bool is_ro_debuggable();
|
||||
|
||||
Regular → Executable
+12
-2
@@ -3,12 +3,18 @@ ifeq ($(TW_INCLUDE_CRYPTO), true)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libe4crypt
|
||||
LOCAL_MODULE_TAGS := eng optional
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_CFLAGS :=
|
||||
LOCAL_SRC_FILES := Decrypt.cpp ScryptParameters.cpp Utils.cpp HashPassword.cpp ext4_crypt.cpp
|
||||
LOCAL_SHARED_LIBRARIES := libselinux libc libc++ libext4_utils libbase libcrypto libcutils libkeymaster_messages libhardware libprotobuf-cpp-lite
|
||||
LOCAL_STATIC_LIBRARIES := libscrypt_static
|
||||
LOCAL_C_INCLUDES := system/extras/ext4_utils system/extras/ext4_utils/include/ext4_utils external/scrypt/lib/crypto system/security/keystore hardware/libhardware/include/hardware system/security/softkeymaster/include/keymaster system/keymaster/include
|
||||
LOCAL_C_INCLUDES := system/extras/ext4_utils \
|
||||
system/extras/ext4_utils/include/ext4_utils \
|
||||
external/scrypt/lib/crypto \
|
||||
system/security/keystore/include \
|
||||
hardware/libhardware/include/hardware \
|
||||
system/security/softkeymaster/include/keymaster \
|
||||
system/keymaster/include
|
||||
|
||||
ifneq ($(wildcard hardware/libhardware/include/hardware/keymaster0.h),)
|
||||
LOCAL_CFLAGS += -DTW_CRYPTO_HAVE_KEYMASTERX
|
||||
@@ -17,6 +23,10 @@ endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
#8.0 or higher
|
||||
LOCAL_CFLAGS += -DHAVE_GATEKEEPER1
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
|
||||
LOCAL_SHARED_LIBRARIES += android.hardware.confirmationui@1.0
|
||||
# LOCAL_CFLAGS += -DUSE_
|
||||
endif
|
||||
LOCAL_SHARED_LIBRARIES += android.hardware.keymaster@3.0 libkeystore_binder libhidlbase libutils libbinder android.hardware.gatekeeper@1.0
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
|
||||
#9.0 rules
|
||||
|
||||
Regular → Executable
+9
-3
@@ -52,10 +52,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <fstream>
|
||||
|
||||
#include <ext4_utils/ext4_crypt.h>
|
||||
#include "ext4_crypt.h"
|
||||
|
||||
#ifdef USE_KEYSTORAGE_4
|
||||
#include <android/security/IKeystoreService.h>
|
||||
#include <android/hardware/confirmationui/1.0/types.h>
|
||||
#include <android/security/BnConfirmationPromptCallback.h>
|
||||
#include <android/security/keystore/IKeystoreService.h>
|
||||
#else
|
||||
#include <keystore/IKeystoreService.h>
|
||||
#include <keystore/authorization_set.h>
|
||||
@@ -82,6 +84,10 @@ extern "C" {
|
||||
|
||||
#include <android-base/file.h>
|
||||
|
||||
#ifdef USE_KEYSTORAGE_4
|
||||
using android::security::keystore::IKeystoreService;
|
||||
#endif
|
||||
|
||||
// Store main DE raw ref / policy
|
||||
extern std::string de_raw_ref;
|
||||
extern std::map<userid_t, std::string> s_de_key_raw_refs;
|
||||
@@ -551,7 +557,7 @@ std::string unwrapSyntheticPasswordBlob(const std::string& spblob_path, const st
|
||||
// First get the keystore service
|
||||
sp<IBinder> binder = getKeystoreBinderRetry();
|
||||
#ifdef USE_KEYSTORAGE_4
|
||||
sp<security::IKeystoreService> service = interface_cast<security::IKeystoreService>(binder);
|
||||
sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder);
|
||||
#else
|
||||
sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder);
|
||||
#endif
|
||||
|
||||
@@ -130,14 +130,14 @@ bool KeymasterOperation::updateCompletely(const std::string& input, std::string*
|
||||
auto error =
|
||||
mDevice->update(mOpHandle, nullptr, &inputBlob, &inputConsumed, nullptr, &outputBlob);
|
||||
if (error != KM_ERROR_OK) {
|
||||
LOG(ERROR) << "update failed, code " << error << "\n";
|
||||
LOG(ERROR) << "update failed, code " << error;
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
output->append(reinterpret_cast<const char*>(outputBlob.data), outputBlob.data_length);
|
||||
free(const_cast<uint8_t*>(outputBlob.data));
|
||||
if (inputConsumed > toRead) {
|
||||
LOG(ERROR) << "update reported too much input consumed\n";
|
||||
LOG(ERROR) << "update reported too much input consumed";
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ bool KeymasterOperation::finish() {
|
||||
auto error = mDevice->finish(mOpHandle, nullptr, nullptr, nullptr, nullptr);
|
||||
mDevice = nullptr;
|
||||
if (error != KM_ERROR_OK) {
|
||||
LOG(ERROR) << "finish failed, code " << error << "\n";
|
||||
LOG(ERROR) << "finish failed, code " << error;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -161,7 +161,7 @@ bool KeymasterOperation::finishWithOutput(std::string* output) {
|
||||
auto error = mDevice->finish(mOpHandle, nullptr, nullptr, nullptr, &outputBlob);
|
||||
mDevice = nullptr;
|
||||
if (error != KM_ERROR_OK) {
|
||||
LOG(ERROR) << "finish failed, code " << error << "\n";
|
||||
LOG(ERROR) << "finish failed, code " << error;
|
||||
return false;
|
||||
}
|
||||
output->assign(reinterpret_cast<const char*>(outputBlob.data), outputBlob.data_length);
|
||||
@@ -174,14 +174,14 @@ Keymaster::Keymaster() {
|
||||
const hw_module_t* module;
|
||||
int ret = hw_get_module_by_class(KEYSTORE_HARDWARE_MODULE_ID, NULL, &module);
|
||||
if (ret != 0) {
|
||||
LOG(ERROR) << "hw_get_module_by_class returned " << ret << "\n";
|
||||
LOG(ERROR) << "hw_get_module_by_class returned " << ret;
|
||||
return;
|
||||
}
|
||||
if (module->module_api_version == KEYMASTER_MODULE_API_VERSION_1_0) {
|
||||
keymaster1_device_t* device;
|
||||
ret = keymaster1_open(module, &device);
|
||||
if (ret != 0) {
|
||||
LOG(ERROR) << "keymaster1_open returned " << ret << "\n";
|
||||
LOG(ERROR) << "keymaster1_open returned " << ret;
|
||||
return;
|
||||
}
|
||||
mDevice = std::make_shared<Keymaster1Device>(device);
|
||||
@@ -189,12 +189,12 @@ Keymaster::Keymaster() {
|
||||
keymaster2_device_t* device;
|
||||
ret = keymaster2_open(module, &device);
|
||||
if (ret != 0) {
|
||||
LOG(ERROR) << "keymaster2_open returned " << ret << "\n";
|
||||
LOG(ERROR) << "keymaster2_open returned " << ret;
|
||||
return;
|
||||
}
|
||||
mDevice = std::make_shared<Keymaster2Device>(device);
|
||||
} else {
|
||||
LOG(ERROR) << "module_api_version is " << module->module_api_version << "\n";
|
||||
LOG(ERROR) << "module_api_version is " << module->module_api_version;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ Keymaster::Keymaster() {
|
||||
keymaster_key_blob_t keyBlob;
|
||||
auto error = mDevice->generate_key(&inParams, &keyBlob);
|
||||
if (error != KM_ERROR_OK) {
|
||||
LOG(ERROR) << "generate_key failed, code " << error << "\n";
|
||||
LOG(ERROR) << "generate_key failed, code " << error;
|
||||
return false;
|
||||
}
|
||||
key->assign(reinterpret_cast<const char*>(keyBlob.key_material), keyBlob.key_material_size);
|
||||
@@ -215,7 +215,7 @@ bool Keymaster::deleteKey(const std::string& key) {
|
||||
keymaster_key_blob_t keyBlob{reinterpret_cast<const uint8_t*>(key.data()), key.size()};
|
||||
auto error = mDevice->delete_key(&keyBlob);
|
||||
if (error != KM_ERROR_OK) {
|
||||
LOG(ERROR) << "delete_key failed, code " << error << "\n";
|
||||
LOG(ERROR) << "delete_key failed, code " << error;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -229,7 +229,7 @@ KeymasterOperation Keymaster::begin(keymaster_purpose_t purpose, const std::stri
|
||||
keymaster_key_param_set_t outParams_set;
|
||||
auto error = mDevice->begin(purpose, &keyBlob, &inParams, &outParams_set, &mOpHandle);
|
||||
if (error != KM_ERROR_OK) {
|
||||
LOG(ERROR) << "begin failed, code " << error << "\n";
|
||||
LOG(ERROR) << "begin failed, code " << error;
|
||||
return KeymasterOperation(nullptr, mOpHandle);
|
||||
}
|
||||
outParams->Clear();
|
||||
@@ -244,7 +244,7 @@ KeymasterOperation Keymaster::begin(keymaster_purpose_t purpose, const std::stri
|
||||
keymaster_operation_handle_t mOpHandle;
|
||||
auto error = mDevice->begin(purpose, &keyBlob, &inParams, nullptr, &mOpHandle);
|
||||
if (error != KM_ERROR_OK) {
|
||||
LOG(ERROR) << "begin failed, code " << error << "\n";
|
||||
LOG(ERROR) << "begin failed, code " << error;
|
||||
return KeymasterOperation(nullptr, mOpHandle);
|
||||
}
|
||||
return KeymasterOperation(mDevice, mOpHandle);
|
||||
|
||||
@@ -56,17 +56,17 @@ bool KeymasterOperation::updateCompletely(const std::string& input, std::string*
|
||||
auto inputBlob = blob2hidlVec(reinterpret_cast<const uint8_t*>(&*it), toRead);
|
||||
auto error = mDevice->update(mOpHandle, hidl_vec<KeyParameter>(), inputBlob, hidlCB);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "update failed: " << error.description() << "\n";
|
||||
LOG(ERROR) << "update failed: " << error.description();
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "update failed, code " << int32_t(km_error) << "\n";
|
||||
LOG(ERROR) << "update failed, code " << int32_t(km_error);
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
if (inputConsumed > toRead) {
|
||||
LOG(ERROR) << "update reported too much input consumed\n";
|
||||
LOG(ERROR) << "update reported too much input consumed";
|
||||
mDevice = nullptr;
|
||||
return false;
|
||||
}
|
||||
@@ -88,11 +88,11 @@ bool KeymasterOperation::finish(std::string* output) {
|
||||
hidl_vec<uint8_t>(), hidlCb);
|
||||
mDevice = nullptr;
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "finish failed: " << error.description() << "\n";
|
||||
LOG(ERROR) << "finish failed: " << error.description();
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "finish failed, code " << int32_t(km_error) << "\n";
|
||||
LOG(ERROR) << "finish failed, code " << int32_t(km_error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -114,27 +114,27 @@ Keymaster::Keymaster() {
|
||||
|
||||
auto error = mDevice->generateKey(inParams.hidl_data(), hidlCb);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "generate_key failed: " << error.description() << "\n";
|
||||
LOG(ERROR) << "generate_key failed: " << error.description();
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "generate_key failed, code " << int32_t(km_error) << "\n";
|
||||
LOG(ERROR) << "generate_key failed, code " << int32_t(km_error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
bool Keymaster::deleteKey(const std::string& key) {
|
||||
LOG(ERROR) << "NOT deleting key in TWRP\n";
|
||||
LOG(ERROR) << "NOT deleting key in TWRP";
|
||||
return false;
|
||||
/*auto keyBlob = blob2hidlVec(key);
|
||||
auto error = mDevice->deleteKey(keyBlob);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "delete_key failed: " << error.description() << "\n";
|
||||
LOG(ERROR) << "delete_key failed: " << error.description();
|
||||
return false;
|
||||
}
|
||||
if (ErrorCode(error) != ErrorCode::OK) {
|
||||
LOG(ERROR) << "delete_key failed, code " << uint32_t(ErrorCode(error)) << "\n";
|
||||
LOG(ERROR) << "delete_key failed, code " << uint32_t(ErrorCode(error));
|
||||
return false;
|
||||
}
|
||||
return true;*/
|
||||
@@ -153,11 +153,11 @@ bool Keymaster::upgradeKey(const std::string& oldKey, const AuthorizationSet& in
|
||||
};
|
||||
auto error = mDevice->upgradeKey(oldKeyBlob, inParams.hidl_data(), hidlCb);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "upgrade_key failed: " << error.description() << "\n";
|
||||
LOG(ERROR) << "upgrade_key failed: " << error.description();
|
||||
return false;
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "upgrade_key failed, code " << int32_t(km_error) << "\n";
|
||||
LOG(ERROR) << "upgrade_key failed, code " << int32_t(km_error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -181,11 +181,11 @@ KeymasterOperation Keymaster::begin(KeyPurpose purpose, const std::string& key,
|
||||
|
||||
auto error = mDevice->begin(purpose, keyBlob, inParams.hidl_data(), hidlCb);
|
||||
if (!error.isOk()) {
|
||||
LOG(ERROR) << "begin failed: " << error.description() << "\n";
|
||||
LOG(ERROR) << "begin failed: " << error.description();
|
||||
return KeymasterOperation(ErrorCode::UNKNOWN_ERROR);
|
||||
}
|
||||
if (km_error != ErrorCode::OK) {
|
||||
LOG(ERROR) << "begin failed, code " << int32_t(km_error) << "\n";
|
||||
LOG(ERROR) << "begin failed, code " << int32_t(km_error);
|
||||
return KeymasterOperation(km_error);
|
||||
}
|
||||
return KeymasterOperation(mDevice, mOpHandle);
|
||||
@@ -207,7 +207,7 @@ using namespace ::android::vold;
|
||||
int keymaster_compatibility_cryptfs_scrypt() {
|
||||
Keymaster dev;
|
||||
if (!dev) {
|
||||
LOG(ERROR) << "Failed to initiate keymaster session\n";
|
||||
LOG(ERROR) << "Failed to initiate keymaster session";
|
||||
return -1;
|
||||
}
|
||||
return dev.isSecure();
|
||||
@@ -224,11 +224,11 @@ int keymaster_compatibility_cryptfs_scrypt() {
|
||||
Keymaster dev;
|
||||
std::string key;
|
||||
if (!dev) {
|
||||
LOG(ERROR) << "Failed to initiate keymaster session\n";
|
||||
LOG(ERROR) << "Failed to initiate keymaster session";
|
||||
return -1;
|
||||
}
|
||||
if (!key_buffer || !key_out_size) {
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument\n";
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument";
|
||||
return -1;
|
||||
}
|
||||
if (key_out_size) {
|
||||
@@ -276,11 +276,11 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
{
|
||||
Keymaster dev;
|
||||
if (!dev) {
|
||||
LOG(ERROR) << "Failed to initiate keymaster session\n";
|
||||
LOG(ERROR) << "Failed to initiate keymaster session";
|
||||
return -1;
|
||||
}
|
||||
if (!key_blob || !object || !signature_buffer || !signature_buffer_size) {
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument\n";
|
||||
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
std::string newKey;
|
||||
bool ret = dev.upgradeKey(key, paramBuilder, &newKey);
|
||||
if(ret == false) {
|
||||
LOG(ERROR) << "Error upgradeKey: \n";
|
||||
LOG(ERROR) << "Error upgradeKey: ";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
}
|
||||
|
||||
if (key_buffer_size < newKey.size()) {
|
||||
LOG(ERROR) << "key buffer size is too small\n";
|
||||
LOG(ERROR) << "key buffer size is too small";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -322,24 +322,24 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
|
||||
}
|
||||
|
||||
if (op.errorCode() != ErrorCode::OK) {
|
||||
LOG(ERROR) << "Error starting keymaster signature transaction: " << int32_t(op.errorCode()) << "\n";
|
||||
LOG(ERROR) << "Error starting keymaster signature transaction: " << int32_t(op.errorCode());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!op.updateCompletely(input, &output)) {
|
||||
LOG(ERROR) << "Error sending data to keymaster signature transaction: "
|
||||
<< uint32_t(op.errorCode()) << "\n";
|
||||
<< uint32_t(op.errorCode());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!op.finish(&output)) {
|
||||
LOG(ERROR) << "Error finalizing keymaster signature transaction: " << int32_t(op.errorCode()) << "\n";
|
||||
LOG(ERROR) << "Error finalizing keymaster signature transaction: " << int32_t(op.errorCode());
|
||||
return -1;
|
||||
}
|
||||
|
||||
*signature_buffer = reinterpret_cast<uint8_t*>(malloc(output.size()));
|
||||
if (*signature_buffer == nullptr) {
|
||||
LOG(ERROR) << "Error allocation buffer for keymaster signature\n";
|
||||
LOG(ERROR) << "Error allocation buffer for keymaster signature";
|
||||
return -1;
|
||||
}
|
||||
*signature_buffer_size = output.size();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
#ifndef _EXT4_CRYPT_H_
|
||||
#define _EXT4_CRYPT_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdbool.h>
|
||||
#include <cutils/multiuser.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
bool e4crypt_is_native();
|
||||
|
||||
int e4crypt_policy_ensure(const char *directory, const char *policy,
|
||||
size_t policy_length,
|
||||
const char *contents_encryption_mode,
|
||||
const char *filenames_encryption_mode);
|
||||
|
||||
static const char* e4crypt_unencrypted_folder = "/unencrypted";
|
||||
static const char* e4crypt_key_ref = "/unencrypted/ref";
|
||||
static const char* e4crypt_key_mode = "/unencrypted/mode";
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // _EXT4_CRYPT_H_
|
||||
@@ -3,7 +3,7 @@ ifeq ($(TW_INCLUDE_CRYPTO), true)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libcryptfsfde
|
||||
LOCAL_MODULE_TAGS := eng optional
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SRC_FILES := cryptfs.cpp
|
||||
LOCAL_SHARED_LIBRARIES := libcrypto libhardware libcutils libstdc++
|
||||
LOCAL_STATIC_LIBRARIES := libscrypttwrp_static
|
||||
|
||||
+39
-46
@@ -256,7 +256,7 @@ static int get_keymaster_hw_fde_passwd(const char* passwd, unsigned char* newpw,
|
||||
|
||||
if (should_use_keymaster()) {
|
||||
if (scrypt_keymaster(passwd, salt, newpw, (void*)ftr)) {
|
||||
SLOGE("scrypt failed\n");
|
||||
SLOGE("scrypt failed");
|
||||
} else {
|
||||
rc = 0;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ static int verify_and_update_hw_fde_passwd(const char *passwd,
|
||||
++crypt_ftr->failed_decrypt_count;
|
||||
|
||||
if (ascii_passwd_updated) {
|
||||
SLOGI("Ascii password was updated\n");
|
||||
SLOGI("Ascii password was updated");
|
||||
} else {
|
||||
/* Code in else part would execute only once:
|
||||
* When device is upgraded from L->M release.
|
||||
@@ -305,14 +305,14 @@ static int verify_and_update_hw_fde_passwd(const char *passwd,
|
||||
if (crypt_ftr->crypt_type == CRYPT_TYPE_DEFAULT) {
|
||||
new_passwd = (char*)malloc(strlen(DEFAULT_HEX_PASSWORD) + 1);
|
||||
if (new_passwd == NULL) {
|
||||
SLOGE("System out of memory. Password verification incomplete\n");
|
||||
SLOGE("System out of memory. Password verification incomplete");
|
||||
goto out;
|
||||
}
|
||||
strlcpy(new_passwd, DEFAULT_HEX_PASSWORD, strlen(DEFAULT_HEX_PASSWORD) + 1);
|
||||
} else {
|
||||
new_passwd = (char*)malloc(strlen(passwd) * 2 + 1);
|
||||
if (new_passwd == NULL) {
|
||||
SLOGE("System out of memory. Password verification incomplete\n");
|
||||
SLOGE("System out of memory. Password verification incomplete");
|
||||
goto out;
|
||||
}
|
||||
convert_key_to_hex_ascii_for_upgrade((const unsigned char*)passwd,
|
||||
@@ -322,7 +322,7 @@ static int verify_and_update_hw_fde_passwd(const char *passwd,
|
||||
(char*) crypt_ftr->crypto_type_name);
|
||||
if (key_index >=0) {
|
||||
crypt_ftr->failed_decrypt_count = 0;
|
||||
SLOGI("Hex password verified...will try to update with Ascii value\n");
|
||||
SLOGI("Hex password verified...will try to update with Ascii value");
|
||||
/* Before updating password, tie that with keymaster to tie with ROT */
|
||||
|
||||
if (get_keymaster_hw_fde_passwd(passwd, newpw,
|
||||
@@ -336,9 +336,9 @@ static int verify_and_update_hw_fde_passwd(const char *passwd,
|
||||
|
||||
if (passwd_updated >= 0) {
|
||||
crypt_ftr->flags |= CRYPT_ASCII_PASSWORD_UPDATED;
|
||||
SLOGI("Ascii password recorded and updated\n");
|
||||
SLOGI("Ascii password recorded and updated");
|
||||
} else {
|
||||
SLOGI("Passwd verified, could not update...Will try next time\n");
|
||||
SLOGI("Passwd verified, could not update...Will try next time");
|
||||
}
|
||||
} else {
|
||||
++crypt_ftr->failed_decrypt_count;
|
||||
@@ -412,10 +412,10 @@ static int keymaster_sign_object(struct crypt_mnt_ftr *ftr,
|
||||
// so) because we really should be using a proper deterministic
|
||||
// RSA padding function, such as PKCS1.
|
||||
memcpy(to_sign + 1, object, min((size_t)RSA_KEY_SIZE_BYTES - 1, object_size));
|
||||
SLOGI("Signing safely-padded object\n");
|
||||
SLOGI("Signing safely-padded object");
|
||||
break;
|
||||
default:
|
||||
SLOGE("Unknown KDF type %d\n", ftr->kdf_type);
|
||||
SLOGE("Unknown KDF type %d", ftr->kdf_type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ initfail:
|
||||
return -1;
|
||||
}
|
||||
/*if (put_crypt_ftr_and_key(ftr) != 0) {
|
||||
SLOGE("Failed to write upgraded key to disk\n");
|
||||
SLOGE("Failed to write upgraded key to disk");
|
||||
}*/
|
||||
SLOGD("Key upgraded successfully\n");
|
||||
return 0;
|
||||
@@ -930,8 +930,8 @@ static int load_crypto_mapping_table(struct crypt_mnt_ftr *crypt_ftr,
|
||||
crypt_ftr->crypto_type_name, master_key_ascii,
|
||||
real_blk_name, extra_params);
|
||||
|
||||
SLOGI("target_type = %s\n", tgt->target_type);
|
||||
SLOGI("real_blk_name = %s, extra_params = %s\n", real_blk_name, extra_params);
|
||||
SLOGI("target_type = %s", tgt->target_type);
|
||||
SLOGI("real_blk_name = %s, extra_params = %s", real_blk_name, extra_params);
|
||||
#else
|
||||
convert_key_to_hex_ascii(master_key, crypt_ftr->keysize, master_key_ascii);
|
||||
strlcpy(tgt->target_type, "crypt", DM_MAX_TYPE_NAME);
|
||||
@@ -1205,13 +1205,13 @@ static int scrypt_keymaster(const char *passwd, const unsigned char *salt,
|
||||
INTERMEDIATE_BUF_SIZE);
|
||||
|
||||
if (rc) {
|
||||
SLOGE("scrypt failed\n");
|
||||
SLOGE("scrypt failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (keymaster_sign_object(ftr, ikey, INTERMEDIATE_BUF_SIZE,
|
||||
&signature, &signature_size)) {
|
||||
SLOGE("Keymaster signing failed\n");
|
||||
SLOGE("Keymaster signing failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1220,7 +1220,7 @@ static int scrypt_keymaster(const char *passwd, const unsigned char *salt,
|
||||
free(signature);
|
||||
|
||||
if (rc) {
|
||||
SLOGE("scrypt failed\n");
|
||||
SLOGE("scrypt failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1242,7 +1242,7 @@ static int decrypt_master_key_aux(const char *passwd, unsigned char *salt,
|
||||
/* Turn the password into an intermediate key and IV that can decrypt the
|
||||
master key */
|
||||
if (kdf(passwd, salt, ikey, kdf_params)) {
|
||||
SLOGE("kdf failed\n");
|
||||
SLOGE("kdf failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1308,7 +1308,7 @@ static int decrypt_master_key(const char *passwd, unsigned char *decrypted_maste
|
||||
decrypted_master_key, kdf, kdf_params,
|
||||
intermediate_key, intermediate_key_size);
|
||||
if (ret != 0) {
|
||||
SLOGW("failure decrypting master key\n");
|
||||
SLOGW("failure decrypting master key");
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1332,13 +1332,6 @@ static int test_mount_hw_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr,
|
||||
|
||||
int key_index = 0;
|
||||
if(is_hw_disk_encryption((char*)crypt_ftr->crypto_type_name)) {
|
||||
if (crypt_ftr->flags & CRYPT_FORCE_COMPLETE) {
|
||||
if (decrypt_master_key(passwd, decrypted_master_key, crypt_ftr, 0, 0)) {
|
||||
printf("Failed to decrypt master key\n");
|
||||
rc = -1;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
key_index = verify_and_update_hw_fde_passwd(passwd, crypt_ftr);
|
||||
if (key_index < 0) {
|
||||
rc = -1;
|
||||
@@ -1349,7 +1342,7 @@ static int test_mount_hw_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr,
|
||||
#ifndef CONFIG_HW_DISK_ENCRYPT_PERF
|
||||
if (create_crypto_blk_dev(crypt_ftr, (unsigned char*)&key_index,
|
||||
real_blkdev, crypto_blkdev, label, 0)) {
|
||||
SLOGE("Error creating decrypted block device\n");
|
||||
SLOGE("Error creating decrypted block device");
|
||||
rc = -1;
|
||||
goto errout;
|
||||
}
|
||||
@@ -1357,7 +1350,7 @@ static int test_mount_hw_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr,
|
||||
} else {
|
||||
if (create_crypto_blk_dev(crypt_ftr, decrypted_master_key,
|
||||
real_blkdev, crypto_blkdev, label, 0)) {
|
||||
SLOGE("Error creating decrypted block device\n");
|
||||
SLOGE("Error creating decrypted block device");
|
||||
rc = -1;
|
||||
goto errout;
|
||||
}
|
||||
@@ -1403,7 +1396,7 @@ static int test_mount_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr,
|
||||
//char real_blkdev[MAXPATHLEN];
|
||||
char tmp_mount_point[64];
|
||||
unsigned int orig_failed_decrypt_count;
|
||||
int rc = 0;
|
||||
int rc;
|
||||
int use_keymaster = 0;
|
||||
unsigned char* intermediate_key = 0;
|
||||
size_t intermediate_key_size = 0;
|
||||
@@ -1446,7 +1439,7 @@ static int test_mount_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr,
|
||||
if (rc == 0 && memcmp(scrypted_intermediate_key,
|
||||
crypt_ftr->scrypted_intermediate_key,
|
||||
sizeof(scrypted_intermediate_key)) == 0) {
|
||||
SLOGI("Password matches\n");
|
||||
SLOGI("Password matches");
|
||||
rc = 0;
|
||||
} else {
|
||||
/* Try mounting the file system anyway, just in case the problem's with
|
||||
@@ -1461,7 +1454,7 @@ static int test_mount_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr,
|
||||
rc = -1;
|
||||
} else {
|
||||
/* Success! */
|
||||
SLOGI("Password did not match but decrypted drive mounted - continue\n");
|
||||
SLOGI("Password did not match but decrypted drive mounted - continue");
|
||||
umount(tmp_mount_point);
|
||||
rc = 0;
|
||||
}
|
||||
@@ -1501,7 +1494,7 @@ int cryptfs_setup_ext_volume(const char* label, const char* real_blkdev,
|
||||
const unsigned char* key, int keysize, char* out_crypto_blkdev) {
|
||||
int fd = open(real_blkdev, O_RDONLY|O_CLOEXEC);
|
||||
if (fd == -1) {
|
||||
SLOGE("Failed to open %s: %s\n", real_blkdev, strerror(errno));
|
||||
SLOGE("Failed to open %s: %s", real_blkdev, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1510,7 +1503,7 @@ int cryptfs_setup_ext_volume(const char* label, const char* real_blkdev,
|
||||
close(fd);
|
||||
|
||||
if (nr_sec == 0) {
|
||||
SLOGE("Failed to get size of %s: %s\n", real_blkdev, strerror(errno));
|
||||
SLOGE("Failed to get size of %s: %s", real_blkdev, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1542,12 +1535,12 @@ int check_unmounted_and_get_ftr(struct crypt_mnt_ftr* crypt_ftr)
|
||||
property_get("ro.crypto.state", encrypted_state, "");
|
||||
if ( master_key_saved || strcmp(encrypted_state, "encrypted") ) {
|
||||
SLOGE("encrypted fs already validated or not running with encryption,"
|
||||
" aborting\n");
|
||||
" aborting");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (get_crypt_ftr_and_key(crypt_ftr)) {
|
||||
SLOGE("Error getting crypt footer and key\n");
|
||||
SLOGE("Error getting crypt footer and key");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1558,11 +1551,11 @@ int check_unmounted_and_get_ftr(struct crypt_mnt_ftr* crypt_ftr)
|
||||
int cryptfs_check_passwd_hw(const char* passwd)
|
||||
{
|
||||
struct crypt_mnt_ftr crypt_ftr;
|
||||
int rc = 0;
|
||||
int rc;
|
||||
unsigned char master_key[KEY_LEN_BYTES];
|
||||
/* get key */
|
||||
if (get_crypt_ftr_and_key(&crypt_ftr)) {
|
||||
SLOGE("Error getting crypt footer and key\n");
|
||||
SLOGE("Error getting crypt footer and key");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1576,7 +1569,7 @@ int cryptfs_check_passwd_hw(const char* passwd)
|
||||
*/
|
||||
rc = cryptfs_get_master_key(&crypt_ftr, passwd, master_key);
|
||||
if (rc) {
|
||||
SLOGE("password doesn't match\n");
|
||||
SLOGE("password doesn't match");
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1584,7 +1577,7 @@ int cryptfs_check_passwd_hw(const char* passwd)
|
||||
DATA_MNT_POINT, CRYPTO_BLOCK_DEVICE);
|
||||
|
||||
if (rc) {
|
||||
SLOGE("Default password did not match on reboot encryption\n");
|
||||
SLOGE("Default password did not match on reboot encryption");
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
@@ -1600,7 +1593,7 @@ int cryptfs_check_passwd_hw(const char* passwd)
|
||||
int cryptfs_check_passwd(const char *passwd)
|
||||
{
|
||||
/*if (e4crypt_is_native()) {
|
||||
SLOGE("cryptfs_check_passwd not valid for file encryption\n");
|
||||
SLOGE("cryptfs_check_passwd not valid for file encryption");
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
@@ -1609,7 +1602,7 @@ int cryptfs_check_passwd(const char *passwd)
|
||||
|
||||
rc = check_unmounted_and_get_ftr(&crypt_ftr);
|
||||
if (rc) {
|
||||
SLOGE("Could not get footer\n");
|
||||
SLOGE("Could not get footer");
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1622,7 +1615,7 @@ int cryptfs_check_passwd(const char *passwd)
|
||||
DATA_MNT_POINT, CRYPTO_BLOCK_DEVICE);
|
||||
|
||||
if (rc) {
|
||||
SLOGE("Password did not match\n");
|
||||
SLOGE("Password did not match");
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1635,7 +1628,7 @@ int cryptfs_check_passwd(const char *passwd)
|
||||
rc = test_mount_encrypted_fs(&crypt_ftr, DEFAULT_PASSWORD,
|
||||
DATA_MNT_POINT, CRYPTO_BLOCK_DEVICE);
|
||||
if (rc) {
|
||||
SLOGE("Default password did not match on reboot encryption\n");
|
||||
SLOGE("Default password did not match on reboot encryption");
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -1652,17 +1645,17 @@ int cryptfs_verify_passwd(const char *passwd)
|
||||
|
||||
property_get("ro.crypto.state", encrypted_state, "");
|
||||
if (strcmp(encrypted_state, "encrypted") ) {
|
||||
SLOGE("device not encrypted, aborting\n");
|
||||
SLOGE("device not encrypted, aborting");
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (!master_key_saved) {
|
||||
SLOGE("encrypted fs not yet mounted, aborting\n");
|
||||
SLOGE("encrypted fs not yet mounted, aborting");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!saved_mount_point) {
|
||||
SLOGE("encrypted fs failed to save mount point, aborting\n");
|
||||
SLOGE("encrypted fs failed to save mount point, aborting");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1742,7 +1735,7 @@ int cryptfs_get_master_key(struct crypt_mnt_ftr* ftr, const char* password,
|
||||
&intermediate_key_size);
|
||||
|
||||
if (rc) {
|
||||
SLOGE("Can't calculate intermediate key\n");
|
||||
SLOGE("Can't calculate intermediate key");
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1760,7 +1753,7 @@ int cryptfs_get_master_key(struct crypt_mnt_ftr* ftr, const char* password,
|
||||
free(intermediate_key);
|
||||
|
||||
if (rc) {
|
||||
SLOGE("Can't scrypt intermediate key\n");
|
||||
SLOGE("Can't scrypt intermediate key");
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ ifeq ($(TW_INCLUDE_CRYPTO), true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.vold_decrypt.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
|
||||
# Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
|
||||
@@ -75,7 +75,7 @@ ifeq ($(TW_INCLUDE_CRYPTO), true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libvolddecrypt
|
||||
LOCAL_MODULE_TAGS := eng optional
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_CFLAGS := -Wall
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += external/stlport/stlport bionic bionic/libstdc++/include
|
||||
@@ -115,7 +115,7 @@ ifeq ($(TW_INCLUDE_CRYPTO), true)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := vdc_pie
|
||||
LOCAL_SRC_FILES := vdc_pie.cpp
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
LOCAL_CLANG := true
|
||||
|
||||
+7
-7
@@ -18,7 +18,7 @@ ifneq ($(TW_EXCLUDE_DEFAULT_USB_INIT), true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.usb.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
|
||||
# Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
|
||||
@@ -34,7 +34,7 @@ endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 22; echo $$?),0)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.service.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
|
||||
@@ -43,7 +43,7 @@ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 22; echo $$?),0)
|
||||
else
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.service.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
|
||||
@@ -54,7 +54,7 @@ endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.hlthchrg.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
|
||||
@@ -72,7 +72,7 @@ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
else
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.hlthchrg.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
|
||||
@@ -85,7 +85,7 @@ ifeq ($(TWRP_INCLUDE_LOGCAT), true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.logd.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
|
||||
# Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
|
||||
@@ -101,7 +101,7 @@ endif
|
||||
ifeq ($(TW_USE_TOOLBOX), true)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := init.recovery.mksh.rc
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
|
||||
# Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
|
||||
|
||||
Regular → Executable
+2
-41
@@ -7,26 +7,11 @@ import /init.recovery.vold_decrypt.rc
|
||||
import /init.recovery.${ro.hardware}.rc
|
||||
|
||||
on early-init
|
||||
# Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
|
||||
write /sys/fs/selinux/checkreqprot 0
|
||||
|
||||
# Set the security context for the init process.
|
||||
# This should occur before anything else (e.g. ueventd) is started.
|
||||
setcon u:r:init:s0
|
||||
|
||||
# Set the security context of /postinstall if present.
|
||||
restorecon /postinstall
|
||||
|
||||
start ueventd
|
||||
|
||||
<<<<<<< HEAD
|
||||
service set_permissive /sbin/permissive.sh
|
||||
oneshot
|
||||
seclabel u:r:recovery:s0
|
||||
=======
|
||||
setprop sys.usb.configfs 0
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
on init
|
||||
export PATH /sbin:/system/bin
|
||||
export LD_LIBRARY_PATH /sbin
|
||||
@@ -35,8 +20,6 @@ on init
|
||||
export ANDROID_DATA /data
|
||||
export EXTERNAL_STORAGE /sdcard
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
symlink /proc/self/fd/0 /dev/stdin
|
||||
symlink /proc/self/fd/1 /dev/stdout
|
||||
symlink /proc/self/fd/2 /dev/stderr
|
||||
@@ -44,7 +27,6 @@ on init
|
||||
symlink /system/bin /bin
|
||||
symlink /system/etc /etc
|
||||
|
||||
>>>>>>> android-10.0.0_r25
|
||||
mount cgroup none /acct cpuacct
|
||||
mkdir /acct/uid
|
||||
|
||||
@@ -61,15 +43,12 @@ on init
|
||||
write /proc/sys/kernel/panic_on_oops 1
|
||||
write /proc/sys/vm/max_map_count 1000000
|
||||
|
||||
<<<<<<< HEAD
|
||||
on fs
|
||||
mount pstore pstore /sys/fs/pstore
|
||||
mkdir /dev/usb-ffs 0770 shell shell
|
||||
mkdir /dev/usb-ffs/adb 0770 shell shell
|
||||
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
|
||||
|
||||
=======
|
||||
>>>>>>> android-10.0.0_r25
|
||||
on boot
|
||||
ifup lo
|
||||
hostname localhost
|
||||
@@ -116,7 +95,6 @@ on late-init
|
||||
trigger early-boot
|
||||
trigger boot
|
||||
|
||||
<<<<<<< HEAD
|
||||
on property:sys.powerctl=*
|
||||
powerctl ${sys.powerctl}
|
||||
|
||||
@@ -125,37 +103,20 @@ service ueventd /sbin/ueventd
|
||||
seclabel u:r:ueventd:s0
|
||||
|
||||
service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
|
||||
=======
|
||||
service ueventd /system/bin/ueventd
|
||||
critical
|
||||
seclabel u:r:ueventd:s0
|
||||
|
||||
service charger /system/bin/charger
|
||||
critical
|
||||
seclabel u:r:charger:s0
|
||||
|
||||
service recovery /system/bin/recovery
|
||||
socket recovery stream 422 system system
|
||||
seclabel u:r:recovery:s0
|
||||
|
||||
service adbd /system/bin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
|
||||
>>>>>>> android-10.0.0_r25
|
||||
disabled
|
||||
socket adbd stream 660 system system
|
||||
seclabel u:r:adbd:s0
|
||||
|
||||
<<<<<<< HEAD
|
||||
# Always start adbd on userdebug and eng builds
|
||||
on property:ro.debuggable=1
|
||||
#write /sys/class/android_usb/android0/enable 1
|
||||
#start adbd
|
||||
setprop service.adb.root 1
|
||||
=======
|
||||
service fastbootd /system/bin/fastbootd
|
||||
|
||||
service fastbootd /sbin/fastbootd
|
||||
disabled
|
||||
group system
|
||||
seclabel u:r:fastbootd:s0
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
# Restart adbd so it can run as root
|
||||
on property:service.adb.root=1
|
||||
|
||||
Regular → Executable
+3
@@ -3,3 +3,6 @@ on boot
|
||||
# For starting recovery on 5.0 and newer
|
||||
service recovery /sbin/recovery
|
||||
seclabel u:r:recovery:s0
|
||||
|
||||
on early-init
|
||||
write /sys/fs/selinux/enforce 0
|
||||
|
||||
Executable
+225
@@ -0,0 +1,225 @@
|
||||
import /init.recovery.logd.rc
|
||||
import /init.recovery.ldconfig.rc
|
||||
import /init.recovery.mksh.rc
|
||||
import /init.recovery.usb.rc
|
||||
import /init.recovery.service.rc
|
||||
import /init.recovery.vold_decrypt.rc
|
||||
import /init.recovery.${ro.hardware}.rc
|
||||
|
||||
on early-init
|
||||
# Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
|
||||
write /sys/fs/selinux/checkreqprot 0
|
||||
|
||||
# Set the security context for the init process.
|
||||
# This should occur before anything else (e.g. ueventd) is started.
|
||||
setcon u:r:init:s0
|
||||
|
||||
# Set the security context of /postinstall if present.
|
||||
restorecon /postinstall
|
||||
|
||||
start ueventd
|
||||
|
||||
service set_permissive /sbin/permissive.sh
|
||||
oneshot
|
||||
seclabel u:r:recovery:s0
|
||||
|
||||
on init
|
||||
export PATH /sbin:/system/bin
|
||||
export LD_LIBRARY_PATH /sbin
|
||||
|
||||
export ANDROID_ROOT /system
|
||||
export ANDROID_DATA /data
|
||||
export EXTERNAL_STORAGE /sdcard
|
||||
|
||||
symlink /proc/self/fd/0 /dev/stdin
|
||||
symlink /proc/self/fd/1 /dev/stdout
|
||||
symlink /proc/self/fd/2 /dev/stderr
|
||||
|
||||
symlink /system/bin /bin
|
||||
symlink /system/etc /etc
|
||||
|
||||
mount cgroup none /acct cpuacct
|
||||
mkdir /acct/uid
|
||||
|
||||
mkdir /system
|
||||
mkdir /data
|
||||
mkdir /cache
|
||||
mkdir /sideload
|
||||
mkdir /mnt/system
|
||||
mount tmpfs tmpfs /tmp
|
||||
|
||||
chown root shell /tmp
|
||||
chmod 0775 /tmp
|
||||
|
||||
write /proc/sys/kernel/panic_on_oops 1
|
||||
write /proc/sys/vm/max_map_count 1000000
|
||||
|
||||
on fs
|
||||
mount pstore pstore /sys/fs/pstore
|
||||
mkdir /dev/usb-ffs 0770 shell shell
|
||||
mkdir /dev/usb-ffs/adb 0770 shell shell
|
||||
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
|
||||
|
||||
on boot
|
||||
ifup lo
|
||||
hostname localhost
|
||||
domainname localdomain
|
||||
|
||||
class_start default
|
||||
|
||||
# Load properties, pre-Android 6.0
|
||||
on load_all_props_action
|
||||
load_all_props
|
||||
|
||||
# Load properties, Android 6.0+
|
||||
on load_system_props_action
|
||||
load_system_props
|
||||
|
||||
# Load properties, Android 6.0+, vendor init lives here
|
||||
on load_persist_props_action
|
||||
load_persist_props
|
||||
|
||||
on firmware_mounts_complete
|
||||
rm /dev/.booting
|
||||
|
||||
# Mount filesystems and start core system services.
|
||||
on late-init
|
||||
trigger early-fs
|
||||
trigger fs
|
||||
trigger post-fs
|
||||
trigger post-fs-data
|
||||
|
||||
# Load properties, pre-Android 6.0
|
||||
trigger load_all_props_action
|
||||
|
||||
# Load properties from /system/ + /factory after fs mount. Place
|
||||
# this in another action so that the load will be scheduled after the prior
|
||||
# issued fs triggers have completed.
|
||||
trigger load_system_props_action
|
||||
|
||||
# Load properties, Android 6.0+, vendor init lives here
|
||||
trigger load_persist_props_action
|
||||
|
||||
# Remove a file to wake up anything waiting for firmware
|
||||
trigger firmware_mounts_complete
|
||||
|
||||
trigger early-boot
|
||||
trigger boot
|
||||
|
||||
on property:sys.powerctl=*
|
||||
powerctl ${sys.powerctl}
|
||||
|
||||
service ueventd /sbin/ueventd
|
||||
critical
|
||||
seclabel u:r:ueventd:s0
|
||||
|
||||
service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
|
||||
disabled
|
||||
socket adbd stream 660 system system
|
||||
seclabel u:r:adbd:s0
|
||||
|
||||
# Always start adbd on userdebug and eng builds
|
||||
on property:ro.debuggable=1
|
||||
#write /sys/class/android_usb/android0/enable 1
|
||||
#start adbd
|
||||
setprop service.adb.root 1
|
||||
|
||||
service fastbootd /sbin/fastbootd
|
||||
disabled
|
||||
group system
|
||||
seclabel u:r:fastbootd:s0
|
||||
|
||||
# Restart adbd so it can run as root
|
||||
on property:service.adb.root=1
|
||||
restart adbd
|
||||
|
||||
# Always start adbd on userdebug and eng builds
|
||||
on fs && property:ro.debuggable=1
|
||||
setprop sys.usb.config adb
|
||||
|
||||
on fs && property:sys.usb.configfs=1
|
||||
mount configfs none /config
|
||||
mkdir /config/usb_gadget/g1 0770 shell shell
|
||||
write /config/usb_gadget/g1/idVendor 0x18D1
|
||||
mkdir /config/usb_gadget/g1/strings/0x409 0770
|
||||
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
|
||||
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
|
||||
write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
|
||||
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
|
||||
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
|
||||
|
||||
on fs && property:sys.usb.configfs=0
|
||||
write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot
|
||||
write /sys/class/android_usb/android0/idVendor 18D1
|
||||
write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
|
||||
write /sys/class/android_usb/android0/iProduct ${ro.product.model}
|
||||
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
|
||||
|
||||
on fs
|
||||
mkdir /dev/usb-ffs 0775 shell shell
|
||||
mkdir /dev/usb-ffs/adb 0770 shell shell
|
||||
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
|
||||
mkdir /dev/usb-ffs/fastboot 0770 system system
|
||||
mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000
|
||||
|
||||
on property:sys.usb.config=adb
|
||||
start adbd
|
||||
|
||||
on property:sys.usb.config=fastboot
|
||||
start fastbootd
|
||||
|
||||
on property:sys.usb.config=none && property:sys.usb.configfs=0
|
||||
stop adbd
|
||||
stop fastboot
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
on property:sys.usb.config=adb && property:sys.usb.configfs=0
|
||||
write /sys/class/android_usb/android0/idProduct D001
|
||||
write /sys/class/android_usb/android0/functions adb
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
on property:sys.usb.config=sideload && property:sys.usb.configfs=0
|
||||
write /sys/class/android_usb/android0/idProduct D001
|
||||
write /sys/class/android_usb/android0/functions adb
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
on property:sys.usb.config=fastboot && property:sys.usb.configfs=0
|
||||
write /sys/class/android_usb/android0/idProduct 4EE0
|
||||
write /sys/class/android_usb/android0/functions fastboot
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
# Configfs triggers
|
||||
on property:sys.usb.config=none && property:sys.usb.configfs=1
|
||||
write /config/usb_gadget/g1/UDC "none"
|
||||
stop adbd
|
||||
stop fastbootd
|
||||
setprop sys.usb.ffs.ready 0
|
||||
rm /config/usb_gadget/g1/configs/b.1/f1
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
|
||||
write /config/usb_gadget/g1/idProduct 0xD001
|
||||
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
|
||||
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
|
||||
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
|
||||
write /config/usb_gadget/g1/idProduct 0xD001
|
||||
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
|
||||
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
|
||||
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
|
||||
write /config/usb_gadget/g1/idProduct 0x4EE0
|
||||
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot"
|
||||
symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1
|
||||
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
+1
-1
@@ -62,7 +62,7 @@ include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := main.c
|
||||
LOCAL_MODULE := fb2png
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_CFLAGS += -DANDROID
|
||||
LOCAL_STATIC_LIBRARIES := libfb2png libpng libz libc
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ include $(BUILD_EXECUTABLE)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := flashutils.c
|
||||
LOCAL_MODULE := libflashutils
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_C_INCLUDES += $(commands_recovery_local_path)
|
||||
LOCAL_SHARED_LIBRARIES := libc libmtdutils libmmcutils libbmlutils libcrecovery
|
||||
|
||||
@@ -97,7 +97,7 @@ include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := flash_image
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
LOCAL_SRC_FILES := flash_image.c
|
||||
@@ -106,7 +106,7 @@ include $(BUILD_EXECUTABLE)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := dump_image
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
LOCAL_SRC_FILES := dump_image.c
|
||||
@@ -115,7 +115,7 @@ include $(BUILD_EXECUTABLE)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := erase_image
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
LOCAL_SRC_FILES := erase_image.c
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include "fuse.h"
|
||||
#include <pthread.h>
|
||||
#include <limits.h> // PATH_MAX
|
||||
#include <linux/fuse.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -58,19 +57,13 @@
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef USE_MINCRYPT
|
||||
#include "mincrypt/sha256.h"
|
||||
#define SHA256_DIGEST_LENGTH SHA256_DIGEST_SIZE
|
||||
#else
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
//#include <android-base/stringprintf.h>
|
||||
//#include <android-base/unique_fd.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
static constexpr uint64_t PACKAGE_FILE_ID = FUSE_ROOT_ID + 1;
|
||||
static constexpr uint64_t EXIT_FLAG_ID = FUSE_ROOT_ID + 2;
|
||||
@@ -80,12 +73,8 @@ static constexpr int NO_STATUS_EXIT = 2;
|
||||
|
||||
using SHA256Digest = std::array<uint8_t, SHA256_DIGEST_LENGTH>;
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
struct fuse_data {
|
||||
int ffd; // file descriptor for the fuse socket
|
||||
android::base::unique_fd ffd; // file descriptor for the fuse socket
|
||||
|
||||
FuseDataProvider* provider; // Provider of the source data.
|
||||
|
||||
@@ -102,8 +91,8 @@ struct fuse_data {
|
||||
|
||||
uint8_t* extra_block; // another block of storage for reads that span two blocks
|
||||
|
||||
uint8_t* hashes; // SHA-256 hash of each block (all zeros
|
||||
// if block hasn't been read yet)
|
||||
std::vector<SHA256Digest>
|
||||
hashes; // SHA-256 hash of each block (all zeros if block hasn't been read yet)
|
||||
};
|
||||
|
||||
static void fuse_reply(const fuse_data* fd, uint64_t unique, const void* data, size_t len) {
|
||||
@@ -162,7 +151,7 @@ static int handle_init(void* data, fuse_data* fd, const fuse_in_header* hdr) {
|
||||
|
||||
static void fill_attr(fuse_attr* attr, const fuse_data* fd, uint64_t nodeid, uint64_t size,
|
||||
uint32_t mode) {
|
||||
memset(attr, 0, sizeof(*attr));
|
||||
*attr = {};
|
||||
attr->nlink = 1;
|
||||
attr->uid = fd->uid;
|
||||
attr->gid = fd->gid;
|
||||
@@ -175,8 +164,7 @@ static void fill_attr(fuse_attr* attr, const fuse_data* fd, uint64_t nodeid, uin
|
||||
}
|
||||
|
||||
static int handle_getattr(void* /* data */, const fuse_data* fd, const fuse_in_header* hdr) {
|
||||
struct fuse_attr_out out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
fuse_attr_out out = {};
|
||||
out.attr_valid = 10;
|
||||
|
||||
if (hdr->nodeid == FUSE_ROOT_ID) {
|
||||
@@ -196,8 +184,7 @@ static int handle_getattr(void* /* data */, const fuse_data* fd, const fuse_in_h
|
||||
static int handle_lookup(void* data, const fuse_data* fd, const fuse_in_header* hdr) {
|
||||
if (data == nullptr) return -ENOENT;
|
||||
|
||||
struct fuse_entry_out out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
fuse_entry_out out = {};
|
||||
out.entry_valid = 10;
|
||||
out.attr_valid = 10;
|
||||
|
||||
@@ -222,8 +209,7 @@ static int handle_open(void* /* data */, const fuse_data* fd, const fuse_in_head
|
||||
if (hdr->nodeid == EXIT_FLAG_ID) return -EPERM;
|
||||
if (hdr->nodeid != PACKAGE_FILE_ID) return -ENOENT;
|
||||
|
||||
struct fuse_open_out out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
fuse_open_out out = {};
|
||||
out.fh = 10; // an arbitrary number; we always use the same handle
|
||||
fuse_reply(fd, hdr->unique, &out, sizeof(out));
|
||||
return NO_STATUS;
|
||||
@@ -271,26 +257,22 @@ static int fetch_block(fuse_data* fd, uint32_t block) {
|
||||
// time we've read this block).
|
||||
// - Otherwise, return -EINVAL for the read.
|
||||
|
||||
uint8_t hash[SHA256_DIGEST_LENGTH];
|
||||
#ifdef USE_MINCRYPT
|
||||
SHA256_hash(fd->block_data, fd->block_size, hash);
|
||||
#else
|
||||
SHA256(fd->block_data, fd->block_size, hash);
|
||||
#endif
|
||||
uint8_t* blockhash = fd->hashes + block * SHA256_DIGEST_LENGTH;
|
||||
if (memcmp(hash, blockhash, SHA256_DIGEST_LENGTH) == 0) {
|
||||
SHA256Digest hash;
|
||||
SHA256(fd->block_data, fd->block_size, hash.data());
|
||||
|
||||
const SHA256Digest& blockhash = fd->hashes[block];
|
||||
if (hash == blockhash) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
|
||||
if (blockhash[i] != 0) {
|
||||
for (uint8_t i : blockhash) {
|
||||
if (i != 0) {
|
||||
fd->curr_block = -1;
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(blockhash, hash, SHA256_DIGEST_LENGTH);
|
||||
fd->hashes[block] = hash;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -377,14 +359,8 @@ int run_fuse_sideload(std::unique_ptr<FuseDataProvider>&& provider, const char*
|
||||
return -1;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:fuse_sideload.cpp
|
||||
fuse_data fd;
|
||||
memset(&fd, 0, sizeof(fd));
|
||||
fd.vtab = vtab;
|
||||
=======
|
||||
fuse_data fd = {};
|
||||
fd.provider = provider.get();
|
||||
>>>>>>> android-10.0.0_r25:fuse_sideload/fuse_sideload.cpp
|
||||
fd.file_size = file_size;
|
||||
fd.block_size = block_size;
|
||||
fd.file_blocks = (file_size == 0) ? 0 : (((file_size - 1) / block_size) + 1);
|
||||
@@ -396,14 +372,8 @@ int run_fuse_sideload(std::unique_ptr<FuseDataProvider>&& provider, const char*
|
||||
goto done;
|
||||
}
|
||||
|
||||
fd.hashes = (uint8_t*)calloc(fd.file_blocks, SHA256_DIGEST_LENGTH);
|
||||
if (fd.hashes == NULL) {
|
||||
fprintf(stderr, "failed to allocate %d bites for hashes\n",
|
||||
fd.file_blocks * SHA256_DIGEST_LENGTH);
|
||||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
// All hashes will be zero-initialized.
|
||||
fd.hashes.resize(fd.file_blocks);
|
||||
fd.uid = getuid();
|
||||
fd.gid = getgid();
|
||||
|
||||
@@ -421,28 +391,21 @@ int run_fuse_sideload(std::unique_ptr<FuseDataProvider>&& provider, const char*
|
||||
goto done;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:fuse_sideload.cpp
|
||||
fd.ffd = open("/dev/fuse", O_RDWR);
|
||||
if (!fd.ffd) {
|
||||
=======
|
||||
fd.ffd.reset(open("/dev/fuse", O_RDWR));
|
||||
if (fd.ffd == -1) {
|
||||
>>>>>>> android-10.0.0_r25:fuse_sideload/fuse_sideload.cpp
|
||||
perror("open /dev/fuse");
|
||||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
{
|
||||
char opts[256];
|
||||
snprintf(opts, sizeof(opts),
|
||||
("fd=%d,user_id=%d,group_id=%d,max_read=%u,"
|
||||
"allow_other,rootmode=040000"),
|
||||
fd.ffd, fd.uid, fd.gid, block_size);
|
||||
std::string opts = android::base::StringPrintf(
|
||||
"fd=%d,user_id=%d,group_id=%d,max_read=%u,allow_other,rootmode=040000", fd.ffd.get(),
|
||||
fd.uid, fd.gid, block_size);
|
||||
|
||||
result = mount("/dev/fuse", FUSE_SIDELOAD_HOST_MOUNTPOINT, "fuse",
|
||||
MS_NOSUID | MS_NODEV | MS_RDONLY | MS_NOEXEC, opts);
|
||||
if (result < 0) {
|
||||
result = mount("/dev/fuse", mount_point, "fuse", MS_NOSUID | MS_NODEV | MS_RDONLY | MS_NOEXEC,
|
||||
opts.c_str());
|
||||
if (result == -1) {
|
||||
perror("mount");
|
||||
goto done;
|
||||
}
|
||||
@@ -530,9 +493,3 @@ done:
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" int run_old_fuse_sideload(const struct provider_vtab& vtab, void* cookie __unused,
|
||||
uint64_t file_size, uint32_t block_size)
|
||||
{
|
||||
return run_fuse_sideload(vtab, file_size, block_size, FUSE_SIDELOAD_HOST_MOUNTPOINT);
|
||||
}
|
||||
|
||||
@@ -17,17 +17,9 @@
|
||||
#ifndef __FUSE_SIDELOAD_H
|
||||
#define __FUSE_SIDELOAD_H
|
||||
|
||||
<<<<<<< HEAD:fuse_sideload.h
|
||||
#ifdef USE_FUSE_SIDELOAD22
|
||||
#include "fuse_sideload22.h"
|
||||
#else
|
||||
|
||||
#include <functional>
|
||||
=======
|
||||
#include <memory>
|
||||
|
||||
#include "fuse_provider.h"
|
||||
>>>>>>> android-10.0.0_r25:fuse_sideload/include/fuse_sideload.h
|
||||
|
||||
// Define the filenames created by the sideload FUSE filesystem.
|
||||
static constexpr const char* FUSE_SIDELOAD_HOST_MOUNTPOINT = "/sideload";
|
||||
@@ -39,15 +31,4 @@ static constexpr const char* FUSE_SIDELOAD_HOST_EXIT_PATHNAME = "/sideload/exit"
|
||||
int run_fuse_sideload(std::unique_ptr<FuseDataProvider>&& provider,
|
||||
const char* mount_point = FUSE_SIDELOAD_HOST_MOUNTPOINT);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int run_old_fuse_sideload(const struct provider_vtab& vtab, void* cookie,
|
||||
uint64_t file_size, uint32_t block_size);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,525 @@
|
||||
/*
|
||||
* Copyright (C) 2014 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.
|
||||
*/
|
||||
|
||||
// This module creates a special filesystem containing two files.
|
||||
//
|
||||
// "/sideload/package.zip" appears to be a normal file, but reading
|
||||
// from it causes data to be fetched from the adb host. We can use
|
||||
// this to sideload packages over an adb connection without having to
|
||||
// store the entire package in RAM on the device.
|
||||
//
|
||||
// Because we may not trust the adb host, this filesystem maintains
|
||||
// the following invariant: each read of a given position returns the
|
||||
// same data as the first read at that position. That is, once a
|
||||
// section of the file is read, future reads of that section return
|
||||
// the same data. (Otherwise, a malicious adb host process could
|
||||
// return one set of bits when the package is read for signature
|
||||
// verification, and then different bits for when the package is
|
||||
// accessed by the installer.) If the adb host returns something
|
||||
// different than it did on the first read, the reader of the file
|
||||
// will see their read fail with EINVAL.
|
||||
//
|
||||
// The other file, "/sideload/exit", is used to control the subprocess
|
||||
// that creates this filesystem. Calling stat() on the exit file
|
||||
// causes the filesystem to be unmounted and the adb process on the
|
||||
// device shut down.
|
||||
//
|
||||
// Note that only the minimal set of file operations needed for these
|
||||
// two files is implemented. In particular, you can't opendir() or
|
||||
// readdir() on the "/sideload" directory; ls on it won't work.
|
||||
|
||||
#include "fuse_sideload.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include "fuse.h"
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/param.h> // MIN
|
||||
#include <sys/stat.h>
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef USE_MINCRYPT
|
||||
#include "mincrypt/sha256.h"
|
||||
#define SHA256_DIGEST_LENGTH SHA256_DIGEST_SIZE
|
||||
#else
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
//#include <android-base/stringprintf.h>
|
||||
//#include <android-base/unique_fd.h>
|
||||
|
||||
static constexpr uint64_t PACKAGE_FILE_ID = FUSE_ROOT_ID + 1;
|
||||
static constexpr uint64_t EXIT_FLAG_ID = FUSE_ROOT_ID + 2;
|
||||
|
||||
static constexpr int NO_STATUS = 1;
|
||||
static constexpr int NO_STATUS_EXIT = 2;
|
||||
|
||||
using SHA256Digest = std::array<uint8_t, SHA256_DIGEST_LENGTH>;
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
struct fuse_data {
|
||||
int ffd; // file descriptor for the fuse socket
|
||||
|
||||
provider_vtab vtab;
|
||||
|
||||
uint64_t file_size; // bytes
|
||||
|
||||
uint32_t block_size; // block size that the adb host is using to send the file to us
|
||||
uint32_t file_blocks; // file size in block_size blocks
|
||||
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
uint32_t curr_block; // cache the block most recently read from the host
|
||||
uint8_t* block_data;
|
||||
|
||||
uint8_t* extra_block; // another block of storage for reads that span two blocks
|
||||
|
||||
uint8_t* hashes; // SHA-256 hash of each block (all zeros
|
||||
// if block hasn't been read yet)
|
||||
};
|
||||
|
||||
static void fuse_reply(const fuse_data* fd, uint64_t unique, const void* data, size_t len) {
|
||||
fuse_out_header hdr;
|
||||
hdr.len = len + sizeof(hdr);
|
||||
hdr.error = 0;
|
||||
hdr.unique = unique;
|
||||
|
||||
struct iovec vec[2];
|
||||
vec[0].iov_base = &hdr;
|
||||
vec[0].iov_len = sizeof(hdr);
|
||||
vec[1].iov_base = const_cast<void*>(data);
|
||||
vec[1].iov_len = len;
|
||||
|
||||
int res = writev(fd->ffd, vec, 2);
|
||||
if (res == -1) {
|
||||
printf("*** REPLY FAILED *** %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
static int handle_init(void* data, fuse_data* fd, const fuse_in_header* hdr) {
|
||||
const fuse_init_in* req = static_cast<const fuse_init_in*>(data);
|
||||
|
||||
// Kernel 2.6.16 is the first stable kernel with struct fuse_init_out defined (fuse version 7.6).
|
||||
// The structure is the same from 7.6 through 7.22. Beginning with 7.23, the structure increased
|
||||
// in size and added new parameters.
|
||||
if (req->major != FUSE_KERNEL_VERSION || req->minor < 6) {
|
||||
printf("Fuse kernel version mismatch: Kernel version %d.%d, Expected at least %d.6", req->major,
|
||||
req->minor, FUSE_KERNEL_VERSION);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fuse_init_out out;
|
||||
out.minor = MIN(req->minor, FUSE_KERNEL_MINOR_VERSION);
|
||||
size_t fuse_struct_size = sizeof(out);
|
||||
#if defined(FUSE_COMPAT_22_INIT_OUT_SIZE)
|
||||
/* FUSE_KERNEL_VERSION >= 23. */
|
||||
|
||||
// If the kernel only works on minor revs older than or equal to 22, then use the older structure
|
||||
// size since this code only uses the 7.22 version of the structure.
|
||||
if (req->minor <= 22) {
|
||||
fuse_struct_size = FUSE_COMPAT_22_INIT_OUT_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
out.major = FUSE_KERNEL_VERSION;
|
||||
out.max_readahead = req->max_readahead;
|
||||
out.flags = 0;
|
||||
out.max_background = 32;
|
||||
out.congestion_threshold = 32;
|
||||
out.max_write = 4096;
|
||||
fuse_reply(fd, hdr->unique, &out, fuse_struct_size);
|
||||
|
||||
return NO_STATUS;
|
||||
}
|
||||
|
||||
static void fill_attr(fuse_attr* attr, const fuse_data* fd, uint64_t nodeid, uint64_t size,
|
||||
uint32_t mode) {
|
||||
memset(attr, 0, sizeof(*attr));
|
||||
attr->nlink = 1;
|
||||
attr->uid = fd->uid;
|
||||
attr->gid = fd->gid;
|
||||
attr->blksize = 4096;
|
||||
|
||||
attr->ino = nodeid;
|
||||
attr->size = size;
|
||||
attr->blocks = (size == 0) ? 0 : (((size - 1) / attr->blksize) + 1);
|
||||
attr->mode = mode;
|
||||
}
|
||||
|
||||
static int handle_getattr(void* /* data */, const fuse_data* fd, const fuse_in_header* hdr) {
|
||||
struct fuse_attr_out out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
out.attr_valid = 10;
|
||||
|
||||
if (hdr->nodeid == FUSE_ROOT_ID) {
|
||||
fill_attr(&(out.attr), fd, hdr->nodeid, 4096, S_IFDIR | 0555);
|
||||
} else if (hdr->nodeid == PACKAGE_FILE_ID) {
|
||||
fill_attr(&(out.attr), fd, PACKAGE_FILE_ID, fd->file_size, S_IFREG | 0444);
|
||||
} else if (hdr->nodeid == EXIT_FLAG_ID) {
|
||||
fill_attr(&(out.attr), fd, EXIT_FLAG_ID, 0, S_IFREG | 0);
|
||||
} else {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
fuse_reply(fd, hdr->unique, &out, sizeof(out));
|
||||
return (hdr->nodeid == EXIT_FLAG_ID) ? NO_STATUS_EXIT : NO_STATUS;
|
||||
}
|
||||
|
||||
static int handle_lookup(void* data, const fuse_data* fd, const fuse_in_header* hdr) {
|
||||
if (data == nullptr) return -ENOENT;
|
||||
|
||||
struct fuse_entry_out out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
out.entry_valid = 10;
|
||||
out.attr_valid = 10;
|
||||
|
||||
std::string filename(static_cast<const char*>(data));
|
||||
if (filename == FUSE_SIDELOAD_HOST_FILENAME) {
|
||||
out.nodeid = PACKAGE_FILE_ID;
|
||||
out.generation = PACKAGE_FILE_ID;
|
||||
fill_attr(&(out.attr), fd, PACKAGE_FILE_ID, fd->file_size, S_IFREG | 0444);
|
||||
} else if (filename == FUSE_SIDELOAD_HOST_EXIT_FLAG) {
|
||||
out.nodeid = EXIT_FLAG_ID;
|
||||
out.generation = EXIT_FLAG_ID;
|
||||
fill_attr(&(out.attr), fd, EXIT_FLAG_ID, 0, S_IFREG | 0);
|
||||
} else {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
fuse_reply(fd, hdr->unique, &out, sizeof(out));
|
||||
return (out.nodeid == EXIT_FLAG_ID) ? NO_STATUS_EXIT : NO_STATUS;
|
||||
}
|
||||
|
||||
static int handle_open(void* /* data */, const fuse_data* fd, const fuse_in_header* hdr) {
|
||||
if (hdr->nodeid == EXIT_FLAG_ID) return -EPERM;
|
||||
if (hdr->nodeid != PACKAGE_FILE_ID) return -ENOENT;
|
||||
|
||||
struct fuse_open_out out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
out.fh = 10; // an arbitrary number; we always use the same handle
|
||||
fuse_reply(fd, hdr->unique, &out, sizeof(out));
|
||||
return NO_STATUS;
|
||||
}
|
||||
|
||||
static int handle_flush(void* /* data */, fuse_data* /* fd */, const fuse_in_header* /* hdr */) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_release(void* /* data */, fuse_data* /* fd */, const fuse_in_header* /* hdr */) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Fetch a block from the host into fd->curr_block and fd->block_data.
|
||||
// Returns 0 on successful fetch, negative otherwise.
|
||||
static int fetch_block(fuse_data* fd, uint32_t block) {
|
||||
if (block == fd->curr_block) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (block >= fd->file_blocks) {
|
||||
memset(fd->block_data, 0, fd->block_size);
|
||||
fd->curr_block = block;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t fetch_size = fd->block_size;
|
||||
if (block * fd->block_size + fetch_size > fd->file_size) {
|
||||
// If we're reading the last (partial) block of the file, expect a shorter response from the
|
||||
// host, and pad the rest of the block with zeroes.
|
||||
fetch_size = fd->file_size - (block * fd->block_size);
|
||||
memset(fd->block_data + fetch_size, 0, fd->block_size - fetch_size);
|
||||
}
|
||||
|
||||
int result = fd->vtab.read_block(block, fd->block_data, fetch_size);
|
||||
if (result < 0) return result;
|
||||
|
||||
fd->curr_block = block;
|
||||
|
||||
// Verify the hash of the block we just got from the host.
|
||||
//
|
||||
// - If the hash of the just-received data matches the stored hash for the block, accept it.
|
||||
// - If the stored hash is all zeroes, store the new hash and accept the block (this is the first
|
||||
// time we've read this block).
|
||||
// - Otherwise, return -EINVAL for the read.
|
||||
|
||||
uint8_t hash[SHA256_DIGEST_LENGTH];
|
||||
#ifdef USE_MINCRYPT
|
||||
SHA256_hash(fd->block_data, fd->block_size, hash);
|
||||
#else
|
||||
SHA256(fd->block_data, fd->block_size, hash);
|
||||
#endif
|
||||
uint8_t* blockhash = fd->hashes + block * SHA256_DIGEST_LENGTH;
|
||||
if (memcmp(hash, blockhash, SHA256_DIGEST_LENGTH) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
|
||||
if (blockhash[i] != 0) {
|
||||
fd->curr_block = -1;
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(blockhash, hash, SHA256_DIGEST_LENGTH);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_read(void* data, fuse_data* fd, const fuse_in_header* hdr) {
|
||||
if (hdr->nodeid != PACKAGE_FILE_ID) return -ENOENT;
|
||||
|
||||
const fuse_read_in* req = static_cast<const fuse_read_in*>(data);
|
||||
uint64_t offset = req->offset;
|
||||
uint32_t size = req->size;
|
||||
|
||||
// The docs on the fuse kernel interface are vague about what to do when a read request extends
|
||||
// past the end of the file. We can return a short read -- the return structure does include a
|
||||
// length field -- but in testing that caused the program using the file to segfault. (I
|
||||
// speculate that this is due to the reading program accessing it via mmap; maybe mmap dislikes
|
||||
// when you return something short of a whole page?) To fix this we zero-pad reads that extend
|
||||
// past the end of the file so we're always returning exactly as many bytes as were requested.
|
||||
// (Users of the mapped file have to know its real length anyway.)
|
||||
|
||||
fuse_out_header outhdr;
|
||||
outhdr.len = sizeof(outhdr) + size;
|
||||
outhdr.error = 0;
|
||||
outhdr.unique = hdr->unique;
|
||||
|
||||
struct iovec vec[3];
|
||||
vec[0].iov_base = &outhdr;
|
||||
vec[0].iov_len = sizeof(outhdr);
|
||||
|
||||
uint32_t block = offset / fd->block_size;
|
||||
int result = fetch_block(fd, block);
|
||||
if (result != 0) return result;
|
||||
|
||||
// Two cases:
|
||||
//
|
||||
// - the read request is entirely within this block. In this case we can reply immediately.
|
||||
//
|
||||
// - the read request goes over into the next block. Note that since we mount the filesystem
|
||||
// with max_read=block_size, a read can never span more than two blocks. In this case we copy
|
||||
// the block to extra_block and issue a fetch for the following block.
|
||||
|
||||
uint32_t block_offset = offset - (block * fd->block_size);
|
||||
|
||||
int vec_used;
|
||||
if (size + block_offset <= fd->block_size) {
|
||||
// First case: the read fits entirely in the first block.
|
||||
|
||||
vec[1].iov_base = fd->block_data + block_offset;
|
||||
vec[1].iov_len = size;
|
||||
vec_used = 2;
|
||||
} else {
|
||||
// Second case: the read spills over into the next block.
|
||||
|
||||
memcpy(fd->extra_block, fd->block_data + block_offset, fd->block_size - block_offset);
|
||||
vec[1].iov_base = fd->extra_block;
|
||||
vec[1].iov_len = fd->block_size - block_offset;
|
||||
|
||||
result = fetch_block(fd, block + 1);
|
||||
if (result != 0) return result;
|
||||
vec[2].iov_base = fd->block_data;
|
||||
vec[2].iov_len = size - vec[1].iov_len;
|
||||
vec_used = 3;
|
||||
}
|
||||
|
||||
if (writev(fd->ffd, vec, vec_used) == -1) {
|
||||
printf("*** READ REPLY FAILED: %s ***\n", strerror(errno));
|
||||
}
|
||||
return NO_STATUS;
|
||||
}
|
||||
|
||||
int run_fuse_sideload(const provider_vtab& vtab, uint64_t file_size, uint32_t block_size,
|
||||
const char* mount_point) {
|
||||
// If something's already mounted on our mountpoint, try to remove it. (Mostly in case of a
|
||||
// previous abnormal exit.)
|
||||
umount2(mount_point, MNT_FORCE);
|
||||
|
||||
// fs/fuse/inode.c in kernel code uses the greater of 4096 and the passed-in max_read.
|
||||
if (block_size < 4096) {
|
||||
fprintf(stderr, "block size (%u) is too small\n", block_size);
|
||||
return -1;
|
||||
}
|
||||
if (block_size > (1 << 22)) { // 4 MiB
|
||||
fprintf(stderr, "block size (%u) is too large\n", block_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fuse_data fd;
|
||||
memset(&fd, 0, sizeof(fd));
|
||||
fd.vtab = vtab;
|
||||
fd.file_size = file_size;
|
||||
fd.block_size = block_size;
|
||||
fd.file_blocks = (file_size == 0) ? 0 : (((file_size - 1) / block_size) + 1);
|
||||
|
||||
int result;
|
||||
if (fd.file_blocks > (1 << 18)) {
|
||||
fprintf(stderr, "file has too many blocks (%u)\n", fd.file_blocks);
|
||||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
fd.hashes = (uint8_t*)calloc(fd.file_blocks, SHA256_DIGEST_LENGTH);
|
||||
if (fd.hashes == NULL) {
|
||||
fprintf(stderr, "failed to allocate %d bites for hashes\n",
|
||||
fd.file_blocks * SHA256_DIGEST_LENGTH);
|
||||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
fd.uid = getuid();
|
||||
fd.gid = getgid();
|
||||
|
||||
fd.curr_block = -1;
|
||||
fd.block_data = static_cast<uint8_t*>(malloc(block_size));
|
||||
if (fd.block_data == nullptr) {
|
||||
fprintf(stderr, "failed to allocate %d bites for block_data\n", block_size);
|
||||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
fd.extra_block = static_cast<uint8_t*>(malloc(block_size));
|
||||
if (fd.extra_block == nullptr) {
|
||||
fprintf(stderr, "failed to allocate %d bites for extra_block\n", block_size);
|
||||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
fd.ffd = open("/dev/fuse", O_RDWR);
|
||||
if (!fd.ffd) {
|
||||
perror("open /dev/fuse");
|
||||
result = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
{
|
||||
char opts[256];
|
||||
snprintf(opts, sizeof(opts),
|
||||
("fd=%d,user_id=%d,group_id=%d,max_read=%u,"
|
||||
"allow_other,rootmode=040000"),
|
||||
fd.ffd, fd.uid, fd.gid, block_size);
|
||||
|
||||
result = mount("/dev/fuse", FUSE_SIDELOAD_HOST_MOUNTPOINT, "fuse",
|
||||
MS_NOSUID | MS_NODEV | MS_RDONLY | MS_NOEXEC, opts);
|
||||
if (result < 0) {
|
||||
perror("mount");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t request_buffer[sizeof(fuse_in_header) + PATH_MAX * 8];
|
||||
for (;;) {
|
||||
ssize_t len = TEMP_FAILURE_RETRY(read(fd.ffd, request_buffer, sizeof(request_buffer)));
|
||||
if (len == -1) {
|
||||
perror("read request");
|
||||
if (errno == ENODEV) {
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (static_cast<size_t>(len) < sizeof(fuse_in_header)) {
|
||||
fprintf(stderr, "request too short: len=%zd\n", len);
|
||||
continue;
|
||||
}
|
||||
|
||||
fuse_in_header* hdr = reinterpret_cast<fuse_in_header*>(request_buffer);
|
||||
void* data = request_buffer + sizeof(fuse_in_header);
|
||||
|
||||
result = -ENOSYS;
|
||||
|
||||
switch (hdr->opcode) {
|
||||
case FUSE_INIT:
|
||||
result = handle_init(data, &fd, hdr);
|
||||
break;
|
||||
|
||||
case FUSE_LOOKUP:
|
||||
result = handle_lookup(data, &fd, hdr);
|
||||
break;
|
||||
|
||||
case FUSE_GETATTR:
|
||||
result = handle_getattr(data, &fd, hdr);
|
||||
break;
|
||||
|
||||
case FUSE_OPEN:
|
||||
result = handle_open(data, &fd, hdr);
|
||||
break;
|
||||
|
||||
case FUSE_READ:
|
||||
result = handle_read(data, &fd, hdr);
|
||||
break;
|
||||
|
||||
case FUSE_FLUSH:
|
||||
result = handle_flush(data, &fd, hdr);
|
||||
break;
|
||||
|
||||
case FUSE_RELEASE:
|
||||
result = handle_release(data, &fd, hdr);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "unknown fuse request opcode %d\n", hdr->opcode);
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == NO_STATUS_EXIT) {
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result != NO_STATUS) {
|
||||
fuse_out_header outhdr;
|
||||
outhdr.len = sizeof(outhdr);
|
||||
outhdr.error = result;
|
||||
outhdr.unique = hdr->unique;
|
||||
TEMP_FAILURE_RETRY(write(fd.ffd, &outhdr, sizeof(outhdr)));
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
fd.vtab.close();
|
||||
|
||||
if (umount2(mount_point, MNT_DETACH) == -1) {
|
||||
fprintf(stderr, "fuse_sideload umount failed: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
free(fd.block_data);
|
||||
free(fd.extra_block);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" int run_old_fuse_sideload(const struct provider_vtab& vtab, void* cookie __unused,
|
||||
uint64_t file_size, uint32_t block_size)
|
||||
{
|
||||
return run_fuse_sideload(vtab, file_size, block_size, FUSE_SIDELOAD_HOST_MOUNTPOINT);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2014 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.
|
||||
*/
|
||||
|
||||
#ifndef __FUSE_SIDELOAD_H
|
||||
#define __FUSE_SIDELOAD_H
|
||||
|
||||
#ifdef USE_FUSE_SIDELOAD22
|
||||
#include "fuse_sideload22.h"
|
||||
#else
|
||||
|
||||
#include <functional>
|
||||
|
||||
// Define the filenames created by the sideload FUSE filesystem.
|
||||
static constexpr const char* FUSE_SIDELOAD_HOST_MOUNTPOINT = "/sideload";
|
||||
static constexpr const char* FUSE_SIDELOAD_HOST_FILENAME = "package.zip";
|
||||
static constexpr const char* FUSE_SIDELOAD_HOST_PATHNAME = "/sideload/package.zip";
|
||||
static constexpr const char* FUSE_SIDELOAD_HOST_EXIT_FLAG = "exit";
|
||||
static constexpr const char* FUSE_SIDELOAD_HOST_EXIT_PATHNAME = "/sideload/exit";
|
||||
|
||||
struct provider_vtab {
|
||||
// read a block
|
||||
std::function<int(uint32_t block, uint8_t* buffer, uint32_t fetch_size)> read_block;
|
||||
|
||||
// close down
|
||||
std::function<void(void)> close;
|
||||
};
|
||||
|
||||
int run_fuse_sideload(const provider_vtab& vtab, uint64_t file_size, uint32_t block_size,
|
||||
const char* mount_point = FUSE_SIDELOAD_HOST_MOUNTPOINT);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int run_old_fuse_sideload(const struct provider_vtab& vtab, void* cookie,
|
||||
uint64_t file_size, uint32_t block_size);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Regular → Executable
+18
-5
@@ -1,7 +1,7 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_CFLAGS := -fno-strict-aliasing
|
||||
LOCAL_CFLAGS := -fno-strict-aliasing -Wno-implicit-fallthrough
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
gui.cpp \
|
||||
@@ -39,9 +39,21 @@ else
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libaosprecovery libselinux
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../otautil/include
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
LOCAL_SHARED_LIBRARIES += libziparchive
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../otautil/include
|
||||
LOCAL_SHARED_LIBRARIES += libziparchive
|
||||
LOCAL_STATIC_LIBRARIES += libotautil
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 28; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../install/include \
|
||||
system/core/libziparchive/include/ \
|
||||
$(LOCAL_PATH)/../recovery_ui/include \
|
||||
$(LOCAL_PATH)/../fuse_sideload/include
|
||||
LOCAL_CFLAGS += -D_USE_SYSTEM_ZIPARCHIVE
|
||||
else
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../install28/ \
|
||||
$(LOCAL_PATH)/../fuse_sideload28/
|
||||
LOCAL_CFLAGS += -DUSE_28_INSTALL -DUSE_OTAUTIL_ZIPARCHIVE
|
||||
endif
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libminzip
|
||||
LOCAL_CFLAGS += -DUSE_MINZIP
|
||||
@@ -84,7 +96,8 @@ endif
|
||||
LOCAL_C_INCLUDES += \
|
||||
bionic \
|
||||
system/core/include \
|
||||
system/core/libpixelflinger/include
|
||||
system/core/libpixelflinger/include \
|
||||
external/freetype/include
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += external/stlport/stlport
|
||||
@@ -98,7 +111,7 @@ include $(BUILD_STATIC_LIBRARY)
|
||||
# Transfer in the resources for the device
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := twrp
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
|
||||
|
||||
|
||||
+9
-6
@@ -40,8 +40,9 @@
|
||||
#include "../twrp-functions.hpp"
|
||||
#include "../openrecoveryscript.hpp"
|
||||
|
||||
#include "../adb_install.h"
|
||||
#include "../fuse_sideload.h"
|
||||
#include "install/adb_install.h"
|
||||
|
||||
#include "fuse_sideload.h"
|
||||
#include "blanktimer.hpp"
|
||||
#include "../twinstall.h"
|
||||
|
||||
@@ -49,14 +50,14 @@ extern "C" {
|
||||
#include "../twcommon.h"
|
||||
#include "../variables.h"
|
||||
#include "cutils/properties.h"
|
||||
#include "../adb_install.h"
|
||||
#include "install/adb_install.h"
|
||||
};
|
||||
#include "../set_metadata.h"
|
||||
#include "set_metadata.h"
|
||||
#include "../minuitwrp/minui.h"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
#include "objects.hpp"
|
||||
#include "../tw_atomic.hpp"
|
||||
#include "tw_atomic.hpp"
|
||||
|
||||
GUIAction::mapFunc GUIAction::mf;
|
||||
std::set<string> GUIAction::setActionsRunningInCallerThread;
|
||||
@@ -1533,7 +1534,9 @@ int GUIAction::adbsideload(std::string arg __unused)
|
||||
bool mtp_was_enabled = TWFunc::Toggle_MTP(false);
|
||||
|
||||
// wait for the adb connection
|
||||
int ret = apply_from_adb("/", &sideload_child_pid);
|
||||
// int ret = apply_from_adb("/", &sideload_child_pid);
|
||||
Device::BuiltinAction reboot_action = Device::REBOOT_BOOTLOADER;
|
||||
int ret = ApplyFromAdb("/", &reboot_action);
|
||||
DataManager::SetValue("tw_has_cancel", 0); // Remove cancel button from gui now that the zip install is going to start
|
||||
|
||||
if (ret != 0) {
|
||||
|
||||
Regular → Executable
+1
-1
@@ -50,7 +50,7 @@ extern "C"
|
||||
#include "../openrecoveryscript.hpp"
|
||||
#include "../orscmd/orscmd.h"
|
||||
#include "blanktimer.hpp"
|
||||
#include "../tw_atomic.hpp"
|
||||
#include "tw_atomic.hpp"
|
||||
|
||||
// Enable to print render time of each frame to the log file
|
||||
//#define PRINT_RENDER_TIME 1
|
||||
|
||||
Regular → Executable
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2012 to 2016 bigbiff/Dees_Troy TeamWin
|
||||
Copyright 2012 to 2020 TeamWin
|
||||
This file is part of TWRP/TeamWin Recovery Project.
|
||||
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
@@ -41,6 +41,7 @@ extern "C" {
|
||||
#include "../twcommon.h"
|
||||
}
|
||||
#include "../minuitwrp/minui.h"
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
#include "objects.hpp"
|
||||
@@ -215,7 +216,7 @@ void GUIInput::UpdateDisplayText() {
|
||||
displayValue = mValue;
|
||||
}
|
||||
|
||||
textWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
|
||||
textWidth = twrpTruetype::gr_ttf_measureEx(displayValue.c_str(), fontResource);
|
||||
}
|
||||
|
||||
void GUIInput::HandleCursorByTouch(int x) {
|
||||
@@ -239,7 +240,7 @@ void GUIInput::HandleCursorByTouch(int x) {
|
||||
|
||||
for (index = 0; index <= displaySize; index++) {
|
||||
cursorString = displayValue.substr(0, index);
|
||||
cursorX = gr_ttf_measureEx(cursorString.c_str(), fontResource) + mRenderX + scrollingX;
|
||||
cursorX = twrpTruetype::gr_ttf_measureEx(cursorString.c_str(), fontResource) + mRenderX + scrollingX;
|
||||
if (cursorX > x) {
|
||||
if (index > 0 && x <= cursorX - ((x - prevX) / 2) && prevX >= mRenderX) {
|
||||
// This helps make sure that we can place the cursor before the very first char if the first char is
|
||||
@@ -280,7 +281,7 @@ void GUIInput::HandleCursorByText() {
|
||||
if (mCursorLocation != -1) {
|
||||
string cursorDisplay = displayValue;
|
||||
cursorDisplay.resize(mCursorLocation);
|
||||
cursorTextWidth = gr_ttf_measureEx(cursorDisplay.c_str(), fontResource);
|
||||
cursorTextWidth = twrpTruetype::gr_ttf_measureEx(cursorDisplay.c_str(), fontResource);
|
||||
}
|
||||
cursorX = mRenderX + cursorTextWidth + scrollingX;
|
||||
if (cursorX >= mRenderX + mRenderW) {
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2012 bigbiff/Dees_Troy TeamWin
|
||||
Copyright 2012 to 2020 TeamWin
|
||||
This file is part of TWRP/TeamWin Recovery Project.
|
||||
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
@@ -28,6 +28,7 @@ extern "C" {
|
||||
#include "gui.h"
|
||||
}
|
||||
#include "../minuitwrp/minui.h"
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
#include "objects.hpp"
|
||||
@@ -333,7 +334,7 @@ void GUIKeyboard::DrawKey(Key& key, int keyX, int keyY, int keyW, int keyH)
|
||||
else if (!labelText.empty() && labelFont && labelFont->GetResource())
|
||||
{
|
||||
void* fontResource = labelFont->GetResource();
|
||||
int textW = gr_ttf_measureEx(labelText.c_str(), fontResource);
|
||||
int textW = twrpTruetype::gr_ttf_measureEx(labelText.c_str(), fontResource);
|
||||
int textH = labelFont->GetHeight();
|
||||
int textX = keyX + (keyW - textW) / 2;
|
||||
int textY = keyY + (keyH - textH) / 2;
|
||||
@@ -346,7 +347,7 @@ void GUIKeyboard::DrawKey(Key& key, int keyX, int keyY, int keyW, int keyH)
|
||||
void* fontResource = mLongpressFont->GetResource();
|
||||
gr_color(mLongpressFontColor.red, mLongpressFontColor.green, mLongpressFontColor.blue, mLongpressFontColor.alpha);
|
||||
string text(1, keychar);
|
||||
int textW = gr_ttf_measureEx(text.c_str(), fontResource);
|
||||
int textW = twrpTruetype::gr_ttf_measureEx(text.c_str(), fontResource);
|
||||
int textX = keyX + keyW - longpressOffsetX - textW;
|
||||
int textY = keyY + longpressOffsetY;
|
||||
gr_textEx_scaleW(textX, textY, text.c_str(), fontResource, keyW, TOP_LEFT, 0);
|
||||
|
||||
Regular → Executable
+5
-1
@@ -42,14 +42,18 @@
|
||||
#ifdef USE_MINZIP
|
||||
#include "../minzip/SysUtil.h"
|
||||
#else
|
||||
#ifdef USE_OTAUTIL_ZIPARCHIVE
|
||||
#include <otautil/SysUtil.h>
|
||||
#else
|
||||
#include <ziparchive/zip_archive.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "../twcommon.h"
|
||||
#include "gui.h"
|
||||
}
|
||||
#include "../zipwrap.hpp"
|
||||
#include "zipwrap.hpp"
|
||||
#include "../minuitwrp/minui.h"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
|
||||
Regular → Executable
+1
-1
@@ -21,7 +21,7 @@
|
||||
#ifndef _PAGES_HEADER_HPP
|
||||
#define _PAGES_HEADER_HPP
|
||||
|
||||
#include "../zipwrap.hpp"
|
||||
#include "zipwrap.hpp"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
Regular → Executable
+13
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 TeamWin
|
||||
Copyright 2012 to 2020 TeamWin
|
||||
This file is part of TWRP/TeamWin Recovery Project.
|
||||
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
@@ -30,11 +30,13 @@
|
||||
#include <iomanip>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "../zipwrap.hpp"
|
||||
#include "zipwrap.hpp"
|
||||
extern "C" {
|
||||
#include "../twcommon.h"
|
||||
#include "gui.h"
|
||||
}
|
||||
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
#include "../minuitwrp/minui.h"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
@@ -155,12 +157,12 @@ void FontResource::LoadFont(xml_node<>* node, ZipWrap* pZip)
|
||||
std::string tmpname = "/tmp/" + file;
|
||||
if (ExtractResource(pZip, "fonts", file, "", tmpname) == 0)
|
||||
{
|
||||
mFont = gr_ttf_loadFont(tmpname.c_str(), font_size, dpi);
|
||||
mFont = twrpTruetype::gr_ttf_loadFont(tmpname.c_str(), font_size, dpi);
|
||||
}
|
||||
else
|
||||
{
|
||||
file = std::string(TWRES "fonts/") + file;
|
||||
mFont = gr_ttf_loadFont(file.c_str(), font_size, dpi);
|
||||
mFont = twrpTruetype::gr_ttf_loadFont(file.c_str(), font_size, dpi);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -170,11 +172,13 @@ void FontResource::LoadFont(xml_node<>* node, ZipWrap* pZip)
|
||||
}
|
||||
|
||||
void FontResource::DeleteFont() {
|
||||
if (mFont)
|
||||
gr_ttf_freeFont(mFont);
|
||||
if (mFont) {
|
||||
twrpTruetype::gr_ttf_freeFont(mFont);
|
||||
}
|
||||
mFont = NULL;
|
||||
if (origFont)
|
||||
gr_ttf_freeFont(origFont);
|
||||
if (origFont) {
|
||||
twrpTruetype::gr_ttf_freeFont(origFont);
|
||||
}
|
||||
origFont = NULL;
|
||||
}
|
||||
|
||||
@@ -182,7 +186,7 @@ void FontResource::Override(xml_node<>* node, ZipWrap* pZip) {
|
||||
if (!origFont) {
|
||||
origFont = mFont;
|
||||
} else if (mFont) {
|
||||
gr_ttf_freeFont(mFont);
|
||||
twrpTruetype::gr_ttf_freeFont(mFont);
|
||||
mFont = NULL;
|
||||
}
|
||||
LoadFont(node, pZip);
|
||||
|
||||
Regular → Executable
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 TeamWin
|
||||
Copyright 2012 to 2020 TeamWin
|
||||
This file is part of TWRP/TeamWin Recovery Project.
|
||||
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
@@ -25,7 +25,8 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "rapidxml.hpp"
|
||||
#include "../zipwrap.hpp"
|
||||
#include "zipwrap.hpp"
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "../minuitwrp/minui.h"
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
|
||||
public:
|
||||
void* GetResource() { return mFont; }
|
||||
int GetHeight() { return gr_ttf_getMaxFontHeight(mFont); }
|
||||
int GetHeight() { return twrpTruetype::gr_ttf_getMaxFontHeight(mFont); }
|
||||
void Override(xml_node<>* node, ZipWrap* pZip);
|
||||
|
||||
protected:
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2013 bigbiff/Dees_Troy TeamWin
|
||||
Copyright 2012 to 2020 TeamWin
|
||||
This file is part of TWRP/TeamWin Recovery Project.
|
||||
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
@@ -22,6 +22,7 @@ extern "C" {
|
||||
#include "../twcommon.h"
|
||||
}
|
||||
#include "../minuitwrp/minui.h"
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
#include "objects.hpp"
|
||||
@@ -633,7 +634,7 @@ bool GUIScrollList::AddLines(std::vector<std::string>* origText, std::vector<std
|
||||
if (origColor)
|
||||
curr_color = origColor->at(i);
|
||||
for (;;) {
|
||||
size_t line_char_width = gr_ttf_maxExW(curr_line.c_str(), mFont->GetResource(), mRenderW);
|
||||
size_t line_char_width = twrpTruetype::gr_ttf_maxExW(curr_line.c_str(), mFont->GetResource(), mRenderW);
|
||||
if (line_char_width < curr_line.size()) {
|
||||
//string left = curr_line.substr(0, line_char_width);
|
||||
size_t wrap_pos = curr_line.find_last_of(" ,./:-_;", line_char_width - 1);
|
||||
|
||||
Regular → Executable
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 TeamWin
|
||||
Copyright 2012 to 2020 TeamWin
|
||||
This file is part of TWRP/TeamWin Recovery Project.
|
||||
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
@@ -39,6 +39,7 @@ extern "C" {
|
||||
#include "../twcommon.h"
|
||||
}
|
||||
#include "../minuitwrp/minui.h"
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
#include "objects.hpp"
|
||||
@@ -270,7 +271,7 @@ int GUISliderValue::measureText(const std::string& str)
|
||||
void* fontResource = NULL;
|
||||
if (mFont) fontResource = mFont->GetResource();
|
||||
|
||||
return gr_ttf_measureEx(str.c_str(), fontResource);
|
||||
return twrpTruetype::gr_ttf_measureEx(str.c_str(), fontResource);
|
||||
}
|
||||
|
||||
int GUISliderValue::Render(void)
|
||||
|
||||
+5
-3
@@ -34,6 +34,8 @@ extern "C" {
|
||||
#include "../twcommon.h"
|
||||
}
|
||||
#include "../minuitwrp/minui.h"
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
|
||||
#include "gui.hpp"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
@@ -883,10 +885,10 @@ void GUITerminal::RenderItem(size_t itemindex, int yPos, bool selected __unused)
|
||||
// render cursor
|
||||
int cursorX = engine->getCursorX();
|
||||
std::string leftOfCursor = line.substr(0, cursorX);
|
||||
int x = gr_ttf_measureEx(leftOfCursor.c_str(), mFont->GetResource());
|
||||
int x = twrpTruetype::gr_ttf_measureEx(leftOfCursor.c_str(), mFont->GetResource());
|
||||
// note that this single character can be a UTF-8 sequence
|
||||
std::string atCursor = (size_t)cursorX < line.length() ? line.substr(cursorX, 1) : " ";
|
||||
int w = gr_ttf_measureEx(atCursor.c_str(), mFont->GetResource());
|
||||
int w = twrpTruetype::gr_ttf_measureEx(atCursor.c_str(), mFont->GetResource());
|
||||
gr_color(mFontColor.red, mFontColor.green, mFontColor.blue, mFontColor.alpha);
|
||||
gr_fill(mRenderX + x, yPos, w, actualItemHeight);
|
||||
gr_color(mBackgroundColor.red, mBackgroundColor.green, mBackgroundColor.blue, mBackgroundColor.alpha);
|
||||
@@ -905,7 +907,7 @@ void GUITerminal::InitAndResize()
|
||||
engine->initPty();
|
||||
// send window resize
|
||||
if (mFont && mFont->GetResource()) {
|
||||
int charWidth = gr_ttf_measureEx("N", mFont->GetResource());
|
||||
int charWidth = twrpTruetype::gr_ttf_measureEx("N", mFont->GetResource());
|
||||
engine->setSize(mRenderW / charWidth, GetDisplayItemCount(), mRenderW, mRenderH);
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2012 to 2016 bigbiff/Dees_Troy TeamWin
|
||||
Copyright 2012 to 2020 TeamWin
|
||||
This file is part of TWRP/TeamWin Recovery Project.
|
||||
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
@@ -39,6 +39,7 @@ extern "C" {
|
||||
#include "../twcommon.h"
|
||||
}
|
||||
#include "../minuitwrp/minui.h"
|
||||
#include "../minuitwrp/truetype.hpp"
|
||||
|
||||
#include "rapidxml.hpp"
|
||||
#include "objects.hpp"
|
||||
@@ -159,7 +160,7 @@ int GUIText::GetCurrentBounds(int& w, int& h)
|
||||
|
||||
h = mFontHeight;
|
||||
mLastValue = gui_parse_text(mText);
|
||||
w = gr_ttf_measureEx(mLastValue.c_str(), fontResource);
|
||||
w = twrpTruetype::gr_ttf_measureEx(mLastValue.c_str(), fontResource);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,19 +98,16 @@
|
||||
<string name="successful">Başarılı</string>
|
||||
<string name="install_failed">Yükleme Başarısız</string>
|
||||
<string name="install_successful">Yükleme Başarılı</string>
|
||||
<string name="wipe_cache_dalvik_btn">Önbellek/Dalvik Temizle</string>
|
||||
<string name="wipe_dalvik_btn">Dalvik Temizle</string>
|
||||
<string name="wipe_cache_dalvik_btn">Cache/dalvik temizle</string>
|
||||
<string name="reboot_system_btn">Sistemi Yeniden Başlat</string>
|
||||
<string name="install_sel_target">Hedef Bölümü Seç</string>
|
||||
<string name="flash_image_select">İmajı Flashlamak için Bölüm Seçin:</string>
|
||||
<string name="flash_image_select">İmajı Flashlamak için Bölüm Seç:</string>
|
||||
<string name="target_partition">Hedef Bölüm:</string>
|
||||
<string name="flashing_image">İmaj Flashlanıyor...</string>
|
||||
<string name="image_flashed">İmaj Flashlandı</string>
|
||||
<string name="wipe_cache_dalvik_confirm">Önbellek ve Dalvik temizlensin mi?</string>
|
||||
<string name="wipe_dalvik_confirm">Dalvik temizlensin mi?</string>
|
||||
<string name="wiping_cache_dalvik">Önbellek ve Dalvik temizleniyor...</string>
|
||||
<string name="wipe_cache_dalvik_complete">Önbellek ve Dalvik temizliği tamamlandı</string>
|
||||
<string name="wipe_dalvik_complete">Dalvik Temizliği Tamamlandı</string>
|
||||
<string name="swipe_wipe">Temizlemek için Kaydır</string>
|
||||
<string name="swipe_wipe_s"> Temizle</string>
|
||||
<string name="no_os1">İşletim Sistemi yüklü değil!</string>
|
||||
@@ -122,13 +119,9 @@
|
||||
<string name="reboot_install_app_hdr">TWRP Uygulaması yüklensin mi?</string>
|
||||
<string name="reboot_install_app1">Resmi TWRP Uygulamasını yüklemek ister misiniz?</string>
|
||||
<string name="reboot_install_app2">Uygulama, yeni TWRP sürümlerini kontrol edebilir.</string>
|
||||
<string name="reboot_install_app_prompt_install">Yüklü değilse TWRP uygulamasını yüklemeyi sor</string>
|
||||
<string name="reboot_install_app_prompt_install">Yüklü değilse, TWRP uygulamasını yüklemek için sor</string>
|
||||
<string name="reboot_install_app_system">Sistem Uygulaması olarak yükle</string>
|
||||
<string name="reboot_installing_app">Uygulama yükleniyor...</string>
|
||||
<string name="uninstall_twrp_system_app">TWRP Uygulamasını Sistemden kaldır</string>
|
||||
<string name="uninstall_twrp_system_app_confirm">TWRP Uygulaması Sistemden kaldırılsın mı?</string>
|
||||
<string name="uninstalling_twrp_system_app">TWRP Uygulaması Sistemden kaldırılıyor...</string>
|
||||
<string name="uninstall_twrp_system_app_complete">TWRP Uygulamasını Sistemden Kaldırma Tamamlandı</string>
|
||||
<string name="swipe_to_install_app">TWRP Uygulamasını yüklemek için kaydır</string>
|
||||
<string name="swipe_flash">Flashlamayı onaylamak için kaydır</string>
|
||||
<string name="confirm_action">Eylemi Onayla</string>
|
||||
@@ -137,7 +130,7 @@
|
||||
<string name="wipe_hdr">Temizle</string>
|
||||
<string name="factory_reset_hdr">Sıfırla</string>
|
||||
<string name="factory_reset_btn">Sıfırla</string>
|
||||
<string name="factory_reset1">Veriyi, Önbelleği ve Dalvik'i temizler</string>
|
||||
<string name="factory_reset1">Veriyi, Önbelleği, ve Dalvik'i temizler</string>
|
||||
<string name="factory_reset2">(dahili depolama hariç)</string>
|
||||
<string name="factory_reset3">Çoğu zaman ihtiyacınız olan</string>
|
||||
<string name="factory_reset4">tek temizlik budur.</string>
|
||||
@@ -158,10 +151,10 @@
|
||||
<string name="format_data_hdr">Veriyi Biçimlendir</string>
|
||||
<string name="format_data_btn">Veriyi Biçimlendir</string>
|
||||
<string name="format_data_ptr1">Veriyi biçimlendirmek tüm uygulamalarınızı,</string>
|
||||
<string name="format_data_ptr2">yedeklerinizi, resimlerinizi, videolarınızı, medyanızı temizleyecek ve</string>
|
||||
<string name="format_data_ptr2">yedeklerinizi, resimlerinizi, videolarınızı, medyanızı, temizleyecek ve</string>
|
||||
<string name="format_data_ptr3">dahili depolama üzerindeki şifrelemeyi kaldıracak.</string>
|
||||
<string name="format_data_adopted">Kabul Edilen Depolama Dahil</string>
|
||||
<string name="format_data_lcp1">Veriyi biçimlendirmek tüm uygulamalarınızı, yedeklerinizi, resimlerinizi, videolarınızı, medyanızı temizleyecek ve</string>
|
||||
<string name="format_data_lcp1">Veriyi biçimlendirmek tüm uygulamalarınızı, yedeklerinizi, resimlerinizi, videolarınızı, medyanızı, temizleyecek ve</string>
|
||||
<string name="format_data_lcp2">dahili depolama üzerindeki şifrelemeyi kaldıracak.</string>
|
||||
<string name="format_data_wtc1">Veriyi biçimlendirmek tüm uygulamalarınızı,</string>
|
||||
<string name="format_data_wtc2">yedeklerinizi ve medyanızı temizleyecek. Bu işlem geri alınamaz.</string>
|
||||
@@ -218,13 +211,13 @@
|
||||
<string name="encryption_tab">ŞİFRELEME</string>
|
||||
<string name="encryption">Şifreleme:</string>
|
||||
<string name="name">Ad:</string>
|
||||
<string name="sel_part_backup">Yedeklenecek Bölümleri Seçin:</string>
|
||||
<string name="sel_part_backup">Yedeklenecek Bölümleri Seç:</string>
|
||||
<string name="storage">Depolama:</string>
|
||||
<string name="enc_disabled">devre dışı - etkinleştirmek için bir şifre ayarlayın</string>
|
||||
<string name="enc_enabled">etkin</string>
|
||||
<string name="enable_backup_comp_chk">Sıkıştırmayı etkinleştir</string>
|
||||
<string name="skip_digest_backup_chk" version="2">Yedekleme sırasında Digest oluşturmayı geç</string>
|
||||
<string name="disable_backup_space_chk" version="2">Yedeklemeden önce boş alan kontrolünü devre dışı bırak</string>
|
||||
<string name="disable_backup_space_chk" version="2">Yedeklemeden önce boş alan denetimini devre dışı bırak</string>
|
||||
<string name="current_boot_slot">Geçerli Yuva: %tw_active_slot%</string>
|
||||
<string name="boot_slot_a">A Yuvası</string>
|
||||
<string name="boot_slot_b">B Yuvası</string>
|
||||
@@ -235,7 +228,7 @@
|
||||
<string name="append_date_btn">Tarih Ekle</string>
|
||||
<string name="backup_name_exists">Bu adda bir yedek zaten var!</string>
|
||||
<string name="encrypt_backup">Yedeklemeniz şifrelensin mi?</string>
|
||||
<string name="enter_pass">Şifreyi Girin:</string>
|
||||
<string name="enter_pass">Şifre Gir:</string>
|
||||
<string name="enter_pass2">Şifreyi Tekrar Girin:</string>
|
||||
<string name="pass_not_match">Şifreler eşleşmiyor!</string>
|
||||
<string name="partitions">Bölümler:</string>
|
||||
@@ -260,7 +253,7 @@
|
||||
<string name="restore_try_decrypt">Şifreli Yedek - Çözülmeye Çalışılıyor</string>
|
||||
<string name="restore_try_decrypt_s">Çözülmeye Çalışılıyor</string>
|
||||
<string name="restore_backup_date">Yedek tarihi: %tw_restore_file_date%</string>
|
||||
<string name="restore_sel_part">Geri Yüklenecek Bölümleri Seçin:</string>
|
||||
<string name="restore_sel_part">Geri Yüklenecek Bölümleri Seç:</string>
|
||||
<string name="restore_enable_digest_chk" version="2">Yedek Dosyalarının Digest Doğrulamasını etkinleştir</string>
|
||||
<string name="restore_complete">Geri Yükleme Tamamlandı</string>
|
||||
<string name="swipe_restore">Geri Yüklemek için Kaydır</string>
|
||||
@@ -274,7 +267,7 @@
|
||||
<string name="swipe_rename"> Yeniden Adlandır</string>
|
||||
<string name="confirm_hdr">Onayla</string>
|
||||
<string name="mount_hdr">Bağla</string>
|
||||
<string name="mount_sel_part">Bağlanacak Bölümleri Seçin:</string>
|
||||
<string name="mount_sel_part">Bağlanacak Bölümleri Seç:</string>
|
||||
<string name="mount_sys_ro_chk">Sistem bölümünü salt okunur bağla</string>
|
||||
<string name="mount_sys_ro_s_chk">Sistemi RO Bağla</string>
|
||||
<string name="decrypt_data_btn">Veri Şifresini Çöz</string>
|
||||
@@ -326,11 +319,10 @@
|
||||
<string name="settings_tz_btn">Zaman Dilimi</string>
|
||||
<string name="settings_screen_btn">Ekran</string>
|
||||
<string name="settings_screen_bright_btn">Ekran Parlaklığı</string>
|
||||
<string name="vibration_disabled">Bu cihaz için titreşim devre dışı</string>
|
||||
<string name="settings_vibration_btn">Titreşim</string>
|
||||
<string name="settings_language_btn">Dil</string>
|
||||
<string name="time_zone_hdr">Zaman Dilimi</string>
|
||||
<string name="sel_tz_list">Zaman Dilimi Seçin:</string>
|
||||
<string name="sel_tz_list">Zaman Dilimi Seç:</string>
|
||||
<!-- Translator note: if it does not make sense to translate the locations or if it makes more sense,
|
||||
feel free to change the location listed or drop the location entirely and just call it UTC -6 -->
|
||||
<string name="utcm11">(UTC -11) Samoa, Midway Adası</string>
|
||||
@@ -382,7 +374,7 @@
|
||||
<string name="button_vibration">Düğme Titreşimi:</string>
|
||||
<string name="kb_vibration">Klavye Titreşimi:</string>
|
||||
<string name="act_vibration">Eylem Titreşimi:</string>
|
||||
<string name="select_language">Dil Seçin:</string>
|
||||
<string name="select_language">Dil Seç:</string>
|
||||
<string name="sel_lang_btn">Dil Seç</string>
|
||||
<string name="set_language_btn">Dili Ayarla</string>
|
||||
<string name="advanced_hdr">Gelişmiş</string>
|
||||
@@ -432,10 +424,10 @@
|
||||
<string name="swipe_to_unlock">Kilidi Açmak için Kaydır</string>
|
||||
<string name="swipe_unlock"> Kilidi Aç</string>
|
||||
<string name="fm_hdr">Dosya Yöneticisi</string>
|
||||
<string name="fm_sel_file">Bir Dosya veya Klasör Seç</string>
|
||||
<string name="fm_sel_file">Bir Dosya veya Klasör Seçin</string>
|
||||
<string name="fm_type_folder">Klasör</string>
|
||||
<string name="fm_type_file">Dosya</string>
|
||||
<string name="fm_choose_act">Eylem Seç</string>
|
||||
<string name="fm_choose_act">Eylem Seçin</string>
|
||||
<string name="fm_selected">%tw_fm_type% seçili:</string>
|
||||
<string name="fm_copy_btn">Kopyala</string>
|
||||
<string name="fm_copy_file_btn">Dosyayı Kopyala</string>
|
||||
@@ -452,7 +444,7 @@
|
||||
<string name="fm_rename_file_btn">Dosyayı Yeniden Adlandır</string>
|
||||
<string name="fm_rename_folder_btn">Klasörü Yeniden Adlandır</string>
|
||||
<string name="fm_renaming">Yeniden Adlandır</string>
|
||||
<string name="fm_sel_dest">Hedef Klasörü Seç</string>
|
||||
<string name="fm_sel_dest">Hedef Klasörü Seçin</string>
|
||||
<string name="fm_sel_curr_folder">Geçerli Klasörü Seç</string>
|
||||
<string name="fm_rename_hdr">Yeniden Adlandır</string>
|
||||
<string name="fm_set_perms_hdr">İzinleri Ayarla</string>
|
||||
@@ -489,28 +481,6 @@
|
||||
<string name="install_cancel">Yükleme</string>
|
||||
<string name="sel_storage_list">Depolama Seç</string>
|
||||
<string name="ok_btn">Tamam</string>
|
||||
<string name="install_twrp_ramdisk">Recovery Ramdisk Yükle</string>
|
||||
<string name="install_kernel">Kernel Yükle</string>
|
||||
<string name="repack_kernel_confirm_hdr">Kernel Yükle</string>
|
||||
<string name="repack_ramdisk_confirm_hdr">Recovery Yükle</string>
|
||||
<string name="repack_kernel_confirm">Kernel Yüklensin mi?</string>
|
||||
<string name="repack_ramdisk_confirm">Recovery Yüklensin mi?</string>
|
||||
<string name="repack_backup_first">Önce geçerli imajı yedekle</string>
|
||||
<string name="repack">Yeniden paketle</string>
|
||||
<string name="swipe_to_install">Yüklemek için Kaydır</string>
|
||||
<string name="installing">Yükleniyor...</string>
|
||||
<string name="install_complete">Yükleme Tamamlandı</string>
|
||||
<string name="unpack_error">İmaj açılırken hata oluştu.</string>
|
||||
<string name="repack_error">İmajı yeniden paketleme hatası.</string>
|
||||
<string name="unpacking_image">{1} açılıyor...</string>
|
||||
<string name="repacking_image">{1} yeniden paketleniyor...</string>
|
||||
<string name="repack_image_hdr">İmaj Seç</string>
|
||||
<string name="fix_recovery_loop">Recovery Bootloop'unu Onar</string>
|
||||
<string name="fix_recovery_loop_confirm">Recovery Bootloop'u Onarılsın mı?</string>
|
||||
<string name="fixing_recovery_loop">Recovery Bootloop'u Onarılıyor...</string>
|
||||
<string name="fix_recovery_loop_complete">Recovery Bootloop'unu Onarma Tamamlandı</string>
|
||||
<string name="fixing_recovery_loop_patch">Kernel yamalanıyor...</string>
|
||||
<string name="fix_recovery_loop_patch_error">Kernel yamalama hatası.</string>
|
||||
|
||||
<!-- Various console messages - these consist of user displayed messages, oftentimes errors -->
|
||||
<string name="no_kernel_selinux">Kernel SELinux içeriklerini okuma desteğine sahip değil.</string>
|
||||
@@ -540,7 +510,7 @@
|
||||
<string name="backup_folder"> * Yedekleme Klasörü: {1}</string>
|
||||
<string name="fail_backup_folder">Yedekleme klasörü oluşturulamadı.</string>
|
||||
<string name="avg_backup_fs">Dosya sistemleri için ortalama yedekleme hızı: {1} MB/sn</string>
|
||||
<string name="avg_backup_img">İmajlı sürücüler için ortalama yedekleme hızı: {1} MB/sn</string>
|
||||
<string name="avg_backup_img">Görüntülü sürücüler için ortalama yedekleme hızı: {1} MB/sn</string>
|
||||
<string name="total_backed_size">[{1} MB YEDEKLENDİ]</string>
|
||||
<string name="backup_completed">[YEDEKLEME {1} SANİYEDE TAMAMLANDI]</string>
|
||||
<string name="restore_started">[GERİ YÜKLEME BAŞLATILDI]</string>
|
||||
@@ -548,7 +518,7 @@
|
||||
<!-- {1} is the partition display name and {2} is the number of seconds -->
|
||||
<string name="restore_part_done">[{1} bitti ({2} saniye)]</string>
|
||||
<string name="verifying_digest" version="2">Digest Doğrulanıyor</string>
|
||||
<string name="skip_digest" version="2">Kullanıcı ayarına göre Digest kontrolü geçiliyor.</string>
|
||||
<string name="skip_digest" version="2">Kullanıcı ayarına göre Digest denetimi geçiliyor.</string>
|
||||
<string name="calc_restore">Geri yükleme ayrıntıları hesaplanıyor...</string>
|
||||
<string name="restore_read_only">{1} geri yüklenemiyor -- salt okunur bağlanmış.</string>
|
||||
<string name="restore_unable_locate">Geri yüklemek için \'{1}\' bölümü bulunamıyor.</string>
|
||||
@@ -563,10 +533,9 @@
|
||||
<string name="unable_find_part_path">\'{1}\' yolu için bölüm bulunamıyor</string>
|
||||
<string name="update_part_details">Bölüm ayrıntıları güncelleniyor...</string>
|
||||
<string name="update_part_details_done">...bitti</string>
|
||||
<string name="wiping_dalvik">Dalvik Dizinleri Temizleniyor...</string>
|
||||
<string name="wiping_dalvik">Dalvik Önbelleği Dizinleri Temizleniyor...</string>
|
||||
<string name="cleaned">Temizlendi: {1}...</string>
|
||||
<string name="cache_dalvik_done">-- Dalvik Önbelleği Dizinleri Temizleme Tamamlandı!</string>
|
||||
<string name="dalvik_done">-- Dalvik Dizinleri Temizleme Tamamlandı!</string>
|
||||
<string name="dalvik_done">-- Dalvik Önbelleği Dizinleri Temizleme Tamamlandı!</string>
|
||||
<string name="no_andsec">Android secure bölümü yok.</string>
|
||||
<string name="unable_to_locate">{1} bulunamıyor.</string>
|
||||
<string name="wiping_datamedia">Dahili depolama temizleniyor -- /data/media...</string>
|
||||
@@ -634,7 +603,7 @@
|
||||
<string name="backup_folder_set">Yedekleme klasörü '{1}' olarak ayarlandı</string>
|
||||
<string name="locate_backup_err">'{1}' yedeği bulunamadı</string>
|
||||
<string name="set_restore_opt">Geri yükleme seçeneklerini ayarlama: '{1}':</string>
|
||||
<string name="digest_check_skip" version="2">Digest kontrolünü atlama açık</string>
|
||||
<string name="digest_check_skip" version="2">Digest denetimini atlama açık</string>
|
||||
<string name="ors_encrypt_restore_err">Şifrelenmiş bir yedeklemeyi geri yüklemek için OpenRecoveryScript kullanılamıyor.</string>
|
||||
<string name="mounting">Bağlanıyor</string>
|
||||
<string name="unmounting">Kaldırılıyor</string>
|
||||
@@ -669,7 +638,7 @@
|
||||
<string name="verify_zip_fail">Zip imzası doğrulama başarısız oldu!</string>
|
||||
<string name="verify_zip_done">Zip imzası başarıyla doğrulandı.</string>
|
||||
<string name="zip_corrupt">Zip dosyası bozuk!</string>
|
||||
<string name="no_digest" version="2">Digest kontrolü geçiliyor: Digest dosyası bulunamadı</string>
|
||||
<string name="no_digest" version="2">Digest denetimi geçiliyor: Digest dosyası bulunamadı</string>
|
||||
<string name="digest_fail" version="2">Digest eşleşmiyor</string>
|
||||
<string name="digest_match" version="2">Digest eşleşti</string>
|
||||
<string name="pid_signal">{1} process ended with signal: {2}</string>
|
||||
|
||||
@@ -6,8 +6,8 @@ ifeq ($(TW_INCLUDE_DUMLOCK), true)
|
||||
htcdumlock.c
|
||||
LOCAL_CFLAGS:= -g -c -W
|
||||
LOCAL_MODULE:=htcdumlock
|
||||
LOCAL_MODULE_TAGS:= eng
|
||||
LOCAL_MODULE_TAGS:= optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
include $(BUILD_EXECUTABLE)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -6,7 +6,7 @@ ifeq ($(TW_INCLUDE_INJECTTWRP), true)
|
||||
injecttwrp.c
|
||||
LOCAL_CFLAGS:= -g -c -W
|
||||
LOCAL_MODULE:=injecttwrp
|
||||
LOCAL_MODULE_TAGS:= eng
|
||||
LOCAL_MODULE_TAGS:= optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
Regular → Executable
+1
-1
@@ -28,7 +28,7 @@
|
||||
#include <selinux/selinux.h>
|
||||
#include <ziparchive/zip_archive.h>
|
||||
|
||||
#include "otautil/DirUtil.h"
|
||||
#include "otautil/dirutil.h"
|
||||
|
||||
static constexpr mode_t UNZIP_DIRMODE = 0755;
|
||||
static constexpr mode_t UNZIP_FILEMODE = 0644;
|
||||
Regular → Executable
+32
-27
@@ -90,7 +90,7 @@ static bool WriteStatusToFd(MinadbdCommandStatus status, int fd) {
|
||||
|
||||
// Installs the package from FUSE. Returns the installation result and whether it should continue
|
||||
// waiting for new commands.
|
||||
static auto AdbInstallPackageHandler(RecoveryUI* ui, int* result) {
|
||||
static auto AdbInstallPackageHandler(int* result) {
|
||||
// How long (in seconds) we wait for the package path to be ready. It doesn't need to be too long
|
||||
// because the minadbd service has already issued an install command. FUSE_SIDELOAD_HOST_PATHNAME
|
||||
// will start to exist once the host connects and starts serving a package. Poll for its
|
||||
@@ -106,11 +106,11 @@ static auto AdbInstallPackageHandler(RecoveryUI* ui, int* result) {
|
||||
continue;
|
||||
} else {
|
||||
should_continue = false;
|
||||
ui->Print("\nTimed out waiting for fuse to be ready.\n\n");
|
||||
// ui->Print("\nTimed out waiting for fuse to be ready.\n\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
*result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, false, false, 0, ui);
|
||||
*result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, false, false, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ static bool HandleMessageFromMinadbd(int socket_fd,
|
||||
|
||||
// TODO(xunchang) add a wrapper function and kill the minadbd service there.
|
||||
static void ListenAndExecuteMinadbdCommands(
|
||||
RecoveryUI* ui, pid_t minadbd_pid, android::base::unique_fd&& socket_fd,
|
||||
pid_t minadbd_pid, android::base::unique_fd&& socket_fd,
|
||||
const std::map<MinadbdCommand, CommandFunction>& command_map) {
|
||||
android::base::unique_fd epoll_fd(epoll_create1(O_CLOEXEC));
|
||||
if (epoll_fd == -1) {
|
||||
@@ -206,8 +206,8 @@ static void ListenAndExecuteMinadbdCommands(
|
||||
constexpr int TIMEOUT_MILLIS = 300 * 1000;
|
||||
while (true) {
|
||||
// Reset the progress bar and the background image before each command.
|
||||
ui->SetProgressType(RecoveryUI::EMPTY);
|
||||
ui->SetBackground(RecoveryUI::NO_COMMAND);
|
||||
// ui->SetProgressType(RecoveryUI::EMPTY);
|
||||
// ui->SetBackground(RecoveryUI::NO_COMMAND);
|
||||
|
||||
// Poll for the status change of the socket_fd, and handle the message if the fd is ready to
|
||||
// read.
|
||||
@@ -272,8 +272,8 @@ static void ListenAndExecuteMinadbdCommands(
|
||||
// b11. exit the listening loop
|
||||
//
|
||||
static void CreateMinadbdServiceAndExecuteCommands(
|
||||
RecoveryUI* ui, const std::map<MinadbdCommand, CommandFunction>& command_map,
|
||||
bool rescue_mode) {
|
||||
const std::map<MinadbdCommand, CommandFunction>& command_map,
|
||||
bool rescue_mode, std::string install_file) {
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
android::base::unique_fd recovery_socket;
|
||||
@@ -291,8 +291,10 @@ static void CreateMinadbdServiceAndExecuteCommands(
|
||||
if (child == 0) {
|
||||
recovery_socket.reset();
|
||||
std::vector<std::string> minadbd_commands = {
|
||||
"/system/bin/minadbd",
|
||||
"--socket_fd",
|
||||
"/sbin/recovery",
|
||||
"recovery",
|
||||
"--adbd",
|
||||
install_file,
|
||||
std::to_string(minadbd_socket.release()),
|
||||
};
|
||||
if (rescue_mode) {
|
||||
@@ -312,7 +314,7 @@ static void CreateMinadbdServiceAndExecuteCommands(
|
||||
return;
|
||||
}
|
||||
|
||||
std::thread listener_thread(ListenAndExecuteMinadbdCommands, ui, child,
|
||||
std::thread listener_thread(ListenAndExecuteMinadbdCommands, child,
|
||||
std::move(recovery_socket), std::ref(command_map));
|
||||
if (listener_thread.joinable()) {
|
||||
listener_thread.join();
|
||||
@@ -331,7 +333,9 @@ static void CreateMinadbdServiceAndExecuteCommands(
|
||||
signal(SIGPIPE, SIG_DFL);
|
||||
}
|
||||
|
||||
int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot_action) {
|
||||
// int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot_action) {
|
||||
int ApplyFromAdb(const char* install_file, Device::BuiltinAction* reboot_action) {
|
||||
|
||||
// Save the usb state to restore after the sideload operation.
|
||||
std::string usb_state = android::base::GetProperty("sys.usb.state", "none");
|
||||
// Clean up state and stop adbd.
|
||||
@@ -340,24 +344,25 @@ int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot
|
||||
return INSTALL_ERROR;
|
||||
}
|
||||
|
||||
RecoveryUI* ui = device->GetUI();
|
||||
// RecoveryUI* ui = device->GetUI();
|
||||
|
||||
int install_result = INSTALL_ERROR;
|
||||
std::map<MinadbdCommand, CommandFunction> command_map{
|
||||
{ MinadbdCommand::kInstall, std::bind(&AdbInstallPackageHandler, ui, &install_result) },
|
||||
{ MinadbdCommand::kRebootAndroid, std::bind(&AdbRebootHandler, MinadbdCommand::kRebootAndroid,
|
||||
{ MinadbdCommand::kInstall, std::bind(&AdbInstallPackageHandler, &install_result) },
|
||||
{ MinadbdCommand::kRebootAndroid, std::bind(&AdbRebootHandler, MinadbdCommand::kRebootAndroid,
|
||||
&install_result, reboot_action) },
|
||||
{ MinadbdCommand::kRebootBootloader,
|
||||
std::bind(&AdbRebootHandler, MinadbdCommand::kRebootBootloader, &install_result,
|
||||
reboot_action) },
|
||||
{ MinadbdCommand::kRebootFastboot, std::bind(&AdbRebootHandler, MinadbdCommand::kRebootFastboot,
|
||||
&install_result, reboot_action) },
|
||||
{ MinadbdCommand::kRebootBootloader,
|
||||
std::bind(&AdbRebootHandler, MinadbdCommand::kRebootBootloader, &install_result,
|
||||
reboot_action) },
|
||||
{ MinadbdCommand::kRebootFastboot, std::bind(&AdbRebootHandler, MinadbdCommand::kRebootFastboot,
|
||||
&install_result, reboot_action) },
|
||||
{ MinadbdCommand::kRebootRecovery, std::bind(&AdbRebootHandler, MinadbdCommand::kRebootRecovery,
|
||||
&install_result, reboot_action) },
|
||||
{ MinadbdCommand::kRebootRescue,
|
||||
std::bind(&AdbRebootHandler, MinadbdCommand::kRebootRescue, &install_result, reboot_action) },
|
||||
};
|
||||
{ MinadbdCommand::kRebootRecovery, std::bind(&AdbRebootHandler, MinadbdCommand::kRebootRecovery,
|
||||
&install_result, reboot_action) },
|
||||
{ MinadbdCommand::kRebootRescue,
|
||||
std::bind(&AdbRebootHandler, MinadbdCommand::kRebootRescue, &install_result, reboot_action) },
|
||||
};
|
||||
|
||||
/*
|
||||
if (!rescue_mode) {
|
||||
ui->Print(
|
||||
"\n\nNow send the package you want to apply\n"
|
||||
@@ -371,8 +376,8 @@ int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot
|
||||
|
||||
ui->Print("\n\nWaiting for rescue commands...\n");
|
||||
}
|
||||
|
||||
CreateMinadbdServiceAndExecuteCommands(ui, command_map, rescue_mode);
|
||||
*/
|
||||
CreateMinadbdServiceAndExecuteCommands(command_map, false, install_file);
|
||||
|
||||
// Clean up before switching to the older state, for example setting the state
|
||||
// to none sets sys/class/android_usb/android0/enable to 0.
|
||||
|
||||
Regular → Executable
+1
-1
@@ -184,7 +184,7 @@ int ApplyFromSdcard(Device* device, RecoveryUI* ui) {
|
||||
}
|
||||
}
|
||||
|
||||
result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, false, false, 0 /*retry_count*/, ui);
|
||||
result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, false, false, 0 /*retry_count*/);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+1
-1
@@ -21,4 +21,4 @@
|
||||
// Applies a package via `adb sideload` or `adb rescue`. Returns the install result (in `enum
|
||||
// InstallResult`). When a reboot has been requested, INSTALL_REBOOT will be the return value, with
|
||||
// the reboot target set in reboot_action.
|
||||
int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot_action);
|
||||
int ApplyFromAdb(const char* install_file, Device::BuiltinAction* reboot_action);
|
||||
|
||||
Regular → Executable
-10
@@ -16,17 +16,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
<<<<<<< HEAD:adb_install.h
|
||||
#include <sys/types.h>
|
||||
|
||||
//class RecoveryUI;
|
||||
|
||||
//static void set_usb_driver(bool enabled);
|
||||
//static void maybe_restart_adbd();
|
||||
int apply_from_adb(const char* install_file, pid_t* child_pid);
|
||||
=======
|
||||
#include "recovery_ui/device.h"
|
||||
#include "recovery_ui/ui.h"
|
||||
>>>>>>> android-10.0.0_r25:install/include/install/fuse_sdcard_install.h
|
||||
|
||||
int ApplyFromSdcard(Device* device, RecoveryUI* ui);
|
||||
|
||||
Regular → Executable
+2
-2
@@ -48,11 +48,11 @@ enum class OtaType {
|
||||
// successful installation if |should_wipe_cache| is true or an updater command asks to wipe the
|
||||
// cache.
|
||||
int install_package(const std::string& package, bool should_wipe_cache, bool needs_mount,
|
||||
int retry_count, RecoveryUI* ui);
|
||||
int retry_count);
|
||||
|
||||
// Verifies the package by ota keys. Returns true if the package is verified successfully,
|
||||
// otherwise returns false.
|
||||
bool verify_package(Package* package, RecoveryUI* ui);
|
||||
bool verify_package(Package* package);
|
||||
|
||||
// Reads meta data file of the package; parses each line in the format "key=value"; and writes the
|
||||
// result to |metadata|. Return true if succeed, otherwise return false.
|
||||
|
||||
Regular → Executable
+2
-2
@@ -33,9 +33,9 @@
|
||||
class Package : public VerifierInterface {
|
||||
public:
|
||||
static std::unique_ptr<Package> CreateMemoryPackage(
|
||||
const std::string& path, const std::function<void(float)>& set_progress);
|
||||
const std::string& path);
|
||||
static std::unique_ptr<Package> CreateMemoryPackage(
|
||||
std::vector<uint8_t> content, const std::function<void(float)>& set_progress);
|
||||
std::vector<uint8_t> content);
|
||||
static std::unique_ptr<Package> CreateFilePackage(const std::string& path,
|
||||
const std::function<void(float)>& set_progress);
|
||||
|
||||
|
||||
Regular → Executable
+1
-1
@@ -24,7 +24,7 @@
|
||||
struct selabel_handle;
|
||||
|
||||
// Returns true on success.
|
||||
bool WipeCache(RecoveryUI* ui, const std::function<bool()>& confirm);
|
||||
bool WipeCache(const std::function<bool()>& confirm);
|
||||
|
||||
// Returns true on success.
|
||||
bool WipeData(Device* device, bool convert_fbe);
|
||||
|
||||
Regular → Executable
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 bigbiff/Dees_Troy TeamWin
|
||||
* Copyright (C) TeamWin
|
||||
* This file is part of TWRP/TeamWin Recovery Project.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "minzip/SysUtil.h"
|
||||
#else
|
||||
#include <ziparchive/zip_archive.h>
|
||||
#include "otautil/SysUtil.h"
|
||||
#include "otautil/sysutil.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
Regular → Executable
+32
-35
@@ -64,8 +64,8 @@ static constexpr int kRecoveryApiVersion = 3;
|
||||
static_assert(kRecoveryApiVersion == RECOVERY_API_VERSION, "Mismatching recovery API versions.");
|
||||
|
||||
// Default allocation of progress bar segments to operations
|
||||
static constexpr int VERIFICATION_PROGRESS_TIME = 60;
|
||||
static constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25;
|
||||
// static constexpr int VERIFICATION_PROGRESS_TIME = 60;
|
||||
// static constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25;
|
||||
|
||||
static std::condition_variable finish_log_temperature;
|
||||
|
||||
@@ -157,8 +157,6 @@ static int CheckAbSpecificMetadata(const std::map<std::string, std::string>& met
|
||||
return INSTALL_ERROR;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:install.cpp
|
||||
=======
|
||||
// Check for downgrade version.
|
||||
int64_t build_timestamp =
|
||||
android::base::GetIntProperty("ro.build.date.utc", std::numeric_limits<int64_t>::max());
|
||||
@@ -182,7 +180,6 @@ static int CheckAbSpecificMetadata(const std::map<std::string, std::string>& met
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> android-10.0.0_r25:install/install.cpp
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -330,7 +327,7 @@ static void log_max_temperature(int* max_temperature, const std::atomic<bool>& l
|
||||
// If the package contains an update binary, extract it and run it.
|
||||
static int try_update_binary(const std::string& package, ZipArchiveHandle zip, bool* wipe_cache,
|
||||
std::vector<std::string>* log_buffer, int retry_count,
|
||||
int* max_temperature, RecoveryUI* ui) {
|
||||
int* max_temperature) {
|
||||
std::map<std::string, std::string> metadata;
|
||||
if (!ReadMetadataFromPackage(zip, &metadata)) {
|
||||
LOG(ERROR) << "Failed to parse metadata in the zip file";
|
||||
@@ -442,7 +439,7 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
|
||||
int seconds;
|
||||
if (tokens.size() == 2 && android::base::ParseDouble(tokens[0].c_str(), &fraction) &&
|
||||
android::base::ParseInt(tokens[1], &seconds)) {
|
||||
ui->ShowProgress(fraction * (1 - VERIFICATION_PROGRESS_FRACTION), seconds);
|
||||
// ui->ShowProgress(fraction * (1 - VERIFICATION_PROGRESS_FRACTION), seconds);
|
||||
} else {
|
||||
LOG(ERROR) << "invalid \"progress\" parameters: " << line;
|
||||
}
|
||||
@@ -450,22 +447,22 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
|
||||
std::vector<std::string> tokens = android::base::Split(args, " ");
|
||||
double fraction;
|
||||
if (tokens.size() == 1 && android::base::ParseDouble(tokens[0].c_str(), &fraction)) {
|
||||
ui->SetProgress(fraction);
|
||||
// ui->SetProgress(fraction);
|
||||
} else {
|
||||
LOG(ERROR) << "invalid \"set_progress\" parameters: " << line;
|
||||
}
|
||||
} else if (command == "ui_print") {
|
||||
ui->PrintOnScreenOnly("%s\n", args.c_str());
|
||||
// ui->PrintOnScreenOnly("%s\n", args.c_str());
|
||||
fflush(stdout);
|
||||
} else if (command == "wipe_cache") {
|
||||
*wipe_cache = true;
|
||||
} else if (command == "clear_display") {
|
||||
ui->SetBackground(RecoveryUI::NONE);
|
||||
// ui->SetBackground(RecoveryUI::NONE);
|
||||
} else if (command == "enable_reboot") {
|
||||
// packages can explicitly request that they want the user
|
||||
// to be able to reboot during installation (useful for
|
||||
// debugging packages that don't exit).
|
||||
ui->SetEnableReboot(true);
|
||||
// ui->SetEnableReboot(true);
|
||||
} else if (command == "retry_update") {
|
||||
retry_update = true;
|
||||
} else if (command == "log") {
|
||||
@@ -576,16 +573,16 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip) {
|
||||
|
||||
static int really_install_package(const std::string& path, bool* wipe_cache, bool needs_mount,
|
||||
std::vector<std::string>* log_buffer, int retry_count,
|
||||
int* max_temperature, RecoveryUI* ui) {
|
||||
ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
|
||||
ui->Print("Finding update package...\n");
|
||||
int* max_temperature) {
|
||||
// ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
|
||||
// ui->Print("Finding update package...\n");
|
||||
// Give verification half the progress bar...
|
||||
ui->SetProgressType(RecoveryUI::DETERMINATE);
|
||||
ui->ShowProgress(VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME);
|
||||
// ui->SetProgressType(RecoveryUI::DETERMINATE);
|
||||
// ui->ShowProgress(VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME);
|
||||
LOG(INFO) << "Update location: " << path;
|
||||
|
||||
// Map the update package into memory.
|
||||
ui->Print("Opening update package...\n");
|
||||
// ui->Print("Opening update package...\n");
|
||||
|
||||
if (needs_mount) {
|
||||
if (path[0] == '@') {
|
||||
@@ -596,14 +593,14 @@ static int really_install_package(const std::string& path, bool* wipe_cache, boo
|
||||
}
|
||||
|
||||
auto package = Package::CreateMemoryPackage(
|
||||
path, std::bind(&RecoveryUI::SetProgress, ui, std::placeholders::_1));
|
||||
path);
|
||||
if (!package) {
|
||||
log_buffer->push_back(android::base::StringPrintf("error: %d", kMapFileFailure));
|
||||
return INSTALL_CORRUPT;
|
||||
}
|
||||
|
||||
// Verify package.
|
||||
if (!verify_package(package.get(), ui)) {
|
||||
if (!verify_package(package.get())) {
|
||||
log_buffer->push_back(android::base::StringPrintf("error: %d", kZipVerificationFailure));
|
||||
return INSTALL_CORRUPT;
|
||||
}
|
||||
@@ -622,21 +619,21 @@ static int really_install_package(const std::string& path, bool* wipe_cache, boo
|
||||
}
|
||||
|
||||
// Verify and install the contents of the package.
|
||||
ui->Print("Installing update...\n");
|
||||
if (retry_count > 0) {
|
||||
ui->Print("Retry attempt: %d\n", retry_count);
|
||||
}
|
||||
ui->SetEnableReboot(false);
|
||||
// ui->Print("Installing update...\n");
|
||||
// if (retry_count > 0) {
|
||||
// ui->Print("Retry attempt: %d\n", retry_count);
|
||||
// }
|
||||
// ui->SetEnableReboot(false);
|
||||
int result =
|
||||
try_update_binary(path, zip, wipe_cache, log_buffer, retry_count, max_temperature, ui);
|
||||
ui->SetEnableReboot(true);
|
||||
ui->Print("\n");
|
||||
try_update_binary(path, zip, wipe_cache, log_buffer, retry_count, max_temperature);
|
||||
// ui->SetEnableReboot(true);
|
||||
// ui->Print("\n");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int install_package(const std::string& path, bool should_wipe_cache, bool needs_mount,
|
||||
int retry_count, RecoveryUI* ui) {
|
||||
int retry_count) {
|
||||
CHECK(!path.empty());
|
||||
|
||||
auto start = std::chrono::system_clock::now();
|
||||
@@ -652,7 +649,7 @@ int install_package(const std::string& path, bool should_wipe_cache, bool needs_
|
||||
} else {
|
||||
bool updater_wipe_cache = false;
|
||||
result = really_install_package(path, &updater_wipe_cache, needs_mount, &log_buffer,
|
||||
retry_count, &max_temperature, ui);
|
||||
retry_count, &max_temperature);
|
||||
should_wipe_cache = should_wipe_cache || updater_wipe_cache;
|
||||
}
|
||||
|
||||
@@ -709,7 +706,7 @@ int install_package(const std::string& path, bool should_wipe_cache, bool needs_
|
||||
LOG(INFO) << log_content;
|
||||
|
||||
if (result == INSTALL_SUCCESS && should_wipe_cache) {
|
||||
if (!WipeCache(ui, nullptr)) {
|
||||
if (!WipeCache(nullptr)) {
|
||||
result = INSTALL_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -717,7 +714,7 @@ int install_package(const std::string& path, bool should_wipe_cache, bool needs_
|
||||
return result;
|
||||
}
|
||||
|
||||
bool verify_package(Package* package, RecoveryUI* ui) {
|
||||
bool verify_package(Package* package) {
|
||||
static constexpr const char* CERTIFICATE_ZIP_FILE = "/system/etc/security/otacerts.zip";
|
||||
std::vector<Certificate> loaded_keys = LoadKeysFromZipfile(CERTIFICATE_ZIP_FILE);
|
||||
if (loaded_keys.empty()) {
|
||||
@@ -727,11 +724,11 @@ bool verify_package(Package* package, RecoveryUI* ui) {
|
||||
LOG(INFO) << loaded_keys.size() << " key(s) loaded from " << CERTIFICATE_ZIP_FILE;
|
||||
|
||||
// Verify package.
|
||||
ui->Print("Verifying update package...\n");
|
||||
auto t0 = std::chrono::system_clock::now();
|
||||
// ui->Print("Verifying update package...\n");
|
||||
// auto t0 = std::chrono::system_clock::now();
|
||||
int err = verify_file(package, loaded_keys);
|
||||
std::chrono::duration<double> duration = std::chrono::system_clock::now() - t0;
|
||||
ui->Print("Update package verification took %.1f s (result %d).\n", duration.count(), err);
|
||||
// std::chrono::duration<double> duration = std::chrono::system_clock::now() - t0;
|
||||
// ui->Print("Update package verification took %.1f s (result %d).\n", duration.count(), err);
|
||||
if (err != VERIFY_SUCCESS) {
|
||||
LOG(ERROR) << "Signature verification failed";
|
||||
LOG(ERROR) << "error: " << kZipVerificationFailure;
|
||||
|
||||
Regular → Executable
+3
-17
@@ -37,7 +37,7 @@
|
||||
#ifdef USE_OLD_VERIFIER
|
||||
#include "verifier24/verifier.h"
|
||||
#else
|
||||
#include "verifier.h"
|
||||
#include "install/install.h"
|
||||
#endif
|
||||
|
||||
#ifdef AB_OTA_UPDATER
|
||||
@@ -124,23 +124,9 @@ static int check_newer_ab_build(ZipWrap* zip)
|
||||
|
||||
property_get("ro.product.device", value, "");
|
||||
const std::string& pkg_device = metadata["pre-device"];
|
||||
|
||||
std::vector<std::string> assertResults = android::base::Split(pkg_device, ",");
|
||||
|
||||
bool deviceExists = false;
|
||||
|
||||
for(const std::string& deviceAssert : assertResults)
|
||||
{
|
||||
std::string assertName = android::base::Trim(deviceAssert);
|
||||
if (assertName == value && !assertName.empty()) {
|
||||
deviceExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!deviceExists) {
|
||||
if (pkg_device != value || pkg_device.empty()) {
|
||||
printf("Package is for product %s but expected %s\n",
|
||||
pkg_device.c_str(), value);
|
||||
pkg_device.c_str(), value);
|
||||
return INSTALL_ERROR;
|
||||
}
|
||||
|
||||
Regular → Executable
+8
-13
@@ -32,11 +32,10 @@
|
||||
class MemoryPackage : public Package {
|
||||
public:
|
||||
// Constructs the class from a file. We will memory maps the file later.
|
||||
MemoryPackage(const std::string& path, std::unique_ptr<MemMapping> map,
|
||||
const std::function<void(float)>& set_progress);
|
||||
MemoryPackage(const std::string& path, std::unique_ptr<MemMapping> map);
|
||||
|
||||
// Constructs the class from the package bytes in |content|.
|
||||
MemoryPackage(std::vector<uint8_t> content, const std::function<void(float)>& set_progress);
|
||||
MemoryPackage(std::vector<uint8_t> content);
|
||||
|
||||
~MemoryPackage() override;
|
||||
|
||||
@@ -102,14 +101,14 @@ class FilePackage : public Package {
|
||||
};
|
||||
|
||||
std::unique_ptr<Package> Package::CreateMemoryPackage(
|
||||
const std::string& path, const std::function<void(float)>& set_progress) {
|
||||
const std::string& path) {
|
||||
std::unique_ptr<MemMapping> mmap = std::make_unique<MemMapping>();
|
||||
if (!mmap->MapFile(path)) {
|
||||
LOG(ERROR) << "failed to map file";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::make_unique<MemoryPackage>(path, std::move(mmap), set_progress);
|
||||
return std::make_unique<MemoryPackage>(path, std::move(mmap));
|
||||
}
|
||||
|
||||
std::unique_ptr<Package> Package::CreateFilePackage(
|
||||
@@ -130,25 +129,21 @@ std::unique_ptr<Package> Package::CreateFilePackage(
|
||||
}
|
||||
|
||||
std::unique_ptr<Package> Package::CreateMemoryPackage(
|
||||
std::vector<uint8_t> content, const std::function<void(float)>& set_progress) {
|
||||
return std::make_unique<MemoryPackage>(std::move(content), set_progress);
|
||||
std::vector<uint8_t> content) {
|
||||
return std::make_unique<MemoryPackage>(std::move(content));
|
||||
}
|
||||
|
||||
MemoryPackage::MemoryPackage(const std::string& path, std::unique_ptr<MemMapping> map,
|
||||
const std::function<void(float)>& set_progress)
|
||||
MemoryPackage::MemoryPackage(const std::string& path, std::unique_ptr<MemMapping> map)
|
||||
: map_(std::move(map)), path_(path), zip_handle_(nullptr) {
|
||||
addr_ = map_->addr;
|
||||
package_size_ = map_->length;
|
||||
set_progress_ = set_progress;
|
||||
}
|
||||
|
||||
MemoryPackage::MemoryPackage(std::vector<uint8_t> content,
|
||||
const std::function<void(float)>& set_progress)
|
||||
MemoryPackage::MemoryPackage(std::vector<uint8_t> content)
|
||||
: package_content_(std::move(content)), zip_handle_(nullptr) {
|
||||
CHECK(!package_content_.empty());
|
||||
addr_ = package_content_.data();
|
||||
package_size_ = package_content_.size();
|
||||
set_progress_ = set_progress;
|
||||
}
|
||||
|
||||
MemoryPackage::~MemoryPackage() {
|
||||
|
||||
Regular → Executable
+15
-15
@@ -36,12 +36,12 @@ constexpr const char* CACHE_ROOT = "/cache";
|
||||
constexpr const char* DATA_ROOT = "/data";
|
||||
constexpr const char* METADATA_ROOT = "/metadata";
|
||||
|
||||
static bool EraseVolume(const char* volume, RecoveryUI* ui, bool convert_fbe) {
|
||||
static bool EraseVolume(const char* volume, bool convert_fbe) {
|
||||
bool is_cache = (strcmp(volume, CACHE_ROOT) == 0);
|
||||
bool is_data = (strcmp(volume, DATA_ROOT) == 0);
|
||||
|
||||
ui->SetBackground(RecoveryUI::ERASING);
|
||||
ui->SetProgressType(RecoveryUI::INDETERMINATE);
|
||||
// ui->SetBackground(RecoveryUI::ERASING);
|
||||
// ui->SetProgressType(RecoveryUI::INDETERMINATE);
|
||||
|
||||
std::vector<saved_log_file> log_files;
|
||||
if (is_cache) {
|
||||
@@ -50,7 +50,7 @@ static bool EraseVolume(const char* volume, RecoveryUI* ui, bool convert_fbe) {
|
||||
log_files = ReadLogFilesToMemory();
|
||||
}
|
||||
|
||||
ui->Print("Formatting %s...\n", volume);
|
||||
// ui->Print("Formatting %s...\n", volume);
|
||||
|
||||
ensure_path_unmounted(volume);
|
||||
|
||||
@@ -84,10 +84,10 @@ static bool EraseVolume(const char* volume, RecoveryUI* ui, bool convert_fbe) {
|
||||
return (result == 0);
|
||||
}
|
||||
|
||||
bool WipeCache(RecoveryUI* ui, const std::function<bool()>& confirm_func) {
|
||||
bool WipeCache(const std::function<bool()>& confirm_func) {
|
||||
bool has_cache = volume_for_mount_point("/cache") != nullptr;
|
||||
if (!has_cache) {
|
||||
ui->Print("No /cache partition found.\n");
|
||||
// ui->Print("No /cache partition found.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -95,29 +95,29 @@ bool WipeCache(RecoveryUI* ui, const std::function<bool()>& confirm_func) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ui->Print("\n-- Wiping cache...\n");
|
||||
bool success = EraseVolume("/cache", ui, false);
|
||||
ui->Print("Cache wipe %s.\n", success ? "complete" : "failed");
|
||||
// ui->Print("\n-- Wiping cache...\n");
|
||||
bool success = EraseVolume("/cache", false);
|
||||
// ui->Print("Cache wipe %s.\n", success ? "complete" : "failed");
|
||||
return success;
|
||||
}
|
||||
|
||||
bool WipeData(Device* device, bool convert_fbe) {
|
||||
RecoveryUI* ui = device->GetUI();
|
||||
ui->Print("\n-- Wiping data...\n");
|
||||
// RecoveryUI* ui = device->GetUI();
|
||||
// ui->Print("\n-- Wiping data...\n");
|
||||
bool success = device->PreWipeData();
|
||||
if (success) {
|
||||
success &= EraseVolume(DATA_ROOT, ui, convert_fbe);
|
||||
success &= EraseVolume(DATA_ROOT, convert_fbe);
|
||||
bool has_cache = volume_for_mount_point("/cache") != nullptr;
|
||||
if (has_cache) {
|
||||
success &= EraseVolume(CACHE_ROOT, ui, false);
|
||||
success &= EraseVolume(CACHE_ROOT, false);
|
||||
}
|
||||
if (volume_for_mount_point(METADATA_ROOT) != nullptr) {
|
||||
success &= EraseVolume(METADATA_ROOT, ui, false);
|
||||
success &= EraseVolume(METADATA_ROOT, false);
|
||||
}
|
||||
}
|
||||
if (success) {
|
||||
success &= device->PostWipeData();
|
||||
}
|
||||
ui->Print("Data wipe %s.\n", success ? "complete" : "failed");
|
||||
// ui->Print("Data wipe %s.\n", success ? "complete" : "failed");
|
||||
return success;
|
||||
}
|
||||
Regular → Executable
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 bigbiff/Dees_Troy TeamWin
|
||||
* Copyright (C) TeamWin
|
||||
* This file is part of TWRP/TeamWin Recovery Project.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -27,8 +27,8 @@
|
||||
#include "minzip/SysUtil.h"
|
||||
#else
|
||||
#include <ziparchive/zip_archive.h>
|
||||
#include "otautil/ZipUtil.h"
|
||||
#include "otautil/SysUtil.h"
|
||||
#include "ZipUtil.h"
|
||||
#include "otautil/sysutil.h"
|
||||
#endif
|
||||
|
||||
ZipWrap::ZipWrap() {
|
||||
Regular → Executable
+7
-5
@@ -14,8 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "adb_install.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -31,15 +29,19 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ui.h"
|
||||
#include "cutils/properties.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "fuse_sideload.h"
|
||||
#ifdef USE_OLD_VERIFIER
|
||||
#include "verifier24/verifier.h"
|
||||
#include "ui.h"
|
||||
#elif USE_28_VERIFIER
|
||||
#include "verifier28/verifier.h"
|
||||
#include "verifier28/adb_install.h"
|
||||
#include "verifier28/ui.h"
|
||||
#include "verifier28/fuse_sideload.h"
|
||||
#else
|
||||
#include "verifier.h"
|
||||
#include "install/install.h"
|
||||
#endif
|
||||
|
||||
static void set_usb_driver(bool enabled) {
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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.
|
||||
*/
|
||||
|
||||
#ifndef _ADB_INSTALL_H
|
||||
#define _ADB_INSTALL_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
//class RecoveryUI;
|
||||
|
||||
//static void set_usb_driver(bool enabled);
|
||||
//static void maybe_restart_adbd();
|
||||
int apply_from_adb(const char* install_file, pid_t* child_pid);
|
||||
|
||||
#endif
|
||||
@@ -5,13 +5,13 @@ ifneq ($(TARGET_SIMULATOR),true)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := system.c popen.c
|
||||
LOCAL_MODULE := libcrecovery
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := system.c popen.c
|
||||
LOCAL_MODULE := libcrecovery
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif
|
||||
|
||||
@@ -34,11 +34,11 @@ PIXELFLINGER_SRC_FILES += \
|
||||
codeflinger/load_store.cpp \
|
||||
codeflinger/blending.cpp \
|
||||
codeflinger/texturing.cpp \
|
||||
fixed.cpp.arm \
|
||||
picker.cpp.arm \
|
||||
pixelflinger.cpp.arm \
|
||||
trap.cpp.arm \
|
||||
scanline.cpp.arm
|
||||
fixed.cpp \
|
||||
picker.cpp \
|
||||
pixelflinger.cpp \
|
||||
trap.cpp \
|
||||
scanline.cpp
|
||||
else
|
||||
PIXELFLINGER_SRC_FILES_x86 := \
|
||||
codeflinger/x86/X86Assembler.cpp \
|
||||
@@ -105,6 +105,7 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||
LOCAL_C_INCLUDES += $(LOCAL_EXPORT_C_INCLUDE_DIRS)
|
||||
LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS)
|
||||
LOCAL_CPPFLAGS := -Wno-unused-function
|
||||
LOCAL_STATIC_LIBRARIES += libbase libutils libcutils
|
||||
LOCAL_C_INCLUDES_x86 := $(PIXELFLINGER_C_INCLUDES_x86)
|
||||
ifeq ($(TW_HAVE_X86_ACCELERATED_PIXELFLINGER),true)
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libenc
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libtar
|
||||
LOCAL_MODULE_TAGS := eng optional
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SRC_FILES := append.c block.c decode.c encode.c extract.c handle.c output.c util.c wrapper.c basename.c strmode.c libtar_hash.c libtar_list.c dirname.c android_utils.c
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH) \
|
||||
external/zlib
|
||||
@@ -25,7 +25,7 @@ include $(BUILD_SHARED_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libtar_static
|
||||
LOCAL_MODULE_TAGS := eng optional
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SRC_FILES := append.c block.c decode.c encode.c extract.c handle.c output.c util.c wrapper.c basename.c strmode.c libtar_hash.c libtar_list.c dirname.c android_utils.c
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH) \
|
||||
external/zlib
|
||||
|
||||
Regular → Executable
+34
-19
@@ -22,19 +22,20 @@ minadbd_cflags := \
|
||||
# libminadbd (static library)
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
# ../fuse_sideload.cpp \
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
fuse_adb_provider.cpp \
|
||||
../fuse_sideload.cpp \
|
||||
minadbd.cpp \
|
||||
minadbd_services.cpp \
|
||||
|
||||
LOCAL_MODULE := libminadbd
|
||||
LOCAL_CFLAGS := $(minadbd_cflags) -Wno-unused-parameter
|
||||
LOCAL_CONLY_FLAGS := -Wimplicit-function-declaration
|
||||
LOCAL_CFLAGS += -std=gnu++2a
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. system/core/adb
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := libadbd
|
||||
LOCAL_SHARED_LIBRARIES := libbase liblog libcutils libc
|
||||
#LOCAL_WHOLE_STATIC_LIBRARIES := libadbd
|
||||
LOCAL_SHARED_LIBRARIES := libadbd libbase liblog libcutils libc
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/libmincrypt/includes
|
||||
@@ -49,6 +50,13 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../fuse_sideload28/
|
||||
else
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../fuse_sideload/include
|
||||
LOCAL_SHARED_LIBRARIES += libfusesideload
|
||||
endif
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
@@ -63,9 +71,16 @@ LOCAL_CLANG := true
|
||||
LOCAL_MODULE := libminadbd
|
||||
LOCAL_CFLAGS := $(minadbd_cflags) -Wno-unused-parameter
|
||||
LOCAL_CONLY_FLAGS := -Wimplicit-function-declaration
|
||||
LOCAL_CFLAGS += -std=gnu++2a
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. system/core/adb
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := libadbd
|
||||
LOCAL_STATIC_LIBRARIES := libbase liblog libcutils libc
|
||||
LOCAL_SHARED_LIBRARIES := libadbd libbase liblog libcutils libc
|
||||
#LOCAL_STATIC_LIBRARIES := libbase liblog libcutils libc
|
||||
|
||||
ifeq ($shell test $(PLATFORM_SDK_VERSION) -lt 29; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../fuse_sideload28/
|
||||
else
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../fuse_sideload/include
|
||||
endif
|
||||
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/libmincrypt/includes
|
||||
@@ -84,19 +99,19 @@ include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# minadbd_test (native test)
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
# include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := minadbd_test
|
||||
LOCAL_COMPATIBILITY_SUITE := device-tests
|
||||
LOCAL_SRC_FILES := fuse_adb_provider_test.cpp
|
||||
LOCAL_CFLAGS := $(minadbd_cflags)
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) system/core/adb
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libBionicGtestMain \
|
||||
libminadbd
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
liblog \
|
||||
libbase \
|
||||
libcutils
|
||||
# LOCAL_MODULE := minadbd_test
|
||||
# LOCAL_COMPATIBILITY_SUITE := device-tests
|
||||
# LOCAL_SRC_FILES := fuse_adb_provider_test.cpp
|
||||
# LOCAL_CFLAGS := $(minadbd_cflags)
|
||||
# LOCAL_C_INCLUDES := $(LOCAL_PATH) system/core/adb
|
||||
# LOCAL_STATIC_LIBRARIES := \
|
||||
# libBionicGtestMain \
|
||||
# libminadbd
|
||||
# LOCAL_SHARED_LIBRARIES := \
|
||||
# liblog \
|
||||
# libbase \
|
||||
# libcutils
|
||||
|
||||
include $(BUILD_NATIVE_TEST)
|
||||
# include $(BUILD_NATIVE_TEST)
|
||||
|
||||
Regular → Executable
Regular → Executable
-5
@@ -68,13 +68,8 @@ int main(int argc, char** argv) {
|
||||
init_transport_registration();
|
||||
usb_init();
|
||||
|
||||
<<<<<<< HEAD
|
||||
//VLOG(ADB) << "Event loop starting";
|
||||
fdevent_loop();
|
||||
=======
|
||||
VLOG(ADB) << "Event loop starting";
|
||||
fdevent_loop();
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Regular → Executable
-104
@@ -48,42 +48,6 @@
|
||||
#include "services.h"
|
||||
#include "sysdeps.h"
|
||||
|
||||
<<<<<<< HEAD
|
||||
typedef struct stinfo stinfo;
|
||||
|
||||
struct stinfo {
|
||||
void (*func)(int fd, void *cookie);
|
||||
int fd;
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
void service_bootstrap_func(void* x) {
|
||||
stinfo* sti = reinterpret_cast<stinfo*>(x);
|
||||
sti->func(sti->fd, sti->cookie);
|
||||
free(sti);
|
||||
}
|
||||
|
||||
#if PLATFORM_SDK_VERSION < 26
|
||||
static void sideload_host_service(int sfd, void* data) {
|
||||
char* args = reinterpret_cast<char*>(data);
|
||||
#else
|
||||
static void sideload_host_service(int sfd, const std::string& args) {
|
||||
#endif
|
||||
int file_size;
|
||||
int block_size;
|
||||
#if PLATFORM_SDK_VERSION < 26
|
||||
if (sscanf(args, "%d:%d", &file_size, &block_size) != 2) {
|
||||
printf("bad sideload-host arguments: %s\n", args);
|
||||
#else
|
||||
if (sscanf(args.c_str(), "%d:%d", &file_size, &block_size) != 2) {
|
||||
printf("bad sideload-host arguments: %s\n", args.c_str());
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
#if PLATFORM_SDK_VERSION < 26
|
||||
free(args);
|
||||
#endif
|
||||
=======
|
||||
static int minadbd_socket = -1;
|
||||
static bool rescue_mode = false;
|
||||
static std::string sideload_mount_point = FUSE_SIDELOAD_HOST_MOUNTPOINT;
|
||||
@@ -174,7 +138,6 @@ static MinadbdErrorCode RunAdbFuseSideload(int sfd, const std::string& args,
|
||||
return kMinadbdHostSocketIOError;
|
||||
}
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
return kMinadbdSuccess;
|
||||
}
|
||||
@@ -193,44 +156,6 @@ static void RescueInstallHostService(unique_fd sfd, const std::string& args) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
#if PLATFORM_SDK_VERSION < 26
|
||||
static int create_service_thread(void (*func)(int, void *), void *cookie) {
|
||||
int s[2];
|
||||
if (adb_socketpair(s)) {
|
||||
printf("cannot create service socket pair\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
stinfo* sti = static_cast<stinfo*>(malloc(sizeof(stinfo)));
|
||||
if(sti == 0) fatal("cannot allocate stinfo");
|
||||
sti->func = func;
|
||||
sti->cookie = cookie;
|
||||
sti->fd = s[1];
|
||||
|
||||
#if PLATFORM_SDK_VERSION == 23
|
||||
adb_thread_t t;
|
||||
if (adb_thread_create( &t, (adb_thread_func_t)service_bootstrap_func, sti)){
|
||||
#else
|
||||
if (!adb_thread_create(service_bootstrap_func, sti)) {
|
||||
#endif
|
||||
free(sti);
|
||||
adb_close(s[0]);
|
||||
adb_close(s[1]);
|
||||
printf("cannot create service thread\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//VLOG(SERVICES) << "service thread started, " << s[0] << ":" << s[1];
|
||||
return s[0];
|
||||
}
|
||||
#else
|
||||
static int create_service_thread(void (*func)(int, const std::string&), const std::string& args) {
|
||||
int s[2];
|
||||
if (adb_socketpair(s)) {
|
||||
printf("cannot create service socket pair\n");
|
||||
return -1;
|
||||
=======
|
||||
// Answers the query on a given property |prop|, by writing the result to the given |sfd|. The
|
||||
// result will be newline-terminated, so nonexistent or nonallowed query will be answered with "\n".
|
||||
// If given an empty string, dumps all the supported properties (analogous to `adb shell getprop`)
|
||||
@@ -255,7 +180,6 @@ static void RescueGetpropHostService(unique_fd sfd, const std::string& prop) {
|
||||
continue;
|
||||
}
|
||||
result += "[" + key + "]: [" + value + "]\n";
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
} else if (kGetpropAllowedProps.find(prop) != kGetpropAllowedProps.end()) {
|
||||
result = android::base::GetProperty(prop, "") + "\n";
|
||||
@@ -321,41 +245,14 @@ static void WipeDeviceService(unique_fd fd, const std::string& args) {
|
||||
exit(kMinadbdMessageFormatError);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
//VLOG(SERVICES) << "service thread started, " << s[0] << ":" << s[1];
|
||||
return s[0];
|
||||
=======
|
||||
std::string response = (status == MinadbdCommandStatus::kSuccess) ? kMinadbdServicesExitSuccess
|
||||
: kMinadbdServicesExitFailure;
|
||||
response += std::string(message_size - response.size(), '\0');
|
||||
if (!android::base::WriteFully(fd, response.c_str(), response.size())) {
|
||||
exit(kMinadbdHostSocketIOError);
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
#endif
|
||||
|
||||
<<<<<<< HEAD
|
||||
#if PLATFORM_SDK_VERSION >= 28
|
||||
int service_to_fd(const char* name, atransport* /* transport */) {
|
||||
#else
|
||||
int service_to_fd(const char* name, const atransport* transport __unused) {
|
||||
#endif
|
||||
int ret = -1;
|
||||
|
||||
if (!strncmp(name, "sideload:", 9)) {
|
||||
// this exit status causes recovery to print a special error
|
||||
// message saying to use a newer adb (that supports
|
||||
// sideload-host).
|
||||
exit(3);
|
||||
} else if (!strncmp(name, "sideload-host:", 14)) {
|
||||
#if PLATFORM_SDK_VERSION < 26
|
||||
char* arg = strdup(name + 14);
|
||||
#else
|
||||
std::string arg(name + 14);
|
||||
#endif
|
||||
ret = create_service_thread(sideload_host_service, arg);
|
||||
=======
|
||||
unique_fd daemon_service_to_fd(std::string_view name, atransport* /* transport */) {
|
||||
// Common services that are supported both in sideload and rescue modes.
|
||||
if (ConsumePrefix(&name, "reboot:")) {
|
||||
@@ -389,7 +286,6 @@ unique_fd daemon_service_to_fd(std::string_view name, atransport* /* transport *
|
||||
}
|
||||
|
||||
return unique_fd{};
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
// Sideload-specific services.
|
||||
|
||||
@@ -24,7 +24,7 @@ LOCAL_SRC_FILES := \
|
||||
LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
|
||||
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
|
||||
LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := libminadbd
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../
|
||||
LOCAL_SHARED_LIBRARIES := libfusesideload libcutils libc
|
||||
|
||||
Regular → Executable
+123
-123
@@ -16,145 +16,145 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# libminui (static library)
|
||||
# ===============================
|
||||
include $(CLEAR_VARS)
|
||||
# include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
events.cpp \
|
||||
graphics.cpp \
|
||||
graphics_drm.cpp \
|
||||
graphics_fbdev.cpp \
|
||||
graphics_overlay.cpp \
|
||||
resources.cpp
|
||||
# LOCAL_SRC_FILES := \
|
||||
# events.cpp \
|
||||
# graphics.cpp \
|
||||
# graphics_drm.cpp \
|
||||
# graphics_fbdev.cpp \
|
||||
# graphics_overlay.cpp \
|
||||
# resources.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := external/libcxx/include external/libpng
|
||||
# LOCAL_C_INCLUDES := external/libcxx/include external/libpng
|
||||
|
||||
ifeq ($(TW_TARGET_USES_QCOM_BSP), true)
|
||||
LOCAL_CFLAGS += -DMSM_BSP
|
||||
LOCAL_SRC_FILES += graphics_overlay.cpp
|
||||
ifeq ($(TARGET_PREBUILT_KERNEL),)
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
|
||||
LOCAL_REQUIRED_MODULES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
|
||||
else
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
|
||||
endif
|
||||
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
|
||||
else
|
||||
ifeq ($(TARGET_CUSTOM_KERNEL_HEADERS),)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
|
||||
else
|
||||
LOCAL_C_INCLUDES += $(TARGET_CUSTOM_KERNEL_HEADERS)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
|
||||
# The header files required for adf graphics can cause compile errors
|
||||
# with adf graphics.
|
||||
LOCAL_SRC_FILES += graphics_adf.cpp
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libadf
|
||||
endif
|
||||
# ifeq ($(TW_TARGET_USES_QCOM_BSP), true)
|
||||
# LOCAL_CFLAGS += -DMSM_BSP
|
||||
# LOCAL_SRC_FILES += graphics_overlay.cpp
|
||||
# ifeq ($(TARGET_PREBUILT_KERNEL),)
|
||||
# ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
|
||||
# LOCAL_REQUIRED_MODULES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
|
||||
# else
|
||||
# LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
|
||||
# endif
|
||||
# LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
|
||||
# else
|
||||
# ifeq ($(TARGET_CUSTOM_KERNEL_HEADERS),)
|
||||
# LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
|
||||
# else
|
||||
# LOCAL_C_INCLUDES += $(TARGET_CUSTOM_KERNEL_HEADERS)
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
# LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
|
||||
# # The header files required for adf graphics can cause compile errors
|
||||
# # with adf graphics.
|
||||
# LOCAL_SRC_FILES += graphics_adf.cpp
|
||||
# LOCAL_WHOLE_STATIC_LIBRARIES += libadf
|
||||
# endif
|
||||
|
||||
ifeq ($(TW_NEW_ION_HEAP), true)
|
||||
LOCAL_CFLAGS += -DNEW_ION_HEAP
|
||||
endif
|
||||
# ifeq ($(TW_NEW_ION_HEAP), true)
|
||||
# LOCAL_CFLAGS += -DNEW_ION_HEAP
|
||||
# endif
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += libpng libbase
|
||||
ifneq ($(wildcard external/libdrm/Android.common.mk),)
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libdrm_platform
|
||||
else
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libdrm
|
||||
endif
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
LOCAL_CFLAGS += -DHAS_LIBSYNC
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libsync_recovery
|
||||
endif
|
||||
# LOCAL_STATIC_LIBRARIES += libpng libbase
|
||||
# ifneq ($(wildcard external/libdrm/Android.common.mk),)
|
||||
# LOCAL_WHOLE_STATIC_LIBRARIES += libdrm_platform
|
||||
# else
|
||||
# LOCAL_WHOLE_STATIC_LIBRARIES += libdrm
|
||||
# endif
|
||||
# ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
|
||||
# LOCAL_CFLAGS += -DHAS_LIBSYNC
|
||||
# LOCAL_WHOLE_STATIC_LIBRARIES += libsync_recovery
|
||||
# endif
|
||||
|
||||
LOCAL_CFLAGS += -Wall -Werror -std=c++14 -Wno-unused-private-field
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||
# LOCAL_CFLAGS += -Wall -Werror -std=c++14 -Wno-unused-private-field
|
||||
# LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
|
||||
# LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_MODULE := libminui
|
||||
# LOCAL_MODULE := libminui
|
||||
|
||||
LOCAL_CLANG := true
|
||||
# LOCAL_CLANG := true
|
||||
|
||||
# This used to compare against values in double-quotes (which are just
|
||||
# ordinary characters in this context). Strip double-quotes from the
|
||||
# value so that either will work.
|
||||
# # This used to compare against values in double-quotes (which are just
|
||||
# # ordinary characters in this context). Strip double-quotes from the
|
||||
# # value so that either will work.
|
||||
|
||||
ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
|
||||
LOCAL_CFLAGS += -DRECOVERY_ABGR
|
||||
endif
|
||||
ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBA_8888)
|
||||
LOCAL_CFLAGS += -DRECOVERY_RGBA
|
||||
endif
|
||||
ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
|
||||
LOCAL_CFLAGS += -DRECOVERY_RGBX
|
||||
endif
|
||||
ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),BGRA_8888)
|
||||
LOCAL_CFLAGS += -DRECOVERY_BGRA
|
||||
endif
|
||||
# ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
|
||||
# LOCAL_CFLAGS += -DRECOVERY_ABGR
|
||||
# endif
|
||||
# ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBA_8888)
|
||||
# LOCAL_CFLAGS += -DRECOVERY_RGBA
|
||||
# endif
|
||||
# ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
|
||||
# LOCAL_CFLAGS += -DRECOVERY_RGBX
|
||||
# endif
|
||||
# ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),BGRA_8888)
|
||||
# LOCAL_CFLAGS += -DRECOVERY_BGRA
|
||||
# endif
|
||||
|
||||
ifneq ($(TARGET_RECOVERY_OVERSCAN_PERCENT),)
|
||||
LOCAL_CFLAGS += -DOVERSCAN_PERCENT=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
|
||||
else
|
||||
LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
|
||||
endif
|
||||
# ifneq ($(TARGET_RECOVERY_OVERSCAN_PERCENT),)
|
||||
# LOCAL_CFLAGS += -DOVERSCAN_PERCENT=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
|
||||
# else
|
||||
# LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
|
||||
# endif
|
||||
|
||||
ifneq ($(TW_BRIGHTNESS_PATH),)
|
||||
LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=\"$(TW_BRIGHTNESS_PATH)\"
|
||||
endif
|
||||
ifneq ($(TW_MAX_BRIGHTNESS),)
|
||||
LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
|
||||
else
|
||||
LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=255
|
||||
endif
|
||||
ifneq ($(TW_NO_SCREEN_BLANK),)
|
||||
LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
|
||||
endif
|
||||
ifneq ($(BOARD_USE_CUSTOM_RECOVERY_FONT),)
|
||||
LOCAL_CFLAGS += -DBOARD_USE_CUSTOM_RECOVERY_FONT=$(BOARD_USE_CUSTOM_RECOVERY_FONT)
|
||||
endif
|
||||
ifeq ($(wildcard system/core/healthd/animation.h),)
|
||||
TARGET_GLOBAL_CFLAGS += -DTW_NO_MINUI_CUSTOM_FONTS
|
||||
CLANG_TARGET_GLOBAL_CFLAGS += -DTW_NO_MINUI_CUSTOM_FONTS
|
||||
endif
|
||||
ifneq ($(TARGET_RECOVERY_DEFAULT_ROTATION),)
|
||||
LOCAL_CFLAGS += -DDEFAULT_ROTATION=$(TARGET_RECOVERY_DEFAULT_ROTATION)
|
||||
else
|
||||
LOCAL_CFLAGS += -DDEFAULT_ROTATION=ROTATION_NONE
|
||||
endif
|
||||
# ifneq ($(TW_BRIGHTNESS_PATH),)
|
||||
# LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=\"$(TW_BRIGHTNESS_PATH)\"
|
||||
# endif
|
||||
# ifneq ($(TW_MAX_BRIGHTNESS),)
|
||||
# LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
|
||||
# else
|
||||
# LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=255
|
||||
# endif
|
||||
# ifneq ($(TW_NO_SCREEN_BLANK),)
|
||||
# LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
|
||||
# endif
|
||||
# ifneq ($(BOARD_USE_CUSTOM_RECOVERY_FONT),)
|
||||
# LOCAL_CFLAGS += -DBOARD_USE_CUSTOM_RECOVERY_FONT=$(BOARD_USE_CUSTOM_RECOVERY_FONT)
|
||||
# endif
|
||||
# ifeq ($(wildcard system/core/healthd/animation.h),)
|
||||
# TARGET_GLOBAL_CFLAGS += -DTW_NO_MINUI_CUSTOM_FONTS
|
||||
# CLANG_TARGET_GLOBAL_CFLAGS += -DTW_NO_MINUI_CUSTOM_FONTS
|
||||
# endif
|
||||
# ifneq ($(TARGET_RECOVERY_DEFAULT_ROTATION),)
|
||||
# LOCAL_CFLAGS += -DDEFAULT_ROTATION=$(TARGET_RECOVERY_DEFAULT_ROTATION)
|
||||
# else
|
||||
# LOCAL_CFLAGS += -DDEFAULT_ROTATION=ROTATION_NONE
|
||||
# endif
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
# include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# libminui (shared library)
|
||||
# ===============================
|
||||
# Used by OEMs for factory test images.
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CLANG := true
|
||||
LOCAL_MODULE := libminui
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libminui
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libpng \
|
||||
libbase
|
||||
# include $(CLEAR_VARS)
|
||||
# LOCAL_CLANG := true
|
||||
# LOCAL_MODULE := libminui
|
||||
# LOCAL_WHOLE_STATIC_LIBRARIES += libminui
|
||||
# LOCAL_SHARED_LIBRARIES := \
|
||||
# libpng \
|
||||
# libbase
|
||||
|
||||
LOCAL_CFLAGS := -Wall -Werror -std=c++14 -Wno-unused-private-field
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
# LOCAL_CFLAGS := -Wall -Werror -std=c++14 -Wno-unused-private-field
|
||||
# LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
# LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||
# include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := minuitest
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
|
||||
LOCAL_SRC_FILES := main.cpp
|
||||
LOCAL_SHARED_LIBRARIES := libbinder libminui libpng libz libutils libstdc++ libcutils liblog libm libc
|
||||
LOCAL_C_INCLUDES := external/libcxx/include external/libpng
|
||||
ifneq ($(TARGET_ARCH), arm64)
|
||||
ifneq ($(TARGET_ARCH), x86_64)
|
||||
LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker
|
||||
else
|
||||
LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
|
||||
endif
|
||||
else
|
||||
LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
|
||||
endif
|
||||
include $(BUILD_EXECUTABLE)
|
||||
# include $(CLEAR_VARS)
|
||||
# LOCAL_MODULE := minuitest
|
||||
# LOCAL_MODULE_TAGS := optional
|
||||
# LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
|
||||
# LOCAL_SRC_FILES := main.cpp
|
||||
# LOCAL_SHARED_LIBRARIES := libbinder libminui libpng libz libutils libstdc++ libcutils liblog libm libc
|
||||
# LOCAL_C_INCLUDES := external/libcxx/include external/libpng
|
||||
# ifneq ($(TARGET_ARCH), arm64)
|
||||
# ifneq ($(TARGET_ARCH), x86_64)
|
||||
# LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker
|
||||
# else
|
||||
# LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
|
||||
# endif
|
||||
# else
|
||||
# LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
|
||||
# endif
|
||||
# include $(BUILD_EXECUTABLE)
|
||||
|
||||
Regular → Executable
-52
@@ -65,24 +65,10 @@ static bool test_bit(size_t bit, unsigned long* array) { // NOLINT
|
||||
|
||||
#ifdef TW_USE_MINUI_WITH_OPTIONAL_TOUCH_EVENTS
|
||||
int ev_init(ev_callback input_cb, bool allow_touch_inputs) {
|
||||
<<<<<<< HEAD
|
||||
#else
|
||||
#ifdef TW_USE_MINUI_WITH_DATA
|
||||
int ev_init(ev_callback input_cb, void* data) {
|
||||
#else
|
||||
int ev_init(ev_callback input_cb) {
|
||||
#endif
|
||||
bool allow_touch_inputs = false;
|
||||
#endif
|
||||
|
||||
g_epoll_fd = epoll_create(MAX_DEVICES + MAX_MISC_FDS);
|
||||
if (g_epoll_fd == -1) {
|
||||
=======
|
||||
g_epoll_fd.reset();
|
||||
|
||||
android::base::unique_fd epoll_fd(epoll_create1(EPOLL_CLOEXEC));
|
||||
if (epoll_fd == -1) {
|
||||
>>>>>>> android-10.0.0_r25
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -114,23 +100,12 @@ int ev_init(ev_callback input_cb) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
ev_fdinfo[ev_count].fd = fd;
|
||||
ev_fdinfo[ev_count].cb = std::move(input_cb);
|
||||
#ifdef TW_USE_MINUI_WITH_DATA
|
||||
ev_fdinfo[ev_count].data = data;
|
||||
#endif
|
||||
ev_count++;
|
||||
ev_dev_count++;
|
||||
if (ev_dev_count == MAX_DEVICES) break;
|
||||
=======
|
||||
epoll_event ev;
|
||||
ev.events = EPOLLIN | EPOLLWAKEUP;
|
||||
ev.data.ptr = &ev_fdinfo[g_ev_count];
|
||||
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev) == -1) {
|
||||
epoll_ctl_failed = true;
|
||||
continue;
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
ev_fdinfo[g_ev_count].fd.reset(fd.release());
|
||||
@@ -152,17 +127,8 @@ int ev_get_epollfd(void) {
|
||||
return g_epoll_fd.get();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
#ifdef TW_USE_MINUI_WITH_DATA
|
||||
int ev_add_fd(int fd, ev_callback cb, void* data) {
|
||||
#else
|
||||
int ev_add_fd(int fd, ev_callback cb) {
|
||||
#endif
|
||||
if (ev_misc_count == MAX_MISC_FDS || cb == NULL) {
|
||||
=======
|
||||
int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb) {
|
||||
if (g_ev_misc_count == MAX_MISC_FDS || cb == nullptr) {
|
||||
>>>>>>> android-10.0.0_r25
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -171,20 +137,10 @@ int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb) {
|
||||
ev.data.ptr = static_cast<void*>(&ev_fdinfo[g_ev_count]);
|
||||
int ret = epoll_ctl(g_epoll_fd, EPOLL_CTL_ADD, fd, &ev);
|
||||
if (!ret) {
|
||||
<<<<<<< HEAD
|
||||
ev_fdinfo[ev_count].fd = fd;
|
||||
ev_fdinfo[ev_count].cb = std::move(cb);
|
||||
#ifdef TW_USE_MINUI_WITH_DATA
|
||||
ev_fdinfo[ev_count].data = data;
|
||||
#endif
|
||||
ev_count++;
|
||||
ev_misc_count++;
|
||||
=======
|
||||
ev_fdinfo[g_ev_count].fd.reset(fd.release());
|
||||
ev_fdinfo[g_ev_count].cb = std::move(cb);
|
||||
g_ev_count++;
|
||||
g_ev_misc_count++;
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -212,15 +168,7 @@ void ev_dispatch(void) {
|
||||
FdInfo* fdi = static_cast<FdInfo*>(g_polled_events[n].data.ptr);
|
||||
const ev_callback& cb = fdi->cb;
|
||||
if (cb) {
|
||||
<<<<<<< HEAD
|
||||
#ifdef TW_USE_MINUI_WITH_DATA
|
||||
cb(fdi->fd, polledevents[n].events, fdi->data);
|
||||
#else
|
||||
cb(fdi->fd, polledevents[n].events);
|
||||
#endif
|
||||
=======
|
||||
cb(fdi->fd, g_polled_events[n].events);
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
-178
@@ -23,18 +23,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
<<<<<<< HEAD
|
||||
#ifdef BOARD_USE_CUSTOM_RECOVERY_FONT
|
||||
#include BOARD_USE_CUSTOM_RECOVERY_FONT
|
||||
#else
|
||||
#include "font_10x18.h"
|
||||
#endif
|
||||
|
||||
#ifndef MSM_BSP
|
||||
=======
|
||||
#include <android-base/properties.h>
|
||||
|
||||
>>>>>>> android-10.0.0_r25
|
||||
#include "graphics_adf.h"
|
||||
#endif
|
||||
#include "graphics_drm.h"
|
||||
@@ -222,29 +212,7 @@ static inline uint32_t pixel_blend(uint8_t alpha, uint32_t pix) {
|
||||
return (out_r & 0xff) | (out_g & 0xff00) | (out_b & 0xff0000) | (gr_current & 0xff000000);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// increments pixel pointer right, with current rotation.
|
||||
static void incr_x16(uint16_t** p, int row_pixels) {
|
||||
if (rotation % 2) {
|
||||
*p = *p + (rotation == 1 ? 1 : -1) * row_pixels;
|
||||
} else {
|
||||
*p = *p + (rotation ? -1 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
// increments pixel pointer down, with current rotation.
|
||||
static void incr_y16(uint16_t** p, int row_pixels) {
|
||||
if (rotation % 2) {
|
||||
*p = *p + (rotation == 1 ? -1 : 1);
|
||||
} else {
|
||||
*p = *p + (rotation ? -1 : 1) * row_pixels;
|
||||
}
|
||||
}
|
||||
|
||||
// increments pixel pointer right, with current rotation.
|
||||
=======
|
||||
// Increments pixel pointer right, with current rotation.
|
||||
>>>>>>> android-10.0.0_r25
|
||||
static void incr_x(uint32_t** p, int row_pixels) {
|
||||
if (rotation == GRRotation::LEFT) {
|
||||
*p = *p - row_pixels;
|
||||
@@ -270,31 +238,8 @@ static void incr_y(uint32_t** p, int row_pixels) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// returns pixel pointer at given coordinates with rotation adjustment.
|
||||
static uint16_t* pixel_at16(GRSurface* surf, int x, int y, int row_pixels) {
|
||||
switch (rotation) {
|
||||
case ROTATION_NONE:
|
||||
return reinterpret_cast<uint16_t*>(surf->data) + y * row_pixels + x;
|
||||
case ROTATION_RIGHT:
|
||||
return reinterpret_cast<uint16_t*>(surf->data) + x * row_pixels + (surf->width - y);
|
||||
case ROTATION_DOWN:
|
||||
return reinterpret_cast<uint16_t*>(surf->data) + (surf->height - 1 - y) * row_pixels +
|
||||
(surf->width - 1 - x);
|
||||
case ROTATION_LEFT:
|
||||
return reinterpret_cast<uint16_t*>(surf->data) + (surf->height - 1 - x) * row_pixels + y;
|
||||
default:
|
||||
printf("invalid rotation %d", rotation);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// returns pixel pointer at given coordinates with rotation adjustment.
|
||||
static uint32_t* pixel_at(GRSurface* surf, int x, int y, int row_pixels) {
|
||||
=======
|
||||
// Returns pixel pointer at given coordinates with rotation adjustment.
|
||||
static uint32_t* PixelAt(GRSurface* surface, int x, int y, int row_pixels) {
|
||||
>>>>>>> android-10.0.0_r25
|
||||
switch (rotation) {
|
||||
case GRRotation::NONE:
|
||||
return reinterpret_cast<uint32_t*>(surface->data()) + y * row_pixels + x;
|
||||
@@ -312,29 +257,8 @@ static uint32_t* PixelAt(GRSurface* surface, int x, int y, int row_pixels) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
static void text_blend16(uint8_t* src_p, int src_row_bytes, uint16_t* dst_p, int dst_row_pixels,
|
||||
int width, int height) {
|
||||
uint8_t alpha_current = static_cast<uint8_t>((alpha_mask & gr_current) >> 24);
|
||||
for (int j = 0; j < height; ++j) {
|
||||
uint8_t* sx = src_p;
|
||||
uint16_t* px = dst_p;
|
||||
for (int i = 0; i < width; ++i, incr_x16(&px, dst_row_pixels)) {
|
||||
uint8_t a = *sx++;
|
||||
if (alpha_current < 255) a = (static_cast<uint32_t>(a) * alpha_current) / 255;
|
||||
*px = pixel_blend16(a, *px);
|
||||
}
|
||||
src_p += src_row_bytes;
|
||||
incr_y16(&dst_p, dst_row_pixels);
|
||||
}
|
||||
}
|
||||
|
||||
static void text_blend(uint8_t* src_p, int src_row_bytes, uint32_t* dst_p, int dst_row_pixels,
|
||||
int width, int height) {
|
||||
=======
|
||||
static void TextBlend(const uint8_t* src_p, int src_row_bytes, uint32_t* dst_p, int dst_row_pixels,
|
||||
int width, int height) {
|
||||
>>>>>>> android-10.0.0_r25
|
||||
uint8_t alpha_current = static_cast<uint8_t>((alpha_mask & gr_current) >> 24);
|
||||
for (int j = 0; j < height; ++j) {
|
||||
const uint8_t* sx = src_p;
|
||||
@@ -404,22 +328,6 @@ void gr_text(const GRFont* font, int x, int y, const char* s, bool bold) {
|
||||
}
|
||||
|
||||
int row_pixels = gr_draw->row_bytes / gr_draw->pixel_bytes;
|
||||
<<<<<<< HEAD
|
||||
|
||||
uint8_t* src_p = font->texture->data + ((ch - ' ') * font->char_width) +
|
||||
(bold ? font->char_height * font->texture->row_bytes : 0);
|
||||
if (gr_draw->pixel_bytes == 2) {
|
||||
uint16_t* dst_p = pixel_at16(gr_draw, x, y, row_pixels);
|
||||
|
||||
text_blend16(src_p, font->texture->row_bytes, dst_p, row_pixels, font->char_width,
|
||||
font->char_height);
|
||||
} else { // not indenting AOSP original code
|
||||
uint32_t* dst_p = pixel_at(gr_draw, x, y, row_pixels);
|
||||
|
||||
text_blend(src_p, font->texture->row_bytes, dst_p, row_pixels, font->char_width,
|
||||
font->char_height);
|
||||
}
|
||||
=======
|
||||
const uint8_t* src_p = font->texture->data() + ((ch - ' ') * font->char_width) +
|
||||
(bold ? font->char_height * font->texture->row_bytes : 0);
|
||||
uint32_t* dst_p = PixelAt(gr_draw, x, y, row_pixels);
|
||||
@@ -427,7 +335,6 @@ void gr_text(const GRFont* font, int x, int y, const char* s, bool bold) {
|
||||
TextBlend(src_p, font->texture->row_bytes, dst_p, row_pixels, font->char_width,
|
||||
font->char_height);
|
||||
|
||||
>>>>>>> android-10.0.0_r25
|
||||
x += font->char_width;
|
||||
}
|
||||
}
|
||||
@@ -447,22 +354,9 @@ void gr_texticon(int x, int y, const GRSurface* icon) {
|
||||
if (outside(x, y) || outside(x + icon->width - 1, y + icon->height - 1)) return;
|
||||
|
||||
int row_pixels = gr_draw->row_bytes / gr_draw->pixel_bytes;
|
||||
<<<<<<< HEAD
|
||||
uint8_t* src_p = icon->data;
|
||||
if (gr_draw->pixel_bytes == 2) {
|
||||
uint16_t* dst_p = pixel_at16(gr_draw, x, y, row_pixels);
|
||||
|
||||
text_blend16(src_p, icon->row_bytes, dst_p, row_pixels, icon->width, icon->height);
|
||||
return;
|
||||
}
|
||||
uint32_t* dst_p = pixel_at(gr_draw, x, y, row_pixels);
|
||||
|
||||
text_blend(src_p, icon->row_bytes, dst_p, row_pixels, icon->width, icon->height);
|
||||
=======
|
||||
const uint8_t* src_p = icon->data();
|
||||
uint32_t* dst_p = PixelAt(gr_draw, x, y, row_pixels);
|
||||
TextBlend(src_p, icon->row_bytes, dst_p, row_pixels, icon->width, icon->height);
|
||||
>>>>>>> android-10.0.0_r25
|
||||
}
|
||||
|
||||
void gr_convert_rgb_555(unsigned char r, unsigned char g, unsigned char b)
|
||||
@@ -536,27 +430,7 @@ void gr_fill(int x1, int y1, int x2, int y2) {
|
||||
if (outside(x1, y1) || outside(x2 - 1, y2 - 1)) return;
|
||||
|
||||
int row_pixels = gr_draw->row_bytes / gr_draw->pixel_bytes;
|
||||
<<<<<<< HEAD
|
||||
if (gr_draw->pixel_bytes == 2) {
|
||||
uint16_t* p = pixel_at16(gr_draw, x1, y1, row_pixels);
|
||||
uint8_t alpha = static_cast<uint8_t>(((gr_current & alpha_mask) >> 24));
|
||||
if (alpha > 0) {
|
||||
for (int y = y1; y < y2; ++y) {
|
||||
uint16_t* px = p;
|
||||
for (int x = x1; x < x2; ++x) {
|
||||
*px = pixel_blend16(alpha, *px);
|
||||
incr_x16(&px, row_pixels);
|
||||
}
|
||||
incr_y16(&p, row_pixels);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
{ // open brace to maintain separation between uint16_t p and uint32_t p
|
||||
uint32_t* p = pixel_at(gr_draw, x1, y1, row_pixels);
|
||||
=======
|
||||
uint32_t* p = PixelAt(gr_draw, x1, y1, row_pixels);
|
||||
>>>>>>> android-10.0.0_r25
|
||||
uint8_t alpha = static_cast<uint8_t>(((gr_current & alpha_mask) >> 24));
|
||||
if (alpha > 0) {
|
||||
for (int y = y1; y < y2; ++y) {
|
||||
@@ -740,49 +614,10 @@ int gr_init_font(const char* name, GRFont** dest) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
static void gr_init_font(void) {
|
||||
int res = gr_init_font("font", &gr_font);
|
||||
if (res == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf("failed to read font: res=%d\n", res);
|
||||
|
||||
// fall back to the compiled-in font.
|
||||
gr_font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font)));
|
||||
gr_font->texture = static_cast<GRSurface*>(malloc(sizeof(*gr_font->texture)));
|
||||
gr_font->texture->width = font.width;
|
||||
gr_font->texture->height = font.height;
|
||||
gr_font->texture->row_bytes = font.width;
|
||||
gr_font->texture->pixel_bytes = 1;
|
||||
|
||||
unsigned char* bits = static_cast<unsigned char*>(malloc(font.width * font.height));
|
||||
gr_font->texture->data = bits;
|
||||
|
||||
unsigned char data;
|
||||
unsigned char* in = font.rundata;
|
||||
while ((data = *in++)) {
|
||||
memset(bits, (data & 0x80) ? 255 : 0, data & 0x7f);
|
||||
bits += (data & 0x7f);
|
||||
}
|
||||
|
||||
gr_font->char_width = font.char_width;
|
||||
gr_font->char_height = font.char_height;
|
||||
}
|
||||
#endif // TW_NO_MINUI_CUSTOM_FONTS
|
||||
|
||||
=======
|
||||
>>>>>>> android-10.0.0_r25
|
||||
void gr_flip() {
|
||||
gr_draw = gr_backend->Flip();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
int gr_init(void)
|
||||
{
|
||||
gr_init_font();
|
||||
=======
|
||||
int gr_init() {
|
||||
// pixel_format needs to be set before loading any resources or initializing backends.
|
||||
std::string format = android::base::GetProperty("ro.minui.pixel_format", "");
|
||||
@@ -801,7 +636,6 @@ int gr_init() {
|
||||
printf("Failed to init font: %d, continuing graphic backend initialization without font file\n",
|
||||
ret);
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendOverlay>() };
|
||||
gr_draw = backend->Init();
|
||||
@@ -812,16 +646,6 @@ int gr_init() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef MSM_BSP
|
||||
if (!gr_draw) {
|
||||
backend = std::make_unique<MinuiBackendAdf>();
|
||||
gr_draw = backend->Init();
|
||||
if (gr_draw)
|
||||
printf("Using adf graphics.\n");
|
||||
}
|
||||
#else
|
||||
printf("Skipping adf graphics because TW_TARGET_USES_QCOM_BSP := true\n");
|
||||
#endif
|
||||
|
||||
if (!gr_draw) {
|
||||
backend = std::make_unique<MinuiBackendDrm>();
|
||||
@@ -835,13 +659,11 @@ int gr_init() {
|
||||
gr_draw = backend->Init();
|
||||
if (gr_draw)
|
||||
printf("Using fbdev graphics.\n");
|
||||
}
|
||||
|
||||
if (!gr_draw) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
gr_backend = backend.release();
|
||||
|
||||
int overscan_percent = android::base::GetIntProperty("ro.minui.overscan_percent", 0);
|
||||
overscan_offset_x = gr_draw->width * overscan_percent / 100;
|
||||
|
||||
Regular → Executable
-20
@@ -116,19 +116,6 @@ int MinuiBackendAdf::DeviceInit(adf_device* dev) {
|
||||
}
|
||||
|
||||
GRSurface* MinuiBackendAdf::Init() {
|
||||
<<<<<<< HEAD
|
||||
#if defined(RECOVERY_ABGR)
|
||||
format = DRM_FORMAT_ABGR8888;
|
||||
#elif defined(RECOVERY_BGRA)
|
||||
format = DRM_FORMAT_BGRA8888;
|
||||
#elif defined(RECOVERY_RGBA)
|
||||
format = DRM_FORMAT_RGBA8888;
|
||||
#elif defined(RECOVERY_RGBX)
|
||||
format = DRM_FORMAT_RGBX8888;
|
||||
#else
|
||||
format = DRM_FORMAT_RGB565;
|
||||
#endif
|
||||
=======
|
||||
PixelFormat pixel_format = gr_pixel_format();
|
||||
if (pixel_format == PixelFormat::ABGR) {
|
||||
format = DRM_FORMAT_ABGR8888;
|
||||
@@ -139,7 +126,6 @@ GRSurface* MinuiBackendAdf::Init() {
|
||||
} else {
|
||||
format = DRM_FORMAT_RGB565;
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
adf_id_t* dev_ids = nullptr;
|
||||
ssize_t n_dev_ids = adf_devices(&dev_ids);
|
||||
@@ -178,14 +164,8 @@ GRSurface* MinuiBackendAdf::Init() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
void MinuiBackendAdf::Sync(__unused GRSurfaceAdf* surf) {
|
||||
#ifdef HAS_LIBSYNC
|
||||
static constexpr unsigned int warningTimeout = 3000;
|
||||
=======
|
||||
void MinuiBackendAdf::Sync(GRSurfaceAdf* surf) {
|
||||
static constexpr unsigned int kWarningTimeout = 3000;
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
if (surf == nullptr) return;
|
||||
|
||||
|
||||
Regular → Executable
-14
@@ -76,19 +76,6 @@ static int drm_format_to_bpp(uint32_t format) {
|
||||
|
||||
std::unique_ptr<GRSurfaceDrm> GRSurfaceDrm::Create(int drm_fd, int width, int height) {
|
||||
uint32_t format;
|
||||
<<<<<<< HEAD
|
||||
#if defined(RECOVERY_ABGR)
|
||||
format = DRM_FORMAT_RGBA8888;
|
||||
#elif defined(RECOVERY_BGRA)
|
||||
format = DRM_FORMAT_ARGB8888;
|
||||
#elif defined(RECOVERY_RGBA)
|
||||
format = DRM_FORMAT_ARGB8888;
|
||||
#elif defined(RECOVERY_RGBX)
|
||||
format = DRM_FORMAT_XBGR8888;
|
||||
#else
|
||||
format = DRM_FORMAT_RGB565;
|
||||
#endif
|
||||
=======
|
||||
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
|
||||
@@ -103,7 +90,6 @@ std::unique_ptr<GRSurfaceDrm> GRSurfaceDrm::Create(int drm_fd, int width, int he
|
||||
} else {
|
||||
format = DRM_FORMAT_RGB565;
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
drm_mode_create_dumb create_dumb = {};
|
||||
create_dumb.height = height;
|
||||
|
||||
Regular → Executable
-18
@@ -16,13 +16,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
<<<<<<< HEAD
|
||||
#ifndef TW_USE_MINUI_21
|
||||
|
||||
=======
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
>>>>>>> android-10.0.0_r25
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <functional>
|
||||
@@ -128,7 +125,6 @@ void gr_clear();
|
||||
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
||||
void gr_fill(int x1, int y1, int x2, int y2);
|
||||
|
||||
<<<<<<< HEAD
|
||||
void gr_texticon(int x, int y, GRSurface* icon);
|
||||
#ifdef TW_NO_MINUI_CUSTOM_FONTS
|
||||
void gr_text(int x, int y, const char *s, bool bold);
|
||||
@@ -136,22 +132,15 @@ int gr_measure(const char *s);
|
||||
void gr_font_size(int *x, int *y);
|
||||
void gr_set_font(__attribute__ ((unused))const char* name);
|
||||
#else
|
||||
=======
|
||||
void gr_texticon(int x, int y, const GRSurface* icon);
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
const GRFont* gr_sys_font();
|
||||
int gr_init_font(const char* name, GRFont** dest);
|
||||
void gr_text(const GRFont* font, int x, int y, const char* s, bool bold);
|
||||
// Returns -1 if font is nullptr.
|
||||
int gr_measure(const GRFont* font, const char* s);
|
||||
<<<<<<< HEAD
|
||||
void gr_font_size(const GRFont* font, int* x, int* y);
|
||||
#endif
|
||||
=======
|
||||
// Returns -1 if font is nullptr.
|
||||
int gr_font_size(const GRFont* font, int* x, int* y);
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
void gr_blit(const GRSurface* source, int sx, int sy, int w, int h, int dx, int dy);
|
||||
unsigned int gr_get_width(const GRSurface* surface);
|
||||
@@ -182,12 +171,9 @@ using ev_set_key_callback = std::function<int(int code, int value)>;
|
||||
|
||||
#ifdef TW_USE_MINUI_WITH_OPTIONAL_TOUCH_EVENTS
|
||||
int ev_init(ev_callback input_cb, bool allow_touch_inputs = false);
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
void ev_exit();
|
||||
int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb);
|
||||
void ev_iterate_available_keys(const std::function<void(int)>& f);
|
||||
>>>>>>> android-10.0.0_r25
|
||||
void ev_iterate_touch_inputs(const std::function<void(int)>& action);
|
||||
#else
|
||||
int ev_init(ev_callback input_cb);
|
||||
@@ -254,8 +240,6 @@ std::vector<std::string> get_locales_in_png(const std::string& png_name);
|
||||
// Free a surface allocated by any of the res_create_*_surface()
|
||||
// functions.
|
||||
void res_free_surface(GRSurface* surface);
|
||||
<<<<<<< HEAD
|
||||
|
||||
#else //ifndef TW_USE_MINUI_21
|
||||
|
||||
// This the old minui21/minui.h for compatibility with building TWRP
|
||||
@@ -348,5 +332,3 @@ void gr_clear();
|
||||
|
||||
#endif // ifndef TW_USE_MINUI_21
|
||||
#endif // ifndef _MINUI_H_
|
||||
=======
|
||||
>>>>>>> android-10.0.0_r25
|
||||
|
||||
Regular → Executable
-13
@@ -33,12 +33,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
<<<<<<< HEAD
|
||||
//#include <android-base/stringprintf.h> // does not exist in 6.0
|
||||
//#include <android-base/strings.h> // does not exist in 6.0
|
||||
=======
|
||||
#include <android-base/strings.h>
|
||||
>>>>>>> android-10.0.0_r25
|
||||
#include <png.h>
|
||||
|
||||
#include "minui/minui.h"
|
||||
@@ -68,13 +63,6 @@ std::unique_ptr<GRSurface> GRSurface::Clone() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
PngHandler::PngHandler(const std::string& name) : error_code_(0), png_fp_(nullptr, fclose) {
|
||||
char res_path[PATH_MAX];
|
||||
sprintf(res_path, "/res/images/%s.png", name.c_str());
|
||||
//std::string res_path = sprintf("/res/images/%s.png", name.c_str());
|
||||
png_fp_.reset(fopen(res_path, "rbe"));
|
||||
=======
|
||||
PngHandler::PngHandler(const std::string& name) {
|
||||
std::string res_path = g_resource_dir + "/" + name + ".png";
|
||||
png_fp_.reset(fopen(res_path.c_str(), "rbe"));
|
||||
@@ -82,7 +70,6 @@ PngHandler::PngHandler(const std::string& name) {
|
||||
if (!png_fp_) {
|
||||
png_fp_.reset(fopen(name.c_str(), "rbe"));
|
||||
}
|
||||
>>>>>>> android-10.0.0_r25
|
||||
if (!png_fp_) {
|
||||
error_code_ = -1;
|
||||
return;
|
||||
|
||||
@@ -201,7 +201,7 @@ LOCAL_STATIC_LIBRARIES += libpixelflinger_twrp
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
|
||||
LOCAL_SHARED_LIBRARIES += libcutils liblog libutils
|
||||
endif
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := libminuitwrp
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
Regular → Executable
+8
-7
@@ -37,6 +37,7 @@
|
||||
#include "graphics.h"
|
||||
// For std::min and std::max
|
||||
#include <algorithm>
|
||||
#include "truetype.hpp"
|
||||
|
||||
struct GRFont {
|
||||
GRSurface* texture;
|
||||
@@ -70,25 +71,25 @@ int gr_textEx_scaleW(int x, int y, const char *s, void* pFont, int max_width, in
|
||||
if (!s || strlen(s) == 0 || !font)
|
||||
return 0;
|
||||
|
||||
measured_height = gr_ttf_getMaxFontHeight(font);
|
||||
measured_height = twrpTruetype::gr_ttf_getMaxFontHeight(font);
|
||||
|
||||
if (scale) {
|
||||
measured_width = gr_ttf_measureEx(s, vfont);
|
||||
measured_width = twrpTruetype::gr_ttf_measureEx(s, vfont);
|
||||
if (measured_width > max_width) {
|
||||
// Adjust font size down until the text fits
|
||||
void *new_font = gr_ttf_scaleFont(vfont, max_width, measured_width);
|
||||
void *new_font = twrpTruetype::gr_ttf_scaleFont(vfont, max_width, measured_width);
|
||||
if (!new_font) {
|
||||
printf("gr_textEx_scaleW new_font is NULL\n");
|
||||
return 0;
|
||||
}
|
||||
measured_width = gr_ttf_measureEx(s, new_font);
|
||||
measured_width = twrpTruetype::gr_ttf_measureEx(s, new_font);
|
||||
// These next 2 lines adjust the y point based on the new font's height
|
||||
new_height = gr_ttf_getMaxFontHeight(new_font);
|
||||
new_height = twrpTruetype::gr_ttf_getMaxFontHeight(new_font);
|
||||
y_scale = (measured_height - new_height) / 2;
|
||||
vfont = new_font;
|
||||
}
|
||||
} else
|
||||
measured_width = gr_ttf_measureEx(s, vfont);
|
||||
measured_width = twrpTruetype::gr_ttf_measureEx(s, vfont);
|
||||
|
||||
int x_adj = measured_width;
|
||||
if (measured_width > max_width)
|
||||
@@ -107,7 +108,7 @@ int gr_textEx_scaleW(int x, int y, const char *s, void* pFont, int max_width, in
|
||||
else if (placement == BOTTOM_LEFT || placement == BOTTOM_RIGHT)
|
||||
y -= measured_height;
|
||||
}
|
||||
return gr_ttf_textExWH(gl, x, y + y_scale, s, vfont, measured_width + x, -1, gr_draw);
|
||||
return twrpTruetype::gr_ttf_textExWH(gl, x, y + y_scale, s, vfont, measured_width + x, -1, gr_draw);
|
||||
}
|
||||
|
||||
void gr_clip(int x, int y, int w, int h)
|
||||
|
||||
Regular → Executable
+516
-723
File diff suppressed because it is too large
Load Diff
Executable
+121
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
Copyright 2013 to 2020 TeamWin
|
||||
TWRP is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
TWRP is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with TWRP. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TWRP_TRUETYPE_HPP
|
||||
#define _TWRP_TRUETYPE_HPP
|
||||
|
||||
#include <map>
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
#include <pixelflinger/pixelflinger.h>
|
||||
#include "minui.h"
|
||||
|
||||
struct TrueTypeFontKey {
|
||||
int size;
|
||||
int dpi;
|
||||
char *path;
|
||||
|
||||
bool operator<(const TrueTypeFontKey &ttfk) const {
|
||||
return size < ttfk.size || (size == ttfk.size && dpi < ttfk.dpi) || (size == ttfk.size && dpi == ttfk.dpi
|
||||
&& std::strcmp(path, ttfk.path) < 0) || (size == ttfk.size && std::strcmp(path, ttfk.path) > 0);
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct TrueTypeFontKey TrueTypeFontKey;
|
||||
|
||||
typedef struct {
|
||||
FT_BBox bbox;
|
||||
FT_BitmapGlyph glyph;
|
||||
} TrueTypeCacheEntry;
|
||||
|
||||
struct StringCacheKey {
|
||||
char *text;
|
||||
int max_width;
|
||||
|
||||
bool operator<(const StringCacheKey &sck) const {
|
||||
return max_width < sck.max_width || (max_width == sck.max_width
|
||||
&& std::strcmp(text, sck.text) < 0) || (max_width == sck.max_width && std::strcmp(text, sck.text) > 0);
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct StringCacheKey StringCacheKey;
|
||||
|
||||
typedef struct StringCacheEntry {
|
||||
GGLSurface surface;
|
||||
int rendered_bytes; // number of bytes from C string rendered, not number of UTF8 characters!
|
||||
StringCacheKey *key;
|
||||
} StringCacheEntry;
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
int refcount;
|
||||
int size;
|
||||
int dpi;
|
||||
int max_height;
|
||||
int base;
|
||||
FT_Face face;
|
||||
std::map<int, TrueTypeCacheEntry*> glyph_cache;
|
||||
std::map<StringCacheKey, StringCacheEntry*> string_cache;
|
||||
pthread_mutex_t mutex;
|
||||
TrueTypeFontKey *key;
|
||||
} TrueTypeFont;
|
||||
|
||||
typedef struct {
|
||||
FT_Library ft_library;
|
||||
std::map<TrueTypeFontKey, TrueTypeFont*> fonts;
|
||||
pthread_mutex_t mutex;
|
||||
} FontData;
|
||||
|
||||
typedef std::map<StringCacheKey, StringCacheEntry*> StringCacheMap;
|
||||
typedef std::map<int, TrueTypeCacheEntry*> TrueTypeCacheEntryMap;
|
||||
typedef std::map<TrueTypeFontKey, TrueTypeFont*> TrueTypeFontMap;
|
||||
|
||||
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
||||
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
|
||||
|
||||
// 32bit FNV-1a hash algorithm
|
||||
// http://isthe.com/chongo/tech/comp/fnv/#FNV-1a
|
||||
static const uint32_t FNV_prime = 16777619U;
|
||||
static const uint32_t offset_basis = 2166136261U;
|
||||
|
||||
#define STRING_CACHE_MAX_ENTRIES 400
|
||||
#define STRING_CACHE_TRUNCATE_ENTRIES 150
|
||||
|
||||
class twrpTruetype {
|
||||
public:
|
||||
twrpTruetype();
|
||||
static int utf8_to_unicode(const char* pIn, unsigned int *pOut);
|
||||
static void* gr_ttf_loadFont(const char *filename, int size, int dpi);
|
||||
static void* gr_ttf_scaleFont(void *font, int max_width, int measured_width);
|
||||
static bool gr_ttf_freeStringCache(void *key, void *value, void *context __unused);
|
||||
static void gr_ttf_freeFont(void *font);
|
||||
static TrueTypeCacheEntry* gr_ttf_glyph_cache_peek(TrueTypeFont *font, int char_index);
|
||||
static TrueTypeCacheEntry* gr_ttf_glyph_cache_get(TrueTypeFont *font, int char_index);
|
||||
static int gr_ttf_copy_glyph_to_surface(GGLSurface *dest, FT_BitmapGlyph glyph, int offX, int offY, int base);
|
||||
static void gr_ttf_calcMaxFontHeight(TrueTypeFont *f);
|
||||
static int gr_ttf_render_text(TrueTypeFont *font, GGLSurface *surface, const char *text, int max_width);
|
||||
static StringCacheEntry* gr_ttf_string_cache_peek(TrueTypeFont *font, const char *text, __attribute__((unused)) int max_width);
|
||||
static StringCacheEntry* gr_ttf_string_cache_get(TrueTypeFont *font, const char *text, int max_width);
|
||||
static int gr_ttf_measureEx(const char *s, void *font);
|
||||
static int gr_ttf_maxExW(const char *s, void *font, int max_width);
|
||||
static int gr_ttf_textExWH(void *context, int x, int y,
|
||||
const char *s, void *pFont,
|
||||
int max_width, int max_height,
|
||||
const gr_surface gr_draw_surface);
|
||||
static int gr_ttf_getMaxFontHeight(void *font);
|
||||
};
|
||||
#endif // _TWRP_TRUETYPE_HPP
|
||||
Regular → Executable
+2
-2
@@ -7,7 +7,7 @@ LOCAL_SRC_FILES := \
|
||||
mmcutils.c
|
||||
|
||||
LOCAL_MODULE := libmmcutils
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
@@ -18,7 +18,7 @@ LOCAL_SRC_FILES := \
|
||||
mmcutils.c
|
||||
|
||||
LOCAL_MODULE := libmmcutils
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
+2
-2
@@ -48,14 +48,14 @@ include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := bml_over_mtd.c
|
||||
LOCAL_C_INCLUDES += $(commands_recovery_local_path)/mtdutils
|
||||
LOCAL_MODULE := libbml_over_mtd
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_CFLAGS += -Dmain=bml_over_mtd_main
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := bml_over_mtd.c
|
||||
LOCAL_MODULE := bml_over_mtd
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities
|
||||
LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities
|
||||
|
||||
Regular → Executable
+11
-9
@@ -5,14 +5,17 @@ LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libtwrpmtp-ffs
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_CFLAGS = -D_FILE_OFFSET_BITS=64 -DMTP_DEVICE -DMTP_HOST -fno-strict-aliasing -Wno-unused-variable -Wno-format -Wno-unused-parameter -Wno-unused-private-field
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH) bionic frameworks/base/include system/core/include bionic/libc/private/ bootable/recovery/twrplibusbhost/include
|
||||
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
|
||||
LOCAL_C_INCLUDES += external/stlport/stlport
|
||||
LOCAL_SHARED_LIBRARIES += libstlport
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += libc++
|
||||
endif
|
||||
LOCAL_CFLAGS = -D_FILE_OFFSET_BITS=64 -DMTP_DEVICE -DMTP_HOST -fno-strict-aliasing \
|
||||
-Wno-unused-variable -Wno-format -Wno-unused-parameter -Wno-unused-private-field \
|
||||
-Wno-implicit-fallthrough
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH) bionic \
|
||||
frameworks/base/include \
|
||||
system/core/include \
|
||||
bionic/libc/private/ \
|
||||
bootable/recovery/twrplibusbhost/include \
|
||||
bootable/recovery/install/include
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += libc++ libaosprecovery
|
||||
|
||||
LOCAL_SRC_FILES = \
|
||||
MtpDataPacket.cpp \
|
||||
@@ -54,7 +57,6 @@ LOCAL_SHARED_LIBRARIES += libz \
|
||||
libdl \
|
||||
libcutils \
|
||||
libutils \
|
||||
libaosprecovery \
|
||||
libselinux \
|
||||
libbase
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "MtpTypes.h"
|
||||
#include "mtp.h"
|
||||
#include "btree.hpp"
|
||||
#include "../../tw_atomic.hpp"
|
||||
#include "tw_atomic.hpp"
|
||||
|
||||
class MtpDatabase;
|
||||
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
|
||||
$(commands_recovery_local_path)/openaes/inc
|
||||
LOCAL_CFLAGS:= -g -c -W
|
||||
LOCAL_MODULE:=openaes
|
||||
LOCAL_MODULE_TAGS:= eng
|
||||
LOCAL_MODULE_TAGS:= optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
LOCAL_SHARED_LIBRARIES = libopenaes libc
|
||||
@@ -18,7 +18,7 @@ ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
|
||||
# Build shared library
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libopenaes
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(commands_recovery_local_path)/openaes/src/isaac \
|
||||
$(commands_recovery_local_path)/openaes/inc
|
||||
@@ -29,7 +29,7 @@ ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
|
||||
# Build static library
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libopenaes_static
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(commands_recovery_local_path)/openaes/src/isaac \
|
||||
$(commands_recovery_local_path)/openaes/inc
|
||||
|
||||
+12
-7
@@ -44,14 +44,14 @@
|
||||
#include "openrecoveryscript.hpp"
|
||||
#include "progresstracking.hpp"
|
||||
#include "variables.h"
|
||||
#include "adb_install.h"
|
||||
#include "install/adb_install.h"
|
||||
#include "data.hpp"
|
||||
#include "adb_install.h"
|
||||
#include "fuse_sideload.h"
|
||||
#include "gui/gui.hpp"
|
||||
#include "gui/pages.hpp"
|
||||
#include "orscmd/orscmd.h"
|
||||
#include "twinstall.h"
|
||||
#include "install/adb_install.h"
|
||||
extern "C" {
|
||||
#include "gui/gui.h"
|
||||
#include "cutils/properties.h"
|
||||
@@ -253,8 +253,8 @@ int OpenRecoveryScript::run_script_file(void) {
|
||||
gui_msg(Msg("set_restore_opt=Setting restore options: '{1}':")(value2));
|
||||
line_len = strlen(value2);
|
||||
for (i=0; i<line_len; i++) {
|
||||
if ((value2[i] == 'S' || value2[i] == 's') && Partition_List.find(PartitionManager.Get_Android_Root_Path() + ';') != string::npos) {
|
||||
Restore_List += PartitionManager.Get_Android_Root_Path() + ';';
|
||||
if ((value2[i] == 'S' || value2[i] == 's') && Partition_List.find("/system;") != string::npos) {
|
||||
Restore_List += "/system;";
|
||||
gui_msg("system=System");
|
||||
} else if ((value2[i] == 'D' || value2[i] == 'd') && Partition_List.find("/data;") != string::npos) {
|
||||
Restore_List += "/data;";
|
||||
@@ -363,10 +363,13 @@ int OpenRecoveryScript::run_script_file(void) {
|
||||
|
||||
int wipe_cache = 0;
|
||||
string result;
|
||||
pid_t sideload_child_pid;
|
||||
// pid_t sideload_child_pid;
|
||||
|
||||
gui_msg("start_sideload=Starting ADB sideload feature...");
|
||||
ret_val = apply_from_adb("/", &sideload_child_pid);
|
||||
|
||||
// ret_val = apply_from_adb("/", &sideload_child_pid);
|
||||
Device::BuiltinAction reboot_action = Device::REBOOT_BOOTLOADER;
|
||||
ret_val = ApplyFromAdb("/", &reboot_action);
|
||||
if (ret_val != 0) {
|
||||
if (ret_val == -2)
|
||||
gui_err("need_new_adb=You need adb 1.0.32 or newer to sideload to this device.");
|
||||
@@ -378,6 +381,7 @@ int OpenRecoveryScript::run_script_file(void) {
|
||||
ret_val = 1; // failure
|
||||
}
|
||||
sideload = 1; // Causes device to go to the home screen afterwards
|
||||
#ifdef USE_28_INSTALL
|
||||
if (sideload_child_pid != 0) {
|
||||
LOGINFO("Signaling child sideload process to exit.\n");
|
||||
struct stat st;
|
||||
@@ -388,6 +392,7 @@ int OpenRecoveryScript::run_script_file(void) {
|
||||
LOGINFO("Waiting for child sideload process to exit.\n");
|
||||
waitpid(sideload_child_pid, &status, 0);
|
||||
}
|
||||
#endif
|
||||
property_set("ctl.start", "adbd");
|
||||
gui_msg("done=Done.");
|
||||
} else if (strcmp(command, "fixperms") == 0 || strcmp(command, "fixpermissions") == 0 || strcmp(command, "fixcontexts") == 0) {
|
||||
@@ -539,7 +544,7 @@ int OpenRecoveryScript::Backup_Command(string Options) {
|
||||
line_len = Options.size();
|
||||
for (i=0; i<line_len; i++) {
|
||||
if (Options.substr(i, 1) == "S" || Options.substr(i, 1) == "s") {
|
||||
Backup_List += PartitionManager.Get_Android_Root_Path() + ';';
|
||||
Backup_List += "/system;";
|
||||
gui_msg("system=System");
|
||||
} else if (Options.substr(i, 1) == "D" || Options.substr(i, 1) == "d") {
|
||||
Backup_List += "/data;";
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ LOCAL_SRC_FILES:= \
|
||||
LOCAL_CFLAGS += -c -W
|
||||
LOCAL_MODULE := orscmd
|
||||
LOCAL_MODULE_STEM := twrp
|
||||
LOCAL_MODULE_TAGS:= eng
|
||||
LOCAL_MODULE_TAGS:= optional
|
||||
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
|
||||
LOCAL_PACK_MODULE_RELOCATIONS := false
|
||||
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ LOCAL_CFLAGS := \
|
||||
-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
|
||||
LOCAL_SRC_FILES := config.cpp ota_io.cpp
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := libotafault
|
||||
LOCAL_CLANG := true
|
||||
LOCAL_C_INCLUDES := $(commands_recovery_local_path)
|
||||
|
||||
Regular → Executable
+1
-8
@@ -24,15 +24,7 @@ cc_library_static {
|
||||
|
||||
// Minimal set of files to support host build.
|
||||
srcs: [
|
||||
<<<<<<< HEAD
|
||||
"SysUtil.cpp",
|
||||
"DirUtil.cpp",
|
||||
"ZipUtil.cpp",
|
||||
"ThermalUtil.cpp",
|
||||
"cache_location.cpp",
|
||||
=======
|
||||
"paths.cpp",
|
||||
>>>>>>> android-10.0.0_r25
|
||||
"rangeset.cpp",
|
||||
],
|
||||
|
||||
@@ -69,6 +61,7 @@ cc_library_static {
|
||||
"libext4_utils",
|
||||
"libfs_mgr",
|
||||
"libselinux",
|
||||
"libziparchive",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user