"Window Manager Crash" on dispatching 'Down' key on Samsung Galaxy S
Asked Answered
W

2

6


I am running my Unit tests on various android devices using Instrumentation . Testcases works fine on emulator & all devices except Samsung Galaxy S. On Samsung Galaxy S it displays a Window Manager crash after injecting some 30 key events using instrumentation here is the complete crash log:

D/dalvikvm(11862): GC_EXPLICIT freed 6800 objects / 374040 bytes in 54ms
D/dalvikvm(11862): GC_EXPLICIT freed 780 objects / 71856 bytes in 39ms
W/dalvikvm(11862): threadid=9: thread exiting with uncaught exception (group=0x4001d7d0)
E/WindowManager( 2472): Window Manager Crash
E/WindowManager( 2472): java.lang.NullPointerException
E/WindowManager( 2472):         at com.android.server.WindowManagerService$KeyWaiter.waitForNextEventTarget(WindowManagerService.java:5844)
E/WindowManager( 2472):         at com.android.server.WindowManagerService.injectKeyEvent(WindowManagerService.java:5565)
E/WindowManager( 2472):         at android.view.IWindowManager$Stub.onTransact(IWindowManager.java:110)
E/WindowManager( 2472):         at com.android.server.WindowManagerService.onTransact(WindowManagerService.java:692)
E/WindowManager( 2472):         at android.os.Binder.execTransact(Binder.java:288)
E/WindowManager( 2472):         at dalvik.system.NativeStart.run(Native Method)
E/AndroidRuntime(11862): FATAL EXCEPTION: Instr: com.myapp.test.ImpInstrumentation
E/AndroidRuntime(11862): java.lang.NullPointerException
E/AndroidRuntime(11862):        at android.os.Parcel.readException(Parcel.java:1266)
E/AndroidRuntime(11862):        at android.os.Parcel.readException(Parcel.java:1248)
E/AndroidRuntime(11862):        at android.view.IWindowManager$Stub$Proxy.injectKeyEvent(IWindowManager.java:830)
E/AndroidRuntime(11862):        at android.app.Instrumentation.sendKeySync(Instrumentation.java:859)
E/AndroidRuntime(11862):        at android.app.Instrumentation.sendKeyDownUpSync(Instrumentation.java:872)
E/AndroidRuntime(11862):        at com.myapp.test.util.ListUtil.<b>arrowDownToPosition</b>(ListUtil.java:69)

And here is the piece of code where it generally crashes:

    private void arrowDownToPosition(int position) {
          int maxDowns = 50;
        while(mListView.getSelectedItemPosition() < position && --maxDowns > 0) {
             mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
        }

//Crashes on below line dispatching enter key
      mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_ENTER);
    }

All solutions/suggestions are welcome.

Wieche answered 1/2, 2012 at 7:18 Comment(8)
What version of Android?Metamorphic
@ReubenScratton on Android 2.2Wieche
Annoying that your stack trace doesn't line up with any of the 2.2.x source trees. Presumably Samsung customized it.Metamorphic
Any ideas what that method waitForNextEventTarget() does?Wieche
Any comments/solution/suggestions from the Samsung guys....Wieche
What key sequence are you injecting?Metamorphic
I am injecting keyevents in this order (1)-. HomeActivity:4 key down then Key Enter (2).- SummaryActivity:1 Key down then Key (3)- DetailActivity - Key down +1 key Enter and then it crashes . But this is just one scenario this issue is getting reproduced in other ListView handling too.Wieche
I saw the same issue in monkey tool too once.Wieche
M
0

Not sure if this helps, but while briefly researching this issue, I found this source. Have a look, particularly from line 175 about a bug with DPAD_CENTER on the Galaxy S, and how the issue is resolved.

Marthamarthe answered 29/2, 2012 at 6:5 Comment(2)
thanks for the hint I am facing the issue in ListView only. I don't have any alternative method to move to a particular position in ListView besides KEYPAD_DOWN on that ListView.Wieche
Ahh I understand, I'll keep looking.Marthamarthe
P
-1

according to your stacktrace it seems that your variable mInstrumentation is null. did you forget to initialize it?

try this:

while(mInstrumentation!=null && mListView.getSelectedItemPosition()>-1) {
    mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
}
Paradox answered 9/2, 2012 at 2:4 Comment(1)
Not it's not. 'mInstrumentation' has clearly been initialised because the stack trace shows the exception originating from inside a child of the 'sendKeyDownUpSync' method.Brainsick

© 2022 - 2024 — McMap. All rights reserved.