Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6017bc4 authored by Todd Poynor's avatar Todd Poynor
Browse files

BatteryService: Fix detection of missing sysfs attributes

Recent conversion from char* to String8 broke these.

Change-Id: I4528c3e4b90614cddbc173ee996c7fc1febb2cf5
parent 08372b42
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -144,7 +144,7 @@ static jint getBatteryHealth(const char* status)


static int readFromFile(const String8& path, char* buf, size_t size)
static int readFromFile(const String8& path, char* buf, size_t size)
{
{
    if (!path)
    if (path.isEmpty())
        return -1;
        return -1;
    int fd = open(path.string(), O_RDONLY, 0);
    int fd = open(path.string(), O_RDONLY, 0);
    if (fd == -1) {
    if (fd == -1) {
@@ -378,19 +378,19 @@ int register_android_server_BatteryService(JNIEnv* env)


    if (!gChargerNames.size())
    if (!gChargerNames.size())
        ALOGE("No charger supplies found");
        ALOGE("No charger supplies found");
    if (!gPaths.batteryStatusPath)
    if (gPaths.batteryStatusPath.isEmpty())
        ALOGE("batteryStatusPath not found");
        ALOGE("batteryStatusPath not found");
    if (!gPaths.batteryHealthPath)
    if (gPaths.batteryHealthPath.isEmpty())
        ALOGE("batteryHealthPath not found");
        ALOGE("batteryHealthPath not found");
    if (!gPaths.batteryPresentPath)
    if (gPaths.batteryPresentPath.isEmpty())
        ALOGE("batteryPresentPath not found");
        ALOGE("batteryPresentPath not found");
    if (!gPaths.batteryCapacityPath)
    if (gPaths.batteryCapacityPath.isEmpty())
        ALOGE("batteryCapacityPath not found");
        ALOGE("batteryCapacityPath not found");
    if (!gPaths.batteryVoltagePath)
    if (gPaths.batteryVoltagePath.isEmpty())
        ALOGE("batteryVoltagePath not found");
        ALOGE("batteryVoltagePath not found");
    if (!gPaths.batteryTemperaturePath)
    if (gPaths.batteryTemperaturePath.isEmpty())
        ALOGE("batteryTemperaturePath not found");
        ALOGE("batteryTemperaturePath not found");
    if (!gPaths.batteryTechnologyPath)
    if (gPaths.batteryTechnologyPath.isEmpty())
        ALOGE("batteryTechnologyPath not found");
        ALOGE("batteryTechnologyPath not found");


    jclass clazz = env->FindClass("com/android/server/BatteryService");
    jclass clazz = env->FindClass("com/android/server/BatteryService");