play3man

Untitled

Nov 4th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.71 KB | None | 0 0
  1. Re: Request
  2. Sounds like fun, count me in. I'm not terribly good with libs and such, it's mostly a frustrating process of trial and error... I wish we had the source code and some documentation for our expensive devices.
  3.  
  4. Anyways, from the stack trace, it looks like your bluetooth stack does not start at all?
  5.  
  6. Code:
  7. E/dalvikvm( 2529): ERROR: couldn't find native method
  8. E/dalvikvm( 2529): Requested: Lcom/android/bluetooth/btservice/AdapterService;.enableRadioNative:()Z
  9. E/dalvikvm( 2529): JNI posting fatal error: RegisterNatives failed for 'com/android/bluetooth/btservice/AdapterService'; aborting...
  10. I/dalvikvm( 2529): "main" prio=5 tid=1 NATIVE
  11. I/dalvikvm( 2529): | group="main" sCount=0 dsCount=0 obj=0x42048e88 self=0x420375b8
  12. I/dalvikvm( 2529): | sysTid=2529 nice=0 sched=0/0 cgrp=apps handle=1074139476
  13. I/dalvikvm( 2529): | state=R schedstat=( 25874007 9273698 52 ) utm=0 stm=2 core=3
  14. I/dalvikvm( 2529): #00 pc 0000132e /system/lib/libcorkscrew.so (unwind_backtrace_thread 29)
  15. I/dalvikvm( 2529): #01 pc 00063502 /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int) 33)
  16. I/dalvikvm( 2529): #02 pc 000574e8 /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool) 395)
  17. I/dalvikvm( 2529): #03 pc 00057556 /system/lib/libdvm.so (dvmDumpThread(Thread*, bool) 25)
  18. I/dalvikvm( 2529): #04 pc 0004bf6c /system/lib/libdvm.so
  19. I/dalvikvm( 2529): #05 pc 00001fd2 /system/lib/libnativehelper.so (jniRegisterNativeMethods 81)
  20. I/dalvikvm( 2529): #06 pc 00004d74 /system/lib/libbluetooth_jni.so (JNI_OnLoad 31)
  21. I/dalvikvm( 2529): #07 pc 00052eae /system/lib/libdvm.so (dvmLoadNativeCode(char const*, Object*, char**) 465)
  22. I/dalvikvm( 2529): #08 pc 0006a6e8 /system/lib/libdvm.so
  23. I/dalvikvm( 2529): #09 pc 000297e0 /system/lib/libdvm.so
  24. I/dalvikvm( 2529): #10 pc 00030c6c /system/lib/libdvm.so (dvmMterpStd(Thread*) 76)
  25. I/dalvikvm( 2529): #11 pc 0002e304 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*) 184)
  26. I/dalvikvm( 2529): #12 pc 00063430 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list) 335)
  27. I/dalvikvm( 2529): #13 pc 00063454 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...) 19)
  28. I/dalvikvm( 2529): #14 pc 0006eb58 /system/lib/libdvm.so (dvmInitClass 663)
  29. I/dalvikvm( 2529): #15 pc 0006a006 /system/lib/libdvm.so
  30. I/dalvikvm( 2529): #16 pc 000297e0 /system/lib/libdvm.so
  31. I/dalvikvm( 2529): #17 pc 00030c6c /system/lib/libdvm.so (dvmMterpStd(Thread*) 76)
  32. I/dalvikvm( 2529): #18 pc 0002e304 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*) 184)
  33. I/dalvikvm( 2529): #19 pc 00063714 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool) 391)
  34. I/dalvikvm( 2529): #20 pc 00002686 /system/bin/app_process
  35. I/dalvikvm( 2529): #21 pc 000297e0 /system/lib/libdvm.so
  36. I/dalvikvm( 2529): #22 pc 00030c6c /system/lib/libdvm.so (dvmMterpStd(Thread*) 76)
  37. I/dalvikvm( 2529): #23 pc 0002e304 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*) 184)
  38. I/dalvikvm( 2529): #24 pc 00063430 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list) 335)
  39. I/dalvikvm( 2529): #25 pc 00063454 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...) 19)
  40. I/dalvikvm( 2529): #26 pc 000028be /system/bin/app_process
  41. I/dalvikvm( 2529): #27 pc 000297e0 /system/lib/libdvm.so
  42. I/dalvikvm( 2529): #28 pc 00030c6c /system/lib/libdvm.so (dvmMterpStd(Thread*) 76)
  43. I/dalvikvm( 2529): #29 pc 0002e304 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*) 184)
  44. I/dalvikvm( 2529): #30 pc 00063714 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool) 391)
  45. I/dalvikvm( 2529): #31 pc 0006b6e2 /system/lib/libdvm.so
  46. I/dalvikvm( 2529): at java.lang.Runtime.nativeLoad(Native Method)
  47. I/dalvikvm( 2529): at java.lang.Runtime.doLoad(Runtime.java:421)
  48. I/dalvikvm( 2529): at java.lang.Runtime.loadLibrary(Runtime.java:362)
  49. I/dalvikvm( 2529): at java.lang.System.loadLibrary(System.java:526)
  50. I/dalvikvm( 2529): at com.android.bluetooth.btservice.AdapterApp.<clinit>(AdapterApp.java:34)
  51. I/dalvikvm( 2529): at java.lang.Class.newInstanceImpl(Native Method)
  52. I/dalvikvm( 2529): at java.lang.Class.newInstance(Class.java:1208)
  53. I/dalvikvm( 2529): at android.app.Instrumentation.newApplication(Instrumentation.java:990)
  54. I/dalvikvm( 2529): at android.app.Instrumentation.newApplication(Instrumentation.java:975)
  55. I/dalvikvm( 2529): at android.app.LoadedApk.makeApplication(LoadedApk.java:515)
  56. I/dalvikvm( 2529): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4435)
  57. I/dalvikvm( 2529): at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
  58. I/dalvikvm( 2529): at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
  59. I/dalvikvm( 2529): at android.app.ActivityThread.handleBindApplication(Native Method)
  60. I/dalvikvm( 2529): at android.app.ActivityThread.access$1500(ActivityThread.java:144)
  61. I/dalvikvm( 2529): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)
  62. I/dalvikvm( 2529): at android.os.Handler.dispatchMessage(Handler.java:102)
  63. I/dalvikvm( 2529): at android.os.Looper.loop(Looper.java:212)
  64. I/dalvikvm( 2529): at android.app.ActivityThread.main(ActivityThread.java:5135)
  65. I/dalvikvm( 2529): at java.lang.reflect.Method.invokeNative(Native Method)
  66. I/dalvikvm( 2529): at java.lang.reflect.Method.invoke(Method.java:515)
  67. I/dalvikvm( 2529): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
  68. I/dalvikvm( 2529): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  69. I/dalvikvm( 2529): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
  70. I/dalvikvm( 2529): at dalvik.system.NativeStart.main(Native Method)
  71. I/dalvikvm( 2529):
  72. E/dalvikvm( 2529): VM aborting
  73. F/libc ( 2529): Fatal signal 6 (SIGABRT) at 0x000009e1 (code=-6), thread 2529 (droid.bluetooth)
  74. The counterpart for libbluetooth_jni.so probably lives in framework.jar (not sure?):
  75. Code:
  76. Lcom/android/bluetooth/btservice/AdapterService;.enableRadioNative:()Z
  77. I'd deodex and decompile framework.jar and look at the differences. Let's see, I happen to have the decompiled framework in front of me.
  78.  
  79. z3 framework.jar has the following in IBluetooth.smali:
  80.  
  81. Code:
  82. .method public abstract enableRadio(I)Z
  83. .annotation system Ldalvik/annotation/Throws;
  84. value = {
  85. Landroid/os/RemoteException;
  86. }
  87. .end annotation
  88. .end method
  89. Code:
  90. .method public abstract isEnabled()Z
  91. .annotation system Ldalvik/annotation/Throws;
  92. value = {
  93. Landroid/os/RemoteException;
  94. }
  95. .end annotation
  96. .end method
  97. Let's grep:
  98.  
  99. Code:
  100. $ grep -r enableRadio *
  101. framework.jar.out/smali/android/bluetooth/IBluetoothManager$Stub$Proxy.smali:.method public enableRadio(I)Z
  102. framework.jar.out/smali/android/bluetooth/IBluetoothManager.smali:.method public abstract enableRadio(I)Z
  103. framework.jar.out/smali/android/bluetooth/IBluetooth$Stub.smali:.field static final TRANSACTION_enableRadio:I = 0x7
  104. framework.jar.out/smali/android/bluetooth/IBluetooth$Stub.smali: invoke-virtual {p0, v1}, Landroid/bluetooth/IBluetooth$Stub;->enableRadio(I)Z
  105. framework.jar.out/smali/android/bluetooth/IBluetooth$Stub$Proxy.smali:.method public enableRadio(I)Z
  106. framework.jar.out/smali/android/bluetooth/IBluetoothManager$Stub.smali:.field static final TRANSACTION_enableRadio:I = 0xe
  107. framework.jar.out/smali/android/bluetooth/IBluetoothManager$Stub.smali: invoke-virtual {p0, v0}, Landroid/bluetooth/IBluetoothManager$Stub;->enableRadio(I)Z
  108. framework.jar.out/smali/android/bluetooth/IBluetooth.smali:.method public abstract enableRadio(I)Z
  109. framework.jar.out/smali/android/bluetooth/BluetoothAdapter.smali:.method public enableRadio(I)Z
  110. framework.jar.out/smali/android/bluetooth/BluetoothAdapter.smali: invoke-interface {v2, p1}, Landroid/bluetooth/IBluetoothManager;->enableRadio(I)Z
  111. So, apparently, the Z3 has that code in android.bluetooth - and it's nowhere to be found in the Z1 framework.jar. From your logcat, it seems that the code request the JNI methods in com/android/bluetooth/btservice/AdapterService. So, hypothesis: your new Z3 libbluetooth_jni.so has the required methods, but the Z1 java counterpart is looking in the wrong place. Possibly because the Bluetooth stack got moved around in between Android versions? Z3 is on 4.4.3 or 4.4.2, Z1 on 4.4.4.
  112.  
  113. Looking at this again, I see your stack crashes in "Requested: Lcom/android/bluetooth/btservice/AdapterService;.enableRadioNative)Z" which, according to Google, lives in the Bluetooth package: https://android.googlesource.com/pla...pps/Bluetooth/
  114. Sony decided to move these to the Z3 framework for some reason - the code I pasted above is only found in Z3 framework.
  115.  
  116. So your Bluetooth stack on the Z1 is trying to load some native methods which are not there anymore - Sony moved them into the framework for some reason. It'd be interesting to decompile Bluetooth.apk to verify this idea.
  117.  
  118. A possible course of action is to port the full bluetooth stack from the Z3 to the Z1. This includes Bluetooth.apk (com.android.bluetooth), android.bluetooth from framework and associated JNI.
  119.  
  120. Code:
  121. $ strings z3/lib/libbluetooth_jni.so | grep enableRadioNative
  122. enableRadioNative
  123. t$ strings z1/lib/libbluetooth_jni.so | grep enableRadioNative
  124. I wonder why I can't find any mention of enableRadioNative in the Z1. It's also possible that the code is only there in Z3, but then it shouldn't crash IF you have the proper libbluetooth_jni.so.
Advertisement
Add Comment
Please, Sign In to add comment