mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 04:25:33 -04:00
universal7885: aidl-support: Mark unstable and fix errors
This commit is contained in:
parent
53b5d14b3c
commit
efc9f1063b
8 changed files with 26 additions and 3 deletions
13
universal7885-common/apps/aidl-support/LICENSE
Normal file
13
universal7885-common/apps/aidl-support/LICENSE
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (C) 2022 Eureka Team
|
||||
//
|
||||
// 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.
|
||||
|
|
@ -6,4 +6,5 @@ aidl_interface {
|
|||
enabled: true,
|
||||
},
|
||||
},
|
||||
unstable: true,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
package vendor.eureka.hardware.fmradio;
|
||||
|
||||
import vendor.eureka.hardware.fmradio.Direction;
|
||||
import vendor.eureka.hardware.fmradio.Status;
|
||||
import vendor.eureka.hardware.fmradio.Space;
|
||||
|
||||
interface IFMRadio {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
cc_library_shared {
|
||||
name: "libfileio",
|
||||
srcs: ["FileIO.cpp"],
|
||||
cppflags: ["-fexceptions"],
|
||||
local_include_dirs: ["include"],
|
||||
export_include_dirs: ["include"],
|
||||
shared_libs: ["liblog"],
|
||||
}
|
||||
|
||||
50
universal7885-common/apps/aidl-support/libfileio/FileIO.cpp
Normal file
50
universal7885-common/apps/aidl-support/libfileio/FileIO.cpp
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#define LOG_TAG "libFileIO"
|
||||
|
||||
#include <log/log.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
namespace FileIO {
|
||||
|
||||
constexpr const int EXIT_ERR = -1;
|
||||
|
||||
int readline(const char *path) {
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
file.open(path);
|
||||
ALOGD("%s: Opening %s", __func__, path);
|
||||
if (file.is_open()) {
|
||||
getline(file, value);
|
||||
file.close();
|
||||
} else {
|
||||
ALOGE("%s: Failed to open %s", __func__, path);
|
||||
return EXIT_ERR;
|
||||
}
|
||||
try {
|
||||
return stoi(value);
|
||||
} catch (std::invalid_argument const &ex) {
|
||||
ALOGE("%s: stoi(): invalid argument: for %s", __func__, value.c_str());
|
||||
} catch (std::out_of_range const &ex) {
|
||||
ALOGE("%s: stoi(): out of range: for %s", __func__, value.c_str());
|
||||
}
|
||||
return EXIT_ERR;
|
||||
}
|
||||
|
||||
void writeline(const char *path, const std::string& data) {
|
||||
std::ofstream file;
|
||||
file.open(path);
|
||||
ALOGD("%s: Opening %s", __func__, path);
|
||||
if (file.is_open()) {
|
||||
file << data;
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
ALOGE("%s: Failed to open %s", __func__, path);
|
||||
}
|
||||
|
||||
void writeline(const char *path, const int data) {
|
||||
writeline(path, std::to_string(data));
|
||||
}
|
||||
|
||||
} // namespace FileIO
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
namespace FileIO {
|
||||
int readline(const char *path);
|
||||
|
||||
void writeline(const char *path, const std::string& data);
|
||||
void writeline(const char *path, const int data);
|
||||
} // namespace FileIO
|
||||
11
universal7885-common/apps/aidl-support/parts/Android.bp
Normal file
11
universal7885-common/apps/aidl-support/parts/Android.bp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
aidl_interface {
|
||||
name: "vendor.eureka.hardware.parts",
|
||||
srcs: ["vendor/eureka/hardware/parts/*.aidl"],
|
||||
backend: {
|
||||
ndk: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
unstable: true,
|
||||
}
|
||||
|
||||
|
|
@ -15,10 +15,9 @@
|
|||
package vendor.eureka.hardware.parts;
|
||||
|
||||
import vendor.eureka.hardware.parts.BatterySys;
|
||||
import vendor.eureka.hardware.parts.Status;
|
||||
|
||||
interface IBatteryStats {
|
||||
int getBatteryStats(in BatterySys stats);
|
||||
|
||||
void setBatteryWritable(in BatterySys stats, in Status value);
|
||||
void setBatteryWritable(in BatterySys stats, in boolean value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue