[Android] ICS | JB 锁屏农历的添加

1. gvim framework-res/res/values/public.xml

    <public type="string" name="chn_ten" id="0x01040519"/>

    <public type="string" name="chn_double" id="0x0104051a"/>

    <public type="string" name="chn_year" id="0x0104051b"/>

    <public type="string" name="lunar_date_template" id="0x0104051c"/>

    <public type="string" name="lunar_date_chushi" id="0x0104051d"/>

    <public type="string" name="lunar_name" id="0x0104051e"/>

    <public type="string" name="lunar_run_month" id="0x0104051f"/>

    <public type="string" name="lunar_month" id="0x01040520"/>

    <public type="string" name="lunar_year" id="0x01040521"/>

    <public type="string" name="lunar_date_format" id="0x01040522"/>

    <public type="string" name="lockscreen_unread_sms" id="0x01040523"/>

    <public type="string" name="lockscreen_unread_mms" id="0x01040524"/>

    <public type="string" name="lockscreen_missed_call" id="0x01040525"/>

 2. gvim framework-res/res/values/strings.xml

    <string name="chn_ten">初十</string>

    <string name="chn_double"></string>

    <string name="chn_year">年)-</string>

    <string name="lunar_date_template">1900年1月31日</string>

    <string name="lunar_date_chushi">初十</string>

    <string name="lunar_name">农历</string>

    <string name="lunar_run_month"></string>

    <string name="lunar_month"></string>

    <string name="lunar_year"></string>

    <string name="lunar_date_format">yyyy年MM月dd日</string>

    <string name="lockscreen_unread_sms">未读短信:%s</string>

    <string name="lockscreen_unread_mms">未读彩信:%s</string>

    <string name="lockscreen_missed_call">未接电话:%s</string>

3. gvim framework-res/res/values/arrays.xml

    <string-array name="chinese_month">

    <item>正月</item>

    <item>二月</item>

    <item>三月</item>

    <item>四月</item>

    <item>五月</item>

    <item>六月</item>

    <item>七月</item>

    <item>八月</item>

    <item>九月</item>

    <item>十月</item>

    <item>冬月</item>

    <item>腊月</item>

    </string-array>

    <string-array name="chinese_month1">

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item>十一</item>

    <item>十二</item>

    </string-array>

    <string-array name="chinese_ten">

    <item></item>

    <item></item>

    <item>廿</item>

    <item></item>

    </string-array>

    <string-array name="chinese_gan">

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    </string-array>

    <string-array name="chinese_zhi">

    <item>子(鼠</item>

    <item>丑(牛</item>

    <item>寅(虎</item>

    <item>卯(兔</item>

    <item>辰(龙</item>

    <item>巳(蛇</item>

    <item>午(马</item>

    <item>未(羊</item>

    <item>申(猴</item>

    <item>酉(鸡</item>

    <item>戌(狗</item>

    <item>亥(猪</item>

    </string-array>

    <string-array name="lunar_animals">

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    </string-array>

    <string-array name="lunar_gans">

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    </string-array>

    <string-array name="lunar_zhis">

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    </string-array>

    <string-array name="lunar_chinese_tens">

    <item></item>

    <item></item>

    <item>廿</item>

    <item></item>

    </string-array>

    <string-array name="lunar_chinese_month">

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    <item></item>

    </string-array>

 4. 修改android.policy.jar中的classes.dex中的com/android/internal/policy/impl/KeyguardStatusViewManager.smali

 1) 取得policy.jar中要修改的起始行(1892)

sed -n '/.method\ refreshDate/=' out_policy_jar/com/android/internal/policy/impl/KeyguardStatusViewManager.smali 

 2) 取得policy.jar中要修改的末尾行(1919)

sed -n '1892,/.end\ method/{=}' out_policy_jar/com/android/internal/policy/impl/KeyguardStatusViewManager.smali | sed -n '$ p'

 3)把1892至1919行删除,用以下代码替换之

.method refreshDate()V

    .registers 6



    .prologue

    .line 889

    iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardStatusViewManager;->mDateView:Landroid/widget/TextView;



    if-eqz v1, :cond_42



    .line 890

    new-instance v0, Ljava/util/Date;



    invoke-direct {v0}, Ljava/util/Date;-><init>()V



    .line 891

    .local v0, now:Ljava/util/Date;

    invoke-virtual {v0}, Ljava/util/Date;->getYear()I



    move-result v1



    add-int/lit16 v1, v1, 0x76c



    invoke-virtual {v0}, Ljava/util/Date;->getMonth()I



    move-result v2



    invoke-virtual {v0}, Ljava/util/Date;->getDate()I



    move-result v3



    invoke-static {v1, v2, v3}, Landroid/util/Lunar;->setLunar(III)V



    .line 892

    iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardStatusViewManager;->mDateView:Landroid/widget/TextView;



    new-instance v2, Ljava/lang/StringBuilder;



    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V



    iget-object v3, p0, Lcom/android/internal/policy/impl/KeyguardStatusViewManager;->mDateFormatString:Ljava/lang/String;



    invoke-static {v3, v0}, Landroid/text/format/DateFormat;->format(Ljava/lang/CharSequence;Ljava/util/Date;)Ljava/lang/CharSequence;



    move-result-object v3



    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;



    move-result-object v2



    const-string v3, " "



    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;



    move-result-object v2



    const/4 v3, 0x5



    const/4 v4, 0x0



    invoke-static {v3, v4}, Landroid/util/Lunar;->getLunar(IZ)Ljava/lang/String;



    move-result-object v3

5. 提取framework.jar的dex文件反编译,将Lunar.smali放到/android/util/目录下,回编译后替换classex.dex。

 Lunar.rar  (From:http://blog.sina.com.cn/s/blog_6fe289450101az44.html)

6. 一张图片展示修改结果(系统版本U8950DV100R001C17B949):

[Android] ICS | JB 锁屏农历的添加

 


关于framework.jar与android.policy.jar的反编译与编译:

1. 用unzip framework.jar -d fw_jar可看到classes.dex文件

2. baksmail classes.dex -o out_framework_jar/反编译classes.dex文件

3. smail out_framework_jar/ -o framework_new.dex 重新编译得到新的dex文件

4. 再用zip把dex文件拖放到framework.jar内即可

你可能感兴趣的:(android)