[PATCH] GSM/WCDMA Network BUG FIX [ICS]

Search This thread

trojan01

Senior Member
Aug 28, 2009
219
123
Adana
Problem: we keep settings at GSM only. But at every restart it changes to WCDMA preferred forcing we on 3G network auto.since We applied the official ics upgrade it has been there.


Fix:
1-How to use Baksmali_Smali.exe ( you need know this)
2-Extract your classes.dex file from framework.jar
3-Go to framework\smali\com\android\internal\telephony\
4-Copy new file into telephony folder

For Odex-ed ROMs go to http://code.google.com/p/smali/wiki/DeodexInstructions

Now, 2g/3g network fixed :D

Credits: savel-76

DOWNLOAD: View attachment RIL.rar
 
Last edited:

gizmolek

Senior Member
Jan 9, 2012
84
32
Gdansk
I prepared a small tutorial (WIN7+ST15i) :)

0. !!! DO NANDROID BACKUP !!!

1. Install latest Java on your PC
2. Download from here "RIL.rar", extract "RIL.smali" and copy somwhere on hard disk
3. Download from somwhere "Smali-Me" tool
4. Extract on local harddisk (eg c:\Smali-Me-1.0)
5. Find on your phone /system/framework/framework.jar
6. Copy "framework.jar" somwhere to your harddisk
7. Extract (winrar, TC, winzip) from "framework.jar" file "classes.dex"
8. Copy "classes.dex" to \Smali-Me-1.0\
9. Run baksmali.bat (as administrator)
10. Go to \Smali-Me-1.0\Decompiled\com\android\internal\telephony\
11. Copy/Replace downloaded and extracted "RIL.smali" (step 2) into \Smali-Me-1.0\Decompiled\com\android\internal\telephony\
12. Copy all files from \Smali-Me-1.0\Decompiled\ to \Smali-Me-1.0\Smali-Me\
13. Run "smali.bat" (as administrator)
14. Delete old "classes.dex" from \Smali-Me-1.0\
15. Rename "modded-classes.dex" to "classes.dex" in \Smali-Me-1.0\
16. Add/replace (winrar, TC, winzip) new "classes.dex" into "framework.jar" which is somwhere on your harddisk (step 6)
17. Copy/replace new "framework.jar" into your phone directory /system/framework/
18. Reboot&enjoy
 
Last edited:

trojan01

Senior Member
Aug 28, 2009
219
123
Adana
  • Like
