Hi,
     Here is a temporary workaround for this issue. I don't have a
battery so I was forced to stub the calls and return a 100% for the
required battery parameters.

Best regards,

Elvis

diff --git a/services/jni/com_android_server_BatteryService.cpp b/
services/jni/com_android_server_BatteryService.cpp
index 6636a97..ec66cae 100644
--- a/services/jni/com_android_server_BatteryService.cpp
+++ b/services/jni/com_android_server_BatteryService.cpp
@@ -150,12 +150,14 @@ static void setBooleanField(JNIEnv* env, jobject
obj, const char* path, jfieldID
     const int SIZE = 16;
     char buf[SIZE];

-    jboolean value = false;
+    jboolean value = true;
+/*
     if (readFromFile(path, buf, SIZE) > 0) {
         if (buf[0] == '1') {
             value = true;
         }
     }
+*/
     env->SetBooleanField(obj, fieldID, value);
 }

@@ -164,10 +166,13 @@ static void setIntField(JNIEnv* env, jobject
obj, const char* path, jfieldID fie
     const int SIZE = 128;
     char buf[SIZE];

-    jint value = 0;
+    jint value = 100;
+
+/*
     if (readFromFile(path, buf, SIZE) > 0) {
         value = atoi(buf);
     }
+*/
     env->SetIntField(obj, fieldID, value);
 }

@@ -181,6 +186,12 @@ static void android_server_BatteryService_update
(JNIEnv* env, jobject obj)
     setIntField(env, obj, BATTERY_VOLTAGE_PATH,
gFieldIds.mBatteryVoltage);
     setIntField(env, obj, BATTERY_TEMPERATURE_PATH,
gFieldIds.mBatteryTemperature);

+    env->SetIntField(obj, gFieldIds.mBatteryStatus,
gConstants.statusFull);
+    env->SetIntField(obj, gFieldIds.mBatteryHealth,
gConstants.healthGood);
+    env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env-
>NewStringUTF("1"));
+
+
+/*
     const int SIZE = 128;
     char buf[SIZE];

@@ -192,6 +203,9 @@ static void android_server_BatteryService_update
(JNIEnv* env, jobject obj)

     if (readFromFile(BATTERY_TECHNOLOGY_PATH, buf, SIZE) > 0)
         env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env-
>NewStringUTF(buf));
+
+*/
+
 }

 static JNINativeMethod sMethods[] = {
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to