[Android Software/Hacking General [Developers Only]] kensiko32:
Ok guys I'm trying to simply apply the "Disable proximity switch" developed by Theos0o to the latest version of skype. I'm a programmer at work but for APK I'm working hard to understand the code. What I have done but not tested is to import the code from Theos to the latest version of skype. But I don't need everything, I just want to disable the proxy. So I added the following lines to d.smali at a specific place:

invoke-static {}, Lcom/skype/AdvancedSettings;->disableProximityVal()Landroid/os/PowerManager$WakeLock;

move-result-object v2

FYI this was in c.smali in version 4.0. I assume MS moved the code to d.smali in version 4.4 because the powermanager part of the code is very similar and was not present in version 4.0.

Now, I understand that DisableProximityVal is a method, as below. The method will not work because I have not added the option to the menu yet, I don't need to. So, what do I need to delete in this code to make it work without any outside variable?

Thank you!!

.method public static disableProximityVal()Landroid/os/PowerManager$WakeLock;

.locals 5

.prologue

const/4 v4, 0x0

.line 1431

sget-object v2, Lcom/skype/AdvancedSettings;->sCtx:Landroid/content/Context;

const-string v3, "skypeCustomSettings"

invoke-virtual {v2, v3, v4}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

move-result-object v2

.line 1432

const-string v3, "disableProximity"

.line 1431

invoke-interface {v2, v3, v4}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

move-result v2

invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

move-result-object v0

.line 1433

.local v0, boolval:Ljava/lang/Boolean;

invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

move-result v2

if-eqz v2, :cond_0

.line 1434

sget-object v2, Lcom/skype/AdvancedSettings;->sCtx:Landroid/content/Context;

.line 1435

const-string v3, "power"

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

move-result-object v1

.line 1434

check-cast v1, Landroid/os/PowerManager;

.line 1436

.local v1, pm:Landroid/os/PowerManager;

const/16 v2, 0xa

sget-object v3, Lcom/skype/AdvancedSettings;->TAG:Ljava/lang/String;

invoke-virtual {v1, v2, v3}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;

move-result-object v2

.line 1440

:goto_0

return-object v2

.line 1438

.end local v1 #pm:Landroid/os/PowerManager;

:cond_0

sget-object v2, Lcom/skype/AdvancedSettings;->sCtx:Landroid/content/Context;

.line 1439

const-string v3, "power"

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

move-result-object v1

.line 1438

check-cast v1, Landroid/os/PowerManager;

.line 1440

.restart local v1 #pm:Landroid/os/PowerManager;

const/16 v2, 0x20

sget-object v3, Lcom/skype/AdvancedSettings;->TAG:Ljava/lang/String;

invoke-virtual {v1, v2, v3}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;

move-result-object v2

goto :goto_0

.end method