Initial unified commit for Android 11, syncing up to v311

This commit is contained in:
Andy CrossGate Yan
2021-08-08 02:20:00 +00:00
commit 01693449b8
191 changed files with 23879 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
From e587d5f4e924737b481095925d152d9d31adf2cc Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 19 Dec 2020 15:57:27 +0000
Subject: [PATCH 1/4] Revert "init: Add vendor-specific initialization hooks."
This reverts commit 7bc78d1354cd2e8df1ba693c627d5be39206e375.
Change-Id: I0c3241ef3626bc989b34723e30b2339e4a62399d
---
init/Android.bp | 9 ---------
init/NOTICE | 26 --------------------------
init/property_service.cpp | 4 ----
init/vendor_init.cpp | 37 -------------------------------------
init/vendor_init.h | 33 ---------------------------------
5 files changed, 109 deletions(-)
delete mode 100644 init/vendor_init.cpp
delete mode 100644 init/vendor_init.h
diff --git a/init/Android.bp b/init/Android.bp
index e28d9f026..827a8293f 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -71,14 +71,6 @@ init_host_sources = [
"host_init_verifier.cpp",
]
-cc_library_static {
- name: "vendor_init",
- recovery_available: true,
- srcs: [
- "vendor_init.cpp",
- ],
-}
-
cc_defaults {
name: "init_defaults",
cpp_std: "experimental",
@@ -169,7 +161,6 @@ cc_library_static {
defaults: [
"init_defaults",
"selinux_policy_version",
- "vendor_init_defaults",
],
srcs: init_common_sources + init_device_sources,
whole_static_libs: [
diff --git a/init/NOTICE b/init/NOTICE
index 383d0f541..c5b1efa7a 100644
--- a/init/NOTICE
+++ b/init/NOTICE
@@ -188,29 +188,3 @@
END OF TERMS AND CONDITIONS
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 44b51c2cf..019955b16 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -70,7 +70,6 @@
#include "subcontext.h"
#include "system/core/init/property_service.pb.h"
#include "util.h"
-#include "vendor_init.h"
using namespace std::literals;
@@ -976,9 +975,6 @@ void PropertyLoadBootDefaults() {
}
}
- // Update with vendor-specific property runtime overrides
- vendor_load_properties();
-
property_initialize_ro_product_props();
property_derive_build_fingerprint();
property_initialize_ro_cpu_abilist();
diff --git a/init/vendor_init.cpp b/init/vendor_init.cpp
deleted file mode 100644
index d3fd5ffe2..000000000
--- a/init/vendor_init.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "vendor_init.h"
-
-/* init vendor override stubs */
-
-__attribute__ ((weak))
-void vendor_load_properties()
-{
-}
diff --git a/init/vendor_init.h b/init/vendor_init.h
deleted file mode 100644
index 9afb449be..000000000
--- a/init/vendor_init.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __INIT_VENDOR__H__
-#define __INIT_VENDOR__H__
-extern void vendor_load_properties(void);
-#endif /* __INIT_VENDOR__H__ */
--
2.25.1

View File

@@ -0,0 +1,38 @@
From abbb1f38b347c8681cac4388d49c227e874ea3d9 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 4 Sep 2019 21:11:48 +0200
Subject: [PATCH 2/4] Panic into recovery rather than bootloader
Getting last_kmsg/pstore from bootloader isn't possible for other people
than the OEM, but we have TWRP to access last_kmsg/pstore
Change-Id: If04bb6572dc66677d7b44f7d302b2d69ce526200
---
init/reboot_utils.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init/reboot_utils.cpp b/init/reboot_utils.cpp
index 76460a5df..5a12dd7af 100644
--- a/init/reboot_utils.cpp
+++ b/init/reboot_utils.cpp
@@ -34,7 +34,7 @@
namespace android {
namespace init {
-static std::string init_fatal_reboot_target = "bootloader";
+static std::string init_fatal_reboot_target = "recovery";
static bool init_fatal_panic = false;
void SetFatalRebootTarget() {
@@ -48,7 +48,7 @@ void SetFatalRebootTarget() {
const char kRebootTargetString[] = "androidboot.init_fatal_reboot_target=";
auto start_pos = cmdline.find(kRebootTargetString);
if (start_pos == std::string::npos) {
- return; // We already default to bootloader if no setting is provided.
+ return; // We already default to recovery if no setting is provided
}
start_pos += sizeof(kRebootTargetString) - 1;
--
2.25.1

View File

@@ -0,0 +1,87 @@
From 9a9baec3df926da5cf27c690590482e11172f821 Mon Sep 17 00:00:00 2001
From: Victor Bo <bvoid@yandex.ru>
Date: Wed, 3 Mar 2021 06:31:17 -0500
Subject: [PATCH 3/4] Restore /sbin for Magisk compatibility
Squash of:
- Revert "Do not create /sbin"
- Revert "Remove sbin from fs_config.cpp"
- add /sbin to the PATH
Change-Id: I1224c9b64ce8eb14f7d15c8441c0633a7e6a20de
---
CleanSpec.mk | 2 --
libcutils/fs_config.cpp | 3 +++
rootdir/Android.mk | 2 +-
rootdir/init.environ.rc.in | 1 +
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 0a534a2bd..81150a0fa 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -80,8 +80,6 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vndksp.libraries.txt)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/sbin/charger)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/sbin/charger)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/sbin)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/sbin)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product_services)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product_services.img)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product_services)
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 5805a4d19..b30707fc8 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -80,6 +80,7 @@ static const struct fs_path_config android_dirs[] = {
{ 00771, AID_SYSTEM, AID_SYSTEM, 0, "data" },
{ 00755, AID_ROOT, AID_SYSTEM, 0, "mnt" },
{ 00751, AID_ROOT, AID_SHELL, 0, "product/bin" },
+ { 00750, AID_ROOT, AID_SHELL, 0, "sbin" },
{ 00777, AID_ROOT, AID_ROOT, 0, "sdcard" },
{ 00751, AID_ROOT, AID_SDCARD_R, 0, "storage" },
{ 00751, AID_ROOT, AID_SHELL, 0, "system/bin" },
@@ -164,6 +165,7 @@ static const struct fs_path_config android_files[] = {
{ 00600, AID_ROOT, AID_ROOT, 0, "system_ext/build.prop" },
{ 00444, AID_ROOT, AID_ROOT, 0, system_ext_conf_dir + 1 },
{ 00444, AID_ROOT, AID_ROOT, 0, system_ext_conf_file + 1 },
+ { 00750, AID_ROOT, AID_SHELL, 0, "sbin/fs_mgr" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin/crash_dump32" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin/crash_dump64" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin/debuggerd" },
@@ -209,6 +211,7 @@ static const struct fs_path_config android_files[] = {
{ 00750, AID_ROOT, AID_SHELL, 0, "init*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "odm/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "product/bin/*" },
+ { 00750, AID_ROOT, AID_SHELL, 0, "sbin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/apex/*/bin/*" },
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index 7d383f522..6d518dcb3 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -77,7 +77,7 @@ endif
#
# create some directories (some are mount points) and symlinks
LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_ROOT_OUT)/, \
- dev proc sys system data data_mirror odm oem acct config storage mnt apex debug_ramdisk \
+ sbin dev proc sys system data data_mirror odm oem acct config storage mnt apex debug_ramdisk \
linkerconfig postinstall $(BOARD_ROOT_EXTRA_FOLDERS)); \
ln -sf /system/bin $(TARGET_ROOT_OUT)/bin; \
ln -sf /system/etc $(TARGET_ROOT_OUT)/etc; \
diff --git a/rootdir/init.environ.rc.in b/rootdir/init.environ.rc.in
index fdaaf1abe..72ba861a8 100644
--- a/rootdir/init.environ.rc.in
+++ b/rootdir/init.environ.rc.in
@@ -10,6 +10,7 @@ on early-init
export ANDROID_TZDATA_ROOT /apex/com.android.tzdata
export EXTERNAL_STORAGE /sdcard
export ASEC_MOUNTPOINT /mnt/asec
+ export PATH /sbin:/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
export BOOTCLASSPATH %BOOTCLASSPATH%
export DEX2OATBOOTCLASSPATH %DEX2OATBOOTCLASSPATH%
export SYSTEMSERVERCLASSPATH %SYSTEMSERVERCLASSPATH%
--
2.25.1

View File

@@ -0,0 +1,52 @@
From f2b0a4042521fc7ad60de242227fcbcf21691a3b Mon Sep 17 00:00:00 2001
From: Victor Bo <bvoid@yandex.ru>
Date: Wed, 26 Feb 2020 07:23:44 +0200
Subject: [PATCH 4/4] fix offline charger v7
modified: rootdir/init.rc
---
rootdir/init.rc | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index a9af0b094..b136f1059 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -11,6 +11,11 @@ import /vendor/etc/init/hw/init.${ro.hardware}.rc
import /system/etc/init/hw/init.usb.configfs.rc
import /system/etc/init/hw/init.${ro.zygote}.rc
+service gsicharger /bin/charger
+ class gsicharger
+ user system
+ group system shell input graphics wakelock
+
# Cgroups are mounted right before early-init using list from /etc/cgroups.json
on early-init
# Disable sysrq from keyboard
@@ -399,7 +404,7 @@ on init
# Healthd can trigger a full boot from charger mode by signaling this
# property when the power button is held.
on property:sys.boot_from_charger_mode=1
- class_stop charger
+ class_stop gsicharger
trigger late-init
on load_persist_props_action
@@ -945,8 +950,12 @@ on nonencrypted
on property:sys.init_log_level=*
loglevel ${sys.init_log_level}
+on charger && property:ro.hardware=mt*
+ write /sys/class/leds/lcd-backlight/trigger "backlight"
+ write /sys/class/android_usb/android0/enable 1
+
on charger
- class_start charger
+ class_start gsicharger
on property:vold.decrypt=trigger_load_persist_props
load_persist_props
--
2.25.1