Bring idle poweroff to RaaA and the sim
[maemo-rb.git] / firmware / target / hosted / android / powermgmt-android.c
blobd23fece39a170619925bfc5134134133ac29171b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 by Thomas Martitz
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include <jni.h>
24 #include <stdbool.h>
25 #include "config.h"
27 extern JNIEnv *env_ptr;
28 extern jclass RockboxService_class;
29 extern jobject RockboxService_instance;
31 static jfieldID _battery_level;
33 void powermgmt_init_target(void)
35 jmethodID initBatteryMonitor = (*env_ptr)->GetMethodID(env_ptr,
36 RockboxService_class,
37 "initBatteryMonitor",
38 "()V");
39 /* start the monitor */
40 (*env_ptr)->CallVoidMethod(env_ptr,
41 RockboxService_instance,
42 initBatteryMonitor);
44 /* cache the battery level field id */
45 _battery_level = (*env_ptr)->GetFieldID(env_ptr,
46 RockboxService_class,
47 "battery_level",
48 "I");
51 int battery_level(void)
53 return (*env_ptr)->GetIntField(env_ptr, RockboxService_instance, _battery_level);
56 int battery_time(void)
57 { /* cannot calculate yet */
58 return 0;
61 /* should always be safe on android targets, the host shuts us down before */
62 bool battery_level_safe(void)
64 return true;
67 /* TODO */
68 unsigned battery_voltage(void)
70 return 0;