[MOD][GUIDE]Add CPU usage in notification panel

Search This thread

meawww

Senior Member
Dec 2, 2013
521
629
Rome
I never seen any guide how to add the cpu usage into notification panel to this is a guide how to do it!

Files need modification
Smali
\SystemUI\smali\com\android\systemui\statusbar\policy

XML's
status_bar_expanded_header.xml
id.xml
strings.xml
public.xml


1: Decompile the SystemUI.apk using apktool.
2: Now download the cpu_smali attachment and put the smalis inside the folder \SystemUI\smali\com\android\systemui\statusbar\policy
3: Open the file \SystemUI\res\values\id.xml and scroll down at the bottom and add these lines

Code:
<item type="id" name="cpu">false</item>
<item type="id" name="sys_id">false</item>

4: Open the file \SystemUI\res\values\strings.xml and scroll down at the bottom and add these lines

Code:
<string name="cpu_idle">idle</string>
<string name="cpu_text">CPU Usage</string>

5: Open the file \SystemUI\res\layout\status_bar_expanded_header.xml and look for the line

Code:
<com.android.systemui.statusbar.policy.ClockStock android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:textColor="@color/notification_header_clock_color" android:gravity="bottom" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" systemui:ampmSmall="true" />
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:textColor="@color/notification_header_date_color" android:gravity="bottom" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="@dimen/notification_panel_header_date_margin_left" android:layout_marginRight="@dimen/notification_panel_header_date_margin_right" android:layout_marginBottom="@dimen/notification_panel_header_date_margin_bottom" android:layout_toEndOf="@id/clock" />

Now we gonna comment out these codes just incase u want the date and clock back in the future so we need to do is replace with these codes

Code:
<!--
<com.android.systemui.statusbar.policy.ClockStock android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:textColor="@color/notification_header_clock_color" android:gravity="bottom" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" systemui:ampmSmall="true" />
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:textColor="@color/notification_header_date_color" android:gravity="bottom" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="@dimen/notification_panel_header_date_margin_left" android:layout_marginRight="@dimen/notification_panel_header_date_margin_right" android:layout_marginBottom="@dimen/notification_panel_header_date_margin_bottom" android:layout_toEndOf="@id/clock" />
-->

6: Now right under the lince we just comment out we will add these lines

Code:
<LinearLayout android:gravity="left" android:orientation="vertical" android:id="@id/cpu" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:textSize="15.0dip" android:textColor="#ffffffff" android:id="@id/sys_id" android:paddingLeft="11.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cpu_text" android:layout_marginLeft="@dimen/status_bar_expanded_notification_margin" />
<com.android.systemui.statusbar.policy.CpuUsageView android:textSize="12.0dip" android:textColor="#ffffffff" android:paddingLeft="23.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>

7: Now save everything and lets compile the SystemUI.apk and sign it.

8: Take the SystemUI.apk we just compiled and signed and decompile it again using apktool

9: Now we open the file public.xml and look for the line <public type="string" name="cpu_idle" id=" now all we needed is the id inside the id=""

10: Now we open the file \SystemUI\smali\com\android\systemui\statusbar\policy\CpuUsageView$1.smali and search for # virtual methods few lines below you will see const v9, 0x7f0a01ad and all we need to do is change the 0x7f0a01ad to the one we found in public.xml

11: Save everything Compile & Sign and push it inside your system\priv-app.

12: Enjoy :D
 

Attachments

  • Screenshot_2014-05-07-17-33-47.jpg
    Screenshot_2014-05-07-17-33-47.jpg
    102.5 KB · Views: 6,674
  • smali.rar
    5.4 KB · Views: 853
Last edited:

Goldie

Inactive Recognized Developer
Oct 16, 2010
9,965
22,759
Why do you only want the xml?

Sent from my SM-G900F using Tapatalk
 

carlospr21

Senior Member
Oct 9, 2007
1,783
1,539
P.R. Levittown
Why do you only want the xml?

Sent from my SM-G900F using Tapatalk

I dont have a pc to do the modding so a flashable vrtheme with the modded .xml will work

I upload my systemui.apk so if anyone can modded it for me i will be thankfull

Sent from my SM-N900A using XDA Premium 4 mobile app
 

Attachments

  • SystemUI.apk
    2.6 MB · Views: 53
Last edited:

Goldie

Inactive Recognized Developer
Oct 16, 2010
9,965
22,759
But then you will not have the smali files that do the actual mod and it will just fc

Sent from my SM-G900F using Tapatalk
 

deuce_biggins

Senior Member
Mar 14, 2014
1,006
2,192
Detroit

@meawww, once again great job...worked as advertised. One question, is it possible to show the clock/date with the CPU usage? I was thinking about playing with the size (dpi) to see what would happen...perhaps even removing the 'CPU Usage' header just to show the core usages as well.

Also, I think your screen dpi is slightly different than mine as well. I lose the last core reading, see pic

e3yve6yq.jpg
 
Last edited:

meawww

Senior Member
Dec 2, 2013
521
629
Rome
@meawww, once again great job...worked as advertised. One question, is it possible to show the clock/date with the CPU usage? I was thinking about playing with the size (dpi) to see what would happen...perhaps even removing the 'CPU Usage' header just to show the core usages as well.

