yashsingh1/xdaforums huggingface dataset:
[Sprint Samsung Galaxy S III] talkingmonkeys:
So I edited the smali that was already in there with tdunham's code and did everything else for the systemui and flashed the enable zip but the toggle will not show up in quicksettings. Not exactly sure what I did wrong. Tried deleting the flashlightobserver smali and it recompiled but that didn't do the trick, Guess I'm going to try again and see if editing cnexus' with tdunham's code will make it work but it won't recompile for me and just keeps giving me this. I'm not that great with understanding smali so any help would be appreciated. Also it shows up in settings so I did that correctly at least.

I: Using Apktool 2.0.0-Beta9 on SystemUI.apk

I: Smaling...

..\_working\SystemUI.apk\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuickSettingButton.smali[90,4] Error for input '.parameter': Invalid directive

..\_working\SystemUI.apk\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuickSettingButton.smali[90,15] mismatched input '"paramBoolean"' expecting END_METHOD_DIRECTIVE

Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton.smali

at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:72)

at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)

at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)

at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:338)

at brut.androlib.Androlib.buildSources(Androlib.java:299)

at brut.androlib.Androlib.build(Androlib.java:285)

at brut.androlib.Androlib.build(Androlib.java:258)

at brut.apktool.Main.cmdBuild(Main.java:236)

at brut.apktool.Main.main(Main.java:88)

----------------

Recompile Not Successful!

Edit: I used the edits from the above post and it recompiled. Fingers crossed it worked.
[Sprint Samsung Galaxy S III] Versatile1:
If you are using apktool 2.0.0 then you will need to make changes above to recompile.
[Sprint Samsung Galaxy S III] talkingmonkeys:
Thank you. I was a little thrown off thinking that was just for the s5 but thats what made it recompile for me. Fingers crossed it fixed my problem also. :good:

Edit: Nope now it just force closes. Even with adding flashlightobserver.smali back. Guess I'll look into it more when I get home and see what I messed up. attatched my working folder for systemui if anyone wants to take a look

http://d-h.st/z31
[Sprint Samsung Galaxy S III] CNexus:
Flashlight observer? There should only be one smali file you are adding and that's the flashlightquicktoggle.smali file.
[Sprint Samsung Galaxy S III] talkingmonkeys:
Sorry I didn't mean adding it. It was already in there. So I should delete it then? Also there's another string in my values/strings for notificationpanel flashlight toggle instead of quicksetting. Removing that string didn't work for me either. About to give it another crack tonight and see if I can get it not to force close.

Edit: Yea I'm not having any luck with this at all. Just keep getting force closes on boot unless I leave the original FlashLightQuickSettingButton.smali. So leaving the original file but when I copied my edited ones contents into that one I got a force close then it loaded and I grabbed a log thats attatched. The toggle was there but said "null" and didn't have the icon.

Do I need to add anything to public.xml or something else that I'm missing here? I tried doing that and then it won't recompile.

After spending way too much time on this I finally figured it out. You will have to add these to the values/public.xml file and then search for 0x7f020032, 0x7f020033 and 0x7f0b0214. Delete each of the apktooldummy's that it gives you that use the same id. Then replace the right code in the right spot in the smali.

<public type="drawable" name="tw_quick_panel_icon_flashlight_on" id="0x7f020032" />
<public type="drawable" name="tw_quick_panel_icon_flashlight_off" id="0x7f020033" />

<public type="string" name="quickpanel_flashlight_text" id="0x7f0b0214" />

Sent from my SGH-I747 on 4.4.2 TW ND8 Port
[Sprint Samsung Galaxy S III] CNexus:
Ah, I see what you mean. yes you should delete the flashlightobserver smali file because this method of activating the flashlight is completely different from samsung's implementation of it
[Sprint Samsung Galaxy S III] Chad The Pathfinder:
[MENTION=1042140]tdunham[/MENTION], I didn't know you are on the S5? This is very cool. I can't wait to try this! :thumbup:
[Sprint Samsung Galaxy S III] talkingmonkeys:
Heres how I did it to stick off install in my rom along with mobile data toggle because arrays in secsettingsprovider.apk didn't work.

Goto system/csc and edit the feature.xml file

Search for the Settings section that will be marked (<!-- Settings -->) and add these 2 lines to the bottom of it. There are many other toggles that are hidden that work on ND8 for example SmartNetwork, ToddlerMode (Network Restriction but the toggles are missing from systemui), WiFiHotspot. Those are just the ones I've tested that I know work correctly. The others may need a few edits to fix up but if you look inside secsettingsprovider.apk in values/arrays.xml you will find a lot of the other ones that they left in there.

<CscFeature_Setting_DefNotificationPanelOrder>Wifi;MobileData;Location;SilentMode;AutoRotate;Bluetooth;DormantMode;PowerSaving;AllShareCast;MultiWindow;SBeam;Nfc;DrivingMode;SmartStay;Sync;AirplaneMode;Flashlight</CscFeature_Setting_DefNotificationPanelOrder>
<CscFeature_Setting_DefQuickPanelOrder>Wifi;MobileData;Location;SilentMode;AutoRotate;Bluetooth;DormantMode;PowerSaving;AllShareCast;MultiWindow;SBeam;Nfc;DrivingMode;SmartStay;Sync;AirplaneMode;Flashlight</CscFeature_Setting_DefQuickPanelOrder>
[Sprint Samsung Galaxy S III] tdunham:
I think someone told me the csc feature edit for the S5 build doesn't work but who knows, maybe they were doing it wrong. LOL

Since I haven't tried this with our build personally but I'll give it a try and report back. I seem to recall that the feature edit only works with a fresh rom flash. If the settings.db already exists, it will not work. Same applies for dirty flashing over an existing rom to do an upgrade or repair.

---------- Post added 31st May 2014 at 12:03 AM ---------- Previous post was 30th May 2014 at 11:30 PM ----------

Update:

Very nice. The features.xml edit do work with our build. Fresh flash only of course.

---------- Post added at 12:08 AM ---------- Previous post was at 12:03 AM ----------

Does anyone happen to know how to fix the way the toggle displays here in the attached screenshot?

The notification panel editor is the only place it displays this way. All the other areas it's just fine.
[Sprint Samsung Galaxy S III] CNexus:
That's just an image thing, you'd need to manually edit the image to add the rounded style that the other images have
[Sprint Samsung Galaxy S III] tdunham:
You would think so right?

I think it's a background or something. All the quickpanel images are similar (not circular) so I'm just not sure why it only does it in the editor.
[Sprint Samsung Galaxy S III] CNexus:
Yeah it's weird though because it should add it automatically if it's doing the background via smali in that case
[Sprint Samsung Galaxy S III] Versatile1:
I can upload it if you want.
[Sprint Samsung Galaxy S III] tdunham:
Yes please. I'd like to try it.
[Sprint Samsung Galaxy S III] Versatile1:
S5-Flashlight_Files
[Sprint Samsung Galaxy S III] Androidwarrior:
Is there a file I can just flash and it does it all for us?
[Sprint Samsung Galaxy S III] CNexus:
If you're asking that, then this thread is not for you
[Sprint Samsung Galaxy S III] Androidwarrior:
So lead me in the right direction fellow xda member.
[Sprint Samsung Galaxy S III] tdunham:
This thread is for your phone right?

KitKat flashlight toggle
[Sprint Samsung Galaxy S III] Ticklefish:
I hate to seem like a beggar but could I ask for help porting this over my KK rom? I'm using a Sony Xperia Z and naturally the Xperia KK smali is significantly different from the Touchwiz code. And I'm not smart enough to work out what to do..:crying:
[Sprint Samsung Galaxy S III] the_original_teknikl:
i have a quick question... and if theres a better place, please direct me.. just thought this would be the best place since you built the flashlight toggle mod and im having a toggle issue

