lujinfeifly / connectbot

Automatically exported from code.google.com/p/connectbot
Apache License 2.0
1 stars 1 forks source link

Google Glass crash on connect #677

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When run on Google Glass, ConnectBot crashes when trying to connect to a host 
with the following logcat output:

W/dalvikvm( 1785): threadid=1: thread exiting with uncaught exception 
(group=0x40dc21f8)
E/AndroidRuntime( 1785): FATAL EXCEPTION: main
E/AndroidRuntime( 1785): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{org.connectbot/org.connectbot.ConsoleActivity}: 
java.lang.NullPointerException
E/AndroidRuntime( 1785):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
E/AndroidRuntime( 1785):    at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime( 1785):    at 
android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime( 1785):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime( 1785):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1785):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1785):    at 
android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 1785):    at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime( 1785):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1785):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 1785):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 1785):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1785): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 1785):    at 
org.connectbot.ActionBarWrapper$RealActionBar.setDisplayHomeAsUpEnabled(ActionBa
rWrapper.java:80)
E/AndroidRuntime( 1785):    at 
org.connectbot.ConsoleActivity.onCreate(ConsoleActivity.java:407)
E/AndroidRuntime( 1785):    at 
android.app.Activity.performCreate(Activity.java:4470)
E/AndroidRuntime( 1785):    at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime( 1785):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime( 1785):    ... 11 more

None of the activities have action bars (the defaults apparently are 
different), so activity.getActionBar() having returned null makes sense.

Original issue reported on code.google.com by jimrandomh@gmail.com on 13 Dec 2013 at 8:26

GoogleCodeExporter commented 8 years ago
Sticking an 'if(actionBar != null)' in front of each reference in 
ActionBarWrapper fixed the crash. No further changes were needed to get to a 
working shell. There are a few cosmetic issues: the font sizes on the 
connections list and the first-run walkthrough are way too big, and the 
protocol-select button renders in white-on-almost-white font. More importantly, 
the keybindings for Ctrl+letter don't seem to do anything. (Port-forwarding 
worked fine; that was actually the main thing I was after). At once point it 
rotated ninety degrees and showed an onscreen keyboard, which is silly, but it 
rotated back and then I couldn't reproduce it.

Original comment by jimrandomh@gmail.com on 13 Dec 2013 at 11:37

GoogleCodeExporter commented 8 years ago
Also - my Glass crops ~4 pixels off the left (and documentation suggests that 
sort of thing may be common), so a configurable margin would be useful. (Though 
it'll probably be unnecessary or superseded by a new API in a future iteration.)

Original comment by jimrandomh@gmail.com on 13 Dec 2013 at 11:40

GoogleCodeExporter commented 8 years ago
Seconded on my Glass Explorer Edition 2.0 model. I can ack the reproduction 
steps jimrandomh provided, as well as the fix.

The steps I took to reproduce this issue:

1) Starting with a Glass Explorer model with Debug Mode enabled, connect to 
another machine over USB.
2) adb install the latest APKs for Settings and Launcher2 
(http://www.glassxe.com/2013/05/23/settings-apk-and-launcher2-apk-from-the-hacki
ng-glass-session-at-google-io/).
3) adb install the latest release APK of connectbot (in my case, 
http://code.google.com/p/connectbot/downloads/detail?name=ConnectBot-git-master-
2013-11-01_20-34-19.apk&can=2&q=)
4) adb shell, am start com.android.launcher/com.android.launcher2.Launcher, 
open the app tray, select connectbot (one can, alternatively, am start 
org.connectbot/.HostListActivity directly)
5) Follow the dialogs, input a valid server, and attempt to connect.

Expected behavior: a connection is established with the server and 
.ConsoleActivity is run.
Actual behavior: connectbot crashes with the dump above.

To fix this, I followed jimrandomh's advice, going a step further and 
commenting out all references to "actionBar". After installing the APK I built 
from the current git master with these changes, the app works on my model of 
Glass.

I was able to reproduce the rotation issue by turning off my Bluetooth 
keyboard. Turning it back on fixed the orientation problem. I suspect it's 
simply related to the default display of the on-screen keyboard.

I cannot recognize, or at least reproduce at this time, the cropping issue 
discussed above, though I have not gone out of my way to attempt to reproduce 
it. My IRSSI session in connectbot appears, naively, to be properly aligned.

Original comment by itisd...@gmail.com on 26 Dec 2013 at 12:08