(大神分析)log——铃声设置FC

LOG

I/ActivityManager( 396): START {act=android.intent.action.TY_RINGTONE_PICKER (has extras) u=0} from pid 2276
E/AndroidRuntime( 2276): FATAL EXCEPTION: main
E/AndroidRuntime( 2276): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.TY_RINGTONE_PICKER (has extras) }
E/AndroidRuntime( 2276): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1559)
E/AndroidRuntime( 2276): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1529)
E/AndroidRuntime( 2276): at android.app.Activity.startActivityFromFragment(Activity.java:3850)
E/AndroidRuntime( 2276): at android.app.Fragment.startActivityForResult(Fragment.java:1021)
E/AndroidRuntime( 2276): at android.app.Fragment.startActivityForResult(Fragment.java:1005)
E/AndroidRuntime( 2276): at android.preference.RingtonePreference.onClick(RingtonePreference.java:145)
E/AndroidRuntime( 2276): at android.preference.Preference.performClick(Preference.java:942)
E/AndroidRuntime( 2276): at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:208)
E/AndroidRuntime( 2276): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
E/AndroidRuntime( 2276): at android.widget.AbsListView.performItemClick(AbsListView.java:1099)
E/AndroidRuntime( 2276): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2934)
E/AndroidRuntime( 2276): at android.widget.AbsListView$1.run(AbsListView.java:3618)
E/AndroidRuntime( 2276): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 2276): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 2276): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2276): at android.app.ActivityThread.main(ActivityThread.java)
E/AndroidRuntime( 2276): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2276): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 2276): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 2276): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 2276): at dalvik.system.NativeStart.main(Native Method)
D/AndroidRuntime( 2276): Shutting down VM
W/dalvikvm( 2276): threadid=1: thread exiting with uncaught exception (group=0x40f31300)
W/ActivityManager( 396): Force finishing activity com.android.settings/.SubSettings
W/ActivityManager( 395): Activity pause timeout for ActivityRecord{415b3440 com.android.settings/.SubSettings}

还是@zoujunhua86给力,正如军华大神所说,一开始就定位错了..
经对比framework.jar.out/smali/android/preference/RingtonePreference.smali 发现多了如下内容

const-string v2, “android.intent.action.TY_RINGTONE_PICKER”
invoke-virtual {v0, v2}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;

这也就符合了第三行的解释
E/AndroidRuntime(  784): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.TY_RINGTONE_PICKER (has extras) }
android.intent.action.TY_RINGTONE_PICKER是额外增加了

大神讲解

E/AndroidRuntime(  784): FATAL EXCEPTION: main
E/AndroidRuntime(  784): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.TY_RINGTONE_PICKER (has extras) }
E/AndroidRuntime(  784):         at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1559)
E/AndroidRuntime(  784):         at android.app.Instrumentation.execStartActivity(Instrumentation.java:1529)
E/AndroidRuntime(  784):         at android.app.Activity.startActivityFromFragment(Activity.java:3850)
E/AndroidRuntime(  784):         at android.app.Fragment.startActivityForResult(Fragment.java:1021)
E/AndroidRuntime(  784):         at android.app.Fragment.startActivityForResult(Fragment.java:1005)
E/AndroidRuntime(  784):         at android.preference.RingtonePreference.onClick(RingtonePreference.java:145)
E/AndroidRuntime(  784):         at android.preference.Preference.performClick(Preference.java:942)
E/AndroidRuntime(  784):         at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:208)
E/AndroidRuntime(  784):         at android.widget.AdapterView.performItemClick(AdapterView.java:298)
E/AndroidRuntime(  784):         at android.widget.AbsListView.performItemClick(AbsListView.java:1099)
E/AndroidRuntime(  784):         at android.widget.AbsListView$PerformClick.run(AbsListView.java:2934)
E/AndroidRuntime(  784):         at android.widget.AbsListView$1.run(AbsListView.java:3618)
E/AndroidRuntime(  784):         at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime(  784):         at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(  784):         at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(  784):         at android.app.ActivityThread.main(ActivityThread.java)
E/AndroidRuntime(  784):         at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  784):         at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(  784):         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(  784):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(  784):         at dalvik.system.NativeStart.main(Native Method)

首先根据这个log定位到RingtonePreference.onClick(RingtonePreference.java:145)有问题
为什么不是出错log的第一行?
因为第一行是安卓基础库,一般不会出问题,是调用者有误。

这里涉及到一点安卓知识,但是我不想展开,只需要对比bosp和厂商的文件,哪个文件?
android.preference.RingtonePreference.onClick(RingtonePreference.java:145)表示
在RingtonePreference.smali中(也可能在其他形如RingtonePreference$1.smali文件中)

路径:framework.jar.out中,android.preference表示在framework.jar.out/android/preference目录下(找不到或者不会看,可以使用find命令),
(RingtonePreference.java:145)表示RingtonePreference文件的145行,对应smali中就是.line 145下的语句,
.onClick表示处于这个文件的onClick方法内

对比bosp和厂商的这两个方法,我推断TY,可能是天语应该是改动这个文件,bosp是安卓标准文件,改成bosp的即可