BatteryService: Fix detection of missing sysfs attributes
Recent conversion from char* to String8 broke these.
Change-Id: I4528c3e4b90614cddbc173ee996c7fc1febb2cf5
diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp
index 485c289..089ba4b 100644
--- a/services/jni/com_android_server_BatteryService.cpp
+++ b/services/jni/com_android_server_BatteryService.cpp
@@ -144,7 +144,7 @@
static int readFromFile(const String8& path, char* buf, size_t size)
{
- if (!path)
+ if (path.isEmpty())
return -1;
int fd = open(path.string(), O_RDONLY, 0);
if (fd == -1) {
@@ -378,19 +378,19 @@
if (!gChargerNames.size())
ALOGE("No charger supplies found");
- if (!gPaths.batteryStatusPath)
+ if (gPaths.batteryStatusPath.isEmpty())
ALOGE("batteryStatusPath not found");
- if (!gPaths.batteryHealthPath)
+ if (gPaths.batteryHealthPath.isEmpty())
ALOGE("batteryHealthPath not found");
- if (!gPaths.batteryPresentPath)
+ if (gPaths.batteryPresentPath.isEmpty())
ALOGE("batteryPresentPath not found");
- if (!gPaths.batteryCapacityPath)
+ if (gPaths.batteryCapacityPath.isEmpty())
ALOGE("batteryCapacityPath not found");
- if (!gPaths.batteryVoltagePath)
+ if (gPaths.batteryVoltagePath.isEmpty())
ALOGE("batteryVoltagePath not found");
- if (!gPaths.batteryTemperaturePath)
+ if (gPaths.batteryTemperaturePath.isEmpty())
ALOGE("batteryTemperaturePath not found");
- if (!gPaths.batteryTechnologyPath)
+ if (gPaths.batteryTechnologyPath.isEmpty())
ALOGE("batteryTechnologyPath not found");
jclass clazz = env->FindClass("com/android/server/BatteryService");