Quantcast
Viewing all articles
Browse latest Browse all 352

[MOD] [GUIDE] [JB BLK1] LockScreen Torch with toggle

Here is a new LockScreen Torch MOD updated for use on the new JB leak BLK1. I have made a few changes this time around (hopefully fr the better :) )

This new version (due to code within android.policy.jar) allows the torch to stay on until the screen times out or you unlock it. No need to hold the button in. Again, not my doing, just changes in the policy.

I have implemented a toggle to allow the user to enable or disable the torch. I did this because I love toggles, Im on a toggle kick right now :)

****EDIT****
This is an updated version to the LockScreen Torch guide.
It is for the newest firmware BLK1
It now includes an on/off toggle located in LockScreen Settings
Enjoy!



THE FLASHABLE ZIP IS MEANT FOR STOCK BLK1 DEODEXED ROMs. IT WILL ADD A FEW OTHER MODs AS WELL. IF YOUR ON A CUSTOM ROM IT WILL PROBABLY STILL WORK BUT IT WILL BREAK ANY THEMES YOU MAY HAVE.



The lockscreen torch will allow you to quickly turn on your flashlight from the lockscreen. Simply push the home button in for torch, it will go off when you unlock, hit the power button or it times out. Not sure who originally wrote the MOD but I have spent some time re-writing it to fit the GS3 based on a dozen or so other tutorials.

After reboot, it will take about 60 seconds before the MOD will engage. Then it will work at will as long as you are on the lockscreen.

DEVs if you want to use this in your ROM feel free, just shoot me some credit and some thanks!

Hit the Thanks Button!

Here is the guide.....

GUIDE New Version with toggle! For BLK1


 

First you will need to download the torch file below and drop it in /system/app, do not install.....just drop in the folder. This will be in the zip file with the smali files.

We will be working with two system files
SecSettings.apk
android.policy.jar

We will begin with SecSettings

Navigate to res/values/strings

Add the following lines somewhere in the middle or end, it doesnt matter.

 
Code:

    <string name="enable_lockscreen_torch">LockScreen Torch</string>
    <string name="enable_lockscreen_torch_text">Enables torch for lockscreen</string>



Navigate to res/xml/Lockscreen_Settings.xml

Add the following lines in RED (this assumes you have the aosplock also, if not just ignore it)

 
Code:

<PreferenceCategory android:title="@string/display_settings" />
    <CheckBoxPreference android:title="@string/enable_aosp_lock" android:key="enable_aosp_lock" android:summary="@string/enable_aosp_lock_text" />
        <CheckBoxPreference android:title="@string/enable_lockscreen_torch" android:key="enable_lockscreen_torch" android:summary="@string/enable_lockscreen_torch_text" />
    <SwitchPreferenceScreen android:title="@string/lock_screen_shortcut_title" android:key="lock_screen_shortcut" android:summary="@string/lock_screen_shortcut_summary">
        <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.lockscreenshortcut.LockScreenShortcutSettings" />
    </SwitchPreferenceScreen>



Navigate to com/android/settings/LockScreenSettings.smali

Add the following code in RED (again, this assumes you havethe AOSP lockscreen. If not, ignore that code)

 
Code:

.method private updateState()V
    .locals 9

    .prologue
    const/4 v5, 0x1

    const/4 v6, 0x0

    .line 263
        iget-object v7, p0, Lcom/android/settings/LockScreenSettings;->mLockScreenTorch:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    const-string v8, "enable_lockscreen_torch"

    invoke-static {v4, v8, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v4

    if-eqz v4, :cond_7

    move v4, v5

    invoke-virtual {v7, v4}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 265
    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4
       
    iget-object v7, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    const-string v8, "enable_aosp_lock"

    invoke-static {v4, v8, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v4

    if-eqz v4, :cond_7

    move v4, v5

    invoke-virtual {v7, v4}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 265
    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    iget-object v7, p0, Lcom/android/settings/LockScreenSettings;->mClock:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    const-string v8, "show_clock"

    invoke-static {v4, v8, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v4

    if-eqz v4, :cond_7



 
Code:

:cond_0
    const-string v9, "clock"

    invoke-virtual {p0, v9}, Lcom/android/settings/LockScreenSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v9

    check-cast v9, Landroid/preference/CheckBoxPreference;

    iput-object v9, p0, Lcom/android/settings/LockScreenSettings;->mClock:Landroid/preference/CheckBoxPreference;

    .line 159
    iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mClock:Landroid/preference/CheckBoxPreference;

    const/4 v10, 0x0

    invoke-virtual {v9, v10}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V

    const-string v9, "enable_aosp_lock"

    invoke-virtual {p0, v9}, Lcom/android/settings/LockScreenSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v9

    check-cast v9, Landroid/preference/CheckBoxPreference;

    iput-object v9, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;

    .line 159
    iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;

    const/4 v10, 0x0

    invoke-virtual {v9, v10}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V
       
        const-string v9, "enable_lockscreen_torch"

    invoke-virtual {p0, v9}, Lcom/android/settings/LockScreenSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v9

    check-cast v9, Landroid/preference/CheckBoxPreference;

    iput-object v9, p0, Lcom/android/settings/LockScreenSettings;->mLockScreenTorch:Landroid/preference/CheckBoxPreference;

    .line 159
    iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mLockScreenTorch:Landroid/preference/CheckBoxPreference;

    const/4 v10, 0x0

    invoke-virtual {v9, v10}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V

    .line 161
    const-string v9, "weather"

    invoke-virtual {p0, v9}, Lcom/android/settings/LockScreenSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v9



 
Code:

:cond_9
    iget-object v4, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v4}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_b

    .line 338
    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    const-string v5, "wake_up_lock_screen"

    iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v6}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v6

    if-eqz v6, :cond_a

    :goto_5
    invoke-static {v4, v5, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1

    :cond_a
    move v2, v3

    goto :goto_5

    :cond_b
    iget-object v4, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v4}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v4

  if-eqz v4, :cond_d

    .line 313
    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    const-string v5, "enable_aosp_lock"

    iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mAospLock:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v6}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v6

    if-eqz v6, :cond_c

    :goto_6
    invoke-static {v4, v5, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 314
    goto/16 :goto_1

    :cond_c
    move v2, v3

    .line 313
    goto :goto_6
       
        :cond_d
    iget-object v4, p0, Lcom/android/settings/LockScreenSettings;->mLockScreenTorch:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v4}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_0

    .line 400
    invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    const-string v5, "enable_lockscreen_torch"

    iget-object v6, p0, Lcom/android/settings/LockScreenSettings;->mLockScreenTorch:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v6}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v6

    if-eqz v6, :cond_e

    :goto_7
    invoke-static {v4, v5, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 450
    goto/16 :goto_1

    :cond_e
    move v2, v3

    .line 550
    goto :goto_7
    .line 600
.end method

.method public onResume()V



Thats it for SecSettings!

Now for android.policy.jar


See next post to continue.......

Attached Thumbnails
Attached Files
Image may be NSFW.
Clik here to view.
File Type: apk
Torch.apk - [Click for QR Code] (158.9 KB)

Viewing all articles
Browse latest Browse all 352

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>