Also, I think your screen dpi is slightly different than mine as well. I lose the last core reading, see pic

e3yve6yq.jpg

Yes you can add clock date back just edit the xml and my dpi is 320
 
  • Like
Reactions: D2Y aka E

12gage

Senior Member
Sep 3, 2007
1,813
264
Albany, OR
I dont have a pc to do the modding so a flashable vrtheme with the modded .xml will work

I upload my systemui.apk so if anyone can modded it for me i will be thankfull

Sent from my SM-N900A using XDA Premium 4 mobile app


Would that theme work with Sprint NAC 4.42? Some themes don't because they don't include Wifi Calling, Hotspot, Mobile Data, Torch, etc... Thanks in advance.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    I never seen any guide how to add the cpu usage into notification panel to this is a guide how to do it!

    Files need modification
    Smali
    \SystemUI\smali\com\android\systemui\statusbar\policy

    XML's
    status_bar_expanded_header.xml
    id.xml
    strings.xml
    public.xml


    1: Decompile the SystemUI.apk using apktool.
    2: Now download the cpu_smali attachment and put the smalis inside the folder \SystemUI\smali\com\android\systemui\statusbar\policy
    3: Open the file \SystemUI\res\values\id.xml and scroll down at the bottom and add these lines

    Code:
    <item type="id" name="cpu">false</item>
    <item type="id" name="sys_id">false</item>

    4: Open the file \SystemUI\res\values\strings.xml and scroll down at the bottom and add these lines

    Code:
    <string name="cpu_idle">idle</string>
    <string name="cpu_text">CPU Usage</string>

    5: Open the file \SystemUI\res\layout\status_bar_expanded_header.xml and look for the line

    Code:
    <com.android.systemui.statusbar.policy.ClockStock android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:textColor="@color/notification_header_clock_color" android:gravity="bottom" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" systemui:ampmSmall="true" />
    <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:textColor="@color/notification_header_date_color" android:gravity="bottom" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="@dimen/notification_panel_header_date_margin_left" android:layout_marginRight="@dimen/notification_panel_header_date_margin_right" android:layout_marginBottom="@dimen/notification_panel_header_date_margin_bottom" android:layout_toEndOf="@id/clock" />

    Now we gonna comment out these codes just incase u want the date and clock back in the future so we need to do is replace with these codes

    Code:
    <!--
    <com.android.systemui.statusbar.policy.ClockStock android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:textColor="@color/notification_header_clock_color" android:gravity="bottom" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/notification_panel_header_clock_margin_left" android:singleLine="true" systemui:ampmSmall="true" />
    <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:textColor="@color/notification_header_date_color" android:gravity="bottom" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="@dimen/notification_panel_header_date_margin_left" android:layout_marginRight="@dimen/notification_panel_header_date_margin_right" android:layout_marginBottom="@dimen/notification_panel_header_date_margin_bottom" android:layout_toEndOf="@id/clock" />
    -->

    6: Now right under the lince we just comment out we will add these lines

    Code:
    <LinearLayout android:gravity="left" android:orientation="vertical" android:id="@id/cpu" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="fill_parent">
    <TextView android:textSize="15.0dip" android:textColor="#ffffffff" android:id="@id/sys_id" android:paddingLeft="11.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cpu_text" android:layout_marginLeft="@dimen/status_bar_expanded_notification_margin" />
    <com.android.systemui.statusbar.policy.CpuUsageView android:textSize="12.0dip" android:textColor="#ffffffff" android:paddingLeft="23.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" />
    </LinearLayout>

    7: Now save everything and lets compile the SystemUI.apk and sign it.

    8: Take the SystemUI.apk we just compiled and signed and decompile it again using apktool

    9: Now we open the file public.xml and look for the line <public type="string" name="cpu_idle" id=" now all we needed is the id inside the id=""

    10: Now we open the file \SystemUI\smali\com\android\systemui\statusbar\policy\CpuUsageView$1.smali and search for # virtual methods few lines below you will see const v9, 0x7f0a01ad and all we need to do is change the 0x7f0a01ad to the one we found in public.xml

    11: Save everything Compile & Sign and push it inside your system\priv-app.

    12: Enjoy :D
    1
    I dont have a pc to do the modding so a flashable vrtheme with the modded .xml will work

    I upload my systemui.apk so if anyone can modded it for me i will be thankfull

    Sent from my SM-N900A using XDA Premium 4 mobile app

    Try this
    1
    @meawww, once again great job...worked as advertised. One question, is it possible to show the clock/date with the CPU usage? I was thinking about playing with the size (dpi) to see what would happen...perhaps even removing the 'CPU Usage' header just to show the core usages as well.

    Also, I think your screen dpi is slightly different than mine as well. I lose the last core reading, see pic

    e3yve6yq.jpg

    Yes you can add clock date back just edit the xml and my dpi is 320
    1
    Yes you can add clock date back just edit the xml and my dpi is 320

    I never edited out my clock and date in the xml file. It just didn't show up (must be overlapping with the cpu usage). I'm wondering if I need to increase the size of my status bar header??