[Galaxy S 4 Themes and Apps] croxray:
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.

View attachment 2844750

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.