• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[GUIDE] Automatic dual sim switching on latest official OTA

Search This thread
I had success. Oneplus 5 with Pie
I discovered that with Pie it is necessary another step between 2 and 3, because the step 2 now gives .cdex files (compact dex) instead of the .dex files, and jadx (at least the versions I tried) can read only .dex files.
In the github page of vdexExtractor I found a section about the vdexExtractor#compact-dex-converter, that is necessary to convert .cdex to .dex.
I used the Linux x86-64 - Statically compiled binaries, the shared libraries version didn't work on my Virtual Machine with linux Mint (I have only windows 10 on my pc)
Using that converter I obtained the .dex files that jadx can read and follow step 3 and 4 of the guide.
I hope to be of some help

Awesome!
At last, I tried this before but gave up, I had it working before Pie, but have been toggling it on and odd manually since Pie.
This time I got it and for my Oneplus 5 it was 176.
I used compact_dex_converters but that produced a filename like .cdex.new, I renamed that to .dex and opened it with jadx-gui and did a search with "Code" ticked, just to clarify for others.
 

BigBrosMo

Senior Member
Jul 10, 2012
307
96
Took forever, but finally got it working. All via Windows. I have a OnePlus 5T and my number was also 176. OS vers 9.0.9
-Used latest vdexExtractor.exe from https://github.com/fOmey/vdexExtractor/tree/master/bin
-Then referenced kevinminions9 post from https://github.com/anestisb/vdexExtractor/issues/23 to download the android version of the converter tool, and then followed the directions to push the converter and pull the dex files back to my laptop
-Couldn't get Jadx working for some reason, so used "Bytecode-Viewer" to find the magic number using the path mentioned in the OP
 

alessandro_xda

Senior Member
Feb 8, 2007
443
85
Bologna
Hi , got commands to disable sim card on OP6 10.3.1 release - may work on other releases

service call extphone 4 i32 1 (disable sim2)
service call extphone 3 i32 1 (enable sim2)
service call extphone 4 i32 0 (disable sim1)
service call extphone 3 i32 0 (enable sim1)
Thanks it also work on my 5T openbeta 33

Sent from my ONEPLUS A5010 using Tapatalk
 

minscetbou

Member
Feb 11, 2011
20
3
Has anyone found the command line for android 11?
The command line above worked fine for a Oneplus 8 running Android 10, but couldn't find the number for the new version.
 

harpreet.s

Senior Member
Oct 27, 2012
151
46
There goes for Android11 , works on NORD , not checked but last digit 1 should be replaced with 0 for sim1
service call isub 41 i32 1 i32 1 (enable sim2)
service call isub 41 i32 0 i32 1 (disable sim2)
 
Last edited:
  • Like
Reactions: minscetbou

harpreet.s

Senior Member
Oct 27, 2012
151
46
Assuming you have root , can you try this -
su shell -c 'service call isub 41 i32 0 i32 1'

This should disable sim2.

You can decompile framework.jar , all source is there for how this code is called.
 
There goes for Android11 , works on NORD , not checked but last digit 1 should be replaced with 0 for sim1
service call isub 41 i32 1 i32 1 (enable sim2)
service call isub 41 i32 0 i32 1 (disable sim2)
Thanks, works kind of (on Nord), however it turns on or off sim1 instead of sim2, easy fix would be to swap the cards :p
Allthough that will make for some calls from the wrong number as I have had them the other way around for a couple of years on the OnePlus 5.
Changing the last digit to 0 does nothing for me.

Also, I did have to use
Bash:
su shell -c 'service call isub 41 i32 0 i32 1'
as a Run Shell command in Tasker for it to work on my Nord.
 
Last edited:

harpreet.s

Senior Member
Oct 27, 2012
151
46
Just play with these 3 commands , any 2 will disable your 2 sim cards -
su shell -c 'service call isub 41 i32 0 i32 1'
su shell -c 'service call isub 41 i32 0 i32 2'
su shell -c 'service call isub 41 i32 0 i32 0'

and to enable that sim , replace the 0 in between of command with 1.

For me first 2 commands work for disabling sim , although command ending with 1 disables sim2 while command ending with 2 disables sim1. It is because the 1,2 at end are sub id values. You can know what value is assigned to your sim card , you can run in dialler *#*#4636#*#* and go to phone information.
 
Last edited:
  • Like
Reactions: alexbergsland

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    TL;DR:
    You need root.
    Shell command with root privileges to toggle sim programatically:
    Code:
    service call phone 162 i32 x i32 y
    Where x is 0 for SIM1 and 1 for SIM2, and y is 0 to disable and 1 to enable.
    For example:
    Code:
    service call phone 162 i32 1 i32 0
    will disable SIM2 and
    Code:
    service call phone 162 i32 1 i32 1
    will enable it.

    Longer version, and how to find the magic "162" number:
    You need:
    1. vdexExtractor
    2. jadx

    Step by step:
    1. Pull /system/framework/arm64/boot-framework.vdex
    2. extract it with vdexExtractor, you should get some dex classfiles.
    3. Open them with jadx and find the one that contains com.android.internal.telephony.ITelephony
    4. Navigate to the class with jadx and locate the value of TRANSACTION_setSimPowerStateForSlot, this is your magic number.

    After you have the command you can use for example Tasker to enable and disable the SIM card.
    The only downside of using this method is that major Android version bumps will most likely break this, as the numbers vary from android build to android build.
    4
    Hi , got commands to disable sim card on OP6 10.3.1 release - may work on other releases

    service call extphone 4 i32 1 (disable sim2)
    service call extphone 3 i32 1 (enable sim2)
    service call extphone 4 i32 0 (disable sim1)
    service call extphone 3 i32 0 (enable sim1)
    2
    Hi , got commands to disable sim card on OP6 10.3.1 release - may work on other releases

    service call extphone 4 i32 1 (disable sim2)
    service call extphone 3 i32 1 (enable sim2)
    service call extphone 4 i32 0 (disable sim1)
    service call extphone 3 i32 0 (enable sim1)
    Thanks it also work on my 5T openbeta 33

    Sent from my ONEPLUS A5010 using Tapatalk
    2
    for what reason someone need to do such thing?

    My reason is that I only want to be reached on my work number during work hours. So in my case I disable sim2 at 1600 when I go home from work, and then I enable it right before I start working again.
    The apps available for this don't work on my phone (opo5) so this was the only way I could find.
    2
    Took forever, but finally got it working. All via Windows. I have a OnePlus 5T and my number was also 176. OS vers 9.0.9
    -Used latest vdexExtractor.exe from https://github.com/fOmey/vdexExtractor/tree/master/bin
    -Then referenced kevinminions9 post from https://github.com/anestisb/vdexExtractor/issues/23 to download the android version of the converter tool, and then followed the directions to push the converter and pull the dex files back to my laptop
    -Couldn't get Jadx working for some reason, so used "Bytecode-Viewer" to find the magic number using the path mentioned in the OP