Reactions: arcatarc
Dec 21, 2012
35
3
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 51
    Problem: we keep settings at GSM only. But at every restart it changes to WCDMA preferred forcing we on 3G network auto.since We applied the official ics upgrade it has been there.


    Fix:
    1-How to use Baksmali_Smali.exe ( you need know this)
    2-Extract your classes.dex file from framework.jar
    3-Go to framework\smali\com\android\internal\telephony\
    4-Copy new file into telephony folder

    For Odex-ed ROMs go to http://code.google.com/p/smali/wiki/DeodexInstructions

    Now, 2g/3g network fixed :D

    Credits: savel-76

    DOWNLOAD: View attachment RIL.rar
    19
    I prepared a small tutorial (WIN7+ST15i) :)

    0. !!! DO NANDROID BACKUP !!!

    1. Install latest Java on your PC
    2. Download from here "RIL.rar", extract "RIL.smali" and copy somwhere on hard disk
    3. Download from somwhere "Smali-Me" tool
    4. Extract on local harddisk (eg c:\Smali-Me-1.0)
    5. Find on your phone /system/framework/framework.jar
    6. Copy "framework.jar" somwhere to your harddisk
    7. Extract (winrar, TC, winzip) from "framework.jar" file "classes.dex"
    8. Copy "classes.dex" to \Smali-Me-1.0\
    9. Run baksmali.bat (as administrator)
    10. Go to \Smali-Me-1.0\Decompiled\com\android\internal\telephony\
    11. Copy/Replace downloaded and extracted "RIL.smali" (step 2) into \Smali-Me-1.0\Decompiled\com\android\internal\telephony\
    12. Copy all files from \Smali-Me-1.0\Decompiled\ to \Smali-Me-1.0\Smali-Me\
    13. Run "smali.bat" (as administrator)
    14. Delete old "classes.dex" from \Smali-Me-1.0\
    15. Rename "modded-classes.dex" to "classes.dex" in \Smali-Me-1.0\
    16. Add/replace (winrar, TC, winzip) new "classes.dex" into "framework.jar" which is somwhere on your harddisk (step 6)
    17. Copy/replace new "framework.jar" into your phone directory /system/framework/
    18. Reboot&enjoy
    9
    I included in the deodex pack made by Knight47 the fix network. I use this on official ICS 4.1.B.0.587 and is working.
    3
    Found!!!

    Anyone, please? what specific part of RIL.smali was changed? so I won't replace my RIL.smali.. maybe that will lessen the chances of Force close..


    I´ve found exactly where the code is, and here is a simple guide showing how to patch your own RIL.smali file:

    Try at your own risk

    1. Inside RIL.smali file look for blue lines at the end of processUnsolicited method:
    Code:
    .method private [B]processUnsolicited[/B](Landroid/os/Parcel;)V
        .registers 27
        .parameter "p"
    
        .prologue
        .line 2611
        invoke-virtual/range {p1 .. p1}, Landroid/os/Parcel;->readInt()I
    
        .
        .
        .
        .
        .
        .
        .
        .
    
        .line 2977
        :pswitch_687
        move-object/from16 v0, p0
    
        move-object/from16 v1, v16
    
        invoke-direct {v0, v14, v1}, Lcom/android/internal/telephony/RIL;->unsljLogRet(ILjava/lang/Object;)V
    
        .line 2979
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/telephony/BaseCommands;->mExitEmergencyCallbackModeRegistrants:Landroid/os/RegistrantList;
    
        move-object/from16 v20, v0
    
        if-eqz v20, :cond_4b
    
        .line 2980
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/telephony/BaseCommands;->mExitEmergencyCallbackModeRegistrants:Landroid/os/RegistrantList;
    
        move-object/from16 v20, v0
    
        new-instance v21, Landroid/os/AsyncResult;
    
        const/16 v22, 0x0
    
        const/16 v23, 0x0
    
        const/16 v24, 0x0
    
        invoke-direct/range {v21 .. v24}, Landroid/os/AsyncResult;-><init>(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Throwable;)V
    
        invoke-virtual/range {v20 .. v21}, Landroid/os/RegistrantList;->notifyRegistrants(Landroid/os/AsyncResult;)V
    
        goto/16 :goto_4b
    
        .line 2986
        [COLOR="blue"][B]:pswitch_6ac
        move-object/from16 v0, p0
    
        move-object/from16 v1, v16
    
        invoke-direct {v0, v14, v1}, Lcom/android/internal/telephony/RIL;->unsljLogRet(ILjava/lang/Object;)V[/B][/COLOR]	
    	
        .line 2992
        check-cast v16, [I
    
        check-cast v16, [I
    
        const/16 v20, 0x0
    
        aget v20, v16, v20
    
        move-object/from16 v0, p0
    
        move/from16 v1, v20
    
        invoke-direct {v0, v1}, Lcom/android/internal/telephony/RIL;->notifyRegistrantsRilConnectionChanged(I)V
    
        goto/16 :goto_4b
    
        .line 2613
        nop
    
        :pswitch_data_6f4
        .packed-switch 0x3e8
            :pswitch_4c
            :pswitch_71
            :pswitch_76
            :pswitch_7b
            :pswitch_80
            :pswitch_85
            :pswitch_8a
            :pswitch_7
            :pswitch_8f
            :pswitch_94
            :pswitch_99
            :pswitch_9e
            :pswitch_a3
            :pswitch_a8
            :pswitch_ad
            :pswitch_b2
            :pswitch_b7
            :pswitch_bc
            :pswitch_c1
            :pswitch_cb
            :pswitch_d0
            :pswitch_d6
            :pswitch_dc
            :pswitch_c6
            :pswitch_e2
            :pswitch_e8
            :pswitch_ee
            :pswitch_f4
            :pswitch_fa
            :pswitch_100
            :pswitch_106
            :pswitch_10c
            :pswitch_112
            :pswitch_118
            :pswitch_11e
            :pswitch_7
            :pswitch_124
        .end packed-switch
    
        .line 2664
        :pswitch_data_742
        .packed-switch 0x3e8
            :pswitch_54
            :pswitch_12a
            :pswitch_145
            :pswitch_160
            :pswitch_199
            :pswitch_1c4
            :pswitch_223
            :pswitch_53
            :pswitch_27b
            :pswitch_2c0
            :pswitch_2e4
            :pswitch_307
            :pswitch_332
            :pswitch_35b
            :pswitch_386
            :pswitch_3b1
            :pswitch_3dc
            :pswitch_3f4
            :pswitch_41f
            :pswitch_475
            :pswitch_48d
            :pswitch_4ba
            :pswitch_4e3
            :pswitch_44a
            :pswitch_4fb
            :pswitch_513
            :pswitch_53e
            :pswitch_569
            :pswitch_597
            :pswitch_5cc
            :pswitch_606
            :pswitch_631
            :pswitch_65c
            :pswitch_687
            [B][COLOR="Blue"]:pswitch_6ac[/COLOR][/B]
        .end packed-switch
    .end method

    Here a curiousity: Pay attention to the blue value above >> pswitch_6ac << this is the line where the "switch" will jump when the "switch" given value is RIL_UNSOL_RIL_CONNECTED (1034), now speaking java (this is not part of guide):
    Code:
    case [B]RIL_UNSOL_RIL_CONNECTED[/B]: {
    	if (RILJ_LOGD) unsljLogRet(response, ret);
    	
    	// Initial conditions
    	[B][COLOR="Red"]setRadioPower(false, null);
    	setPreferredNetworkType(mPreferredNetworkType, null);
    	setCdmaSubscriptionSource(mCdmaSubscription, null);[/COLOR][/B]
    	notifyRegistrantsRilConnectionChanged(((int[])ret)[0]);
    	break;
    }
    Now let´s put the red lines above as smali inside the "switch", that is the patch itself!!

    2. Add some empty lines between blue and green lines:
    Code:
        .line 2986
        [B][COLOR="Blue"]:pswitch_6ac
        move-object/from16 v0, p0
    
        move-object/from16 v1, v16
    
        invoke-direct {v0, v14, v1}, Lcom/android/internal/telephony/RIL;->unsljLogRet(ILjava/lang/Object;)V[/COLOR][/B]	
        
        
    
    
        
    
    
    
    
        [B][COLOR="SeaGreen"].line 2992
        check-cast v16, [I
    
        check-cast v16, [I
    
        const/16 v20, 0x0
    
        aget v20, v16, v20
    
        move-object/from16 v0, p0
    
        move/from16 v1, v20
    
        invoke-direct {v0, v1}, Lcom/android/internal/telephony/RIL;->notifyRegistrantsRilConnectionChanged(I)V
    
        goto/16 :goto_4b
    
        .line 2613
        nop[/COLOR][/B]

    3. Add red smali lines and you´ll get:
    Code:
        .line 2986
        [COLOR="blue"][B]:pswitch_6ac
        move-object/from16 v0, p0
    
        move-object/from16 v1, v16
    
        invoke-direct {v0, v14, v1}, Lcom/android/internal/telephony/RIL;->unsljLogRet(ILjava/lang/Object;)V[/B][/COLOR]	
        
     
        
        
        [B][COLOR="Red"].line 2989
        const/16 v20, 0x0
    
        const/16 v21, 0x0
    
        move-object/from16 v0, p0
    
        move/from16 v1, v20
    
        move-object/from16 v2, v21
    
        invoke-virtual {v0, v1, v2}, Lcom/android/internal/telephony/RIL;->setRadioPower(ZLandroid/os/Message;)V
    
        .line 2990
        move-object/from16 v0, p0
    
        iget v0, v0, Lcom/android/internal/telephony/BaseCommands;->mPreferredNetworkType:I
    
        move/from16 v20, v0
    
        const/16 v21, 0x0
    
        move-object/from16 v0, p0
    
        move/from16 v1, v20
    
        move-object/from16 v2, v21
    
        invoke-virtual {v0, v1, v2}, Lcom/android/internal/telephony/RIL;->setPreferredNetworkType(ILandroid/os/Message;)V
    
        .line 2991
        move-object/from16 v0, p0
    
        iget v0, v0, Lcom/android/internal/telephony/BaseCommands;->mCdmaSubscription:I
    
        move/from16 v20, v0
    
        const/16 v21, 0x0
    
        move-object/from16 v0, p0
    
        move/from16 v1, v20
    
        move-object/from16 v2, v21
    
        invoke-virtual {v0, v1, v2}, Lcom/android/internal/telephony/RIL;->setCdmaSubscriptionSource(ILandroid/os/Message;)V[/COLOR][/B]    
    
    
    
    
        [B][COLOR="SeaGreen"].line 2992
        check-cast v16, [I
    
        check-cast v16, [I
    
        const/16 v20, 0x0
    
        aget v20, v16, v20
    
        move-object/from16 v0, p0
    
        move/from16 v1, v20
    
        invoke-direct {v0, v1}, Lcom/android/internal/telephony/RIL;->notifyRegistrantsRilConnectionChanged(I)V
    
        goto/16 :goto_4b
    
        .line 2613
        nop[/COLOR][/B]
    (You can leave the empty lines, compiler will remove them)

    4. Save file and close it.
    5. Done!!

    Now compile your new framework.jar classes.dex!!! I hope the guide helps you... ;)
    And thanks trojan01 and savel-76
    1
    can this be done by some patch using recovery? If it is possible can some one do that? My knoolage about this is too small