[Galaxy S II General] remuntada78:
GUIDE[How To]Change Unlock Lockscreen Effect "on the fly"

[YOUTUBE]PwnGTmq1qYY[/YOUTUBE]

work perfectly in my rom 4.1.2 xwlsd based

Before modding do a Nandroid Backup

thanks and credit to Goldie for his help to achieve this mod:good:

thanks and credit to Didact74 for how to add a listpreference:good:

To achieve you need:

SecSettings.apk

framework-res.apk

android.policy.jar

tool for decompile and compile like apktool 1.5.2;

tool for text edit like notepad++:

Start with SecSettings.apk:

Decompile SecSettings.apk ,go in res/xml ,open with text editor lockscreen_settings.xml and add the red line

<SwitchPreferenceScreen android:title="@string/weather" android:key="weather" android:summary="@string/weather_summary" />
[COLOR="Red"]<PreferenceCategory android:title="@string/lockscreen_effect" android:key="lockscreen_effect" >
<ListPreference android:entries="@array/lockscreen_unlock_effect_entries" android:title="@string/choose_lockscreen_effect" android:key="unlock_effect" android:entryValues="@array/lockscreen_unlock_effect_values" android:summary="@string/lockscreen_effect_summary" />
</PreferenceCategory>[/COLOR]
<CheckBoxPreference android:title="@string/ripple_effect" android:key="ripple_effect" android:summary="@string/ripple_effect_summary" />
<PreferenceScreen android:title="@string/ink_effect" android:key="ink_effect">
<intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.InkeffectPreview" />
</PreferenceScreen>

Go in res/value open with text editor arrays.xml and add at the end the red line

[COLOR="Red"]<string-array name="lockscreen_unlock_effect_entries">
<item>Stock effect S2</item>
<item>Stock effect S4</item>
<item>Flames effect</item>
</string-array>
<string-array name="lockscreen_unlock_effect_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>[/COLOR]
</resources>

Go in res/value open with text editor strings.xml and add at the end this line

<string name="lockscreen_effect">Lockscreen Effect</string>
<string name="lockscreen_effect_summary">Chooose lockscreen effect</string>
<string name="choose_lockscreen_effect">Select lockscreen effect</string>

Go in smali\com\android\settings\LockScreenSettings.smali and add the following lines in RED

.field private mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;

[COLOR="Red"].field private mLockscreenEffect:Landroid/preference/ListPreference;[/COLOR]

.field private mLockScreenShortcut:Landroid/preference/SwitchPreferenceScreen;

In the same file find .method public onCreate and add the following lines in RED

.line 144
const v9, 0x7f07003b

invoke-virtual {p0, v9}, Landroid/preference/PreferenceFragment;->addPreferencesFromResource(I)V

.line 147
[COLOR="Red"]const-string v9, "unlock_effect"

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

move-result-object v9

check-cast v9, Landroid/preference/ListPreference;

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

const-string v9, "unlock_effect"

const/4 v11, 0x0

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

move-result v9

iget-object v11, p0, Lcom/android/settings/LockScreenSettings;->mLockscreenEffect:Landroid/preference/ListPreference;

invoke-static {v9}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

move-result-object v9

invoke-virtual {v11, v9}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

iget-object v11, p0, Lcom/android/settings/LockScreenSettings;->mLockscreenEffect:Landroid/preference/ListPreference;

invoke-virtual {v11, p0}, Landroid/preference/SwitchPreferenceScreen;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V[/COLOR]

const-string v9, "lock_screen_shortcut"

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

move-result-object v9

In the same file find .method public onPreferenceChange and add the red lines

const-string v10, "dualclock_settings"

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

move-result v10

if-eqz v10,[COLOR="Red"] :cond_18[/COLOR]

.line 365
check-cast p2, Ljava/lang/Boolean;

.end local p2
invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z

move-result v10

if-eqz v10, :cond_1

.end local p2
invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z

move-result v10

invoke-virtual {p0, v10}, Lcom/android/settings/LockScreenSettings;->setCameraShortCut(Z)V

goto/16 :goto_1

[COLOR="Red"]:cond_18
iget-object v10, p0, Lcom/android/settings/LockScreenSettings;->mLockscreenEffect:Landroid/preference/ListPreference;

if-ne p1, v10, :cond_2

check-cast p2, Ljava/lang/String;

invoke-static {p2}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

move-result-object v10

invoke-virtual {v10}, Ljava/lang/Integer;->intValue()I

move-result v9

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

move-result-object v10

const-string v11, "unlock_effect"

invoke-static {v10, v11, v9}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_1[/COLOR]
.end method

Save all changes and compile SecSettings

framework-res part

Decompile framework-res.apk ,download this zip View attachment framework-res.zip and put the drawable png in respective folder

Compile framework-res and decompile the new framework-res.apk to obtain the new ids of the new pngs that you'll need in android.policy.jar.

So open framework-res\res\value\public and leave it open

android.policy.jar part

Decompile android.policy.jar and go in com\android\internal\policy\impl\sec an open CircleUnlockView-smali and find .method private getUnlockscreenLockImageIdAt(D)I and add the followin red lines , in blue lines some explanation

.method private getUnlockscreenLockImageIdAt(D)I
[COLOR="Red"] .registers 9[/COLOR]
.parameter "value"

.prologue
.line 671
[COLOR="Red"]	iget-object v4, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v4

const-string v5, "unlock_effect"

const v6, 0x0

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

move-result v4

const v5, 0x1

if-eq v4, v5, :cond_new

const v5, 0x2

if-eq v4, v5, :cond_new2

const/16 v2, 0x1c

new-array v1, v2, [I

fill-array-data v1, :array_S2stock

goto :goto_new

:cond_new

const/16 v2, 0x1c

new-array v1, v2, [I

fill-array-data v1, :array_S4stock

goto :goto_new

:cond_new2

const/16 v2, 0x1c

new-array v1, v2, [I

fill-array-data v1, :array_flames

:goto_new[/COLOR]

.line 682
.local v1, unlockscreen_lock_drawables:[I
const-wide v2, 0x3fb999999999999aL

cmpg-double v2, p1, v2

if-gez v2, :cond_14

.line 683
const/4 v0, 0x0

.line 689
.local v0, index:I
:goto_11
aget v2, v1, v0

return v2

.line 684
.end local v0 #index:I
:cond_14
const-wide/high16 v2, 0x3ff0

cmpl-double v2, p1, v2

if-ltz v2, :cond_1e

.line 685
array-length v2, v1

add-int/lit8 v0, v2, -0x1

.restart local v0 #index:I
goto :goto_11

.line 687
.end local v0 #index:I
:cond_1e
array-length v2, v1

int-to-double v2, v2

mul-double/2addr v2, p1

double-to-int v2, v2

add-int/lit8 v0, v2, -0x1

.restart local v0 #index:I
goto :goto_11

.line 671
nop

[COLOR="Red"] :array_S2stock
.array-data 0x4
0x91t 0x4t 0x8t 0x1t [COLOR="Blue"]<--id of keyguard_unlockscreen_lock_01 ,if is not the same then search in your public[/COLOR]
0x92t 0x4t 0x8t 0x1t
0x93t 0x4t 0x8t 0x1t
0x94t 0x4t 0x8t 0x1t [COLOR="Blue"]the ids are in sequence[/COLOR]
0x95t 0x4t 0x8t 0x1t [COLOR="Blue"] example how to determine id in the array ,0x7f02015a [/COLOR]
0x96t 0x4t 0x8t 0x1t [COLOR="Blue"] would became 0x5at 0x1t 0x2t 0x7ft[/COLOR]
0x97t 0x4t 0x8t 0x1t[COLOR="Blue"] the values are reversed[/COLOR]
0x98t 0x4t 0x8t 0x1t
0x99t 0x4t 0x8t 0x1t
0x9at 0x4t 0x8t 0x1t
0x9bt 0x4t 0x8t 0x1t
0x9ct 0x4t 0x8t 0x1t
0x9dt 0x4t 0x8t 0x1t
0x9et 0x4t 0x8t 0x1t
0x9ft 0x4t 0x8t 0x1t
0xa0t 0x4t 0x8t 0x1t
0xa1t 0x4t 0x8t 0x1t
0xa2t 0x4t 0x8t 0x1t
0xa3t 0x4t 0x8t 0x1t
0xa4t 0x4t 0x8t 0x1t
0xa5t 0x4t 0x8t 0x1t
0xa6t 0x4t 0x8t 0x1t
0xa7t 0x4t 0x8t 0x1t
0xa8t 0x4t 0x8t 0x1t
0xa9t 0x4t 0x8t 0x1t
0xaat 0x4t 0x8t 0x1t
0xabt 0x4t 0x8t 0x1t
0xact 0x4t 0x8t 0x1t [COLOR="Blue"]<--id of keyguard_unlockscreen_lock_28[/COLOR]
.end array-data

:array_S4stock
.array-data 0x4
0x51t 0x0at 0x08t 0x01t [COLOR="Blue"]<--id of S4keyguard_unlockscreen_lock_01 , search in your public[/COLOR]
0x52t 0x0at 0x08t 0x01t
0x53t 0x0at 0x08t 0x01t
0x54t 0x0at 0x08t 0x01t
0x55t 0x0at 0x08t 0x01t
0x56t 0x0at 0x08t 0x01t
0x57t 0x0at 0x08t 0x01t
0x58t 0x0at 0x08t 0x01t
0x59t 0x0at 0x08t 0x01t
0x5at 0x0at 0x08t 0x01t
0x5bt 0x0at 0x08t 0x01t
0x5ct 0x0at 0x08t 0x01t
0x5dt 0x0at 0x08t 0x01t
0x5et 0x0at 0x08t 0x01t
0x5ft 0x0at 0x08t 0x01t
0x60t 0x0at 0x08t 0x01t
0x61t 0x0at 0x08t 0x01t
0x62t 0x0at 0x08t 0x01t
0x63t 0x0at 0x08t 0x01t
0x64t 0x0at 0x08t 0x01t
0x65t 0x0at 0x08t 0x01t
0x66t 0x0at 0x08t 0x01t
0x67t 0x0at 0x08t 0x01t
0x68t 0x0at 0x08t 0x01t
0x69t 0x0at 0x08t 0x01t
0x6at 0x0at 0x08t 0x01t
0x6bt 0x0at 0x08t 0x01t
0x6ct 0x0at 0x08t 0x01t [COLOR="Blue"]<--id of S4keyguard_unlockscreen_lock_28[/COLOR]
.end array-data

:array_flames
.array-data 0x4
0x7bt 0x0at 0x08t 0x01t[COLOR="Blue"]<--id of flameskeyguard_unlockscreen_lock_01 , search in your public[/COLOR]
0x7ct 0x0at 0x08t 0x01t
0x7dt 0x0at 0x08t 0x01t
0x7et 0x0at 0x08t 0x01t
0x7ft 0x0at 0x08t 0x01t
0x80t 0x0at 0x08t 0x01t
0x81t 0x0at 0x08t 0x01t
0x82t 0x0at 0x08t 0x01t
0x83t 0x0at 0x08t 0x01t
0x84t 0x0at 0x08t 0x01t
0x85t 0x0at 0x08t 0x01t
0x86t 0x0at 0x08t 0x01t
0x87t 0x0at 0x08t 0x01t
0x88t 0x0at 0x08t 0x01t
0x89t 0x0at 0x08t 0x01t
0x8at 0x0at 0x08t 0x01t
0x8bt 0x0at 0x08t 0x01t
0x8ct 0x0at 0x08t 0x01t
0x8dt 0x0at 0x08t 0x01t
0x8et 0x0at 0x08t 0x01t
0x8ft 0x0at 0x08t 0x01t
0x90t 0x0at 0x08t 0x01t
0x91t 0x0at 0x08t 0x01t
0x92t 0x0at 0x08t 0x01t
0x93t 0x0at 0x08t 0x01t
0x94t 0x0at 0x08t 0x01t
0x95t 0x0at 0x08t 0x01t
0x96t 0x0at 0x08t 0x01t [COLOR="Blue"]<--id of flameskeyguard_unlockscreen_lock_28[/COLOR]
.end array-data
[/COLOR]
.end method

pay attention with the ids in the array ,make sure they are the same of yours in framework-res\res\value\public

In the same file find .method private createArrow()V and add the followin red lines , in blue lines some explanation

.method private createArrow()V
[COLOR="Red"] .registers 6[/COLOR]

.prologue
.line 199
new-instance v0, Landroid/widget/ImageView;

iget-object v1, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->arrow:Landroid/widget/ImageView;

[COLOR="Red"]iget-object v2, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "unlock_effect"

const v4, 0x0

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

move-result v2

const v4, 0x1

if-eq v2, v4, :cond_new

const v4, 0x2

if-eq v2, v4, :cond_new2

const v1, 0x108048e[COLOR="Blue"]<--id of keyguard_unlock_circle_arrow_1, make sure that it is the same of your public[/COLOR]

goto :goto_new

:cond_new

const v1, 0x01080a72 [COLOR="Blue"]id of S4keyguard_unlock_circle_arrow_1[/COLOR]

goto :goto_new

:cond_new2

const v1, 0x01080a79[COLOR="Blue"]id of flameskeyguard_unlock_circle_arrow_1 [/COLOR]

:goto_new[/COLOR]

.line 200
iget-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->arrow:Landroid/widget/ImageView;

invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

.line 201

find .method private createInnerCircle()V and add the followin red lines , in blue lines some explanation

.method private createInnerCircle()V
[COLOR="Red"].registers 6[/COLOR]

.prologue
.line 177
new-instance v0, Landroid/widget/ImageView;

iget-object v1, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mCircleInPress:Landroid/widget/ImageView;

[COLOR="Red"]iget-object v2, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "unlock_effect"

const v4, 0x0

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

move-result v2

const v4, 0x1

if-eq v2, v4, :cond_new

const v4, 0x2

if-eq v2, v4, :cond_new2

const v1, 0x0108048f[COLOR="Blue"]id of keyguard_unlock_circle_circleview_in[/COLOR]

goto :goto_new

:cond_new

const v1, 0x01080a73[COLOR="Blue"]id of S4keyguard_unlock_circle_circleview_in[/COLOR]

goto :goto_new

:cond_new2

const v1, 0x01080a7a[COLOR="Blue"]id of flameskeyguard_unlock_circle_circleview_in[/COLOR]

:goto_new[/COLOR]

.line 178
iget-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mCircleInPress:Landroid/widget/ImageView;

invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

.line 179
return-void
.end method

find .method private createThreeCircles()V and add the followin red lines , in blue lines some explanation

.method private createThreeCircles()V
[COLOR="Red"] .registers 7[/COLOR]

.prologue
const/4 v2, 0x0

.line 182
new-instance v0, Landroid/widget/ImageView;

iget-object v1, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->circle_1:Landroid/widget/ImageView;

[COLOR="Red"]iget-object v3, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "unlock_effect"

const v5, 0x0

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

move-result v3

const v5, 0x1

if-eq v3, v5, :cond_new

const v5, 0x2

if-eq v3, v5, :cond_new2

const v1, 0x01080407[COLOR="Blue"]id of keyguard_lockscreen_circle_1[/COLOR]

goto :goto_new

:cond_new

const v1, 0x01080a6e[COLOR="Blue"]id of S4keyguard_lockscreen_circle_1[/COLOR]

goto :goto_new

:cond_new2

const v1, 0x01080a75[COLOR="Blue"]id of flameskeyguard_lockscreen_circle_1[/COLOR]

:goto_new[/COLOR]

.line 183
iget-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->circle_1:Landroid/widget/ImageView;

invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

.line 184
new-instance v0, Landroid/widget/ImageView;

iget-object v1, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->circle_2:Landroid/widget/ImageView;

[COLOR="Red"]iget-object v3, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "unlock_effect"

const v5, 0x0

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

move-result v3

const v5, 0x1

if-eq v3, v5, :cond_new3

const v5, 0x2

if-eq v3, v5, :cond_new4

const v1, 0x01080408[COLOR="Blue"]id of keyguard_lockscreen_circle_2[/COLOR]

goto :goto_new2

:cond_new3

const v1, 0x01080a6f[COLOR="Blue"]id of S4keyguard_lockscreen_circle_2[/COLOR]

goto :goto_new2

:cond_new4

const v1, 0x01080a76[COLOR="Blue"]id of flameskeyguard_lockscreen_circle_2[/COLOR]

:goto_new2[/COLOR]

.line 185
iget-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->circle_2:Landroid/widget/ImageView;

invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

.line 186
new-instance v0, Landroid/widget/ImageView;

iget-object v1, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->circle_3:Landroid/widget/ImageView;

[COLOR="Red"]iget-object v3, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "unlock_effect"

const v5, 0x0

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

move-result v3

const v5, 0x1

if-eq v3, v5, :cond_new5

const v5, 0x2

if-eq v3, v5, :cond_new6

const v1, 0x01080409[COLOR="Blue"]id of keyguard_lockscreen_circle_3[/COLOR]

goto :goto_new3

:cond_new5

const v1, 0x01080a70[COLOR="Blue"]id of S4keyguard_lockscreen_circle_3[/COLOR]

goto :goto_new3

:cond_new6

const v1, 0x01080a77[COLOR="Blue"]id of flameskeyguard_lockscreen_circle_3[/COLOR]

:goto_new3[/COLOR]

.line 187
iget-object v0, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->circle_3:Landroid/widget/ImageView;

invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

.line 188

Save all changes and compile android.policy

Put SecSettings.apk,framework-res.apk,android.policy.jar in your device.