I'm trying to ask a generic question about ShutdownThread->Reboot() so please don't stop reading when I say, the device I'm on is a Novo 7 Aurora on ICS 4.0.3.
I have implemented some of the advanced power menu for my tablet in .smali. Unfortunately, I can't figure out what to put in for the "reason" to make it reboot normally. I can make it shutdown, I can make it reboot recovery, but I cannot make it reboot normally. Every attempt to reboot normally results in recovery.
I've looked at the "reason" in a few ROMs that I've disassembled and it seems to be different in different ROMs... (example: "null", "" , "now").
Do you have any tips on this?
Is the "reason" for reboot() different depending upon kernel or upon CWM?
Is there a reasonable way to hack the native code to find it? Or another way to find it?
As a work-around, would it be possible to get a shell from within system code (framework.jar) and use the shell command to reboot? I think I know how to do this, but don't want to try if it's not possible to get a shell from within system code.
now seems to be a normal reboot, and the extra args that you need to define are either "recovery", "download" or "bootloader" afaik
From my ext power menu:
For rebooting normally: (now)
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$10;
.super Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.source "GlobalActions.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions;->createDialog()Landroid/app/AlertDialog;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/GlobalActions;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
.registers 4
.parameter
.parameter "x0"
.parameter "x1"
.prologue
.line 267
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$10;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
invoke-direct {p0, p2, p3}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>(II)V
return-void
.end method
# virtual methods
.method public onPress()V
.registers 3
.prologue
.line 271
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$10;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v0
const/4 v1, 0x0
const-string p0, "now"
invoke-static {v0, p0, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
.line 272
return-void
.end method
.method public showBeforeProvisioning()Z
.registers 2
.prologue
.line 279
const/4 v0, 0x1
return v0
.end method
.method public showDuringKeyguard()Z
.registers 2
.prologue
.line 275
const/4 v0, 0x1
return v0
.end method
for rebooting in recovery:
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$11;
.super Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.source "GlobalActions.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions;->createDialog()Landroid/app/AlertDialog;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/GlobalActions;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
.registers 4
.parameter
.parameter "x0"
.parameter "x1"
.prologue
.line 267
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$11;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
invoke-direct {p0, p2, p3}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>(II)V
return-void
.end method
# virtual methods
.method public onPress()V
.registers 3
.prologue
.line 271
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$11;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v0
const/4 v1, 0x0
const-string p0, "recovery"
invoke-static {v0, p0, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
.line 272
return-void
.end method
.method public showBeforeProvisioning()Z
.registers 2
.prologue
.line 279
const/4 v0, 0x1
return v0
.end method
.method public showDuringKeyguard()Z
.registers 2
.prologue
.line 275
const/4 v0, 0x1
return v0
.end method
and for download/bootloader it's the same as above one, but then with the state changed to either "download" or "bootloader".
To shutdown the phone
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$4;
.super Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.source "GlobalActions.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions;->createDialog()Landroid/app/AlertDialog;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/GlobalActions;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
.registers 4
.parameter
.parameter "x0"
.parameter "x1"
.prologue
.line 267
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$4;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
invoke-direct {p0, p2, p3}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>(II)V
return-void
.end method
# virtual methods
.method public onPress()V
.registers 3
.prologue
.line 271
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$4;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v0
const/4 v1, 0x0
invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
.line 272
return-void
.end method
.method public showBeforeProvisioning()Z
.registers 2
.prologue
.line 279
const/4 v0, 0x1
return v0
.end method
.method public showDuringKeyguard()Z
.registers 2
.prologue
.line 275
const/4 v0, 0x1
return v0
.end method
Hope this helped you, And btw I also would like to know how to execute adb shell commands from smali
broodplank1337 said:
now seems to be a normal reboot, and the extra args that you need to define are either "recovery", "download" or "bootloader" afaik
For rebooting normally: (now)
Hope this helped you, And btw I also would like to know how to execute adb shell commands from smali
Click to expand...
Click to collapse
Thanks for trying to help but "now" also takes me to recovery for some reason. Is this defined in CWM or somewhere else?
Here is an example of how to run a shell script as root from smali. I just don't know if it works from a system jar. This is decompiled from "Novotools" by genokolar. He claims the tool itself is copywrited but I would think there is no harm in learning from the smali.
Code:
.method public static execRootCmdSilent(Ljava/lang/String;)I
.locals 6
.parameter "paramString"
.prologue
.line 40
:try_start_0
const-string v4, "RootCmd"
invoke-static {v4, p0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
.line 41
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v4
const-string v5, "su"
invoke-virtual {v4, v5}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v2
.line 42
.local v2, localProcess:Ljava/lang/Process;
new-instance v0, Ljava/io/DataOutputStream;
invoke-virtual {v2}, Ljava/lang/Process;->getOutputStream()Ljava/io/OutputStream;
move-result-object v4
invoke-direct {v0, v4}, Ljava/io/DataOutputStream;-><init>(Ljava/io/OutputStream;)V
.line 44
.local v0, localDataOutputStream:Ljava/io/DataOutputStream;
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v4, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, "\n"
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
.line 45
.local v3, str:Ljava/lang/String;
invoke-virtual {v0, v3}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
.line 46
invoke-virtual {v0}, Ljava/io/DataOutputStream;->flush()V
.line 47
const-string v4, "exit\n"
invoke-virtual {v0, v4}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
.line 48
invoke-virtual {v0}, Ljava/io/DataOutputStream;->flush()V
.line 49
invoke-virtual {v2}, Ljava/lang/Process;->waitFor()I
.line 50
invoke-virtual {v2}, Ljava/lang/Process;->exitValue()I
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
move-result v4
.line 55
.end local v0 #localDataOutputStream:Ljava/io/DataOutputStream;
.end local v2 #localProcess:Ljava/lang/Process;
.end local v3 #str:Ljava/lang/String;
:goto_0
return v4
.line 52
:catch_0
move-exception v1
.line 53
.local v1, localException:Ljava/lang/Exception;
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
.line 55
const/4 v4, 0x1
goto :goto_0
.end method
It's called like this:
Code:
:try_start_0
const-string v2, "reboot"
invoke-static {v2}, Lcom/genokolar/Novotools/RootCmd;->execRootCmdSilent(Ljava/lang/String;)I
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
I just don't want to resort to this when the stupid reboot command should work.
KevlarTheGreat said:
Thanks for trying to help but "now" also takes me to recovery for some reason. Is this defined in CWM or somewhere else?
Here is an example of how to run a shell script as root from smali. I just don't know if it works from a system jar. This is decompiled from "Novotools" by genokolar. He claims the tool itself is copywrited but I would think there is no harm in learning from the smali.
Code:
.method public static execRootCmdSilent(Ljava/lang/String;)I
.locals 6
.parameter "paramString"
.prologue
.line 40
:try_start_0
const-string v4, "RootCmd"
invoke-static {v4, p0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
.line 41
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v4
const-string v5, "su"
invoke-virtual {v4, v5}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v2
.line 42
.local v2, localProcess:Ljava/lang/Process;
new-instance v0, Ljava/io/DataOutputStream;
invoke-virtual {v2}, Ljava/lang/Process;->getOutputStream()Ljava/io/OutputStream;
move-result-object v4
invoke-direct {v0, v4}, Ljava/io/DataOutputStream;-><init>(Ljava/io/OutputStream;)V
.line 44
.local v0, localDataOutputStream:Ljava/io/DataOutputStream;
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v4, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, "\n"
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
.line 45
.local v3, str:Ljava/lang/String;
invoke-virtual {v0, v3}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
.line 46
invoke-virtual {v0}, Ljava/io/DataOutputStream;->flush()V
.line 47
const-string v4, "exit\n"
invoke-virtual {v0, v4}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V
.line 48
invoke-virtual {v0}, Ljava/io/DataOutputStream;->flush()V
.line 49
invoke-virtual {v2}, Ljava/lang/Process;->waitFor()I
.line 50
invoke-virtual {v2}, Ljava/lang/Process;->exitValue()I
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
move-result v4
.line 55
.end local v0 #localDataOutputStream:Ljava/io/DataOutputStream;
.end local v2 #localProcess:Ljava/lang/Process;
.end local v3 #str:Ljava/lang/String;
:goto_0
return v4
.line 52
:catch_0
move-exception v1
.line 53
.local v1, localException:Ljava/lang/Exception;
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
.line 55
const/4 v4, 0x1
goto :goto_0
.end method
It's called like this:
Code:
:try_start_0
const-string v2, "reboot"
invoke-static {v2}, Lcom/genokolar/Novotools/RootCmd;->execRootCmdSilent(Ljava/lang/String;)I
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
I just don't want to resort to this when the stupid reboot command should work.
Click to expand...
Click to collapse
That's strange.. "now" or null should work. if it doesn't you can just use the smali code i posted, and if that code doesn't work then you know the problem is something else good luck on trying.
btw, thanks for the shell execution script ^^
Related
Hi,
"Hot Reboot" does not work currently.
I learned from the next person.
His name is "cielavenir "
Learned this command from someone he also.
Code:
# setprop ctl.restart zygote
The results similar to "Hot Reboot" By performing the above commands.
Our aim is to incorporate the above command to "APM".
I was able to incorporate it.
The following is a "Hot Reboot" until now.
Code:
# virtual methods
.method public onPress()V
.locals 6
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v3
[COLOR="Silver"]const/4 v4, 0x4
new-array v0, v4, [Ljava/lang/String;
const/4 v4, 0x0
const-string v5, "pkill"
aput-object v5, v0, v4
const/4 v4, 0x1
const-string v5, "-TERM"
aput-object v5, v0, v4
const/4 v4, 0x2
const-string v5, "-f"
aput-object v5, v0, v4
const/4 v4, 0x3
const-string v5, "system_server"
aput-object v5, v0, v4
[/COLOR]
:try_start_0
invoke-virtual {v3, v0}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v2
:goto_0
return-void
:catch_0
move-exception v1
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_0
.end method
Changed as follows.
Code:
# virtual methods
.method public onPress()V
.locals 6
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v3
[COLOR="Red"]const/4 v4, 0x3
new-array v0, v4, [Ljava/lang/String;
const/4 v4, 0x0
const-string v5, "setprop"
aput-object v5, v0, v4
const/4 v4, 0x1
const-string v5, "ctl.restart"
aput-object v5, v0, v4
const/4 v4, 0x2
const-string v5, "zygote"
aput-object v5, v0, v4
[/COLOR]
:try_start_0
invoke-virtual {v3, v0}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v2
:goto_0
return-void
:catch_0
move-exception v1
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_0
.end method
New "Hot Reboot" works normally!!
I also can "Safe Mode" also operate similarly.
The following is a "Safe Mode" until now.
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$22;
.super Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.source "GlobalActions.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions;->createDialogAdv()Lcom/htc/widget/HtcAlertDialog;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/GlobalActions;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;III)V
.locals 0
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$22;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
invoke-direct {p0, p2, p3, p4}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>(III)V
return-void
.end method
# virtual methods
.method public onPress()V
.locals 3
const-string v0, "ADVANCED POWER MENU"
const-string v1, "Safe mode"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$22;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$1000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/view/WindowManagerPolicy$WindowManagerFuncs;
move-result-object v0
invoke-interface {v0}, Landroid/view/WindowManagerPolicy$WindowManagerFuncs;->rebootSafeMode()V
const-string v0, "ADVANCED POWER MENU"
const-string v1, "Safe mode end"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
return-void
.end method
.method public showBeforeProvisioning()Z
.locals 1
const/4 v0, 0x1
return v0
.end method
.method public showDuringKeyguard()Z
.locals 1
const/4 v0, 0x1
return v0
.end method
Changed as follows.
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$22;
.super Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.source "GlobalActions.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions;->createDialogAdv()Lcom/htc/widget/HtcAlertDialog;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/GlobalActions;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;III)V
.locals 0
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$22;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
invoke-direct {p0, p2, p3, p4}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>(III)V
return-void
.end method
# virtual methods
.method public onPress()V
.locals 6
[COLOR="Red"]const-string v2, "persist.sys.safemode"
const-string v3, "1"
invoke-static {v2, v3}, Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v3
const/4 v4, 0x3
new-array v0, v4, [Ljava/lang/String;
const/4 v4, 0x0
const-string v5, "setprop"
aput-object v5, v0, v4
const/4 v4, 0x1
const-string v5, "ctl.restart"
aput-object v5, v0, v4
const/4 v4, 0x2
const-string v5, "zygote"
aput-object v5, v0, v4[/COLOR]
:try_start_0
invoke-virtual {v3, v0}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v2
:goto_0
return-void
:catch_0
move-exception v1
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_0
.end method
.method public showBeforeProvisioning()Z
.locals 1
const/4 v0, 0x1
return v0
.end method
.method public showDuringKeyguard()Z
.locals 1
const/4 v0, 0x1
return v0
.end method
You can also use the following command.
Hot Reboot
Code:
adb shell su -c setprop ctl.restart zygote
Safe Mode
Code:
adb shell su -c setprop persist.sys.safemode 1
adb shell su -c setprop ctl.restart zygote
Thank you!!
pertamax..
good job.. broo..
:good:
belantara said:
pertamax..
good job.. broo..
:good:
Click to expand...
Click to collapse
So flash this and we will be able to hot reboot when shutting the phone
Sent from my HTC Butterfly using xda premium
Hey Guyzzz.This is Guide About How To Add Lollipop Platlogo In Your ROM ICS/JB/KK
Disclaimer:I or XDA Developers will not be responsible for any damage of your Device.A Backup is highly recomanded.
Things You Will Needed:
1) A fully de-odxed rom
2) framework.jar from your rom
3) Tools for .jar Decompiling
4) A tiny brain
Instruction:
1) De-compile your framework.jar. (In some cases like some Samsung Roms, it can be framework2.jar)
2) now navigate to smali/com/android/internal/app and open PlatLogoActivity.smali and open the file.
3) And replace the whole with it:
Code:
.class public Lcom/android/internal/app/PlatLogoActivity;
.super Landroid/app/Activity;
.source "PlatLogoActivity.java"
# direct methods
.method public constructor <init>()V
.registers 1
.prologue
.line 12
invoke-direct {p0}, Landroid/app/Activity;-><init>()V
return-void
.end method
# virtual methods
.method protected onCreate(Landroid/os/Bundle;)V
.registers 7
.parameter "savedInstanceState"
.prologue
.line 16
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
.line 18
new-instance v1, Landroid/content/Intent;
const-string v2, "android.intent.action.MAIN"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 19
.local v1, intent:Landroid/content/Intent;
new-instance v2, Landroid/content/ComponentName;
const-string v3, "bloody.badboy.LollipopEasterEgg"
const-string v4, "bloody.badboy.LollipopEasterEgg.MainActivity"
invoke-direct {v2, v3, v4}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v1, v2}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
.line 23
:try_start_16
invoke-virtual {p0, v1}, Lcom/android/internal/app/PlatLogoActivity;->startActivity(Landroid/content/Intent;)V
:try_end_19
.catch Landroid/content/ActivityNotFoundException; {:try_start_16 .. :try_end_19} :catch_1d
.line 39
:goto_19
invoke-virtual {p0}, Lcom/android/internal/app/PlatLogoActivity;->finish()V
.line 41
return-void
.line 31
:catch_1d
move-exception v0
.line 35
.local v0, e:Landroid/content/ActivityNotFoundException;
const-string v2, "First install that app i have told you to!"
const/4 v3, 0x0
invoke-static {p0, v2, v3}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v2
invoke-virtual {v2}, Landroid/widget/Toast;->show()V
goto :goto_19
.end method[/HIDE]
4) Now recompile your framework.jar And flash it with the both apk from attachment, using CWM of Use AROMA file manager
If You Like it then Hit My Thanks Button. :good:
Special thanks to for his Easter Egg: iamareebjamal
Hello guys
Here is a new guide that help you to add ominiSwitch Recent Panal on your device
Before doing this make sure you have done this.
[This guide is only for Android 5.0+]
Credit:-
KachalkinGeorg (The GK)
Reuirement (Deodexed):-
1.Settings.apk
2.SystemUI.apk
3.framework.jar
4.NotePad++
5.Patience.. if you dont have try to get it
First part ( Settings.apk )
1.Decompile Settings.apk
2.Download ominisettings.zip from attachment. Extract and copy files to your decompiled Settings
3.Open Settings\res\xml\gk_recents_panel.xml
add
Code:
<PreferenceCategory android:title="@string/recents_panel_other">
<PreferenceScreen android:title="@string/omniswitch_settings_title" android:fragment="com.android.settings.gk.RecentsPanel.OmniSwitch" />
</PreferenceCategory>
4.Open Settings\res\values\strings.xml
add
Code:
<string name="recents_panel_other">Other Recents</string>
<string name="omniswitch_settings_title">OmniSwitch</string>
<string name="recents_use_omniswitch_title">Use for recents</string>
<string name="recents_use_omniswitch_summary">Use OmniSwitch instead of default recents view</string>
<string name="omniswitch_start_settings_title">Settings</string>
<string name="omniswitch_start_settings_summary">Open OmniSwitch settings</string>
<string name="omniswitch_first_time_title">Information</string>
<string name="omniswitch_first_time_message">Make sure you have enabled OmniSwitch. You can do this by using \"Settings\" below</string>
5.Recompile and Decompile Settings (For id's)
6.Open Settings\smali\com\android\settings\gk\RecentsPanel\OmniSwitch.smali
find
Code:
0x7f090427
replace with below id
Code:
<public type="string" name="omniswitch_first_time_title"
find
Code:
0x7f090428
replace with below id
Code:
<public type="string" name="omniswitch_first_time_message"
find
Code:
0x7f060067
replace with below id
Code:
<public type="xml" name="gk_recents_omniswitch"
7.Recompile Settings and move to your device
Continued on next post
Continued.
Second Part ( SystemUI.apk )
1.Decompile SystemUI.apk
2.Open SystemUI\smali\com\android\systemui\statusbar\BaseStatusBar.smali
find below method
Code:
.method static sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V
After the end of the previous method, add this
Code:
.method private isOmniSwitchEnabled()Z
.locals 6
.prologue
const/4 v1, 0x1
const/4 v2, 0x0
.line 1196
iget-object v3, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "recents_use_omniswitch"
const/4 v5, -0x2
invoke-static {v3, v4, v2, v5}, Landroid/provider/Settings$System;->getIntForUser(Landroid/content/ContentResolver;Ljava/lang/String;II)I
move-result v0
.line 1199
.local v0, "settingsValue":I
if-ne v0, v1, :cond_0
:goto_0
return v1
:cond_0
move v1, v2
goto :goto_0
.end method
find
Code:
.method protected cancelPreloadingRecents()V
replace whole method with this
Code:
.method protected cancelPreloadingRecents()V
.locals 1
.prologue
.line 1246
invoke-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z
move-result v0
if-nez v0, :cond_0
.line 1247
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
if-eqz v0, :cond_0
.line 1248
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->cancelPreloadingRecents()V
.line 1251
:cond_0
return-void
.end method
find
Code:
.method protected hideRecents(ZZ)V
replace whole method with this
Code:
.method protected hideRecents(ZZ)V
.locals 3
.param p1, "triggeredFromAltTab" # Z
.param p2, "triggeredFromHomeKey" # Z
.prologue
.line 1215
invoke-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z
move-result v1
if-eqz v1, :cond_1
.line 1216
new-instance v0, Landroid/content/Intent;
const-string v1, "org.omnirom.omniswitch.ACTION_HIDE_OVERLAY"
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 1217
.local v0, "showIntent":Landroid/content/Intent;
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;
sget-object v2, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v1, v0, v2}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
.line 1223
.end local v0 # "showIntent":Landroid/content/Intent;
:cond_0
:goto_0
return-void
.line 1219
:cond_1
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
if-eqz v1, :cond_0
.line 1220
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
invoke-interface {v1, p1, p2}, Lcom/android/systemui/RecentsComponent;->hideRecents(ZZ)V
goto :goto_0
.end method
find
Code:
.method protected preloadRecents()V
replace whole method
Code:
.method protected preloadRecents()V
.locals 1
.prologue
.line 1238
invoke-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z
move-result v0
if-nez v0, :cond_0
.line 1239
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
if-eqz v0, :cond_0
.line 1240
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->preloadRecents()V
.line 1243
:cond_0
return-void
.end method
find
Code:
.method protected showRecents(Z)V
replace whole method with this
Code:
.method protected showRecents(Z)V
.locals 3
.param p1, "triggeredFromAltTab" # Z
.prologue
.line 1203
invoke-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z
move-result v1
if-eqz v1, :cond_1
.line 1204
new-instance v0, Landroid/content/Intent;
const-string v1, "org.omnirom.omniswitch.ACTION_SHOW_OVERLAY"
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 1205
.local v0, "showIntent":Landroid/content/Intent;
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;
sget-object v2, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v1, v0, v2}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
.line 1212
.end local v0 # "showIntent":Landroid/content/Intent;
:cond_0
:goto_0
return-void
.line 1207
:cond_1
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
if-eqz v1, :cond_0
.line 1208
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;
const-string v2, "recentapps"
invoke-static {v1, v2}, Lcom/android/systemui/statusbar/BaseStatusBar;->sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V
.line 1209
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
invoke-virtual {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->getStatusBarView()Landroid/view/View;
move-result-object v2
invoke-interface {v1, p1, v2}, Lcom/android/systemui/RecentsComponent;->showRecents(ZLandroid/view/View;)V
goto :goto_0
.end method
find
Code:
.method protected showRecentsNextAffiliatedTask()V
replace whole method with this
Code:
.method protected showRecentsNextAffiliatedTask()V
.locals 1
.prologue
.line 1254
invoke-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z
move-result v0
if-nez v0, :cond_0
.line 1255
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
if-eqz v0, :cond_0
.line 1256
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->showNextAffiliatedTask()V
.line 1259
:cond_0
return-void
.end method
find
Code:
.method protected showRecentsPreviousAffiliatedTask()V
replace whole method with this
Code:
.method protected showRecentsPreviousAffiliatedTask()V
.locals 1
.prologue
.line 1262
invoke-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z
move-result v0
if-nez v0, :cond_0
.line 1263
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
if-eqz v0, :cond_0
.line 1264
iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->showPrevAffiliatedTask()V
.line 1267
:cond_0
return-void
.end method
find
Code:
.method protected toggleRecents()V
replace whole method with this
Code:
.method protected toggleRecents()V
.locals 5
.prologue
.line 1226
invoke-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z
move-result v1
if-eqz v1, :cond_1
.line 1227
new-instance v0, Landroid/content/Intent;
const-string v1, "org.omnirom.omniswitch.ACTION_TOGGLE_OVERLAY"
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 1228
.local v0, "showIntent":Landroid/content/Intent;
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;
sget-object v2, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v1, v0, v2}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
.line 1235
.end local v0 # "showIntent":Landroid/content/Intent;
:cond_0
:goto_0
return-void
.line 1230
:cond_1
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
if-eqz v1, :cond_0
.line 1231
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;
const-string v2, "recentapps"
invoke-static {v1, v2}, Lcom/android/systemui/statusbar/BaseStatusBar;->sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V
.line 1232
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;
iget-object v2, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mDisplay:Landroid/view/Display;
iget v3, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mLayoutDirection:I
invoke-virtual {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->getStatusBarView()Landroid/view/View;
move-result-object v4
invoke-interface {v1, v2, v3, v4}, Lcom/android/systemui/RecentsComponent;->toggleRecents(Landroid/view/Display;ILandroid/view/View;)V
goto :goto_0
.end method
3.Recompile SystemUI and move to your device
Continued on next post
Continued.
Final part ( framework.jar )
1.Decompile framework.jar
2.Download ominiframework.zip from attachment. Extract and copy files to decompiled framework
3.Open framework.jar\smali\android\provider\Settings$System.smali
find
Code:
.field public static final RECENTS_SHOW_SEARCH_BAR:Ljava/lang/String; = "recents_show_search_bar"
below add a new field
Code:
.field public static final RECENTS_USE_OMNISWITCH:Ljava/lang/String; = "recents_use_omniswitch"
4.Recompile framework and move to your device
Now download Omini_System.zip and flash using any custom recovery.
Enjoy...
Screenshots:-
solved found a way to set var in code thanks !!
dont know where to got for help i decompiled a app i use and it gets device imei number in app i found all parts that get imei number and wana set virable to a fixed imei number
where do i have to enter a fixed set code ? i have imei number i wana set but c++ is nothink like this code i got fro apk studio .smali file
any help please
.source "ConfigManager.java"
Code:
.field private final PREF_DEVICE_IMEI:Ljava/lang/String;
###################################################################
.line 32
const-string v0, "Imei"
iput-object v0, p0, Lcom/apexnetworks/rms/config/ConfigManager;->PREF_DEVICE_IMEI:Ljava/lang/String;
##################################################################################
.method public getDeviceImei(Landroid/content/Context;)Ljava/lang/String;
.locals 3
.param p1, "context" # Landroid/content/Context;
.prologue
.line 117
invoke-direct {p0, p1}, Lcom/apexnetworks/rms/config/ConfigManager;->getInstallationSecurityPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v0
const-string v1, "Imei"
const/4 v2, 0x0
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
###################################################################################
.method public setDeviceImei(Landroid/content/Context;Ljava/lang/String;)V
.locals 3
.param p1, "context" # Landroid/content/Context;
.param p2, "deviceImei" # Ljava/lang/String;
.prologue
.line 121
invoke-direct {p0, p1}, Lcom/apexnetworks/rms/config/ConfigManager;->getInstallationSecurityPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v1
.line 122
.local v1, "sp":Landroid/content/SharedPreferences;
invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
.line 123
.local v0, "editor":Landroid/content/SharedPreferences$Editor;
const-string v2, "Imei"
invoke-interface {v0, v2, p2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
.line 124
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
.line 125
return-void
.end method
This guide will tell you how you can add Marshmallow Platlogo to your JellyBean Device.(Found it on Internet)
Requirements :-> Android 4.1 or up
-> APK Tools (Download Here)
-> 7-zip
-> framework.jar (from System\Framework\framework.jar)
-> Marshmallow.zip (Link Below)
-> Notepad++
-> Custom Recovery (eg.CWM)
-> Basic Knowledge of Decompiling, Recompiling, Flashing
Now, How to do it :
STEP 1: Decompile 'framework.jar' using APK Tools. (If you don't know how to do it, Click Here)
STEP 2: Go to '\smali\com\android\internal\app\PlatLogoActivity.smali'
STEP 3: Open 'PlatLogoActivity.smali' using Notepad++ and delete all content. and Copy the code from here down below and save the file.
Code:
.class public Lcom/android/internal/app/PlatLogoActivity;
.super Landroid/app/Activity;
.source "PlatLogoActivity.java"
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 12
invoke-direct {p0}, Landroid/app/Activity;-><init>()V
return-void
.end method
# virtual methods
.method protected onCreate(Landroid/os/Bundle;)V
.locals 5
.param p1, "savedInstanceState" # Landroid/os/Bundle;
.prologue
.line 16
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
.line 18
new-instance v1, Landroid/content/Intent;
const-string v2, "android.intent.action.MAIN"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 19
.local v1, "intent":Landroid/content/Intent;
new-instance v2, Landroid/content/ComponentName;
const-string v3, "androstarkdeveloper.marshamlloweasteregg"
const-string v4, "androstarkdeveloper.marshamlloweasteregg.MainActivity"
invoke-direct {v2, v3, v4}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v1, v2}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
.line 23
:try_start_0
invoke-virtual {p0, v1}, Lcom/android/internal/app/PlatLogoActivity;->startActivity(Landroid/content/Intent;)V
:try_end_0
.catch Landroid/content/ActivityNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
.line 39
:goto_0
invoke-virtual {p0}, Lcom/android/internal/app/PlatLogoActivity;->finish()V
.line 41
return-void
.line 31
:catch_0
move-exception v0
.line 35
.local v0, "e":Landroid/content/ActivityNotFoundException;
const-string v2, "Error"
const/4 v3, 0x0
invoke-static {p0, v2, v3}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v2
invoke-virtual {v2}, Landroid/widget/Toast;->show()V
goto :goto_0
.end method
STEP 4: Recompile the framework.jar file and place it back into the System. (Permissions : rw- r-- r--)
STEP 5: Flash the 'Marshmallow Platlogo.zip' using CWM or other recovery (Available in the Download link gicen below)
Downloads and Credits : http://www.romclaims.com/2017/09/apktool-4.1.x-how-to-add-android-marshmallow-platlogo-on-jellybean-device.html
[RESERVED]
[RESERVED]
Good work thanks you