Related
kahvitahra said:
Samsung JB roms
What you need to do is:
-Decompile android.policy.jar of your rom
-Copy attached JB folder to yours (POST 1)
-In file "GlobalActions$99.smali" there is id 0x1110008, you might want to check that this id is same in you roms puplic.xml ( config_sf_slowBlur ).
( check also that ids 0x104000a = "ok" -string and 0x104 = "cancel" -string matches in your framework. )
-Open GlobalActions.smali
-Search line "new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;" ( some roms might have different number on reboot button. You find right one by for example tracking mRestart. See example below. )
-Change number 5 to 99 ( two of them )
Before
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$5;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
After
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$99;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
-Open GlobalActions$SinglePressAction.smali
-Before line "# instance fields"
paste following code
Code:
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
-Then after line "# direct methods"
paste following code
Code:
.method static constructor <clinit>()V
.registers 3
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method
-So your file should look something like this after those changes
Code:
.class abstract Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Lcom/android/internal/policy/impl/GlobalActions$Action;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/internal/policy/impl/GlobalActions;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x40a
name = "SinglePressAction"
.end annotation
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
# instance fields
.field private final mIconResId:I
.field private final mMessageResId:I
# direct methods
.method static constructor <clinit>()V
.registers 3
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method
.method protected constructor <init>(II)V
.registers 3
.parameter "iconResId"
.........
.........
-Compile .jar and your done.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click to expand...
Click to collapse
Note : This is not my work..I'm just sharing the work of the XDA Member kahvitahra :
Original Thread - http://forum.xda-developers.com/showpost.php?p=38379872&postcount=184
Batt. %
ImBJ said:
original thread - http://forum.xda-developers.com/show...&postcount=184 Samsung JB roms
What you need to do is:
-Decompile android.policy.jar of your rom
-Copy attached JB folder to yours (POST 1)
-In file "GlobalActions$99.smali" there is id 0x1110008, you might want to check that this id is same in you roms puplic.xml ( config_sf_slowBlur ).
( check also that ids 0x104000a = "ok" -string and 0x104 = "cancel" -string matches in your framework. )
-Open GlobalActions.smali
-Search line "new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;" ( some roms might have different number on reboot button. You find right one by for example tracking mRestart. See example below. )
-Change number 5 to 99 ( two of them )
Before
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$5;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
After
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$99;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
-Open GlobalActions$SinglePressAction.smali
-Before line "# instance fields"
paste following code
Code:
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
-Then after line "# direct methods"
paste following code
Code:
.method static constructor <clinit>()V
.registers 3
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method
-So your file should look something like this after those changes
Code:
.class abstract Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Lcom/android/internal/policy/impl/GlobalActions$Action;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/internal/policy/impl/GlobalActions;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x40a
name = "SinglePressAction"
.end annotation
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
# instance fields
.field private final mIconResId:I
.field private final mMessageResId:I
# direct methods
.method static constructor <clinit>()V
.registers 3
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method
.method protected constructor <init>(II)V
.registers 3
.parameter "iconResId"
.........
.........
-Compile .jar and your done.
Click to expand...
Click to collapse
[/QUOTE]
Are the screen shots of sg star??? If yes how did u enabled battery percentage????
deleted
Are the screen shots of sg star??? If yes how did u enabled battery percentage????[/QUOTE]
its galaxy young !! i'll post the tutorial for battery percentage later..
U can also do this using xposed module xblast tools
Sent from my GT-S5282 using Tapatalk
T3snake said:
U can also do this using xposed module xblast tools
Sent from my GT-S5282 using Tapatalk
Click to expand...
Click to collapse
i agree !! but this is for custom roms !! so people can have it without xblast tool !!
nice tut thank bro for this mod
Are the screen shots of sg star??? If yes how did u enabled battery percentage????[/QUOTE]
charging lol
I have found about 5 different threads that have methods to edit clock.smali to remove am/pm from status bar but none of them work on this rom, it has a different clock.smali. after a few hours of searching i've decided to start a new thread because it seems we need a different variant of the mod for this variant of clock.smali. This is taken from an LG phone running 4.0.4
i'm going to post my clock.smali and if anyone has any ideas i would love to try/test them out.
Code:
.class public Lcom/android/systemui/statusbar/policy/Clock;
.super Landroid/widget/TextView;
.source "Clock.java"
# instance fields
.field private mAttached:Z
.field private mCalendar:Ljava/util/Calendar;
.field private mClockFormat:Ljava/text/SimpleDateFormat;
.field private mClockFormatString:Ljava/lang/String;
.field private mHandler:Landroid/os/Handler;
.field private final mIntentReceiver:Landroid/content/BroadcastReceiver;
.field private mPhoneStateListener:Landroid/telephony/PhoneStateListener;
.field mServiceState:Landroid/telephony/ServiceState;
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.locals 1
.parameter "context"
.prologue
.line 83
const/4 v0, 0x0
invoke-direct {p0, p1, v0}, Lcom/android/systemui/statusbar/policy/Clock;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 84
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.locals 1
.parameter "context"
.parameter "attrs"
.prologue
.line 87
const/4 v0, 0x0
invoke-direct {p0, p1, p2, v0}, Lcom/android/systemui/statusbar/policy/Clock;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
.line 88
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
.locals 1
.parameter "context"
.parameter "attrs"
.parameter "defStyle"
.prologue
.line 91
invoke-direct {p0, p1, p2, p3}, Landroid/widget/TextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
.line 170
new-instance v0, Lcom/android/systemui/statusbar/policy/Clock$3;
invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/Clock$3;-><init>(Lcom/android/systemui/statusbar/policy/Clock;)V
iput-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mIntentReceiver:Landroid/content/BroadcastReceiver;
.line 94
new-instance v0, Landroid/telephony/PhoneStateListener;
invoke-direct {v0}, Landroid/telephony/PhoneStateListener;-><init>()V
iput-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mPhoneStateListener:Landroid/telephony/PhoneStateListener;
.line 95
invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/Clock;->getPhoneStateListener()Landroid/telephony/PhoneStateListener;
move-result-object v0
iput-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mPhoneStateListener:Landroid/telephony/PhoneStateListener;
.line 98
new-instance v0, Lcom/android/systemui/statusbar/policy/Clock$1;
invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/Clock$1;-><init>(Lcom/android/systemui/statusbar/policy/Clock;)V
iput-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mHandler:Landroid/os/Handler;
.line 105
return-void
.end method
.method static synthetic access$000(Lcom/android/systemui/statusbar/policy/Clock;)Ljava/util/Calendar;
.locals 1
.parameter "x0"
.prologue
.line 62
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mCalendar:Ljava/util/Calendar;
return-object v0
.end method
.method static synthetic access$002(Lcom/android/systemui/statusbar/policy/Clock;Ljava/util/Calendar;)Ljava/util/Calendar;
.locals 0
.parameter "x0"
.parameter "x1"
.prologue
.line 62
iput-object p1, p0, Lcom/android/systemui/statusbar/policy/Clock;->mCalendar:Ljava/util/Calendar;
return-object p1
.end method
.method static synthetic access$100(Lcom/android/systemui/statusbar/policy/Clock;)Ljava/text/SimpleDateFormat;
.locals 1
.parameter "x0"
.prologue
.line 62
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mClockFormat:Ljava/text/SimpleDateFormat;
return-object v0
.end method
.method static synthetic access$202(Lcom/android/systemui/statusbar/policy/Clock;Ljava/lang/String;)Ljava/lang/String;
.locals 0
.parameter "x0"
.parameter "x1"
.prologue
.line 62
iput-object p1, p0, Lcom/android/systemui/statusbar/policy/Clock;->mClockFormatString:Ljava/lang/String;
return-object p1
.end method
.method static synthetic access$300(Lcom/android/systemui/statusbar/policy/Clock;)Landroid/os/Handler;
.locals 1
.parameter "x0"
.prologue
.line 62
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mHandler:Landroid/os/Handler;
return-object v0
.end method
.method static synthetic access$400(Lcom/android/systemui/statusbar/policy/Clock;)Z
.locals 1
.parameter "x0"
.prologue
.line 62
invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/Clock;->hasService()Z
move-result v0
return v0
.end method
.method static synthetic access$500(Lcom/android/systemui/statusbar/policy/Clock;)Landroid/content/Context;
.locals 1
.parameter "x0"
.prologue
.line 62
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mContext:Landroid/content/Context;
return-object v0
.end method
.method static synthetic access$600(Lcom/android/systemui/statusbar/policy/Clock;)Landroid/content/Context;
.locals 1
.parameter "x0"
.prologue
.line 62
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mContext:Landroid/content/Context;
return-object v0
.end method
.method private getPhoneStateListener()Landroid/telephony/PhoneStateListener;
.locals 1
.prologue
.line 144
new-instance v0, Lcom/android/systemui/statusbar/policy/Clock$2;
invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/Clock$2;-><init>(Lcom/android/systemui/statusbar/policy/Clock;)V
.line 151
.local v0, phoneStateListener:Landroid/telephony/PhoneStateListener;
return-object v0
.end method
.method private final getSmallTime()Ljava/lang/CharSequence;
.locals 9
.prologue
.line 231
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/Clock;->getContext()Landroid/content/Context;
move-result-object v3
.line 232
.local v3, context:Landroid/content/Context;
invoke-static {v3}, Landroid/text/format/DateFormat;->is24HourFormat(Landroid/content/Context;)Z
move-result v2
.line 235
.local v2, b24:Z
if-eqz v2, :cond_0
.line 236
const v5, 0x104007e
.line 241
.local v5, res:I
:goto_0
const v0, 0xef00
.line 242
.local v0, MAGIC1:C
const v1, 0xef01
.line 245
.local v1, MAGIC2:C
invoke-virtual {v3, v5}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object v4
.line 246
.local v4, format:Ljava/lang/String;
iget-object v8, p0, Lcom/android/systemui/statusbar/policy/Clock;->mClockFormatString:Ljava/lang/String;
invoke-virtual {v4, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v8
if-nez v8, :cond_1
.line 278
new-instance v7, Ljava/text/SimpleDateFormat;
invoke-direct {v7, v4}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
.local v7, sdf:Ljava/text/SimpleDateFormat;
iput-object v7, p0, Lcom/android/systemui/statusbar/policy/Clock;->mClockFormat:Ljava/text/SimpleDateFormat;
.line 279
iput-object v4, p0, Lcom/android/systemui/statusbar/policy/Clock;->mClockFormatString:Ljava/lang/String;
.line 283
:goto_1
iget-object v8, p0, Lcom/android/systemui/statusbar/policy/Clock;->mCalendar:Ljava/util/Calendar;
invoke-virtual {v8}, Ljava/util/Calendar;->getTime()Ljava/util/Date;
move-result-object v8
invoke-virtual {v7, v8}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v6
.line 305
.local v6, result:Ljava/lang/String;
return-object v6
.line 238
.end local v0 #MAGIC1:C
.end local v1 #MAGIC2:C
.end local v4 #format:Ljava/lang/String;
.end local v5 #res:I
.end local v6 #result:Ljava/lang/String;
.end local v7 #sdf:Ljava/text/SimpleDateFormat;
:cond_0
const v5, 0x104007d
.restart local v5 #res:I
goto :goto_0
.line 281
.restart local v0 #MAGIC1:C
.restart local v1 #MAGIC2:C
.restart local v4 #format:Ljava/lang/String;
:cond_1
iget-object v7, p0, Lcom/android/systemui/statusbar/policy/Clock;->mClockFormat:Ljava/text/SimpleDateFormat;
.restart local v7 #sdf:Ljava/text/SimpleDateFormat;
goto :goto_1
.end method
.method private hasService()Z
.locals 3
.prologue
const/4 v1, 0x0
.line 155
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mServiceState:Landroid/telephony/ServiceState;
.line 156
.local v0, ss:Landroid/telephony/ServiceState;
if-eqz v0, :cond_0
.line 157
invoke-virtual {v0}, Landroid/telephony/ServiceState;->getState()I
move-result v2
packed-switch v2, :pswitch_data_0
.line 162
:pswitch_0
const/4 v1, 0x1
.line 165
:cond_0
:pswitch_1
return v1
.line 157
:pswitch_data_0
.packed-switch 0x1
:pswitch_1
:pswitch_0
:pswitch_1
.end packed-switch
.end method
# virtual methods
.method protected onAttachedToWindow()V
.locals 5
.prologue
.line 109
invoke-super {p0}, Landroid/widget/TextView;->onAttachedToWindow()V
.line 111
iget-boolean v1, p0, Lcom/android/systemui/statusbar/policy/Clock;->mAttached:Z
if-nez v1, :cond_0
.line 112
const/4 v1, 0x1
iput-boolean v1, p0, Lcom/android/systemui/statusbar/policy/Clock;->mAttached:Z
.line 113
new-instance v0, Landroid/content/IntentFilter;
invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V
.line 115
.local v0, filter:Landroid/content/IntentFilter;
const-string v1, "android.intent.action.TIME_TICK"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 116
const-string v1, "android.intent.action.TIME_SET"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 117
const-string v1, "android.intent.action.TIMEZONE_CHANGED"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 118
const-string v1, "android.intent.action.CONFIGURATION_CHANGED"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 120
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/Clock;->getContext()Landroid/content/Context;
move-result-object v1
iget-object v2, p0, Lcom/android/systemui/statusbar/policy/Clock;->mIntentReceiver:Landroid/content/BroadcastReceiver;
const/4 v3, 0x0
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/Clock;->getHandler()Landroid/os/Handler;
move-result-object v4
invoke-virtual {v1, v2, v0, v3, v4}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;
.line 127
.end local v0 #filter:Landroid/content/IntentFilter;
:cond_0
invoke-static {}, Ljava/util/TimeZone;->getDefault()Ljava/util/TimeZone;
move-result-object v1
invoke-static {v1}, Ljava/util/Calendar;->getInstance(Ljava/util/TimeZone;)Ljava/util/Calendar;
move-result-object v1
iput-object v1, p0, Lcom/android/systemui/statusbar/policy/Clock;->mCalendar:Ljava/util/Calendar;
.line 130
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/Clock;->updateClock()V
.line 131
return-void
.end method
.method protected onDetachedFromWindow()V
.locals 2
.prologue
.line 135
invoke-super {p0}, Landroid/widget/TextView;->onDetachedFromWindow()V
.line 136
iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mAttached:Z
if-eqz v0, :cond_0
.line 137
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/Clock;->getContext()Landroid/content/Context;
move-result-object v0
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/Clock;->mIntentReceiver:Landroid/content/BroadcastReceiver;
invoke-virtual {v0, v1}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V
.line 138
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mAttached:Z
.line 140
:cond_0
return-void
.end method
.method final updateClock()V
.locals 3
.prologue
.line 226
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/Clock;->mCalendar:Ljava/util/Calendar;
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v1
invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->setTimeInMillis(J)V
.line 227
invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/Clock;->getSmallTime()Ljava/lang/CharSequence;
move-result-object v0
invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/policy/Clock;->setText(Ljava/lang/CharSequence;)V
.line 228
return-void
.end method
thanks in advance for any help i will report back asap on any suggestions.
[Q&A] [GUIDE][SMALI]Understanding and Creating Smali Mods & General Smali Questions
Q&A for [GUIDE][SMALI]Understanding and Creating Smali Mods & General Smali Questions
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for [GUIDE][SMALI]Understanding and Creating Smali Mods & General Smali Questions. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
Help me. I die inside.
Hello, I'm stuck.
I've managed to copy the smali models and information here (thanks) and elsewhere to insert info into the sharedPreferences database. I'm testing with checkbox booleans.
What I'm trying to do is call these values back in random places in the smali so I can compare if the checkbox is on, do xxx. I'm working within kik8.2.
I am attempting to return the boolean value directly to the chat text so I can visually see the return and understand better how to use the functions.
Here is where the chat is returned:
a/b/a/g.smali
Code:
.class public Lkik/a/b/a/g;
.super Lkik/a/b/a/f;
.source "SourceFile"
# instance fields
.field private a:Ljava/lang/String;
# direct methods
.method public constructor <init>(Ljava/lang/String;)V
.locals 2
.prologue
const/4 v1, 0x1
.line 9
const/16 v0, 0xf
invoke-direct {p0, v1, v1, v1, v0}, Lkik/a/b/a/f;-><init>(IZZI)V
.line 10
iput-object p1, p0, Lkik/a/b/a/g;->a:Ljava/lang/String;
.line 11
return-void
.end method
# virtual methods
.method public final a()Ljava/lang/String;
.locals 1
.prologue
.line 15
iget-object v0, p0, Lkik/a/b/a/g;->a:Ljava/lang/String;
return-object v0
.end method
Now here are some of the things I've tried to do:
Code:
.class public Lkik/a/b/a/g;
.super Lkik/a/b/a/f;
.source "SourceFile"
# instance fields
.field private a:Ljava/lang/String;
[COLOR="Red"]
.field private c:Landroid/content/SharedPreferences;[/COLOR]
# direct methods
.method public constructor <init>(Ljava/lang/String;)V
.locals 2
.prologue
const/4 v1, 0x1
.line 9
const/16 v0, 0xf
invoke-direct {p0, v1, v1, v1, v0}, Lkik/a/b/a/f;-><init>(IZZI)V
.line 10
iput-object p1, p0, Lkik/a/b/a/g;->a:Ljava/lang/String;
.line 11
return-void
.end method
# virtual methods
.method public final a()Ljava/lang/String;
.locals [COLOR="Red"]4[/COLOR]
.prologue
.line 15
[COLOR="Red"] iget-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
const-string v1, "kik.enterbutton.sends"
const/4 v2, 0x0
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
move-result-object v0
# return v0
#
# iget-object v0, p0, Lkik/a/b/a/g;->a:Ljava/lang/String;[/COLOR]
return-object v0
.end method
logcat shows me I don't have access to /a/a.smali.c->. I'm not very familiar with java so this doesn't exactly help the cause but I've come this far ... so...
This is what is inside /a/a.smali
Code:
.class public Lkik/android/chat/a/a;
.super Ljava/lang/Object;
.source "SourceFile"
# static fields
.field private static final a:Ljava/lang/Long;
# instance fields
.field private b:Lkik/a/h/o;
.field private c:Landroid/content/SharedPreferences;
.field private d:Lkik/a/c/q;
.field private e:Lcom/kik/d/p;
# direct methods
.method static constructor <clinit>()V
.locals 2
.prologue
.line 20
const-wide/16 v0, 0x3e8
invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v0
sput-object v0, Lkik/android/chat/a/a;->a:Ljava/lang/Long;
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Lkik/a/h/o;Lcom/kik/d/p;Lkik/a/c/q;)V
.locals 2
.prologue
.line 29
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 26
new-instance v0, Lcom/kik/d/p;
invoke-direct {v0}, Lcom/kik/d/p;-><init>()V
iput-object v0, p0, Lkik/android/chat/a/a;->e:Lcom/kik/d/p;
.line 30
iput-object p2, p0, Lkik/android/chat/a/a;->b:Lkik/a/h/o;
.line 31
const-string v0, "KikPreferences"
const/4 v1, 0x0
invoke-virtual {p1, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
iput-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
.line 32
iput-object p4, p0, Lkik/android/chat/a/a;->d:Lkik/a/c/q;
.line 33
new-instance v0, Lkik/android/chat/a/b;
invoke-direct {v0, p0}, Lkik/android/chat/a/b;-><init>(Lkik/android/chat/a/a;)V
invoke-virtual {p3, v0}, Lcom/kik/d/p;->a(Lcom/kik/d/r;)Lcom/kik/d/r;
.line 40
return-void
.end method
.method static synthetic a(Lkik/android/chat/a/a;)V
.locals 3
.prologue
.line 17
iget-object v0, p0, Lkik/android/chat/a/a;->d:Lkik/a/c/q;
const-string v1, "kik.android.chat.preferences.UserPreferenceManager.restored"
const/4 v2, 0x1
invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v2
invoke-interface {v0, v1, v2}, Lkik/a/c/q;->a(Ljava/lang/String;Ljava/lang/Boolean;)Z
return-void
.end method
.method static synthetic b(Lkik/android/chat/a/a;)Lcom/kik/d/p;
.locals 1
.prologue
.line 17
iget-object v0, p0, Lkik/android/chat/a/a;->e:Lcom/kik/d/p;
return-object v0
.end method
.method private e()Lcom/kik/j/a/j/a;
.locals 2
.prologue
.line 59
new-instance v0, Lcom/kik/j/a/j/a;
invoke-direct {v0}, Lcom/kik/j/a/j/a;-><init>()V
.line 60
invoke-virtual {p0}, Lkik/android/chat/a/a;->a()Z
move-result v1
invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/kik/j/a/j/a;->a(Ljava/lang/Boolean;)Lcom/kik/j/a/j/a;
.line 61
invoke-virtual {p0}, Lkik/android/chat/a/a;->b()Lcom/kik/j/a/j/a$a;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/kik/j/a/j/a;->a(Lcom/kik/j/a/j/a$a;)Lcom/kik/j/a/j/a;
.line 62
return-object v0
.end method
# virtual methods
.method public final a(Lcom/kik/j/a/j/a$a;)V
.locals 4
.prologue
.line 44
if-nez p1, :cond_0
.line 49
:goto_0
return-void
.line 47
:cond_0
iget-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
const-string v1, "kik.chat.bubble.id"
iget v2, p1, Lcom/kik/j/a/j/a$a;->w:I
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;
move-result-object v0
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
.line 48
iget-object v0, p0, Lkik/android/chat/a/a;->b:Lkik/a/h/o;
const-string v1, "user_preferences"
const/4 v2, 0x0
invoke-direct {p0}, Lkik/android/chat/a/a;->e()Lcom/kik/j/a/j/a;
move-result-object v3
invoke-interface {v0, v1, v2, v3}, Lkik/a/h/o;->b(Ljava/lang/String;Ljava/lang/String;Lcom/b/a/n;)Lcom/kik/d/p;
goto :goto_0
.end method
.method public final a(Z)V
.locals 5
.prologue
.line 53
iget-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
const-string v1, "kik.enterbutton.sends"
invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
move-result-object v0
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
.line 54
iget-object v0, p0, Lkik/android/chat/a/a;->b:Lkik/a/h/o;
const-string v1, "user_preferences"
const/4 v2, 0x0
invoke-direct {p0}, Lkik/android/chat/a/a;->e()Lcom/kik/j/a/j/a;
move-result-object v3
sget-object v4, Lkik/android/chat/a/a;->a:Ljava/lang/Long;
invoke-interface {v0, v1, v2, v3, v4}, Lkik/a/h/o;->b(Ljava/lang/String;Ljava/lang/String;Lcom/b/a/n;Ljava/lang/Long;)Lcom/kik/d/p;
.line 55
return-void
.end method
.method public final a(Z)V
.locals 5
.prologue
.line 53
iget-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
const-string v1, "kik.pikik1"
invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
move-result-object v0
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
.line 54
iget-object v0, p0, Lkik/android/chat/a/a;->b:Lkik/a/h/o;
const-string v1, "user_preferences"
const/4 v2, 0x0
invoke-direct {p0}, Lkik/android/chat/a/a;->e()Lcom/kik/j/a/j/a;
move-result-object v3
sget-object v4, Lkik/android/chat/a/a;->a:Ljava/lang/Long;
invoke-interface {v0, v1, v2, v3, v4}, Lkik/a/h/o;->b(Ljava/lang/String;Ljava/lang/String;Lcom/b/a/n;Ljava/lang/Long;)Lcom/kik/d/p;
.line 55
return-void
.end method
.method public final a(Z)V
.locals 5
.prologue
.line 53
iget-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
const-string v1, "kik.pikik2"
invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
move-result-object v0
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
.line 54
iget-object v0, p0, Lkik/android/chat/a/a;->b:Lkik/a/h/o;
const-string v1, "user_preferences"
const/4 v2, 0x0
invoke-direct {p0}, Lkik/android/chat/a/a;->e()Lcom/kik/j/a/j/a;
move-result-object v3
sget-object v4, Lkik/android/chat/a/a;->a:Ljava/lang/Long;
invoke-interface {v0, v1, v2, v3, v4}, Lkik/a/h/o;->b(Ljava/lang/String;Ljava/lang/String;Lcom/b/a/n;Ljava/lang/Long;)Lcom/kik/d/p;
.line 55
return-void
.end method
.method public final a()Z
.locals 3
.prologue
.line 67
iget-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
const-string v1, "kik.enterbutton.sends"
const/4 v2, 0x0
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
move-result v0
return v0
.end method
.method public final b()Lcom/kik/j/a/j/a$a;
.locals 3
.prologue
.line 72
iget-object v0, p0, Lkik/android/chat/a/a;->c:Landroid/content/SharedPreferences;
const-string v1, "kik.chat.bubble.id"
const/4 v2, -0x1
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I
move-result v0
invoke-static {v0}, Lcom/kik/j/a/j/a$a;->a(I)Lcom/kik/j/a/j/a$a;
move-result-object v0
return-object v0
.end method
.method public final c()V
.locals 3
.prologue
.line 87
iget-object v0, p0, Lkik/android/chat/a/a;->d:Lkik/a/c/q;
const-string v1, "kik.android.chat.preferences.UserPreferenceManager.restored"
invoke-interface {v0, v1}, Lkik/a/c/q;->j(Ljava/lang/String;)Ljava/lang/Boolean;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
move-result v0
if-eqz v0, :cond_0
.line 89
iget-object v0, p0, Lkik/android/chat/a/a;->e:Lcom/kik/d/p;
invoke-virtual {v0}, Lcom/kik/d/p;->e()V
.line 107
:goto_0
return-void
.line 92
:cond_0
iget-object v0, p0, Lkik/android/chat/a/a;->b:Lkik/a/h/o;
const-string v1, "user_preferences"
const-class v2, Lcom/kik/j/a/j/a;
invoke-interface {v0, v1, v2}, Lkik/a/h/o;->d(Ljava/lang/String;Ljava/lang/Class;)Lcom/kik/d/p;
move-result-object v0
new-instance v1, Lkik/android/chat/a/c;
invoke-direct {v1, p0}, Lkik/android/chat/a/c;-><init>(Lkik/android/chat/a/a;)V
invoke-virtual {v0, v1}, Lcom/kik/d/p;->a(Lcom/kik/d/r;)Lcom/kik/d/r;
goto :goto_0
.end method
.method public final d()Lcom/kik/d/p;
.locals 1
.prologue
.line 111
iget-object v0, p0, Lkik/android/chat/a/a;->e:Lcom/kik/d/p;
return-object v0
.end method
I was successfully able to insert using a.smali function copy and associating it throughout xml and where necessary in the other referencing smali to set its value to 1 before login. The "kik.pikik1" and "kik.pikik2" are the fields I've inserted and I'm trying to read out of the SharedPrefs. Any help is greatly appreciated.
I have tried many things in the g.smali to return the value (1/0, true/false) directly into the chat. Setting as object and regular return. I'm using "enterbuttonsends" because it's native.
Can anyone please help me im a nood at all of this and im not sure which ADB
Notepad ++
A good image editor like Photoshop or GIMP app on the play store will be the best ones that fit listed tools can anyone please help me ???
hello I'm your follower, I wanted to ask if you could explain how you created onclicklistener to change from Celsius to Fahrenheit because I wanted to adapt it to a clock change from analog to digital. I hope you can help me. I await your answer thanks sorry for my english but I'm Italian ... you can also write on telegram @Pirrotto. happy to follow you
Hello there!
I would like to ask how to crack an apk which requires code in order to be activated.
The following apk is this : //play.google.com/store/apps/details?id=org.ndsbg.android.zebratest&hl=bg&rdid=%20org.ndsbg.android.zebratest&pli=1#details-reviews
I'm a newbie and i am trying to change the permission of the apk so when you enter to be activated at once without the requirement of the code.
Here is the apk which i have decompiled: //drive.google.com/open?id=0B6ZzM6XEUkzgWW43aFZURlU3Y1E
I am looking inside one of the files which is called activitycompayhoneycomb which is invalidating the activity of the apk and i am wondering what to do cuz i don't understand any bit of this language :
.class Landroid/support/v4/app/ActivityCompatHoneycomb;
.super Ljava/lang/Object;
.source "ActivityCompatHoneycomb.java"
# direct methods
.method constructor <init>()V
.locals 0
.prologue
.line 27
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method static dump(Landroid/app/Activity;Ljava/lang/String;Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/StringV
.locals 0
.param p0, "activity" # Landroid/app/Activity;
.param p1, "prefix" # Ljava/lang/String;
.param p2, "fd" # Ljava/io/FileDescriptor;
.param p3, "writer" # Ljava/io/PrintWriter;
.param p4, "args" # [Ljava/lang/String;
.prologue
.line 34
invoke-virtual {p0, p1, p2, p3, p4}, Landroid/app/Activity;->dump(Ljava/lang/String;Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/StringV
.line 35
return-void
.end method
.method static invalidateOptionsMenu(Landroid/app/ActivityV
.locals 0
.param p0, "activity" # Landroid/app/Activity;
.prologue
.line 29
invoke-virtual {p0}, Landroid/app/Activity;->invalidateOptionsMenu()V
.line 30
return-void
.end method
Activity :
.class public Landroid/support/v4/app/ActivityCompat;
.super Landroid/support/v4/content/ContextCompat;
.source "ActivityCompat.java"
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 27
invoke-direct {p0}, Landroid/support/v4/content/ContextCompat;-><init>()V
return-void
.end method
.method public static invalidateOptionsMenu(Landroid/app/ActivityZ
.locals 2
.param p0, "activity" # Landroid/app/Activity;
.prologue
.line 61
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0xb
if-lt v0, v1, :cond_0
.line 62
invoke-static {p0}, Landroid/support/v4/app/ActivityCompatHoneycomb;->invalidateOptionsMenu(Landroid/app/ActivityV
.line 63
const/4 v0, 0x1
.line 65
:goto_0
return v0
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
If anyone could help me i would be very grateful.
RULE 6. Do not post or request warez.
If a piece of software requires you to pay to use it, then pay for it.
We do not accept warez nor do we permit members to request, post, promote or describe ways in which warez, cracks, serial codes or other means of avoiding payment, can be obtained or used.
This is a site of developers, i.e. the sort of people who create such software.
When you cheat a software developer, you cheat us as a community.
Thread Closed!
Hi, I've been reading this forum and it has been very helpful towards beginners. I have two questions about smali bytecode..
I often see something like this
Code:
.method public final setValue(Ljava/lang/String;)V
.registers 2
iput-object p1, p0 Lpackage;->Ihavevalue:Ljava/lang/String;
return-void
.end-method
What I have been trying to do is to add a GET HTTP Request in between to log the value. (Doing it for a bet with my pal)
Code:
.method public final setValue(Ljava/lang/String;)V
.registers 5
iput-object p1, p0 Lpackage;->Ihavevalue:Ljava/lang/String;
new-instance v0, Ljava/net/URL;
const-string v1, "http://SomeUrl"
invoke-direct {v0, v1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
const-string v1, "GET"
invoke-virtual {v0}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;
# There's some check-cast I see here.. but decided to omit it
move-result-object v0
invoke-virtual {v0, v1}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V
invoke-virtual {v0}, Ljava/net/URLConnection;->connect()V
return-void
.end-method
This is what it kind of looks like. But my server is not receiving any requests..
Am I missing something?
And also, can you call any class in smali anywhere?
E.g
call Lcom/package/packagex methods in Lcom/packagey/packagez ?
Thanks for reading this question... I really hope seniors can clarify. <3
I promise to contribute to modding once I learn about smali..