我的应用程序使用AccessibilityManager未处理事件使设备崩溃(Galaxy Nexus和Nexus 4)

时间:2013-01-17 11:02:25

标签: android

当我在我的Galaxy Nexus上切换到4.2并且持续使用我的Nexus 4时,这种情况就开始发生了。我的应用程序随机崩溃(软重置)设备,即使没有用户输入也是如此。

这是崩溃前的Logcat:

01-17 12:54:24.960: E/AccessibilityManager(10497): Error during sending EventType: TYPE_WINDOW_CONTENT_CHANGED; EventTime: 151405384; PackageName: com.ntasher.homeconII; MovementGranularity: 0; Action: 0 [ ClassName: android.widget.FrameLayout; Text: []; ContentDescription: null; ItemCount: -1; CurrentItemIndex: -1; IsEnabled: true; IsPassword: false; IsChecked: false; IsFullScreen: false; Scrollable: false; BeforeText: null; FromIndex: -1; ToIndex: -1; ScrollX: -1; ScrollY: -1; MaxScrollX: -1; MaxScrollY: -1; AddedCount: -1; RemovedCount: -1; ParcelableData: null ]; recordCount: 0 
01-17 12:54:24.960: E/AccessibilityManager(10497): android.os.DeadObjectException
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.BinderProxy.transact(Native Method)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.accessibility.IAccessibilityManager$Stub$Proxy.sendAccessibilityEvent(IAccessibilityManager.java:227)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.accessibility.AccessibilityManager.sendAccessibilityEvent(AccessibilityManager.java:265)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.ViewRootImpl.requestSendAccessibilityEvent(ViewRootImpl.java:4700)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:4699)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEventUnchecked(View.java:4680)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEventInternal(View.java:4657)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEvent(View.java:4626)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at com.android.internal.policy.impl.PhoneWindow$DecorView.sendAccessibilityEvent(PhoneWindow.java:2067)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.run(ViewRootImpl.java:5462)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.Handler.handleCallback(Handler.java:725)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.Looper.loop(Looper.java:137)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.app.ActivityThread.main(ActivityThread.java:5039)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at java.lang.reflect.Method.invokeNative(Native Method)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at java.lang.reflect.Method.invoke(Method.java:511)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at dalvik.system.NativeStart.main(Native Method)
01-17 12:54:25.931: E/InputEventReceiver(10497): channel '42466698 com.ntasher.homeconII/com.ntasher.homeconII.HomeConII (client)' ~ Publisher closed input channel or an error occurred.  events=0x9

之后设备软复位(直接发光到“X”)。

这里发生了什么?是一些未处理的例外吗?我怎么能抓住它? 感谢。

1 个答案:

答案 0 :(得分:2)

您尚未提供任何代码,但我怀疑这是问题所在。

在创建绑定到系统的某个对象时,您正在传递Activity上下文。因此,当您关闭应用程序并且对象停留时,它将成为一个死引用。对不再活着且可见的活动的引用。

在某些地方你会有像以下几行:

SomeClass object = new SomeClass(this); //Or getActivity() or something.

在这里,将Context参数更改为getApplicationContext()(除非该代码正在创建并显示对话框,在这种情况下,请使用“活动”上下文。)