[MOD] Add Flashlight LED Quick Toggle to SystemUI

croxray

Member
May 23, 2014
20
23
0
You will need SQLite Editor: https://play.google.com/store/apps/details?id=com.speedsoftware.sqleditor
p.s take a backup before you do anything!!
Torch app is not my work.

Screenshot_2014-07-01-03-08-51.png

How to install:
-Place SystemUI.apk and SecSettings.apk in /system/priv-app/ and set right permissions (rw-r-r)
-Place Torch.apk in /system/app/ and set right permissions (rw-r-r)
-Open SqLite Editor and navigate to:/data/data/com.android.providers.settings/databases/ and open settings.db
-Press the "system" line and search for "notification_panel_active_app_list" and highlight it; then press the edit icon at the top
-In the "value" field add ";Flashlight" , then Save and close the program
-Reboot your device. Now you should have the flashlight toggle in the notification panel.​


Modding Settings:
Decompile SecSettings and navigate to com/android/settings
Open NotificationPanelMenu.smali and search for the method ".method private makeConvertPanelName"
Make sure that the following lines are present somewhere in the makeConvertPanelName method.

iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
const-string v1, "Flashlight"
const-string v2, "notification_panel_flashlight"
invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/ObjectLjava/lang/Object;

AND

iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
const-string v1, "notification_panel_flashlight"
const-string v2, "Flashlight"
invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/ObjectLjava/lang/Object;

If the 8 lines above are not anywhere in the "makeConvertPanelName" method, then add them to the end of the method before the return-void.
Now save the file and close it and navigate to SecSettings/res/values/strings.xml
Add the following line to your strings.xml if it does not already exist:
<string name="notification_panel_flashlight">Flashlight</string>
Save and close strings.xml and navigate to SecSettings/res/drawable-xxhdpi
Extract the notification_panel_flashlight.png from attachment.zip/SecSettings and copy it into the drawable folder from above
Finally, recompile SecSettings with your modifications

Modding SystemUI
Decompile SystemUI.apk and navigate to com/android/systemui/statusbar/policy/quicksetting in your file browser
Copy and paste FlashlightQuickSettingButton.smali from inside the zip you downloaded (flashlight_files.zip/SystemUI/FlashlightQuickSettingButton.smali) into this folder
Navigate to SystemUI/res/drawable-xxhdpi
Copy and paste the two pngs (tw_quick_panel_icon_flashlight_off.png and tw_quick_panel_icon_flashlight_on.png) from the SystemUI folder of the attachment into the decompiled drawable folder you opened above
Now navigate to SystemUI/res/values and open the strings.xml with your text editor
Search for "quickpanel_flashlight_text". If it does not exist anywhere in the file, add this to the bottom of your strings.xml file:
<string name="quickpanel_flashlight_text">Flashlight</string>
Now recompile SystemUI.apk
After that you have to copy META-INF and AndroidManifest.xml from the original to the modded apk.
Then extract the MODDED apk again and open com/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton.smali and res/values/public.xml
Now you have to make the ids for the pictures the same as the ones declared in public.xml. Search for "flashlight" in public.xml.
Now find the ids which do not match and replace the ones in the smali files with the ones from the public.xml files.
Recompile your SystemUI.apk and follow the rest of the steps from the thread.
note: never make a reset in settings notification panel toggles rearrangment because it will remove your flashlight toggle from settings.

I don't have the png files anymore, but you can pull them from the apks attached here.
 

Attachments

Last edited:

asia559571

Senior Member
Jul 14, 2013
498
247
73
Hi croxray! Really like the idea of this mod but I'm on stock S4 i9500, Odexed 4.4.2 XXUFNB3. I want to keep the SystemUI as is but have your Flashlight Quick Toggle, would this be possible? if so will it help if I sent you a copy of my SystemUI.apk to modify. Thanks in advance & Kind Regards to You :highfive:
 

croxray

Member
May 23, 2014
20
23
0
Hi croxray! Really like the idea of this mod but I'm on stock S4 i9500, Odexed 4.4.2 XXUFNB3. I want to keep the SystemUI as is but have your Flashlight Quick Toggle, would this be possible? if so will it help if I sent you a copy of my SystemUI.apk to modify. Thanks in advance & Kind Regards to You :highfive:
Send me your secsettings.apk and systemui.apk and i will modify it for you tomorrow in the evening. :)
 
  • Like
Reactions: asia559571

donkeyhigh

Member
Mar 9, 2012
49
10
0
Would this work for Note3 n9005 with v23 omega rom?
Please say yes, the volume up Xposed torch thing is really unreliable, and I use the torch allot.. :-\
 

