smali bytecode - Android Q&A, Help & Troubleshooting

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..

Related

[MOD/Source] [KB5] Text-based battery percent in Status bar

This was more or less the same method I used before, but this time for battery percentage.
Same procedure as before:
decompile services.jar
open com/android/server/status/StatusBarPolicy.smali
do the edits below
compile
push in recovery/flash
first, make the system think we're dealing with text
find
Code:
.line 524
const-string v3, "battery"
const v4, 0x10802ae
invoke-static {v3, v7, v4, v6, v6}, Lcom/android/server/status/IconData;->makeIcon(Ljava/lang/String;Ljava/lang/String;III)Lcom/android/server/status/IconData;
move-result-object v3
iput-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryData:Lcom/android/server/status/IconData;
.line 526
iget-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryData:Lcom/android/server/status/IconData;
invoke-virtual {p2, v3, v7}, Lcom/android/server/status/StatusBarService;->addIcon(Lcom/android/server/status/IconData;Lcom/android/server/status/NotificationData;)Landroid/os/IBinder;
move-result-object v3
iput-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryIcon:Landroid/os/IBinder;
and replace it with this
Code:
const-string v3, "battery"
const-string v4, "?% "
invoke-static {v3, v4}, Lcom/android/server/status/IconData;->makeText(Ljava/lang/String;Ljava/lang/CharSequence;)Lcom/android/server/status/IconData;
move-result-object v3
iput-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryData:Lcom/android/server/status/IconData;
.line 9991
iget-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryData:Lcom/android/server/status/IconData;
invoke-virtual {p2, v3, v7}, Lcom/android/server/status/StatusBarService;->addIcon(Lcom/android/server/status/IconData;Lcom/android/server/status/NotificationData;)Landroid/os/IBinder;
move-result-object v3
iput-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryIcon:Landroid/os/IBinder;
next replace the updateBattery() method with this one
Code:
.method private final updateBatteryNum()V
.registers 10
.prologue
const-string v5, ""
:cond_1
iget v1, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryLevel:I
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v5
const-string v1, "%"
invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
goto :goto_1
if-nez v4, :cond_1
:goto_1
.line 106
iget-object v2, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryTextData:Lcom/android/server/status/IconData;
.line 107
iput-object v5, v2, Lcom/android/server/status/IconData;->text:Ljava/lang/CharSequence;
.line 762
iget-object v5, p0, Lcom/android/server/status/StatusBarPolicy;->mService:Lcom/android/server/status/StatusBarService;
iget-object v6, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryTextIcon:Landroid/os/IBinder;
iget-object v7, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryTextData:Lcom/android/server/status/IconData;
const/4 v8, 0x0
invoke-virtual {v5, v6, v7, v8}, Lcom/android/server/status/StatusBarService;->updateIcon(Landroid/os/IBinder;Lcom/android/server/status/IconData;Lcom/android/server/status/NotificationData;)V
return-void
.end method
ok, now my method is a little different and it doesn't take any inputs, so we're gonna have to modify the call to it
find this:
Code:
.method static synthetic access$300(Lcom/android/server/status/StatusBarPolicy;Landroid/content/Intent;)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 111
invoke-direct {p0, p1}, Lcom/android/server/status/StatusBarPolicy;->updateBattery(Landroid/content/Intent;)V
return-void
.end method
towards the bottom you'll see the call to the method, change that block of code to
Code:
.method static synthetic access$300(Lcom/android/server/status/StatusBarPolicy;Landroid/content/Intent;)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 111
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateBattery()V
return-void
.end method
done!
Wow great work man. This is awesome.
Sent from my SGH-T959
jneal9 said:
Wow great work man. This is awesome.
Sent from my SGH-T959
Click to expand...
Click to collapse
Thats the only kind he does
Whitehawkx said:
Thats the only kind he does
Click to expand...
Click to collapse
Agreed! Same with you.
jellette said:
Agreed! Same with you.
Click to expand...
Click to collapse
Touché.
All of you guys do...
Hmm...interesting. Great work man.
so is there anyway easier?
i was wondering if there is anyway this can be done through a flash or not? that would just replace the entire services.jar right? i guess im gonna try it. lol. ever since i flashed whitehawks new lockscreens no battery percent mod will work properly. it will just show the percent as if it was an inaccurate battery. ex. if i was on 47 percent it would show 40 percent until i got into the 30's.
Good work man as always ..
COuld You provide the same tutorial for ICS?
There is no StatusbarPolicy.smali after baksmali services.jar
data enabled after USB disconected
If I disable data connection and connect to USB data is automatically activated.
If I disable data with connected to USB after disconect data is automatically activated again.
This issue is for all ICS ROMs
Why?
I need tutorial for ICS too.
I'd like to try this and I decompiled services.jar.
But there are no StatusBarPolicy.smali.
My phone isXperia acro HD(ICS 4.0.4).
* Xperia acro HD is localized Xperia S for Japan.