i'm on wicked x rom, me and bilgerryan got the flashlight toggle figured out following your thread....

i've also flashed his more and extra toggles zip to add more togglles including toddler mode/network restriction mode.... however, the icon for that specific toggle does not show up,

bilgerryan is not sure where to look for that issue,

ive tried searching the smali for toddler/network restriction mode and xml for toddler/network restriction mode, i then created pngs named accordingly and rebuilt the apk and still no icons for network restriction toggle..... ive posted a screenshot in my pcb thread in post 3 (the screenshot of pcb wifi icons has the missing toggle icon) linked in my signature, and also in the wicked x thread....

since you wrote this for the flashlight toggle and got it directed at specific images... i was wondering if you would be able to instruct me on how to direct one of the other toggles towards a specific image... specifically the network restriction (thats hows its named in the pulldown menu) aka toddler mode (thats how its referred to as in the coding)....

any help or direction would be greatly appreciated....
[Sprint Samsung Galaxy S III] The Sickness:
Not too sure if this would work, but have you added the toggle to CSC/feature.xml?

Haters Make Me Famous

Deviant Team Member
[Sprint Samsung Galaxy S III] the_original_teknikl:
Does it matter that the toggle already shows and is usable.... Simply the icon doesn't show..... Would adding it there (and I'm assuming it already is due to the toggle showing and working already just no icon) make a difference?

Sent from a Wicked Virgin Mobile Samsung Galaxy S3 running KT747 Kernel on KITKAT Touchwiz.
[Sprint Samsung Galaxy S III] The Sickness:
Oh ok. No need to add it to CSC then.....have you tried to push the image in with 7 zip?

Haters Make Me Famous

Deviant Team Member
[Sprint Samsung Galaxy S III] the_original_teknikl:
i have, but nothing shows up.. ive search and named the pngs what i

THINK

they should be named, based off the names in the xml's and smali's... but still no go...

not sure exactly what im supposed to be looking for as to what the name of the pngs should be for this toggle.... i may be naming the images wrong but cant find where they are named...

that may be the issue... just need help on WHAT DESIGNATES the png's name for the toggle icon, and WHAT FILE that line would be in....

again.. if i am in the wrong thread please direct me as this appeared to be the best place based on my search (since its similiar and gs3 specific)

thanks again for any help
[Sprint Samsung Galaxy S III] CNexus:
The ids referenced in the toggle smali need to match the ids of the toggle images you added
[Sprint Samsung Galaxy S III] CNexus:
The ids referenced in the toggle smali need to match the ids of the toggle images you added

Located in the toddlermodeYYY.smali at com/android/systemui/statusbar/policy/quicksetting
[Sprint Samsung Galaxy S III] the_original_teknikl:
So it is in the toddlermodbutton.smali code?

I thought I named them the same... But guess I'll have to try again... I didn't change anything in smali.... Just tried to match the png names to what is in smali with no luck..... Maybe the wrong smali file??

I'll take a look again tomorrow evening.. Thanks again.

Sent from a Wicked Virgin Mobile Samsung Galaxy S3 running KT747 Kernel on KITKAT Touchwiz.
[Sprint Samsung Galaxy S III] CNexus:
The images are referenced by id in the smali, not by name

You need to change the ids to the ids of the images you added
[Sprint Samsung Galaxy S III] the_original_teknikl:
Welp... That's a little advanced for me at this point in time.... That explains why I couldn't get it to work...

I'll continue to try and guess/attempt to research/understand the id thing lol..... But someone better than me will prolly figure it out before me....

Thanks for clearing this up for me... Appreciate the help

My ocd can rest a little now, knowing I am currently not capable of this feat.... (Yet)...

Again... Thanks for clearing up why it wasn't working my way :)

