FORUMS
Remove All Ads from XDA

[HOWTO][MTK6589] Autohide mobile signal icons for empty SIM slots

6,939 posts
Thanks Meter: 19,802
 
Post Reply Email Thread
How to auto-hide mobile signal icons for empty SIM slots on MTK6589 devices

Introduction
Many users using only one SIM card tend to get fed up with the mobile signal
icon that's always displayed for empty SIM slot in the status bar. This how-to will show you
how to smali hack the SystemUI to make these icons auto-hide - according to presence
of a SIM card in a SIM slots. This is a clean solution - since it will dynamically reflect
which sim slot is in use and which is not. If both SIM slots are used, both icons will be visible.

For devs: It took me several hours to figure out how this could be achieved,
so please, if you decide to use this how-to to include the mod in your custom roms,
I expect you to give proper credits. Thanks in advance.


The guide does not cover things like deodexing/decompiling/compiling/odexing jars and apks.
It expects you already are familiar with these processes.
There are already many guides for those out there.

Solution
1) Decompile SystemUI.apk

2) Open smali/com/android/systemui/statusbar/SignalClusterViewGemini.smali

3) search for "apply" method
Code:
# virtual methods
.method public apply()V
4) Make note of constants defined at the beginning of the method.
We will need 0x0, 0x1, and 0x8 later.
v5 = 0x0 - ID for SIM Slot 1
v9 = 0x1 - ID for SIM Slot 2
v6 = 0x8 - constant used to set visibility of a view (0x8 == View.GONE)
Code:
.prologue
const/4 v11, 0x4

const/4 v10, 0x0

const/4 v9, 0x1

const/16 v6, 0x8

const/4 v5, 0x0
5) Search for first occurence of isSimInserted method call in "apply" method
Code:
.line 421
.local v3, state:I
invoke-direct {p0, v5}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v5 == 0x0 which is SIM Slot #1

move-result v4

if-eqz v4, :cond_1f
v5 constant which value ix 0x0 is used - this means it checks for SIM presense in Slot 1
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_1f
(label name might be different in your case)

6) Search for label name we found in the previous step to locate the start
of the code section for this label (:cond_1f in my case) Should look similat to this
Code:
.line 452
.end local v0           #id:I
.end local v1           #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2           #simColorId:I
:cond_1f

iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkType:Landroid/widget/ImageView;
7) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_1f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroup:Landroid/view/ViewGroup;

invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 1 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)

8) Now search for next occurrence of isSimInserted call in "apply" method - this time for SIM Slot 2
Code:
.line 546
.restart local v3       #state:I
invoke-direct {p0, v9}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v9 == 0x1 which is SIM Slot #2

move-result v4

if-eqz v4, :cond_2f
v9 constant which value ix 0x1 is used - this means it checks for SIM presense in Slot 2
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_2f
(label name might be different in your case)

9) Search for label name we found in the previous step to locate the start
of the code section for this label (:cond_2f in my case) Should look similar to this
Code:
.line 578
.end local v0           #id:I
.end local v1           #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2           #simColorId:I
:cond_2f

iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkTypeGemini:Landroid/widget/ImageView;
10) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_2f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroupGemini:Landroid/view/ViewGroup;

invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 2 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)

11) Recompile SystemUI and push it to phone. Done.
The Following 23 Users Say Thank You to C3C076 For This Useful Post: [ View ] Gift C3C076 Ad-Free
 
 
11th May 2013, 01:01 PM |#2  
Member
Thanks Meter: 6
 
More
EDITED:............
14th December 2013, 08:48 AM |#3  
Senior Member
Thanks Meter: 26
 
More
Hi i changed the smali but it didn`t work...I got the same names and files in smali as you on your screenshots.
When I`m pasting the lines from your post should I delete the old ones?
11th June 2014, 02:05 PM |#4  
rkharat98's Avatar
Senior Member
Flag Pune, Maharashtra, India
Thanks Meter: 12
 
More
Thank u very very much.. This was what I needed.. Really thanku...
5th July 2014, 04:19 PM |#5  
rkharat98's Avatar
Senior Member
Flag Pune, Maharashtra, India
Thanks Meter: 12
 
More
Oops.. Got one problem.. After doing every thing as u said.. Zipaligned... And flashed.. And then SystemUI is FCing....
Can u plz plz reply A.S.A.P.
Plz..

Sent from my Micromax A116i using XDA Premium 4 mobile app
10th July 2014, 09:56 PM |#6  
C3C076's Avatar
OP Recognized Contributor
Flag Bratislava
Thanks Meter: 19,802
 
Donate to Me
More
If there are FCs you probably did something wrong. Logcat would tell you exactly where and why it FCs so it'll help you to pinpoint where your issue is.
The Following User Says Thank You to C3C076 For This Useful Post: [ View ] Gift C3C076 Ad-Free
25th July 2014, 12:29 PM |#7  
rkharat98's Avatar
Senior Member
Flag Pune, Maharashtra, India
Thanks Meter: 12
 
More
Quote:
Originally Posted by C3C076

If there are FCs you probably did something wrong. Logcat would tell you exactly where and why it FCs so it'll help you to pinpoint where your issue is.

It worked.. Thank you very much..
Gravity Box was causing problems.. I disabled it. And all done...:thumbup:

Sent from my Micromax A116i using XDA Premium 4 mobile app

---------- Post added at 04:59 PM ---------- Previous post was at 04:57 PM ----------

Quote:
Originally Posted by sebcio2804

Hi i changed the smali but it didn`t work...I got the same names and files in smali as you on your screenshots.
When I`m pasting the lines from your post should I delete the old ones?

No.. Just do as mentioned.. It worked for me..

Sent from my Micromax A116i using XDA Premium 4 mobile app
26th April 2016, 09:49 PM |#8  
akhil17kr's Avatar
Senior Member
Flag gurgaon
Thanks Meter: 47
 
More
Quote:
Originally Posted by C3C076

How to auto-hide mobile signal icons for empty SIM slots on MTK6589 devices

Introduction
Many users using only one SIM card tend to get fed up with the mobile signal
icon that's always displayed for empty SIM slot in the status bar. This how-to will show you
how to smali hack the SystemUI to make these icons auto-hide - according to presence
of a SIM card in a SIM slots. This is a clean solution - since it will dynamically reflect
which sim slot is in use and which is not. If both SIM slots are used, both icons will be visible.

For devs: It took me several hours to figure out how this could be achieved,
so please, if you decide to use this how-to to include the mod in your custom roms,
I expect you to give proper credits. Thanks in advance.


The guide does not cover things like deodexing/decompiling/compiling/odexing jars and apks.
It expects you already are familiar with these processes.
There are already many guides for those out there.

Solution
1) Decompile SystemUI.apk

2) Open smali/com/android/systemui/statusbar/SignalClusterViewGemini.smali

3) search for "apply" method

Code:
# virtual methods
.method public apply()V
4) Make note of constants defined at the beginning of the method.
We will need 0x0, 0x1, and 0x8 later.
v5 = 0x0 - ID for SIM Slot 1
v9 = 0x1 - ID for SIM Slot 2
v6 = 0x8 - constant used to set visibility of a view (0x8 == View.GONE)
Code:
.prologue
const/4 v11, 0x4

const/4 v10, 0x0

const/4 v9, 0x1

const/16 v6, 0x8

const/4 v5, 0x0
5) Search for first occurence of isSimInserted method call in "apply" method
Code:
.line 421
.local v3, state:I
invoke-direct {p0, v5}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v5 == 0x0 which is SIM Slot #1

move-result v4

if-eqz v4, :cond_1f
v5 constant which value ix 0x0 is used - this means it checks for SIM presense in Slot 1
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_1f
(label name might be different in your case)

6) Search for label name we found in the previous step to locate the start
of the code section for this label (:cond_1f in my case) Should look similat to this
Code:
.line 452
.end local v0           #id:I
.end local v1           #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2           #simColorId:I
:cond_1f

iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkType:Landroid/widget/ImageView;
7) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_1f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroup:Landroid/view/ViewGroup;

invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 1 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)

8) Now search for next occurrence of isSimInserted call in "apply" method - this time for SIM Slot 2
Code:
.line 546
.restart local v3       #state:I
invoke-direct {p0, v9}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v9 == 0x1 which is SIM Slot #2

move-result v4

if-eqz v4, :cond_2f
v9 constant which value ix 0x1 is used - this means it checks for SIM presense in Slot 2
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_2f
(label name might be different in your case)

9) Search for label name we found in the previous step to locate the start
of the code section for this label (:cond_2f in my case) Should look similar to this
Code:
.line 578
.end local v0           #id:I
.end local v1           #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2           #simColorId:I
:cond_2f

iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkTypeGemini:Landroid/widget/ImageView;
10) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_2f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroupGemini:Landroid/view/ViewGroup;

invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 2 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)

11) Recompile SystemUI and push it to phone. Done.

Hello ,
I'm using AOSP Lollipop ROM on my redmi note 3 pro (dual sim) , using both sim. but the problem is there is only 1 signal bar icon for sim , doesn't matter if you use 1 SIM ,2 sim or no sim at all . Signal bar icon on status bar remains only 1. ROM developer who modified it is not helping at all to remove it.

Can you please help in how to unhide and show both sim card signal strength icon ?

Have posted same ques in this thread please see - http://forum.xda-developers.com/gene...tatus-t3366574
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes