mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 20:45:31 -04:00
[DNM] universal7885: import hardware/samsung deps
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
c25cedb10c
commit
76a69f9276
40 changed files with 3779 additions and 0 deletions
24
universal7885-common/secril_config_svc/Android.bp
Normal file
24
universal7885-common/secril_config_svc/Android.bp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Copyright (C) 2021 The LineageOS 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_binary {
|
||||
name: "secril_config_svc",
|
||||
vendor: true,
|
||||
srcs: ["secril_config_svc.cpp"],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
],
|
||||
}
|
||||
70
universal7885-common/secril_config_svc/secril_config_svc.cpp
Normal file
70
universal7885-common/secril_config_svc/secril_config_svc.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (C) 2021, The LineageOS 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "secril_config_svc"
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <android-base/strings.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#define EFS_OLD "/efs/"
|
||||
#define EFS_NEW "/mnt/vendor/efs/"
|
||||
#define FACTORY_PROP "factory.prop"
|
||||
#define TELEPHONY_PROP "telephony.prop"
|
||||
|
||||
void LoadProperties(std::string data) {
|
||||
for (std::string line : android::base::Split(data, "\n")) {
|
||||
if (line == "\0") break;
|
||||
|
||||
std::vector<std::string> parts = android::base::Split(line, "=");
|
||||
if (parts.size() == 2) {
|
||||
LOG(INFO) << "Setting property: " << line;
|
||||
android::base::SetProperty(parts.at(0), parts.at(1));
|
||||
} else {
|
||||
LOG(ERROR) << "Invalid data: " << line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
std::string prop = FACTORY_PROP;
|
||||
|
||||
if (argc > 1 && std::string(argv[1]) == "NetworkConfig")
|
||||
prop = TELEPHONY_PROP;
|
||||
|
||||
std::ifstream in(EFS_NEW + prop);
|
||||
if (in.good()) {
|
||||
in.close();
|
||||
prop = EFS_NEW + prop;
|
||||
} else {
|
||||
prop = EFS_OLD + prop;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Loading properties from " << prop;
|
||||
|
||||
std::string content;
|
||||
if (android::base::ReadFileToString(prop, &content)) {
|
||||
LoadProperties(content.c_str());
|
||||
} else if (prop == FACTORY_PROP) {
|
||||
LOG(WARNING) << "Could not read " << prop << ", setting defaults!";
|
||||
LoadProperties("ro.vendor.multisim.simslotcount=1");
|
||||
} else {
|
||||
LOG(WARNING) << "Could not read " << prop << "!";
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue