sm6225-common: Add init extension to override ro.carrier
Change-Id: I82ec6b0d2293dc13524660fd0e2539f08ced2f9f
This commit is contained in:
parent
0da2e505af
commit
799d86bb52
3 changed files with 46 additions and 0 deletions
|
@ -66,6 +66,9 @@ DEVICE_MANIFEST_FILE := $(COMMON_PATH)/manifest.xml
|
|||
DEVICE_MATRIX_FILE := $(COMMON_PATH)/compatibility_matrix.xml
|
||||
ODM_MANIFEST_FILES := $(COMMON_PATH)/manifest-qva.xml
|
||||
|
||||
# Init
|
||||
TARGET_INIT_VENDOR_LIB := //$(COMMON_PATH):libinit_sm6225
|
||||
|
||||
# Kernel
|
||||
BOARD_BOOT_HEADER_VERSION := 3
|
||||
BOARD_INCLUDE_DTB_IN_BOOTIMG := true
|
||||
|
|
13
libinit/Android.bp
Normal file
13
libinit/Android.bp
Normal file
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// Copyright (C) 2022 The LineageOS Project
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
cc_library_static {
|
||||
name: "libinit_sm6225",
|
||||
srcs: ["init_sm6225.cpp"],
|
||||
recovery_available: true,
|
||||
include_dirs: ["system/core/init"],
|
||||
shared_libs: ["libbase"]
|
||||
}
|
30
libinit/init_sm6225.cpp
Normal file
30
libinit/init_sm6225.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2022 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <android-base/properties.h>
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
#include <sys/_system_properties.h>
|
||||
|
||||
#include "vendor_init.h"
|
||||
|
||||
using android::base::GetProperty;
|
||||
|
||||
namespace {
|
||||
void PropertyOverride(const std::string& name, const std::string& value, bool add = true) {
|
||||
auto pi = const_cast<prop_info*>(__system_property_find(name.c_str()));
|
||||
|
||||
if (pi != nullptr) {
|
||||
__system_property_update(pi, value.c_str(), value.size());
|
||||
} else if (add) {
|
||||
__system_property_add(name.c_str(), name.size(), value.c_str(), value.size());
|
||||
}
|
||||
}
|
||||
}; // anonymous namespace
|
||||
|
||||
void vendor_load_properties() {
|
||||
std::string value = GetProperty("ro.boot.carrier", "");
|
||||
if (!value.empty()) PropertyOverride("ro.carrier", value);
|
||||
}
|
Loading…
Reference in a new issue