mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-07 15:00:34 -08:00
Port Android battery status to Android 4.4 and earlier
* java/org/gnu/emacs/EmacsService.java (EmacsService) (queryBattery19): New function. (queryBattery): Call it on old systems. Also, return AC line status and temperature. * lisp/battery.el (battery-android): Implement more format directives. * src/android.c (android_query_battery): Handle new status fields. * src/android.h (struct android_battery_state): Add `plugged' and `temperature'. * src/androidfns.c (Fandroid_query_battery): Return new fields.
This commit is contained in:
parent
4392423cb6
commit
488a75f2e2
5 changed files with 94 additions and 14 deletions
|
|
@ -2797,11 +2797,13 @@ frame_parm_handler android_frame_parm_handlers[] =
|
|||
DEFUN ("android-query-battery", Fandroid_query_battery,
|
||||
Sandroid_query_battery, 0, 0, 0,
|
||||
doc: /* Perform a query for battery information.
|
||||
This function will not work before Android 5.0.
|
||||
Value is nil upon failure, or a list of the form:
|
||||
|
||||
(CAPACITY CHARGE-COUNTER CURRENT-AVERAGE CURRENT-NOW STATUS
|
||||
REMAINING)
|
||||
REMAINING PLUGGED TEMP)
|
||||
|
||||
where REMAINING, CURRENT-AVERAGE, and CURRENT-NOW are undefined prior
|
||||
to Android 5.0.
|
||||
|
||||
See the documentation at
|
||||
|
||||
|
|
@ -2822,12 +2824,14 @@ for more details about these values. */)
|
|||
if (android_query_battery (&state))
|
||||
return Qnil;
|
||||
|
||||
return listn (6, make_int (state.capacity),
|
||||
make_int (state.charge_counter),
|
||||
return listn (8, make_int (state.capacity),
|
||||
make_fixnum (state.charge_counter),
|
||||
make_int (state.current_average),
|
||||
make_int (state.current_now),
|
||||
make_int (state.status),
|
||||
make_int (state.remaining));
|
||||
make_fixnum (state.status),
|
||||
make_int (state.remaining),
|
||||
make_fixnum (state.plugged),
|
||||
make_fixnum (state.temperature));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue