Battery Status/Percentage on Status bar

Check systemUI code all you need is there to enable the symbol and percentage on status bar, also remove this from your build.prop in vendor: ro.boot.fake_battery (core_amlogic.mk in sdk)
Now im not sure this will work, since this sdk it was really not made to support battery!

2 Likes

in systemui source, goto StatusBarIconController.java line 79 remove the battery.
You also might want to to go to config.xml also from systemui, and add battery to:
quick_settings_tiles_default
quick_settings_tiles_stock
quick_settings_tiles_retail_mode

Good luck!

2 Likes

@superceleron

Thanx for your suggestions.
It really did work but battery percentage is not changing while I keep my device on. But when I do reboot/restart then it gets changed.
So, Is there anything missing here?

well looks like is only reading it once, you have to dig more in to the systemui code, you might also want to have a look at BatteryMonitor.cpp in system folder in sdk, and BatteryService.java in frameworks.
Is all i can tell you now without digging more in to the sdk, i do not have the time now to look at it.
I do recommend you probing the service from adb.
here is a good reading for that probing:
Android Battery Mocking tutorial. This article does not require the user… | by Kaushik N. Sanji | Medium

2 Likes

Could you tell me which power board are you using? How do you control when to charge batteries and when to release current? I also want to arrange battery power for the VIN3 and a few if you could show a few photos it would be great

1 Like

@superceleron
Thanx.
SystemUI is not updating the percentage but everything else seems fine. Battery charging and discharging symbol works good.
I just need to see about the percentage.

Ok good, then you really need to dig more deep in to the systemui code.

@superceleron @Terry @Vladimir.v.v
Just asking,

Do we have any other source code for VIM3 android 9 which is designed for tablet or mobiles?

2 Likes

Well amlogic should have it, but i think they only give to phone/tablet makers.
But not sure here.

On the Edge-v series (Rockchip 3399) it may be there, there is just a version for the tablet, but I have not tested it. On Amlogic I have never encountered this.

You need to modify a lot of source code, such as linux driver, dts, android frameworks and hal.
Why did you want to add battery management? This involves hardware and software changes.
Can you tell me your product requirements? Maybe you can use Edge-V + Juice board.

@Terry

I have already added my battery charger and fuel gauge drivers in kernel and dts.
And as per @superceleron suggestions I am able to see battery symbol on status bar and charging and discharging symbol works good.
I am just not getting the percentage right on status bar while my screen is on but when I do screen lock/unlock then percentage also gets changed.

So, I am thinking only systemUI is not working here.
So, could you please guide me through it because I think we can enable that feature in VIM3?

Sharing the screenshot.

You can try to modify the device/khadas/common/core_amlogic.mk and device/khadas/kvim3/device.mk 、device/khadas/kvim3/kvim3.mk

--- a/common/core_amlogic.mk
+++ b/common/core_amlogic.mk
@@ -513,9 +513,6 @@ PRODUCT_PROPERTY_OVERRIDES += \
     dalvik.vm.heapgrowthlimit=256m
 
 
-PRODUCT_PROPERTY_OVERRIDES += \
-    ro.boot.fake_battery=42
-
 #set audioflinger heapsize,for lowramdevice
 #the default af heap size is 1M,it is not enough
 PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/kvim3/device.mk b/kvim3/device.mk
index 09128f0..77e59c9 100644
--- a/kvim3/device.mk
+++ b/kvim3/device.mk
@@ -128,10 +128,5 @@ $(call inherit-product, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-he
 
 
 
-#To remove healthd from the build
-PRODUCT_PACKAGES += android.hardware.health@2.0-service.override
-DEVICE_FRAMEWORK_MANIFEST_FILE += \
-       system/libhidl/vintfdata/manifest_healthd_exclude.xml
-
 #To keep healthd in the build
 PRODUCT_PACKAGES += android.hardware.health@2.0-service
diff --git a/kvim3/kvim3.mk b/kvim3l/kvim3.mk
index 162cf06..31c9a47 100644
--- a/kvim3/kvim3.mk
+++ b/kvim3/kvim3.mk
@@ -434,6 +434,9 @@ PRODUCT_PROPERTY_OVERRIDES += \
    ro.product.firmware=00900001 \
    ro.product.otaupdateurl=http://dl.khadas.com:8089/otaupdate/update
 
+PRODUCT_PACKAGES += \
+   healthd
+
 #########################################################################
 #
 #                                     A/B update

Thanx @Terry

I tried your suggestion but still I need to do screen lock/unlock to update the percentage on status bar.

U can force refresh the systemui service through a script every few minutes.
Although this is not ideal, but might serve your purpose. (The status bar will hide and reappear every time it refreshes though.)

1 Like

Thanx @Yasir_Javed
I understand your idea but I don’t think that would be the right way to do so.
I want it to be permanent.

you can also probably try to force refresh only the batterymanager service but i don’t remember exactly which fil that is. I used to Mod navbar icons and had to face similar problem initially. However i did it using a Xposed framework so it was a little bit easier for me.

This was my project back then. neXus navbarz | Xposed Module Repository

Also this might help:
https://developer.android.com/reference/android/os/BatteryManager

Okay, I will have a look at it.
Thanx

hello, I want to install xposed framework on vim3l,but android system version is 9.0,xposed is not support 9.0,I try to install by magisk, but it not work。What should I do?

you can try vim3 android 11 firmware