diff options
author | Rebecca Schultz Zavin <rebecca@android.com> | 2009-04-28 17:24:47 -0700 |
---|---|---|
committer | Rebecca Schultz Zavin <rebecca@android.com> | 2009-05-05 16:15:36 -0700 |
commit | e7e6fa3fbfeae278f739f3863197d0c4fc750abe (patch) | |
tree | d453eac6fdc6470fe6e8ee04434d8a6c047fae9b /services/jni | |
parent | ef65477523a6170bab7897809d1a8f9a3f5165f6 (diff) | |
download | frameworks_base-e7e6fa3fbfeae278f739f3863197d0c4fc750abe.zip frameworks_base-e7e6fa3fbfeae278f739f3863197d0c4fc750abe.tar.gz frameworks_base-e7e6fa3fbfeae278f739f3863197d0c4fc750abe.tar.bz2 |
If no battery stats are found, return status_unknown
If the battery files can't be found return status_unkown instead of an
error. On systems where we haven't brought up battery stats yet they
assume the battery is dead and turn off as soon as the runtime starts
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'services/jni')
-rw-r--r-- | services/jni/com_android_server_BatteryService.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp index 6636a97..2524966 100644 --- a/services/jni/com_android_server_BatteryService.cpp +++ b/services/jni/com_android_server_BatteryService.cpp @@ -186,6 +186,9 @@ static void android_server_BatteryService_update(JNIEnv* env, jobject obj) if (readFromFile(BATTERY_STATUS_PATH, buf, SIZE) > 0) env->SetIntField(obj, gFieldIds.mBatteryStatus, getBatteryStatus(buf)); + else + env->SetIntField(obj, gFieldIds.mBatteryStatus, + gConstants.statusUnknown); if (readFromFile(BATTERY_HEALTH_PATH, buf, SIZE) > 0) env->SetIntField(obj, gFieldIds.mBatteryHealth, getBatteryHealth(buf)); |