Skip to content

Instantly share code, notes, and snippets.

@tmtm
Created April 6, 2013 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmtm/5327012 to your computer and use it in GitHub Desktop.
Save tmtm/5327012 to your computer and use it in GitHub Desktop.
b-mobile や IIJmio などの MVNO SIM で Android を使用する際にアンテナ表示がされない問題に対処するためのパッチを自動適用するスクリプト。 パッチの内容は http://hyzero3.blogspot.jp/2012/12/galaxy-noteandroid421romjellybeer-v351.html このツールを使わなくても、簡単にできる方法あり→ http://bl.oov.ch/2013/04/android-docomo-mvno-sim.html
#!/usr/local/bin/ruby
require 'fileutils'
system 'adb pull /system/framework/telephony-common.jar' or raise 'adb pull'
FileUtils.cp 'telephony-common.jar', 'telephony-common.jar.orig', :preserve=>true
system 'unzip telephony-common.jar classes.dex' or raise 'unzip'
system 'java -jar baksmali-1.4.2.jar classes.dex' or raise 'java baksmali'
file = 'out/com/android/internal/telephony/gsm/GsmServiceStateTracker.smali'
src = <<EOS
:pswitch_data_20
.packed-switch 0x0
:pswitch_1b
:pswitch_1c
:pswitch_1b
:pswitch_1b
:pswitch_1b
:pswitch_1e
:pswitch_5
:pswitch_5
:pswitch_5
:pswitch_5
:pswitch_1b
:pswitch_5
:pswitch_1b
:pswitch_1b
:pswitch_1b
.end packed-switch
EOS
dest = <<EOS
:pswitch_data_20
.packed-switch 0x0
:pswitch_1b
:pswitch_1c
:pswitch_1b
:pswitch_1c
:pswitch_1b
:pswitch_1e
:pswitch_5
:pswitch_5
:pswitch_5
:pswitch_5
:pswitch_1b
:pswitch_5
:pswitch_1b
:pswitch_1c
:pswitch_1b
.end packed-switch
EOS
content = File.read(file)
content.gsub!(/#{Regexp.escape src}/, dest)
File.write(file, content)
system 'java -jar smali-1.4.2.jar -o classes.dex out' or raise 'java smali'
system 'zip telephony-common.jar classes.dex' or raise 'zip'
system 'adb push telephony-common.jar /system/framework/telephony-common.jar' or raise 'adb push'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment