[Verizon Samsung Galaxy S III] Didact74:
PART 2 android.policy.jar

Navigate to smali/com/android/internal/policy/impl/KeyguardViewMediator$4.smali

Find the following code and add the part in RED

packed-switch v2, :pswitch_data_0

.line 1172
:goto_0
[COLOR="Red"][B] :pswitch_0
[/B][/COLOR] return-void

Find the 13 : pswitch_ lines and increase them by 1. For example

:pswitch_0 becomes :pswitch_1
:pswitch_1 becomes :pswitch_2
:pswitch_2 becomes :pswitch_3
:pswitch_3 becomes :pswitch_4
:pswitch_4 becomes :pswitch_5
:pswitch_5 becomes :pswitch_6
:pswitch_6 becomes :pswitch_7
:pswitch_7 becomes :pswitch_8
:pswitch_8 becomes :pswitch_9
:pswitch_9 becomes :pswitch_a
:pswitch_a becomes :pswitch_b
:pswitch_b becomes :pswitch_c
:pswitch_c becomes :pswitch_d

Find the following code

invoke-static {v0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->access$300(Lcom/android/internal/policy/impl/KeyguardViewMediator;)V

.line 1169
monitor-exit v1

goto :goto_0

Add the following directly after

.line 974
:pswitch_e
iget-object v2, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator$4;->this$0:Lcom/android/internal/policy/impl/KeyguardViewMediator;

iget v3, p1, Landroid/os/Message;->arg1:I

if-eqz v3, :cond_2

move v3, v0

:goto_3
#calls: Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V
invoke-static {v2, v3}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->access$1900(Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V

goto :goto_0

:cond_2
move v3, v1

goto :goto_3

Find the "nop' at the end and add another one right below it

throw v0

.line 1129
nop

nop

Find the stack of : pswitch_ lines at the end of the smali and delete : pswitch_0

Then add the following so the entire stack will end up looking like this

.packed-switch 0x1

:pswitch_1
:pswitch_2
:pswitch_3
:pswitch_4
:pswitch_5
:pswitch_6
:pswitch_7
:pswitch_8
:pswitch_9
:pswitch_a
:pswitch_b
:pswitch_c
:pswitch_d
:pswitch_0
:pswitch_0
:pswitch_0
:pswitch_0
:pswitch_0
:pswitch_0
:pswitch_e
.end packed-switch
.end method

Thats it for KeyguardViewMediator$4.smali. Save and close the file.

Navigate to smali/com/android/internal/policy/impl/KeyguardViewMediator.smali

Add the following in RED

.field private static final SET_HIDDEN:I = 0xc

[COLOR="Red"].field private static final SET_TORCH:I = 0x14[/COLOR]

.field private static final SHOW:I = 0x2

.field private mTelephonyManager:Landroid/telephony/TelephonyManager;

[COLOR="red"].field private mTorchEnabled:Z

.field private mTorchStateChanged:Z
[/COLOR]
.field private mUnlockSoundId:I

# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/android/internal/policy/impl/PhoneWindowManager;Landroid/os/LocalPowerManager;)V
.locals 11
.parameter "context"
.parameter "callback"
.parameter "powerManager"

.prologue
.line 299
invoke-direct {p0}, Ljava/lang/Object;-><init>()V

[COLOR="red"]const/4 v0, 0x1

iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z
[/COLOR]
.line 179
const/4 v0, 0x1

iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mSuppressNextLockSound:Z

.line 180
const/4 v0, 0x1

iput-object p1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mContext:Landroid/content/Context;

.line 302
iput-object p3, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mRealPowerManager:Landroid/os/LocalPowerManager;

[COLOR="red"] const/4 v0, 0x0

iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z
[/COLOR]
.line 303
const-string v0, "power"

invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

move-result-object v0

check-cast v0, Landroid/os/PowerManager;

iput-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mPM:Landroid/os/PowerManager;

.line 304
iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mPM:Landroid/os/PowerManager;

const v1, 0x1000001a

.method static synthetic access$2300(Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V
.locals 0
.parameter "x0"
.parameter "x1"

.prologue
.line 103
invoke-direct {p0, p1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetHidden(Z)V

return-void
.end method

[COLOR="red"].method static synthetic access$2400(Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V
.locals 0

invoke-direct {p0, p1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V

return-void
.end method
[/COLOR]
.method static synthetic access$300(Lcom/android/internal/policy/impl/KeyguardViewMediator;I)V

invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->adjustLocked(Z)V

.line 1411
monitor-exit p0

[COLOR="red"] invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V
[/COLOR]
goto :goto_0

:catchall_0
move-exception v0

monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0

throw v0
.end method

.method private handleKeyguardDone(Z)V

invoke-virtual {v0}, Lcom/android/internal/policy/impl/KeyguardViewManager;->onScreenTurnedOff()V

.line 1562
monitor-exit p0

[COLOR="red"]invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V[/COLOR]

.line 1563
return-void

.line 1562
:catchall_0
move-exception v0

monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0

throw v0
.end method

.method private handleNotifyScreenOn(Lcom/android/internal/policy/impl/KeyguardViewManager$ShowListener;)V
.locals 2

invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->adjustUserActivityLocked()V

.line 682
invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->adjustStatusBarLocked()V

[COLOR="red"] invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V
[/COLOR]
.line 684
:cond_0
monitor-exit p0

.line 685
return-void

.line 684
:catchall_0
move-exception v0

monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0

throw v0
.end method

[COLOR="red"].method private handleSetTorch(Z)V
.locals 6

const/4 v0, 0x0

iget-object v5, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mContext:Landroid/content/Context;

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

move-result-object v5

const-string v4, "enable_lockscreen_torch"

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

move-result v5

if-eqz v5, :cond_0

const/4 v5, 0x0

const/4 v4, 0x1

:try_start_0
iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z

if-nez v1, :cond_1

iput-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

const/4 v1, 0x1

iput-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z

:cond_0
:goto_0
return-void

:cond_1
iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

if-eq v1, p1, :cond_0

iput-boolean p1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

new-instance v0, Landroid/content/Intent;

const-string v1, "net.cactii.flash2.TOGGLE_FLASHLIGHT"

invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

const-string v1, "net.cactii.flash2.EXTRA_DISABLE_NOTIFICATION"

const/4 v2, 0x1

invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

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

invoke-virtual {v1, v0}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

goto :goto_0

:catch_0
move-exception v1

goto :goto_0
.end method
[/COLOR]
.method private handleShow()V

invoke-interface {v0, v1}, Landroid/app/IActivityManager;->closeSystemDialogs(Ljava/lang/String;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_0

.line 1380
:goto_1
:try_start_2
iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mShowKeyguardWakeLock:Landroid/os/PowerManager$WakeLock;

invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V

[COLOR="red"]const/4 v0, 0x1

iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z
[/COLOR]
.line 1381
monitor-exit p0

goto :goto_0

:catchall_0
move-exception v0

monitor-exit p0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0

.end method

[COLOR="red"].method private resetTorchState()V
.locals 1

iget-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z

if-eqz v0, :cond_0

const/4 v0, 0x0

invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V

:cond_0
return-void
.end method
[/COLOR]
.method private showLocked()V
.locals 3

.prologue
.line 839
const-string v1, "KeyguardViewMediator"

const-string v1, "KeyguardViewMediator"

const-string v2, "done waiting for mWaitingUntilKeyguardVisible"

invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0

goto :goto_1
.end method

[COLOR="red"].method public setTorch(Z)V
.locals 5

const/16 v4, 0x14

const/4 v3, 0x0

iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mScreenOn:Z

if-eqz v1, :cond_0

iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;

invoke-virtual {v1, v4}, Landroid/os/Handler;->removeMessages(I)V

iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;

if-eqz p1, :cond_1

const/4 v2, 0x1

:goto_0
invoke-virtual {v1, v4, v2, v3}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;

move-result-object v0

iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;

invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

:cond_0
return-void

:cond_1
move v2, v3

goto :goto_0
.end method
[/COLOR]
.method public verifyUnlock(Landroid/view/WindowManagerPolicy$OnKeyguardExitResult;)V
.locals 2
.parameter "callback"

.prologue
.line 618
monitor-enter p0

Thats it for KeyguardViewMediator.smali. Save the file and close.

Continue to post 3.........