Sent from a Wicked Virgin Mobile Samsung Galaxy S3 running KT747 Kernel on KITKAT Touchwiz.
[Sprint Samsung Galaxy S III] tdunham:
A value is assigned to every string and png file (other stuff too but for our purposes this is what we need for this) in res/values/public.xml.

If you look at my smali http://xdaforums.com/showpost.php?p=52947352&postcount=283 you will see the comments I added to the public value lines.

For instance the line:

const v4, 0x7f020354 ## tw_quick_panel_icon_flashlight_off

0x7f020354 is the public value assigned to the png file called tw_quick_panel_icon_flashlight_off

There are 5 public.xml values you need to change so they match YOUR SystemUI.apk.

After you recompile and decompile the first time, open res/values/public.xml and search for the text in the blue field (example quoted above) quickpanel_flashlight_text and change the value 7f0b0211 to whatever the one in your public.xml file is. Do the same for all 5 values in the smali, recompile one last time and you should be good to go.
[Sprint Samsung Galaxy S III] the_original_teknikl:
I'm at work right now.. But will def take a look at this tonight....

Thanks man.

Edit. Still at work and haven't had a chance to look at it yet... But wanted to say thank you for pointing me in the right direction.... Knew I was doing sething wrong... Just not WHAT... Not too good with smali but I'll look at it.... Thanks again.

Edit2: and yes, i know u were referring to xml, i was TRYING to convey...... im not good with smali, and thought thats where i needed to look, so ill take a look at what you said to look at........ obviously i didnt say that clearly in the first edit so i wanted to clear that up lol, and i still might not figure it out tonight, but atleast i know what threads to search now so thanks again :)

edit: 3 i just now had the chance to see ur smali edit in your link above (busy day) but i atleast have a basis to work with so my statement above still stands... if someone else figures it out before me atleast i can say i tried lol but ill have a learners experience with the smale (quick learner btw, just NEVER done anything with smali)...last edit i promise, sorry

Sent from a Wicked Virgin Mobile Samsung Galaxy S3 running KT747 Kernel on KITKAT Touchwiz.
[Sprint Samsung Galaxy S III] the_original_teknikl:
first i want to say i promised i would not edit the above post again... this is not an edit so i didnt break my promise :p

second....

THANK YOU!!!! [MENTION=1042140]tdunham[/MENTION]

i got it figured out... thank you so much man...
[Sprint Samsung Galaxy S III] calebcabob:
S4?

Will this work on the i545? I have the fully unlocked bootloader version of the Verizon Samsung Galaxy S4, running Android 4.3 (Bonestock ROM). If not, any clue where I can begin to find such a Mod? I've searched deep and wide, this is the closest thing I've found.
[Sprint Samsung Galaxy S III] tdunham:
Maybe.

It would have to be rooted and deodexed.

And this is not a mod, it is only a guide.
[Sprint Samsung Galaxy S III] calebcabob:
Yes, its rooted and decodexed. OK. I had trouble finding the SystemUI.apk

---------- Post added at 01:45 PM ---------- Previous post was at 01:43 PM ----------

Oops. I'm dumb. I got it:)
[Sprint Samsung Galaxy S III] TylerMarshall256:
I dont have a 'com/android/systemui/statusbar/policy/quicksetting' folder. I'm on the ATT galaxy though. Does anyone know where I'm suppose to put the 'FlashlightQuickSettingButton.smali' file at?
[Sprint Samsung Galaxy S III] The Sickness:
It's in SystemUI dex

Haters Made Me Famous

Deviant Development Team Member
[Sprint Samsung Galaxy S III] talkingmonkeys:
The mod is already in my update for likewise which is what you're on. Look in the thread for it.

Sent from my SGH-I747 running TW4.4.2 TMS3KK
[Sprint Samsung Galaxy S III] TylerMarshall256:
I dont have a 'dex' folder
[Sprint Samsung Galaxy S III] metalfan78:
The folder you are looking for is in smali/com/android. You are looking in res for it.
[Sprint Samsung Galaxy S III] TylerMarshall256:
Alright I see it now. Thanks. I kinda wanted to do it myself but since it's already been made why waste your time.
[Sprint Samsung Galaxy S III] Gunthermic:
FlashLight Mod

Need some help all..

Galaxy tab Pro 8.4

Android 4.4.2

Using the OP's 4.4 Kit-Kat files.. smali

Flashlight does work, however the images are screwy... Android 4.4.2 uses a Rounded BG and overlays the Toggle image ontop... I can't for the life of me figure out how to possible fix it...

Anyone get it to display correctly on Android 4.4.2 that uses the newer style of Rounded BG

First shot even though you can't see it very well is the White Flashlight Image, and second is when it's on(green).. Yes I know no theming done yet.

Images sizes are 168x168 in drawbale-sw800dp-xhdpi

Problems/Issues:

1. Newer Kit-Kat doesnt use the line under image anymore..

2. It uses a Round BG as background resource and lays the toggle(only a white image) on top.When Of/Onn changes color of Rounded BG Image..
[Sprint Samsung Galaxy S III] Versatile1:
Use the ones for the S5
[Sprint Samsung Galaxy S III] Gunthermic:
Thanks for answering. However use ones for S5?

Unless I missed them, didnt see those in OP. I know someone said S5, but never saw a post of how on S5...
[Sprint Samsung Galaxy S III] metalfan78:
Did you add the images to both SecSettings and SystemUI?
[Sprint Samsung Galaxy S III] Gunthermic:
Settings are not the issue. That all works perfect.

It's just the part of the toggles as previously shown

Sent from my SM-T320 using Xparent BlueTapatalk 2
[Sprint Samsung Galaxy S III] metalfan78:
That happened to me before and I didn't have all the png's in the correct places, that's why I asked.

---------- Post added at 06:32 AM ---------- Previous post was at 06:30 AM ----------

https://www.dropbox.com/s/bm0h9d1zdo0nc47/Flashlight_Files_S5.zip

https://www.dropbox.com/s/yjo9w9jzxhxrcmp/FlashlightQuickSettingButton.zip

Try these
[Sprint Samsung Galaxy S III] tdunham:
Try the S5 image files posted here. May need to fiddle with filenames, I don't recall exactly.

http://xdaforums.com/showpost.php?p=53044798&postcount=305
[Sprint Samsung Galaxy S III] metalfan78:
Mine is fine, the files I posted are the same ones tdunham linked to. They both should work.
[Sprint Samsung Galaxy S III] Gunthermic:
I applied the s5 files, and now I get nothing at all. No FC's, just nothing in Quicksettings. (No flashlight) everythign else is fine..

add the smali file, add the correct public id's to it...

Here is an example of the Constructor on this Kit-Kat tablet: Anyone wanna try to convert it over for flashlight??

.method public constructor <init>(Landroid/content/Context;)V
.locals 7

const/4 v2, 0x0

const v1, 0x7f0a00db [COLOR="Red"]#tw_quick_panel_icon_bluetooth_dim[/COLOR]

const/4 v5, 0x0

sget-boolean v0, Lcom/android/systemui/statusbar/Feature;->mUseJellyBeanGUI:Z

if-nez v0, :cond_0

const/4 v0, 0x1

:goto_0
invoke-direct {p0, p1, v2, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;Z)V

iput-object v2, p0, Lcom/android/systemui/statusbar/policy/quicksetting/BluetoothQuickSettingButton;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

new-instance v0, Lcom/android/systemui/statusbar/policy/quicksetting/BluetoothQuickSettingButton$1;

invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/BluetoothQuickSettingButton$1;-><init>(Lcom/android/systemui/statusbar/policy/quicksetting/BluetoothQuickSettingButton;)V

iput-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/BluetoothQuickSettingButton;->mIntentReceiver:Landroid/content/BroadcastReceiver;

sget-boolean v0, Lcom/android/systemui/statusbar/Feature;->mUseJellyBeanGUI:Z

if-eqz v0, :cond_1

const v2, 0x7f0201dd [COLOR="red"]#tw_quick_panel_icon_bluetooth_on[/COLOR]

const v3, 0x7f0201dc [COLOR="red"]#tw_quick_panel_icon_bluetooth_off[/COLOR]

const v4, 0x7f0201db [COLOR="red"]#tw_quick_panel_icon_bluetooth_dim[/COLOR]

move-object v0, p0

move v6, v5

invoke-virtual/range {v0 .. v6}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->initLayout(IIIIII)V

:goto_1
invoke-virtual {p0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->setListener(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;)V

return-void

:cond_0
move v0, v5

goto :goto_0

:cond_1
const v0, 0x7f0201de [COLOR="red"]#tw_quick_panel_icon_bluetooth_round[/COLOR]

invoke-virtual {p0, v1, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->initLayout(II)V

goto :goto_1
.end method
[Sprint Samsung Galaxy S III] metalfan78:
And you added the string? I'm just trying to narrow down the easy things first. Did you flash the 'enable' zip as well?
[Sprint Samsung Galaxy S III] tdunham:
I already did a converted smali for Kitkat for this.

It starts at post 283. Read onward from there, I think there was additional info that may apply I can't recall.

http://xdaforums.com/showpost.php?p=52947352&postcount=283
[Sprint Samsung Galaxy S III] Gunthermic:
Yes I tried that. It does not work on tablet. Using code from post causes flashlight to not even show.

I dont need to flash any enable stuff. As the orginial smali code from op cause 100% function of flashlight. Only issues is the way the images are handled in tablet version of kitkat.. my flashlight toggle is set in settingsprovider. So it permanently. Notification panel is perfect..

I appriciate both of u trying to help. What xda is about.. I might not be explaining myself right.

Sent from my SCH-I545 using Xparent BlueTapatalk 2
[Sprint Samsung Galaxy S III] tdunham:
Did you do anything with method onclick?

Compare mine with yours from Post 283 to see if there are differences. I think I may have modified that method as well, I just can't recall its been a while since I looked at it.
[Sprint Samsung Galaxy S III] Gunthermic:
No have not modified onclick. Cause I can't understand it.... I am sure the the code in constructor has to marry up?

I will look at you onclick... but the constructor code I posted above is quite a bit diff

Sent from my SM-T320 using Xparent BlueTapatalk 2
[Sprint Samsung Galaxy S III] tdunham:
I think it is because I used a different method to decompile mine.

I will take a look later but I think the onclick in mine is different than the one from the OP. Oldtimer memory though so I will look later. :rolleyes:

---------- Post added at 02:07 PM ---------- Previous post was at 02:02 PM ----------

Also, if you have time, have you tried using my entire modified flashlight quicksettings smali but just changing the public values yet?
[Sprint Samsung Galaxy S III] Gunthermic:
Yes I replaced and used yours... images didn't work. Flashlight turns on/off... so I rewrote the constructor.. now the images appear correct. But now onclick fails to work...

See my delima? Your straight s5 changes don't work...

Sent from my SM-T320 using Xparent BlueTapatalk 2
[Sprint Samsung Galaxy S III] CNexus:
Logcat please and I'll see if I can whip up a fixed onClick method for you
[Sprint Samsung Galaxy S III] tdunham:
Actually, I did those changes for the Galaxy SIII, but no matter.

I think you should go back to what worked and figure out what your image problem is from there. Modifying the onclick method wasn't/isn't necessary if it was working to begin with, the only issue being the images not displaying properly. You are compiling/decompiling for values/then compiling one last time with final public values and not trying to use old public values for the images correct?

Same has to be done for SecSettings images too I think. Its been a while since I've done this. I know I got stuck for a while with it not showing at all also.