[HOW-TO] [LSJ] [4.1.2] Volume Rocker mod **26 NOV fixed**

Hello xda'ers.
Today I post this thread to help people who want volume rocker mod in their I9100.
This thread is not supposed to be a request thread, especially for non thanking people, but is open to help, support and debug (or improves).
For DEVs the how to on jelly bean [LSJ] (add green parts)
edit PhoneWindowManager.smali in android.policy.jar
Code:
.field private mIsSensorhubEnabled:Z
.field mIsSleepWithCameraOnTop:Z
.field private mIsTablet:Z
.field private mIsVisibleSPenGestureView:Z
[COLOR="YellowGreen"].field mIsVolumeAction:Z
.field mIsVolumeBlocking:Z
[/COLOR]
.field mKeyboardTapVibePattern:[J
.field mKeyguard:Landroid/view/WindowManagerPolicy$WindowState;
.field mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;
Code:
.field private mVolumeDownKeyTime:J
.field private mVolumeDownKeyTriggered:Z
[COLOR="YellowGreen"].field mVolumeDownLongPress:Ljava/lang/Runnable;[/COLOR]
.field private final mVolumeKeyLongPressforOneTouchReport:Ljava/lang/Runnable;
.field private mVolumeUpKeyConsumedByOneTouchReportChord:Z
.field private mVolumeUpKeyConsumedByScreenRecordChord:Z
.field private mVolumeUpKeyTime:J
.field private mVolumeUpKeyTriggered:Z
[COLOR="YellowGreen"].field mVolumeUpLongPress:Ljava/lang/Runnable;[/COLOR]
.field mWindowManager:Landroid/view/IWindowManager;
.field mWindowManagerFuncs:Landroid/view/WindowManagerPolicy$WindowManagerFuncs;
Code:
.line 7234
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$35;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$35;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenLockTimeout:Ljava/lang/Runnable;
[COLOR="YellowGreen"] .line 8130
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipNext;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipNext;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
.line 8131
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipPrev;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipPrev;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
[/COLOR]
.line 8132
return-void
.end method
Code:
.method handleVolumeKey(II)V
.registers 8
.parameter "stream"
.parameter "keycode"
.prologue
.line 5405
[COLOR="YellowGreen"] move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-nez v0, :cond_c[/COLOR]
invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getAudioService()Landroid/media/IAudioService;
move-result-object v0
.line 5406
.local v0, audioService:Landroid/media/IAudioService;
if-nez v0, :cond_7
.line 5437
[COLOR="YellowGreen"] :cond_c
:goto_c[/COLOR]
return-void
[COLOR="Red"]:goto_6[/COLOR]
Code:
.line 5435
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
[COLOR="YellowGreen"]goto :goto_c[/COLOR]
[COLOR="Red"] goto :goto_6[/COLOR]
Code:
.line 5435
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
[COLOR="YellowGreen"]goto :goto_c[/COLOR]
[COLOR="Red"]goto :goto_6[/COLOR]
add this just above .method public hasNavigationBar()Z
Code:
[COLOR="YellowGreen"].method handleVolumeLongPress(I)V
.registers 6
.parameter "keycode"
.prologue
const/4 v1, 0x1
move-object/from16 v0, p0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
const/4 v1, 0x0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
const/16 v1, 0x18
if-ne p1, v1, :cond_19
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
.local v0, btnHandler:Ljava/lang/Runnable;
:goto_e
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
invoke-static {}, Landroid/view/ViewConfiguration;->getTapTimeout()I
move-result v2
int-to-long v2, v2
invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
.end local v0 #btnHandler:Ljava/lang/Runnable;
:cond_19
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
.restart local v0 #btnHandler:Ljava/lang/Runnable;
goto :goto_e
.end method
.method handleVolumeLongPressAbort()V
.registers 3
.prologue
const/4 v1, 0x0
move-object/from16 v0, p0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
return-void
.end method
[/COLOR]
Code:
.line 5838
:cond_388
:goto_388
[COLOR="YellowGreen"]if-eqz v5, :cond_mir[/COLOR]
[COLOR="Red"]if-eqz v5, :cond_4f3[/COLOR]
Code:
.line 5926
.end local v6 #ex:Landroid/os/RemoteException;
:cond_4c0
move-object/from16 v0, p0
[COLOR="YellowGreen"] iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenOnEarly:Z
if-nez v0, :cond_new
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
move-result v25
if-eqz v25, :cond_new
move-object/from16 v0, p0
move/from16 v14, v18
invoke-virtual {v0, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(I)V
:cond_new
move-object/from16 v0, p0
[/COLOR]
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v27, v0
if-nez v27, :cond_68
Code:
.line 5934
.end local v26 #telephonyService:Lcom/android/internal/telephony/ITelephony;
[COLOR="Red"]:cond_4f3[/COLOR]
[COLOR="YellowGreen"]:cond_mir
if-nez v5, :cond_ko
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-eqz v0, :cond_ko
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
if-nez v0, :cond_ko
move-object/from16 v0, p0
const/4 v3, 0x0
move/from16 v14, v18
invoke-virtual {v0, v3, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_ko[/COLOR]
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v27, v0
if-eqz v27, :cond_68
add this method under .method sendCloseSystemWindows(Ljava/lang/StringV
Code:
[COLOR="YellowGreen"].method protected sendMediaButtonEvent(I)V
.registers 15
.parameter "code"
.prologue
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v1
.local v1, eventtime:J
new-instance v11, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v11, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
.local v11, downIntent:Landroid/content/Intent;
new-instance v0, Landroid/view/KeyEvent;
const/4 v5, 0x0
const/4 v7, 0x0
move-wide v3, v1
move v6, p1
invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;-><init>(JJIII)V
.local v0, downEvent:Landroid/view/KeyEvent;
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v11, v4, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v11, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V
new-instance v12, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v12, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
.local v12, upIntent:Landroid/content/Intent;
new-instance v3, Landroid/view/KeyEvent;
const/4 v8, 0x1
const/4 v10, 0x0
move-wide v4, v1
move-wide v6, v1
move v9, p1
invoke-direct/range {v3 .. v10}, Landroid/view/KeyEvent;-><init>(JJIII)V
.local v3, upEvent:Landroid/view/KeyEvent;
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v12, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v12, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V
const/4 v8, 0x1
move-object/from16 v9, p0
iput-boolean v8, v9, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
return-void
.end method[/COLOR]
done.
now add the 2 subclasses attached and recompile.
Mirko ddd said:
Hello xda'ers.
Today I post this thread to help people who want volume rocker mod in their I9100.
Mod is based on kahvitara's one, but cleaned up and easier to implement; no SDcard path, minimum delay and ready to use.
This thread is not supposed to be a request thread, especially for non thanking people, but is open to help, support and debug (or improves).
here is the smali diffs, and u can find the untouched file before of applying the mod so u can compare and implement it easily.
Tested on I9100 (my phone) but will work on US clones, and most of ICS samsung touchwized phones with some rearranging.
Currently I m on LPX, if someone cares I can provide the zip, but only with this mod and reccommended ONLY to samsung stock deodexed roms LPX.
Click to expand...
Click to collapse
Another awwsome mod by Mirko.!! Always grt to hv you arnd mate :good:
geekynoob said:
Another awwsome mod by Mirko.!! Always grt to hv you arnd mate :good:
Click to expand...
Click to collapse
Inviato dal mio GT-I9100 con Tapatalk 2
Hi Mirko.
In your file you have this code. In the stock file I am comparing to and the PhoneWindowManager$KillConcept.smali file does not exist either. Is this part new code and new file?:
Code:
.line 3674
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
tdunham said:
Hi Mirko.
In your file you have this code. In the stock file I am comparing to and the PhoneWindowManager$KillConcept.smali file does not exist either. Is this part new code and new file?:
Code:
.line 3674
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
Click to expand...
Click to collapse
i don t understand, are we talking about backto kill or volume rocker?
Mirko ddd said:
i don t understand, are we talking about backto kill or volume rocker?
Click to expand...
Click to collapse
This is for Volume Rocker. I do not have those lines or (Killconcept file) in my code. I also download this: i9100_XWLPX_Deodexed_signed.zip hoping to have stock android.policy.jar for comparison and is does not exist there either. So I thought I would ask.
Edit: I feel foolish, you put code on Github that included code for back to kill mod. I should have noticed. You may want to remove that code to prevent confusion.
tdunham said:
This is for Volume Rocker. I do not have those lines or (Killconcept file) in my code. I also download this: i9100_XWLPX_Deodexed_signed.zip hoping to have stock android.policy.jar for comparison and is does not exist there either. So I thought I would ask.
Click to expand...
Click to collapse
mate.. kill concept smali has nothing to do with volume rocker
Mirko ddd said:
mate.. kill concept smali has nothing to do with volume rocker
Click to expand...
Click to collapse
Yes, no problem. I found out as soon as I posted. Thanks.
tdunham said:
Yes, no problem. I found out as soon as I posted. Thanks.
Click to expand...
Click to collapse
lol :silly:
MirkO You Are Really Great
updated to LSJ
reupdated
Nice work
One thing tho, a fast look and seems like you have a field missing:
.field mVolumeDownPress:Ljava/lang/Runnable;
LegendK95 said:
Nice work
One thing tho, a fast look and seems like you have a field missing:
.field mVolumeDownPress:Ljava/lang/Runnable;
Click to expand...
Click to collapse
lol is there, but it s not highlighted well, damn txt editor!
can u make it for odexed one please thanks
Thanks mate for the guide, gonna try it tomorrow.
MyLifeRocks10 said:
Thanks mate for the guide, gonna try it tomorrow.
Click to expand...
Click to collapse
yoshi it s easy to implement, later this week i ll try to improve it.
I am sorry for my ignorance. But what is this supposed to do?
MySeLfPT said:
I am sorry for my ignorance. But what is this supposed to do?
Click to expand...
Click to collapse
Mmh, in OP there s a zip to flash on LSJ jelly bean deodexed rom to get skip songs while screen is off.
And there s a tutorial too to help rom developers to include this feature into their own roms.
Hope u understand now
Mirko, during screen-off single press skips the song instead changing the volume, what did I wrong?
Btw, I think the "goto_6" doesn't need to be changed to "goto_c".

[MOD] Samsung KeyBoard Swipe Color Change Found! - Updated Instructions

Okay, alot of dev's/themers been looking for this one...
If you use, please give credit, I spent many hours finding this Mod... Dont take credit for someone else's work...
This Mod will allow you to change the Samsung KeyBoard Swipe Color..(SamsungIME.apk)
Look for:
smali\com\diotek\ime\framework\view\AbstractKeyBoardView.smali
Search for -> .method private setTracePaintOptionsWithSettings()V
Click to see Org Code
Code:
.method private setTracePaintOptionsWithSettings()V
.locals 5
.prologue
const/16 v4, 0xff
const/4 v1, 0x1
const/4 v3, 0x0
.line 9829
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
if-nez v0, :cond_0
.line 9830
new-instance v0, Landroid/graphics/Paint;
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V
iput-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
.line 9832
:cond_0
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
if-eqz v0, :cond_1
.line 9833
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V
.line 9835
:cond_1
iput-short v3, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePointCount:S
.line 9836
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V
.line 9837
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setDither(Z)V
.line 9838
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
const/16 v1, 0xa5
const/16 v2, 0xf3
invoke-static {v4, v3, v1, v2}, Landroid/graphics/Color;->argb(IIII)I
Click to see what to change:
Code:
.method private setTracePaintOptionsWithSettings()V
.locals 5
.prologue
const/16 v4, [B][U][COLOR="Blue"]0xff[/COLOR][/U][/B] [B][COLOR="seagreen"]Change for Alpha Value - "0xff" [/COLOR][/B]
const/4 v1, 0x1
const/4 v3, [B][U][COLOR="Blue"]0x0[/COLOR][/U][/B] [B][COLOR="seaGreen"] - Change for Red Value - "0x0"[/COLOR][/B]
.line 9829
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
if-nez v0, :cond_0
.line 9830
new-instance v0, Landroid/graphics/Paint;
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V
iput-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
.line 9832
:cond_0
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
if-eqz v0, :cond_1
.line 9833
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V
.line 9835
:cond_1
iput-short v3, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePointCount:S
.line 9836
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V
.line 9837
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setDither(Z)V
.line 9838
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
const/16 v1, [B][U][COLOR="Blue"]0xa5[/COLOR][/U][/B] [COLOR="seagreen"]- Change for Green Value - "0xa5"[/COLOR]
const/16 v2, [B][U][COLOR="Blue"]0xf3[/COLOR][/U][/B] [COLOR="seagreen"] - Change for Blue Value - "0xf3"[/COLOR]
invoke-static {v4, v3, v1, v2}, Landroid/graphics/Color;->argb(IIII)I
So what it boils down to is that the Swipe Color is what we call RGB color coding. I suggest a site like this to see values you can use:
Hex to RGB Color converter
Thats it folks.. swipe color squashed!!!!
Verified to work on N3 KeyBoards
A Little clarification on Instructions.
I was swamped with questions on how to edit and such.. So with @strongsteve help we dug more and here is an easier way to get your colors instead of trying to use RGB values..
change code:
Code:
const/16 v1, 0xa5
const/16 v2, 0xf3
to
Code:
const v3, 0x33
const v1, 0x66
const v2, 0xcc
Then just use any normal Hex Color code you would normally use!!!
In the above example I used 3366cc which is DarkHorse Blue..
I hope that helps
Thanks been looking for this myself. Great job!
Sent from my SCH-I545 using XDA Premium 4 mobile app
This has been long sought after....thanks for this and great work my friend! :highfive::good:
ALL Users must be reminded to give credit for this share, as, unless I am mistaken, it is not too many other places!
Sorry... can someone post what those lines should look like once they have been changed to a diff color? I'm not sure exactly what in those lines I should be changing (I do understand the color codes).
Sorry for the noobish question.
TheCelt said:
Sorry... can someone post what those lines should look like once they have been changed to a diff color? I'm not sure exactly what in those lines I should be changing (I do understand the color codes).
Sorry for the noobish question.
Click to expand...
Click to collapse
You would be changing the codes themselves.
i.e ff or a5, or whatever...
I will write up more in a bit..
Gunthermic said:
You would be changing the codes themselves.
i.e ff or a5, or whatever...
I will write up more in a bit..
Click to expand...
Click to collapse
Thanks for clarifying the coding changes.... one last (what I am sure if dumb) question. where does one find that file. I am rooted and searched the device for both "smali" and "diotek" using ES file Explorer and have not found the file referenced above.
TheCelt said:
Thanks for clarifying the coding changes.... one last (what I am sure if dumb) question. where does one find that file. I am rooted and searched the device for both "smali" and "diotek" using ES file Explorer and have not found the file referenced above.
Click to expand...
Click to collapse
Its contained inside the SamsungIME apk itself. It has to be decompiled and MODed
Gunthermic said:
Its contained inside the SamsungIME apk itself. It has to be decompiled and MODed
Click to expand...
Click to collapse
Got it. Thanks Gunthermic. Much appreciated.

[Q&A] [GUIDE][SMALI]Understanding and Creating Smali Mods & General Smali Questions

[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

[Devs][Guide] Add Reboot Safestrap Recovery to power menu with toggle

Credits goes to @sagitt67 and @daxgirl .
Credits for toggle goes to @tdunham main guide is here and @asc1977 for the guide here big thanks to them.
In this Guide we'll modify framework-res.apk and services.jar
framework-res.apk:
Download framework-res.zip that is attached below, extract and copy it in your decompiled framework-res.apk folder
now open res/values/arrays.xml
find <string-array name="config_globalActionsList"> and add blue
Code:
<string-array name="config_globalActionsList">
<item>power</item>
<item>datamode</item>
<item>airplane</item>
<item>restart</item>
<item>lockdown</item>
<item>bugreport</item>
<item>users</item>
[COLOR="blue"]<item>rebootsafestrap</item>[/COLOR]
<item>emergencymode</item>
<item>subscreen</item>
</string-array>
now go to res/values/strings.xml at very end and add blue
Code:
<string name="wifi_extender_notification_title">Wi-Fi extender on</string>
<string name="wifi_extender_notification_message">Tap here to set up.</string>
<string name="config_tspstate_threshold" />
[COLOR="blue"]<string name="tw_ic_do_restart_safestrap">Reboot Safestrap</string>[/COLOR]
</resources>
done with framework-res.apk recompile
Services.jar:
download services.zip that is attached below, extract and copy it in your decompiled services.jar folder
open smali/com/android/server/policy/GlobalActions.smali
add blue line in # instance fields
Code:
.field private mRestart:Lcom/android/server/policy/GlobalActions$SinglePressAction;
[COLOR="blue"].field private mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;
[/COLOR]
.field mRestartIconResId:I
find .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog;
add blue
Code:
if-eqz v4, :cond_27b
const v4, 0x1080a58
.line 1642
:goto_11c
const v6, 0x104070e
.line 1639
move-object/from16 v0, p0
invoke-direct {v5, v0, v4, v6}, Lcom/android/server/policy/GlobalActions$21;-><init>(Lcom/android/server/policy/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v5, v0, Lcom/android/server/policy/GlobalActions;->mRestart:Lcom/android/server/policy/GlobalActions$SinglePressAction;
[COLOR="Blue"]new-instance v4, Lcom/android/server/policy/GlobalActions$99;
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/server/policy/GlobalActions;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
const-string v1, "tw_ic_do_restart_safestrap"
const-string v2, "drawable"
const-string v3, "android"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v5
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/server/policy/GlobalActions;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
const-string v1, "tw_ic_do_restart_safestrap"
const-string v2, "string"
const-string v3, "android"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v6
move-object/from16 v0, p0
invoke-direct {v4, v0, v5, v6}, Lcom/android/server/policy/GlobalActions$99;-><init>(Lcom/android/server/policy/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v4, v0, Lcom/android/server/policy/GlobalActions;->mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;[/COLOR]
.line 1688
invoke-static {}, Lcom/samsung/android/feature/SemCscFeature;->getInstance()Lcom/samsung/android/feature/SemCscFeature;
move-result-object v4
const-string/jumbo v5, "CscFeature_Common_ConfigBikeMode"
invoke-virtual {v4, v5}, Lcom/samsung/android/feature/SemCscFeature;->getString(Ljava/lang/String;)Ljava/lang/String;
Now next part is tricky, add lines in blue and changes in green
Code:
const/4 v7, 0x1
move-object/from16 v0, p0
invoke-direct {v0, v6, v4, v5, v7}, Lcom/android/server/policy/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/server/policy/GlobalActions$Action;Ljava/util/ArrayList;Z)Z
.line 1767
new-instance v4, Lcom/android/server/policy/GlobalActions$BugReportAction;
move-object/from16 v0, p0
invoke-direct {v4, v0}, Lcom/android/server/policy/GlobalActions$BugReportAction;-><init>(Lcom/android/server/policy/GlobalActions;)V
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;
[COLOR="blue"]const/16 v6, 0x100
const/4 v7, 0x1
move-object/from16 v0, p0
invoke-direct {v0, v6, v4, v5, v7}, Lcom/android/server/policy/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/server/policy/GlobalActions$Action;Ljava/util/ArrayList;Z)Z
move-object/from16 v0, p0
iget-object v4, v0, Lcom/android/server/policy/GlobalActions;->mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;[/COLOR]
const/16 v6, [COLOR="Green"]0x200[/COLOR] [COLOR="Red"]#before was 0x100[/COLOR]
const/4 v7, 0x1
move-object/from16 v0, p0
invoke-direct {v0, v6, v4, v5, v7}, Lcom/android/server/policy/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/server/policy/GlobalActions$Action;Ljava/util/ArrayList;Z)Z
now search for const-string/jumbo v4, "silent" and add blue line above it and green parts must match orange part
Code:
const-string/jumbo v4, "emergencymode"
invoke-virtual {v4, v11}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_381
.line 1835
move-object/from16 v0, p0
iget-object v4, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mEmergency:Lcom/android/server/policy/GlobalActions$ToggleAction;
invoke-virtual {v4, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
goto/16 :[COLOR="orange"]goto_2d9[/COLOR] #look that green part match this
.line 1836
:cond_381
[COLOR="Blue"]const-string/jumbo v4, "rebootsafestrap"
invoke-virtual {v4, v11}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_3da
move-object/from16 v0, p0
iget-object v4, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;
invoke-virtual {v4, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
goto/16 :[COLOR="Green"]goto_2d9 [/COLOR]
:cond_3da[/COLOR]
const-string/jumbo v4, "silent"
next part is missing in Android 7 services.jar so we need to readd it for mod
find .method private addCustomDialogItems(Landroid/graphics/drawable/BitmapDrawable;Ljava/lang/String;Landroid/content/Intent;ILjava/util/ArrayListZ
add this above method
Code:
[COLOR="Blue"].method static synthetic access$500(Lcom/android/server/policy/GlobalActions;)Landroid/content/Context;
.locals 1
iget-object v0, p0, Lcom/android/server/policy/GlobalActions;->mContext:Landroid/content/Context;
return-object v0
.end method[/COLOR]
thats it, recompile and push to phone
Note: For me one time i get after reboot a loop of phone restarts, only one time happens. If it happen i solved it with wipe dalvik-cache and cache
Credits goes to @TheDriller for this part in this guide
Note: no need to change the code in GlobalActions$99.smali already done
GlobalActions$99.smali:
find .method public onPress()V and replace blue lines with red one
Code:
move-result-object v0
check-cast v0, Landroid/os/PowerManager;
[COLOR="Red"]const-string v1, "recovery"
invoke-virtual {v0, v1}, Landroid/os/PowerManager;->reboot(Ljava/lang/String;)V[/COLOR]
to
Code:
move-result-object v0
check-cast v0, Landroid/os/PowerManager;
[COLOR="Blue"]const-string v1, "su -c echo 1 > /data/.recovery_mode && su -c reboot now"
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v2
invoke-virtual {v2, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;[/COLOR]
Wow thia makes things so much easier
Sent from my SM-G950U using Tapatalk
This is different on the Note 8 isn't it? I got as far as the services jar .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; I input the blue text that was mentioned but I'm curious why in your sample does it not have .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; before the blue text?
The Second batch of code with the green changes I had no idea where to input that and I couldn't find const/16 v6, 0x100 to change to 200 either
The step after that I was genuinely lost nothing matched what you had in your sample I felt like I was so close to getting it.
Thanks
SM-N950W
dillweedinc said:
This is different on the Note 8 isn't it? I got as far as the services jar .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; I input the blue text that was mentioned but I'm curious why in your sample does it not have .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; before the blue text?
The Second batch of code with the green changes I had no idea where to input that and I couldn't find const/16 v6, 0x100 to change to 200 either
The step after that I was genuinely lost nothing matched what you had in your sample I felt like I was so close to getting it.
Thanks
Click to expand...
Click to collapse
I will check them soon.
Maybe @JavixKGD can help you as he asked for the mod and he got it working on Note 8.
It is important to specify that this mod only applies to Nougat, it needs to be updated for Oreo.
I am using Nougat 7.1.1 on a note 8 sm-n950w with me's samfail firmware bl1 - I sent him a message thanks! I see it built into another firmware that is available but id rather build it into me's samfail firmy since there is some issues to be wrinkled out in the other custom firmwares.
This thread is more currently active than the Safestrap one. I'm just here looking for more information on how to flash ROMS while keeping your others. Like do I activate that slot then start flashing and do you know if it's possible to use Slick ROM as one of the slots? I'm rooted with Partcyborg on bootloader v2
xSl33p said:
This thread is more currently active than the Safestrap one. I'm just here looking for more information on how to flash ROMS while keeping your others. Like do I activate that slot then start flashing and do you know if it's possible to use Slick ROM as one of the slots? I'm rooted with Partcyborg on bootloader v2
Click to expand...
Click to collapse
Dont quote me on this but im pretty sure the slots arent 100% functional yet you can do backups and restore your system flash zips ect. , I know this thread is more active but you should really stick with the topic of the thread, your question would get answered there.
I got an answer from the guy you recommended afaneh92 thanks, it looks like I need to place the smalis in a different folder as they go over the limit, I dont have time right now but he also sent me his services .jar so I can see what the difference is I got some learning to do.
Thanks
Canadian Dilly.
dillweedinc said:
Dont quote me on this but im pretty sure the slots arent 100% functional yet you can do backups and restore your system flash zips ect. , I know this thread is more active but you should really stick with the topic of the thread, your question would get answered there.
I got an answer from the guy you recommended afaneh92 thanks, it looks like I need to place the smalis in a different folder as they go over the limit, I dont have time right now but he also sent me his services .jar so I can see what the difference is I got some learning to do.
Thanks
Canadian Dilly.
Click to expand...
Click to collapse
Im working on update and some fixes for the mod, then will rewrite this guide in the Note 8 section.

Categories

Resources