gsi: reconcile system fingerprint / device model with vendor
This commit is contained in:
parent
732c135b4d
commit
aaba77ede8
|
@ -0,0 +1,5 @@
|
|||
DEVICE_PATH := device/peter/gsi
|
||||
|
||||
# Sepolicy
|
||||
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/private
|
||||
SELINUX_IGNORE_NEVERALLOWS := true
|
|
@ -29,3 +29,8 @@ PRODUCT_PROPERTY_OVERRIDES += \
|
|||
# Resetprop
|
||||
PRODUCT_PACKAGES += \
|
||||
resetprop_sys
|
||||
|
||||
# Init
|
||||
PRODUCT_PACKAGES += \
|
||||
init_gsi
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
cc_binary {
|
||||
name: "init_gsi",
|
||||
system_ext_specific: true,
|
||||
srcs: ["init_gsi.cpp"],
|
||||
shared_libs: ["libbase", "libdl", "libutils"],
|
||||
init_rc: ["init_gsi.rc"],
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#include <android-base/logging.h>
|
||||
#include <android-base/properties.h>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace std;
|
||||
|
||||
template<typename... Args>
|
||||
void fork_execl(Args... args) {
|
||||
int pid, status;
|
||||
if ((pid = fork()) == 0) {
|
||||
execl(args..., nullptr);
|
||||
} else {
|
||||
waitpid(pid, &status, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void override_ro_prop(string prefix, string source, string postfix, string value) {
|
||||
if (value.length() == 0) return;
|
||||
|
||||
std::string prop = prefix;
|
||||
|
||||
if (source.length() > 0) {
|
||||
prop += ".";
|
||||
prop += source;
|
||||
}
|
||||
|
||||
prop += "." + postfix;
|
||||
std::cout << prop << std::endl;
|
||||
std::cout << value << std::endl;
|
||||
|
||||
fork_execl("/system/system_ext/bin/resetprop_sys", "resetprop_sys", prop.c_str(), value.c_str());
|
||||
}
|
||||
|
||||
std::string RO_PROP_SOURCES[] = {
|
||||
"", "product", "odm", "vendor", "system_ext", "system", "bootimage",
|
||||
};
|
||||
|
||||
int main() {
|
||||
string device = base::GetProperty("ro.product.vendor.device", "");
|
||||
string model = base::GetProperty("ro.product.vendor.model", "");
|
||||
string name = base::GetProperty("ro.product.vendor.name", "");
|
||||
string brand = base::GetProperty("ro.product.vendor.brand", "");
|
||||
string manufacturer = base::GetProperty("ro.product.vendor.manufacturer", "");
|
||||
string fingerprint = base::GetProperty("ro.vendor.build.fingerprint", "");
|
||||
|
||||
for (const auto& source : RO_PROP_SOURCES) {
|
||||
override_ro_prop("ro.product", source, "device", device);
|
||||
override_ro_prop("ro.product", source, "model", model);
|
||||
override_ro_prop("ro.product", source, "name", name);
|
||||
override_ro_prop("ro.product", source, "brand", brand);
|
||||
override_ro_prop("ro.product", source, "manufacturer", manufacturer);
|
||||
override_ro_prop("ro", source, "build.fingerprint", fingerprint);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
service init_gsi /system/system_ext/bin/init_gsi
|
||||
class core
|
||||
user root
|
||||
group root
|
||||
seclabel u:r:init:s0
|
|
@ -1 +1,2 @@
|
|||
include build/make/target/board/generic_arm64/BoardConfig.mk
|
||||
include device/peter/gsi/BoardConfigCommon.mk
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
cc_binary {
|
||||
name: "resetprop_sys",
|
||||
system_ext_specific: true,
|
||||
srcs: [
|
||||
//nanopb
|
||||
"Magisk/native/jni/external/nanopb/pb_common.c",
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
allow init system_file:file execute_no_trans;
|
Loading…
Reference in New Issue