Esempio n. 1
0
 /**
  * Sends over the unix username and password if the appropriate option is enabled, in order to
  * automatically authenticate to x11vnc when it asks for unix credentials (-unixpw).
  */
 void sendUnixAuth() {
   // If the type of connection is ssh-tunneled and we are told to send the unix credentials, then
   // do so.
   // Do not send the up event if this is a bb10 device, since the up-event hack in
   // processLocalKeyEvent takes care of that...
   if (connection.getConnectionType() == VncConstants.CONN_TYPE_SSH
       && connection.getAutoXUnixAuth()) {
     keyboard.processLocalKeyEvent(
         KeyEvent.KEYCODE_UNKNOWN,
         new KeyEvent(SystemClock.uptimeMillis(), connection.getSshUser(), 0, 0));
     keyboard.processLocalKeyEvent(
         KeyEvent.KEYCODE_ENTER, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
     if (!bb10)
       keyboard.processLocalKeyEvent(
           KeyEvent.KEYCODE_ENTER, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER));
     keyboard.processLocalKeyEvent(
         KeyEvent.KEYCODE_UNKNOWN,
         new KeyEvent(SystemClock.uptimeMillis(), connection.getSshPassword(), 0, 0));
     keyboard.processLocalKeyEvent(
         KeyEvent.KEYCODE_ENTER, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
     if (!bb10)
       keyboard.processLocalKeyEvent(
           KeyEvent.KEYCODE_ENTER, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER));
   }
 }
Esempio n. 2
0
  public void closeConnection() {
    maintainConnection = false;

    if (keyboard != null) {
      // Tell the server to release any meta keys.
      keyboard.clearMetaState();
      keyboard.processLocalKeyEvent(0, new KeyEvent(KeyEvent.ACTION_UP, 0));
    }
    // Close the rfb connection.
    if (rfbconn != null) rfbconn.close();

    // rfbconn = null;
    // rfb = null;
    // cc = null;
    // sock = null;

    // Close the SSH tunnel.
    if (sshConnection != null) {
      sshConnection.terminateSSHTunnel();
      sshConnection = null;
    }
    onDestroy();
  }