external: Sync with openconnect rev 2c4851e

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
libs: Sync with latest openconnect sources

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
AuthFormHandler: Disable fixPadding() for now

The tweaks I made earlier produced good results on a tablet, but look bad
on a lower-res phone (especially in landscape mode).  Let's just revert
back to the default padding for the time being.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
AuthFormHandler: Switch to numeric text input for PIN fields

libopenconnect now tells us whether each input field is alphanumeric or
numeric, so use this information when rendering the form.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
AuthFormHandler: Use updated LibOpenConnect API for opt.value

FormOpt.setValue() was removed in the latest iteration of the library.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
AuthFormHandler: Prepopulate auth form when appropriate

Save auth form entries across task switches or screen rotations.  If
the server supplies form data (e.g. secondary_username), display it
unless the user has saved a different value.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
LogWindow: Fix FC on screen rotation in <= JB 4.1

The ordering of onResume() and onCreateOptionsMenu() differs from one
Android release to the next[1].  So check to make sure mConn isn't null
before using it in onCreateOptionsMenu().

[1] http://code.google.com/p/android/issues/detail?id=39721

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Fix up disconnect/reconnect buttons

Add "Reconnect to <VPN>" button to the status fragment.  Add more checks
to disable the Reconnect buttons on a clean install, where we have no
VPN profiles (or no VPN profile has ever been used).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Make "show log window" configurable

Add a global preference that determines whether to show the log window
or the status fragment upon connection.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
VPNConnector: Reference-count activities separately from fragments

A non-foreground activity is guaranteed to call onPause() so we know
to raise the notification if an alert dialog pops up.  Fragments
might not be destroyed under the same circumstances, so we ignore them
in the refcount.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Disable restart-on-boot option for now

This still has a number of outstanding issues:

 - Network not up at the time the BOOT_COMPLETED intent is received

 - System VPN warning dialog dismissing itself if the screen isn't
unlocked quickly enough

 - Weird task stack after GrantPermissionActivity calls finish()

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
OpenConnectManagementThread: Generate fake stats callbacks while paused

Make sure the UI doesn't wait forever for a stats callback that won't
return.  Also make sure we aren't filling up the cmd_fd pipe with stats
requests while the mainloop isn't running.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>