WerWolv

Senior Member
Mar 17, 2014
159
175
0
Bern
You should just make the Mod for the most popular ROMs. Like PhoeniX, Omega, Echo, Eudemony, etc.
When you give me the files you've edited, i'll help you and upload the modified SystemUIs :3
 

churapa

Senior Member
Jun 12, 2008
1,897
4,874
0
48
@croxray You SHOULD do whatever you want, we are not the ones to tell YOU what to do.
The most popular ROMs have already included this mod.
We can download your files and compare to the ones we want to mod and do it ourselves, that's what I did, remember?
Thanks for making this possible.
 

croxray

Member
May 23, 2014
20
23
0
@croxray You SHOULD do whatever you want, we are not the ones to tell YOU what to do.
The most popular ROMs have already included this mod.
We can download your files and compare to the ones we want to mod and do it ourselves, that's what I did, remember?
Thanks for making this possible.
Sure I remember :) you're welcome. As for other replies, I am now going to college so I try to focus on that :) have a nice day
 
  • Like
Reactions: aaatso and churapa

aaatso

Senior Member
Dec 29, 2013
519
476
83
question

You should just make the Mod for the most popular ROMs. Like PhoeniX, Omega, Echo, Eudemony, etc.
When you give me the files you've edited, i'll help you and upload the modified SystemUIs :3
IS THERE mod that works on echoe rom v.36.1
 

croxray

Member
May 23, 2014
20
23
0
Modding Settings:
Decompile SecSettings and navigate to com/android/settings
Open NotificationPanelMenu.smali and search for the method ".method private makeConvertPanelName"
Make sure that the following lines are present somewhere in the makeConvertPanelName method.

iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
const-string v1, "Flashlight"
const-string v2, "notification_panel_flashlight"
invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/ObjectLjava/lang/Object;

AND

iget-object v0, p0, Lcom/android/settings/NotificationPanelMenu;->mConvertPanelItemstring:Ljava/util/HashMap;
const-string v1, "notification_panel_flashlight"
const-string v2, "Flashlight"
invoke-virtual {v0, v1, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/ObjectLjava/lang/Object;

If the 8 lines above are not anywhere in the "makeConvertPanelName" method, then add them to the end of the method before the return-void.
Now save the file and close it and navigate to SecSettings/res/values/strings.xml
Add the following line to your strings.xml if it does not already exist:
<string name="notification_panel_flashlight">Flashlight</string>
Save and close strings.xml and navigate to SecSettings/res/drawable-xxhdpi
Extract the notification_panel_flashlight.png from attachment.zip/SecSettings and copy it into the drawable folder from above
Finally, recompile SecSettings with your modifications

Modding SystemUI
Decompile SystemUI.apk and navigate to com/android/systemui/statusbar/policy/quicksetting in your file browser
Copy and paste FlashlightQuickSettingButton.smali from inside the zip you downloaded (flashlight_files.zip/SystemUI/FlashlightQuickSettingButton.smali) into this folder
Navigate to SystemUI/res/drawable-xxhdpi
Copy and paste the two pngs (tw_quick_panel_icon_flashlight_off.png and tw_quick_panel_icon_flashlight_on.png) from the SystemUI folder of the attachment into the decompiled drawable folder you opened above
Now navigate to SystemUI/res/values and open the strings.xml with your text editor
Search for "quickpanel_flashlight_text". If it does not exist anywhere in the file, add this to the bottom of your strings.xml file:
<string name="quickpanel_flashlight_text">Flashlight</string>
Now recompile SystemUI.apk
After that you have to copy META-INF and AndroidManifest.xml from the original to the modded apk.
Then extract the MODDED apk again and open com/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton.smali and res/values/public.xml
Now you have to make the ids for the pictures the same as the ones declared in public.xml. Search for "flashlight" in public.xml.
Now find the ids which do not match and replace the ones in the smali files with the ones from the public.xml files. I put comments in the smali file so you know what is what.
Recompile your SystemUI.apk and follow the rest of the steps from the thread.
note: never make a reset in settings notification panel toggles rearrangment because it will remove your flashlight toggle from settings.
 
  • Like
Reactions: ambasadii

croxray

Member
May 23, 2014
20
23
0
I shared the full method, however I don't own Galaxy S4 for like 6 months so I don't have the png files for the flashlight anymore, you can decompile apk's from the first post and then take the png files from there. happy modding ;)
 
  • Like
Reactions: PutraMasyers97