FORUMS
Remove All Ads from XDA

[XPOSED MODULE][MOD] Enable BATTERY_STATS In KitKat

44 posts
Thanks Meter: 56
 
Post Reply Email Thread
30th November 2013, 12:36 PM |#21  
pawo99's Avatar
Senior Member
Thanks Meter: 202
 
More
Wakelock detector is now working on Kitkat thanks to this module
The Following User Says Thank You to pawo99 For This Useful Post: [ View ] Gift pawo99 Ad-Free
 
 
30th November 2013, 07:36 PM |#22  
sanderg's Avatar
Senior Member
Thanks Meter: 58
 
More
Thumbs up Thanks Gsamtan!
@gsamtan I just purchased the pro version of your battery monitor after having used the free version for a long time. Good to see you are really deep into this stuff. Keep up the good work.
1st December 2013, 08:16 AM |#23  
TecknoFreak's Avatar
Recognized Contributor
Flag Deltona
Thanks Meter: 1,285
 
Donate to Me
More
How can I add this mod into a ROM directly instead?
1st December 2013, 12:24 PM |#24  
olorolo's Avatar
Senior Member
Flag Pittsburgh
Thanks Meter: 1,349
 
Donate to Me
More
Says problem parsing package

Sent from my HTCONE using Tapatalk
1st December 2013, 02:49 PM |#25  
OP Member
Flag Austin
Thanks Meter: 56
 
More
Quote:
Originally Posted by olorolo

Says problem parsing package

Sent from my HTCONE using Tapatalk

This will only work on KitKat - it won't install on anything prior to 4.4 as it isn't needed. Not sure if that is the issue your seeing or not..
1st December 2013, 03:07 PM |#26  
OP Member
Flag Austin
Thanks Meter: 56
 
More
Quote:
Originally Posted by SVLAN

How can I add this mod into a ROM directly instead?

It's actually very simple to add this directly into a ROM - and is something I hope ROM developers do.

1) Change 'BATTERY_STATS' permission back from 'signature|system' to 'dangerous'. Such as the following:
https://android.googlesource.com/pla...idManifest.xml

Code:
    <!-- Allows an application to collect battery statistics -->
    <permission android:name="android.permission.BATTERY_STATS"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:label="@string/permlab_batteryStats"
        android:description="@string/permdesc_batteryStats"
        android:protectionLevel="dangerous" />
2) If you want compatibility with apps that have not yet been updated for KitKat, you can also do the following (but be careful here..it's better that the apps simply release an update to tolerate the service name change...)
https://android.googlesource.com/pla...ceManager.java

Code:
    /**
     * Returns a reference to a service with the given name.
     *
     * @param name the name of the service to get
     * @return a reference to the service, or <code>null</code> if the service doesn't exist
     */
    public static IBinder getService(String name) {
        try {

            // If the user sends in the old 'batteryinfo' service name, assume they really want 'batterystats'.
            if ("batteryinfo".equals(name))
            {
                name = "batterystats";
            }

            IBinder service = sCache.get(name);
            if (service != null) {
                return service;
            } else {
                return getIServiceManager().getService(name);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "error in getService", e);
        }
        return null;
    }
The Following User Says Thank You to gsamtan For This Useful Post: [ View ] Gift gsamtan Ad-Free
2nd December 2013, 10:47 AM |#27  
juliatan's Avatar
Senior Member
Thanks Meter: 48
 
More
Quote:
Originally Posted by gsamtan

GSam Battery Monitor definitely works with this Xposed module (this is how I originally tested GSam on KitKat) - make sure you're running version 3.0 of the battery monitor, and the latest (1.2) version of this module. And make sure after enabling the module that you restart your phone....

Xposed module 1.2 is and was already enabled and running. GSam Bat. Mon. was updated via Play Store today. I de-installed (via within) root companion. Gsam now does give stats, but not display stats. I removed and reinstalled GSam via Play Store. Still all but display stats.

Before I install GSam Root Comp. again, is there a solution? And what and if where to get GSam b├Ęta people in topic are talking about?

As said earlier I rather don't use Gsam Root C. because with adjusted system future OTA almost certain will fail and not be offered again when forgetting to remove GSAm via Root C. So I hope for solution.

Thanks

Edit: View hours later display stats started working!
2nd December 2013, 06:35 PM |#28  
Senior Member
Thanks Meter: 53
 
More
Quote:
Originally Posted by olorolo

Says problem parsing package

Sent from my HTCONE using Tapatalk

Same problem here. Error when downloading or installing:

"Download file is not a valid APK (or incompatible)"
4th December 2013, 06:45 PM |#29  
groo_pcd's Avatar
Junior Member
Thanks Meter: 4
 
More
nexus 4, stock kernel, kitkat . happy to report that wakelock app is working again. great work developer

Sent from my Nexus 4 using Tapatalk
4th December 2013, 07:48 PM |#30  
Senior Member
Thanks Meter: 3,144
 
Donate to Me
More
Quote:
Originally Posted by gsamtan

It's actually very simple to add this directly into a ROM - and is something I hope ROM developers do.

1) Change 'BATTERY_STATS' permission back from 'signature|system' to 'dangerous'. Such as the following:
https://android.googlesource.com/pla...idManifest.xml

Code:
    <!-- Allows an application to collect battery statistics -->
    <permission android:name="android.permission.BATTERY_STATS"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:label="@string/permlab_batteryStats"
        android:description="@string/permdesc_batteryStats"
        android:protectionLevel="dangerous" />
2) If you want compatibility with apps that have not yet been updated for KitKat, you can also do the following (but be careful here..it's better that the apps simply release an update to tolerate the service name change...)
https://android.googlesource.com/pla...ceManager.java

Code:
    /**
     * Returns a reference to a service with the given name.
     *
     * @param name the name of the service to get
     * @return a reference to the service, or <code>null</code> if the service doesn't exist
     */
    public static IBinder getService(String name) {
        try {

            // If the user sends in the old 'batteryinfo' service name, assume they really want 'batterystats'.
            if ("batteryinfo".equals(name))
            {
                name = "batterystats";
            }

            IBinder service = sCache.get(name);
            if (service != null) {
                return service;
            } else {
                return getIServiceManager().getService(name);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "error in getService", e);
        }
        return null;
    }

I believe this is in sources and not cooked roms? Where can i find this Android Manifest in cooked roms if possible?
6th December 2013, 05:33 AM |#31  
OP Member
Flag Austin
Thanks Meter: 56
 
More
The manifest should be in every rom. You'll have to re-build the core framework though with your change. You can't just modify a file on an already built rom...

Sent from my LG-LS970 using XDA Premium 4 mobile app
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes