[GUIDE][HOW-TO]Add Invisible Power Button to Status Bar

dipesh1502

Senior Member
Sep 16, 2013
2,400
3,832
0
MUMbai
Heya Guys Wassup

Today i Am Going to Teach You How To Add Invisible Power Button In The Status Bar


What it actually does is
it will add an invisible power button on the Clock on the Top Right of the Status Bar
By touching it once you can screen off
and by long pressing it you can access the power menu



Ready???
So Here We Go:angel:

STEP 1-Pull SystemUI.apk from Your Phone

STEP 2 -Decompile it

STEP 3-Open SystemUI/res/layout/status_bar.xml

STEP 4-Find These Lines At The End

Code:
<ImageView android:layout_gravity="top|left|center" android:id="@id/rounded_corner_ul" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ul" />
<ImageView android:layout_gravity="top|right|center" android:id="@id/rounded_corner_ur" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ur" />
</com.android.systemui.statusbar.phone.PhoneStatusBarView>


STEP 5-Add This Line

Code:
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="right" android:id="@id/home" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/screen_lock" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:keyRepeat="false" systemui:glowBackground="@drawable/ic_sysbar_highlight" androidrientation="vertical" />
So It Should Look Like This

Code:
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="right" android:id="@id/home" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/screen_lock" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:keyRepeat="false" systemui:glowBackground="@drawable/ic_sysbar_highlight" androidrientation="vertical" />
<ImageView android:layout_gravity="top|left|center" android:id="@id/rounded_corner_ul" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ul" />
<ImageView android:layout_gravity="top|right|center" android:id="@id/rounded_corner_ur" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rounded_corner_ur" />
</com.android.systemui.statusbar.phone.PhoneStatusBarView>




STEP 5-Save It And Close it


STEP 6-Copy The attached png to res/drawable-xhdpi and drawable/xxhdpi ( if available )


for hdpi devices add the png to drawable -hdpi
http://d-h.st/avH



STEP 6-Recompile and Sign Your Apk


To Use Copy To system/app with Permissions RW-R-R


Reboot And Enjoy And Dont Forget To Press The THANKS Button:laugh::good:



CREDITS


@Leo For the png and inspiration
 
Last edited:

mukulsoni

Senior Member
Aug 16, 2013
721
4,789
133
Bangkok
You can try with a backup
If it works then please report,:)
I just tried with my LG-P500 running cm-11, SysytemUI.apk and got this error while compiling it. Its showing "id with value @id/home" not matched", see the log. Appreciate your kind help.

Edit: Solve it by adding manually adding ids into value/ids.xml. Will try and see
 

Attachments

Last edited:

dipesh1502

Senior Member
Sep 16, 2013
2,400
3,832
0
MUMbai
I just tried with my LG-P500 running cm-11, SysytemUI.apk and got this error while compiling it. Its showing "id with value @id/home" not matched", see the log. Appreciate your kind help.

Edit: Solve it by adding manually adding ids into value/ids.xml. Will try and see
Theres no resource for rounded corners in your systemui.apk
Still i guess i have tried it
So test it and report:)
 
  • Like
Reactions: mukulsoni

mukulsoni

Senior Member
Aug 16, 2013
721
4,789
133
Bangkok
Last edited: