[Guide] LockScreen torch mod

rcheung28

Senior Member
Jul 27, 2012
199
14
0
Vancouver
It's in /system/framework but you will also need android.policy.odex which you will need to deodex to be able to see the smali files.

There is a thread in Samsung Galaxy SII Original Android Development by sicopat here: http://forum.xda-developers.com/showthread.php?t=1208320 which states how to deodex a jar file.

You will also need all of the other jar files from /system/framework to be able to deodex it properly.

If you need a hand or some tips, just ask.

Sent from my GT-I9505 using Tapatalk 4 Beta
Does that mean I'll have to deodex all of the files in framework in order for this mod to work?
 
  • Like
Reactions: Mzi.Rintu

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
Does that mean I'll have to deodex all of the files in framework in order for this mod to work?
No mate,

You just need to make sure that you have a folder on your computer with smali & baksmali in it as well as all the jar files from your framework folder. You will also need to take your android.policy.odex and put it in the same folder. Then you will need to follow the instructions in sicopat's thread.

Once you complete the command, you should have a new 'out' folder which contains all of the smali files from android.policy.odex

I hope this makes sense? Let me know if you need any other clarification.

Dave
 
  • Like
Reactions: rcheung28

rcheung28

Senior Member
Jul 27, 2012
199
14
0
Vancouver
No mate,

You just need to make sure that you have a folder on your computer with smali & baksmali in it as well as all the jar files from your framework folder. You will also need to take your android.policy.odex and put it in the same folder. Then you will need to follow the instructions in sicopat's thread.

Once you complete the command, you should have a new 'out' folder which contains all of the smali files from android.policy.odex

I hope this makes sense? Let me know if you need any other clarification.

Dave
If I have to android.policy.odex file in the folder, that means I don't have to deodex the android.policy.jar file?
 

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
If I have to android.policy.odex file in the folder, that means I don't have to deodex the android.policy.jar file?
You can't deodex the android.policy.jar file. There is essentially nothing in it. Look at the size of it. It should be about 1kb? Then look at android.policy.odex and it should be much much larger. An .odex file contains all of the information in it that you need to convert the apk or jar file from odexed to deodexed.

Once you smali the android.policy.odex file and get the 'out' folder, you will then need to make your mods to whatever smali files you need to. Then you will need to baksmali the out folder which will give you a new classes.dex file. If you want to deodex android.policy.jar, then you will need to use a program like 7Zip and place that classes.dex file in android.policy.jar but if you want to keep it odexed then you will need to follow sicopat's thread or use alkhafaf's guide on re-odexing here.

Any other questions, just ask.

Dave
 
  • Like
Reactions: rcheung28

rcheung28

Senior Member
Jul 27, 2012
199
14
0
Vancouver
So I bring all the smali/baksmali files, .jar/.odex files from framework, into the same folder. Execute android.policy.jar with 1.bat. Get a classout folder, work on the files based on this torch mod tutorial. After I'm done, compile it back using 2.bat. I get a .dex file, then I reodex it following sicopat's tutorial.

Is that the correct procedure?

p.s. Dave I appreciate all this help, you're explanations are very detailed, it's just that I'm still new and still need some guidance.

Edit: I went ahead and tried experimenting with smali/baksmali. In the classout folder, I'm not getting the KeyguardViewMediator$4.smali file.
 
Last edited:

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
So I bring all the smali/baksmali files, .jar/.odex files from framework, into the same folder. Execute android.policy.jar with 1.bat. Get a classout folder, work on the files based on this torch mod tutorial. After I'm done, compile it back using 2.bat. I get a .dex file, then I reodex it following sicopat's tutorial.

Is that the correct procedure?

p.s. Dave I appreciate all this help, you're explanations are very detailed, it's just that I'm still new and still need some guidance.

Edit: I went ahead and tried experimenting with smali/baksmali. In the classout folder, I'm not getting the KeyguardViewMediator$4.smali file.
You can either reodex it using sicopat's tutorial or using alkhafaf's auto odexer script. That should be the way you need to do it. I usually use alkhafaf's auto odexer script after I've deodexed and made my edits to smali files.

Mate it's no problems at all. I have had a lot of help on these forums from some awesome people, so I'm very happy to help anyone I can.

It should be in com/android/internal/policy/impl? Are you sure it's not there??
 
  • Like
Reactions: rcheung28

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
Yup I've tried redoing the entire process once more and I'm pretty sure it's not there. I'm running 4.0.4 ZSLPN downloaded from the stock rom thread.
Ahhhh I think it might be a different smali file for ICS. I believe that the guide is written about JB 4.1.2 maybe?

There might be a different smali file that you need to edit. Maybe search for that :catchall code that the OP states needs to be modified and go from there? Sorry I'm not very skilled in smali editing, it's like a foreign language to me :eek:
 
  • Like
Reactions: rcheung28

rcheung28

Senior Member
Jul 27, 2012
199
14
0
Vancouver
Ahhhh I think it might be a different smali file for ICS. I believe that the guide is written about JB 4.1.2 maybe?

There might be a different smali file that you need to edit. Maybe search for that :catchall code that the OP states needs to be modified and go from there? Sorry I'm not very skilled in smali editing, it's like a foreign language to me :eek:
It's all good. If all else fails, then I'll just access the torch thru a widget. Thanks so much for your help!
 

hunksahil

Senior Member
May 10, 2012
103
22
0
pune
installed widget locker and since then lock screen torch not working

please tell me what I need to do.. I installed paid version of widget locker from play store and since then I cannot access the lock screen torch..
what should I do so as it access this feature again?
 

efaustino84

Senior Member
Feb 13, 2013
773
257
0
Harare
got an odd error when i try to compile the change
Code:
C:\work\apktool\smali>java -jar smali.jar classout1 -o classes.dex
classout1\com\android\internal\policy\impl\KeyguardViewMediator$4.smali[258,3] L
abel "pswitch_7" is not defined.
classout1\com\android\internal\policy\impl\KeyguardViewMediator$4.smali[259,9] L
abel "pswitch_7" is not defined.
classout1\com\android\internal\policy\impl\KeyguardViewMediator$4.smali[261,9] L
abel "pswitch_7" is not defined.
classout1\com\android\internal\policy\impl\KeyguardViewMediator$4.smali[263,9] L
abel "pswitch_7" is not defined.
just compared to some of the file posted and it looks like i have the same content

ok found the issue
messed up in the first :pswitch_7 had something else there
 
Last edited:

jim256

Senior Member
Nov 26, 2007
900
21
0
I've been looking EVERYWHERE for this great feature...Does anyone know if this would work on the Galaxy Note II (AT&T)?

Thank you!
 

bratboo

Senior Member
Dec 20, 2009
782
244
0
@majdinj

Hi! Is there a way to make this same as MIUI where when you hold and long press the button to activate the torch and after maybe 2 or 3 sec it will lock on Torch On without the need to long press the home button anymore (this will also make the screen, screen off), To turn it off you just have to press the home button again.

Many Thanks!