[Xperia Arc Android Development] Rizal Lovins:
GUIDE Xperia SP Lockscreen Only For JB 4.1.2

Visit this thread for how to decompile >>CLICK HERE<<

Required file from Xperia SP

- Xperia SP android.policy.jar deodexed ( for source code ) Download in attachcement

- Download Xperia SP Lockscreen modified in attachcement

Instructions :

- Red (remove code)

- Blue (add code)

- Green (change/replace code)

Step 1

- Decompile Xperia SP android.policy.jar

- Go to smali/com/android/internal/policy/impl and copy ExtendedKeyguardScreen.smali and ExternalLockScreen.smali

- ExternalLockScreen.smali need to be editing

Find invoke-static {p0, v4}, Lcom/android/internal/policy/impl/ExternalLockScreen;->validateExternalLockScreen(Landroid/content/Context;Landroid/content/ComponentName;)Z

.line 238
sget-object v9, Lcom/android/internal/policy/impl/ExternalLockScreen;->sLockScreenInfoLock:Ljava/util/concurrent/locks/Lock;

invoke-interface {v9}, Ljava/util/concurrent/locks/Lock;->unlock()V

[COLOR="Red"] .line 241
if-nez v4, :cond_2[/COLOR]

.line 242
invoke-static {p0}, Lcom/android/internal/policy/impl/ExternalLockScreen;->getExternalLockScreenPackage(Landroid/content/Context;)Landroid/content/ComponentName;

move-result-object v4

[COLOR="red"].line 246
:cond_2
invoke-static {p0, v4}, Lcom/android/internal/policy/impl/ExternalLockScreen;->validateExternalLockScreen(Landroid/content/Context;Landroid/content/ComponentName;)Z

move-result v8

.line 250
if-eqz v8, :cond_3[/COLOR]

.line 251
invoke-virtual {v4}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;

move-result-object v9

Find .method private static validateExternalLockScreen(Landroid/content/Context;Landroid/content/ComponentName;)Z

.method private static validateExternalLockScreen(Landroid/content/Context;Landroid/content/ComponentName;)Z
.locals 4
.parameter "context"
.parameter "info"

.prologue
const/4 v1, 0x0

.line 131
[COLOR="red"] if-eqz p1, :cond_0[/COLOR]

invoke-virtual {p1}, Landroid/content/ComponentName;->getClassName()Ljava/lang/String;

move-result-object v2

[COLOR="red"] if-eqz v2, :cond_0[/COLOR]

invoke-virtual {p1}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;

move-result-object v2

[COLOR="red"] if-nez v2, :cond_1

.line 132
:cond_0
const-string v2, "ExternalLockScreen"

const-string v3, "External lockscreen name and package info has not been set correctly!"

invoke-static {v2, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
[/COLOR]
.line 147
:goto_0
return v1

.line 140
:cond_1
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

move-result-object v0

.line 141
.local v0, pm:Landroid/content/pm/PackageManager;
const-string v2, "com.sonyericsson.permission.EXTERNAL_LOCKSCREEN"

invoke-virtual {p1}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;

move-result-object v3

invoke-virtual {v0, v2, v3}, Landroid/content/pm/PackageManager;->checkPermission(Ljava/lang/String;Ljava/lang/String;)I

move-result v2

[COLOR="red"] if-nez v2, :cond_2[/COLOR]

.line 143
const/4 v1, 0x1

goto :goto_0

[COLOR="red"] .line 146
:cond_2
const-string v2, "ExternalLockScreen"

const-string v3, "Validation of external lockscreen failed!!"

invoke-static {v2, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

goto :goto_0[/COLOR]
.end method

Save it!!!

Step 2

- Next extract your phone/rom android.policy.jar and decompile it with baksmali/smali program. From the output, copy and paste the ExtendedKeyguardScreen.smali and the modified ExternalLockScreen.smali to smali/com/android/internal/policy/impl

- Then open smali/com/android/internal/policy/impl/ LockPatternKeyguardView.smali

.field private mHasDialog:Z

.field mInfoCallback:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$InfoCallbackImpl;

[COLOR="Blue"].field private mIsExternallyLoadedLockScreenEnabled:Z[/COLOR]

.field private mIsTalkbackDrvModeOn:Z

Find # virtual methods.method public cleanUp()V

# virtual methods
.method public cleanUp()V
.locals 2

.prologue
const/4 v1, 0x0

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

iput-boolean v0, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mIsExternallyLoadedLockScreenEnabled:Z[/COLOR]

.line 1096
iget-object v0, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockScreen:Landroid/view/View;

Find .method createLockScreen()Landroid/view/View;

.prologue
[COLOR="blue"] iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;

iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;

invoke-static {v1, v2}, Lcom/android/internal/policy/impl/ExternalLockScreen;->getLockScreen(Landroid/content/Context;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)Landroid/view/View;

move-result-object v0

.local v0, lockView:Landroid/view/View;
if-eqz v0, :cond_1

const/4 v1, 0x1

:goto_0
iput-boolean v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mIsExternallyLoadedLockScreenEnabled:Z

.line 1038
iget-boolean v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mIsExternallyLoadedLockScreenEnabled:Z

if-nez v1, :cond_0[/COLOR]

.line 1268
new-instance v0, Lcom/android/internal/policy/impl/sec/LockScreen;

[COLOR="blue"] .end local v0 #lockView:Landroid/view/View;[/COLOR]
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;

iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;>mConfiguration:Landroid/content/res/Configuration;

iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;>mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;

iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;>mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;

iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;>mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;

invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/sec/LockScreen;->(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V

.line 1274
[COLOR="Lime"] .restart local v0 #lockView:Landroid/view/View;[/COLOR]
[COLOR="blue"] :cond_0[/COLOR]
invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->initializeTransportControlView(Landroid/view/View;)V

.line 1275
return-object v0

[COLOR="Blue"] :cond_1
const/4 v1, 0x0

goto :goto_0[/COLOR]
.end method

Save it!!! Recompile/compile, if done, download Xperia SP Lockscreen from here :

and install via recovery and put android.policy.jar modified to system framework

Thanks to Arsaw for the Guide :good: