WiFi Country Problem Solving for K2_U/K2_UL (Android 4.2.2)

Search This thread

BrateloSlava

Senior Member
Sep 12, 2012
982
914
Kharkiv
Hello!

After buying this phone model, I was horrified to learn, that he does not want to connect to my wi-fi router in the 5 GHz range. :mad:

Full description of the problem and how to resolve it are described in this and this topics.

I have carefully read both topics and the following materials:
MccTable.java
Mobile country code
Dalvik opcodes

I tried all the proposed solutions and they are not quite like me. I decided to do everything a little bit differently.

telephony-common\smali\com\android\internal\telephony\MccTable.smali
OLD
Code:
.method public static countryCodeForMcc(I)Ljava/lang/String;
    .locals 2
    .parameter "mcc"

    .prologue
    .line 124
    invoke-static {p0}, Lcom/android/internal/telephony/MccTable;->entryForMcc(I)Lcom/android/internal/telephony/MccTable$MccEntry;

    move-result-object v0

    .line 126
    .local v0, entry:Lcom/android/internal/telephony/MccTable$MccEntry;
    if-nez v0, :cond_0

    .line 127
    const-string v1, ""

    .line 129
    :goto_0
    return-object v1

    :cond_0
    iget-object v1, v0, Lcom/android/internal/telephony/MccTable$MccEntry;->iso:Ljava/lang/String;

    goto :goto_0
.end method
NEW
Code:
.method public static countryCodeForMcc(I)Ljava/lang/String;
    .locals 2
    .parameter "mcc"

    .prologue
    .line 124
    invoke-static {p0}, Lcom/android/internal/telephony/MccTable;->entryForMcc(I)Lcom/android/internal/telephony/MccTable$MccEntry;

    move-result-object v0

    .line 126
    .local v0, entry:Lcom/android/internal/telephony/MccTable$MccEntry;
[COLOR="Red"]#    if-nez v0, :cond_0[/COLOR]

    .line 127
[COLOR="red"]    const-string v1, "us"[/COLOR]

    .line 129
    :goto_0
    return-object v1

    :cond_0
    iget-object v1, v0, Lcom/android/internal/telephony/MccTable$MccEntry;->iso:Ljava/lang/String;

    goto :goto_0
.end method

framework\smali\android\net\wifi\WifiStateMachine.smali
OLD
Code:
.method private setCountryCode()V
    .locals 3

    .prologue
    .line 3780
    iget-object v1, p0, Landroid/net/wifi/WifiStateMachine;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string/jumbo v2, "wifi_country_code"

    invoke-static {v1, v2}, Landroid/provider/Settings$Global;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 3782
    .local v0, countryCode:Ljava/lang/String;
    if-eqz v0, :cond_0

    invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z

    move-result v1

    if-nez v1, :cond_0

    .line 3783
    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Landroid/net/wifi/WifiStateMachine;->setCountryCode(Ljava/lang/String;Z)V

    .line 3787
    :cond_0
    return-void
.end method
NEW
Code:
.method private setCountryCode()V
    .locals 3

    .prologue
    .line 3780
    iget-object v1, p0, Landroid/net/wifi/WifiStateMachine;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string/jumbo v2, "wifi_country_code"

    invoke-static {v1, v2}, Landroid/provider/Settings$Global;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 3782
    .local v0, countryCode:Ljava/lang/String;
    if-eqz v0, :cond_0

    invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z

    move-result v1

    if-nez v1, :cond_0

    .line 3783
[COLOR="Red"]    const-string v0, "us"[/COLOR]
    
    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Landroid/net/wifi/WifiStateMachine;->setCountryCode(Ljava/lang/String;Z)V

    .line 3787
    :cond_0
    return-void
.end method

Result - archive for installation through TWRP:
- for 3G model (K2_U)
- for LTE model (K2_UL). If not work, try this

Try, check, write the results.

Enjoy!
 
Last edited:

BrateloSlava

Senior Member
Sep 12, 2012
982
914
Kharkiv
Did you test it?
Screenshot from my phone. Now.

LTE version tested radarga.

ADD.
LTE users. Please, try 3G version, if LTE version doesn't work.
 

Attachments

  • Screenshot_2014-01-29-18-36-19.png
    Screenshot_2014-01-29-18-36-19.png
    97.3 KB · Views: 250
  • Screenshot_2014-01-29-18-36-47.png
    Screenshot_2014-01-29-18-36-47.png
    108.6 KB · Views: 240
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Hello!

    After buying this phone model, I was horrified to learn, that he does not want to connect to my wi-fi router in the 5 GHz range. :mad:

    Full description of the problem and how to resolve it are described in this and this topics.

    I have carefully read both topics and the following materials:
    MccTable.java
    Mobile country code
    Dalvik opcodes

    I tried all the proposed solutions and they are not quite like me. I decided to do everything a little bit differently.

    telephony-common\smali\com\android\internal\telephony\MccTable.smali
    OLD
    Code:
    .method public static countryCodeForMcc(I)Ljava/lang/String;
        .locals 2
        .parameter "mcc"
    
        .prologue
        .line 124
        invoke-static {p0}, Lcom/android/internal/telephony/MccTable;->entryForMcc(I)Lcom/android/internal/telephony/MccTable$MccEntry;
    
        move-result-object v0
    
        .line 126
        .local v0, entry:Lcom/android/internal/telephony/MccTable$MccEntry;
        if-nez v0, :cond_0
    
        .line 127
        const-string v1, ""
    
        .line 129
        :goto_0
        return-object v1
    
        :cond_0
        iget-object v1, v0, Lcom/android/internal/telephony/MccTable$MccEntry;->iso:Ljava/lang/String;
    
        goto :goto_0
    .end method
    NEW
    Code:
    .method public static countryCodeForMcc(I)Ljava/lang/String;
        .locals 2
        .parameter "mcc"
    
        .prologue
        .line 124
        invoke-static {p0}, Lcom/android/internal/telephony/MccTable;->entryForMcc(I)Lcom/android/internal/telephony/MccTable$MccEntry;
    
        move-result-object v0
    
        .line 126
        .local v0, entry:Lcom/android/internal/telephony/MccTable$MccEntry;
    [COLOR="Red"]#    if-nez v0, :cond_0[/COLOR]
    
        .line 127
    [COLOR="red"]    const-string v1, "us"[/COLOR]
    
        .line 129
        :goto_0
        return-object v1
    
        :cond_0
        iget-object v1, v0, Lcom/android/internal/telephony/MccTable$MccEntry;->iso:Ljava/lang/String;
    
        goto :goto_0
    .end method

    framework\smali\android\net\wifi\WifiStateMachine.smali
    OLD
    Code:
    .method private setCountryCode()V
        .locals 3
    
        .prologue
        .line 3780
        iget-object v1, p0, Landroid/net/wifi/WifiStateMachine;->mContext:Landroid/content/Context;
    
        invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    
        move-result-object v1
    
        const-string/jumbo v2, "wifi_country_code"
    
        invoke-static {v1, v2}, Landroid/provider/Settings$Global;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
    
        move-result-object v0
    
        .line 3782
        .local v0, countryCode:Ljava/lang/String;
        if-eqz v0, :cond_0
    
        invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z
    
        move-result v1
    
        if-nez v1, :cond_0
    
        .line 3783
        const/4 v1, 0x0
    
        invoke-virtual {p0, v0, v1}, Landroid/net/wifi/WifiStateMachine;->setCountryCode(Ljava/lang/String;Z)V
    
        .line 3787
        :cond_0
        return-void
    .end method
    NEW
    Code:
    .method private setCountryCode()V
        .locals 3
    
        .prologue
        .line 3780
        iget-object v1, p0, Landroid/net/wifi/WifiStateMachine;->mContext:Landroid/content/Context;
    
        invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    
        move-result-object v1
    
        const-string/jumbo v2, "wifi_country_code"
    
        invoke-static {v1, v2}, Landroid/provider/Settings$Global;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
    
        move-result-object v0
    
        .line 3782
        .local v0, countryCode:Ljava/lang/String;
        if-eqz v0, :cond_0
    
        invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z
    
        move-result v1
    
        if-nez v1, :cond_0
    
        .line 3783
    [COLOR="Red"]    const-string v0, "us"[/COLOR]
        
        const/4 v1, 0x0
    
        invoke-virtual {p0, v0, v1}, Landroid/net/wifi/WifiStateMachine;->setCountryCode(Ljava/lang/String;Z)V
    
        .line 3787
        :cond_0
        return-void
    .end method

    Result - archive for installation through TWRP:
    - for 3G model (K2_U)
    - for LTE model (K2_UL). If not work, try this

    Try, check, write the results.

    Enjoy!
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone