OPP: Fix Resource Leak in OPP (2/2)
[Test Procedure]
1) Select File -> Press share via BT -> Press back key
2) Repeat step 1 in loop (1024 times)
Expected Result
No BT crash observed
Observed Result
-------------------------------------------------------------------------------------------------
issueTag : SYSTEM_TOMBSTONE
PackageName : N/A
PackageVersion : N/A
ExceptionType : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
ExceptionMessage : #00 pc 0004ea14 /system/lib/libdvm.so #01 pc 00004a49 /system/lib/libbluetooth_jni.so
Process : com.android.bluetooth
Build : FarEastone/Smart503_03TW/MC2:4.4.2/KVT49L/03TW_0_160:user/release-keys
StackTrace :
issueCount : 3
issueLogPath :
... TEM_TOMBSTONE/SYSTEM_TOMBSTONE@1397693648904.txt 2014-04-17 08:14:08 (GMT+8)
... TEM_TOMBSTONE/SYSTEM_TOMBSTONE@1397693649571.txt 2014-04-17 08:14:09 (GMT+8)
... TEM_TOMBSTONE/SYSTEM_TOMBSTONE@1397693650035.txt 2014-04-17 08:14:10 (GMT+8)
and then we can see:
-------------------------------------------------------------------------------------------------
issueTag : system_app_crash
PackageName : com.android.bluetooth
PackageVersion : 4.4.2-00WW_0_160
ExceptionType : java.lang.RuntimeException
ExceptionMessage : Could not read input channel file descriptors from parcel.
Process : com.android.bluetooth
Flag : 0x88be45
Build : FarEastone/Smart503_03TW/MC2:4.4.2/KVT49L/03TW_0_160:user/release-keys
throwClassName : android.view.InputChannel.nativeReadFromParcel
throwMethodName : Native Method
StackTrace :
java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
at android.view.InputChannel.nativeReadFromParcel(Native Method)
at android.view.InputChannel.readFromParcel(InputChannel.java:148)
at android.view.IWindowSession$Stub$Proxy.addToDisplay(IWindowSession.java:690)
at android.view.ViewRootImpl.setView(ViewRootImpl.java:502)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2860)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5055)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:658)
at dalvik.system.NativeStart.main(Native Method)
Root Cause:
Input stream was never closed resulting in leak with each iteration and system crash after 1024 iterations.
Fix:
Handle closing of input stream and Remove hashmap share if no device is selected by user when trying to send
file via BT. Without this, input stream was never closed resulting in leak with each iteration and system crash
after 1024 iterations.
Test: Performed the usecase overnight and see if no crash is observed.
Bug: 35626275
Change-Id: I92aa0d8e81977fde0446f565f1de95e2d91e1e9c
3 files changed
tree: 8c4ed18f9eff2d23460af6cb3b56d664ea1d1be4
- android/