FreeRDP
Loading...
Searching...
No Matches
com.freerdp.freerdpcore.presentation.SessionActivity Class Reference
Inheritance diagram for com.freerdp.freerdpcore.presentation.SessionActivity:
Collaboration diagram for com.freerdp.freerdpcore.presentation.SessionActivity:

Data Structures

class  ConnectThread
 

Public Member Functions

void onCreate (Bundle savedInstanceState)
 
void onWindowFocusChanged (boolean hasFocus)
 
void onConfigurationChanged (Configuration newConfig)
 
boolean onCreateOptionsMenu (Menu menu)
 
boolean onOptionsItemSelected (MenuItem item)
 
void handleBackPressed ()
 
boolean onKeyLongPress (int keyCode, KeyEvent event)
 
boolean onKeyDown (int keycode, KeyEvent event)
 
boolean onKeyUp (int keycode, KeyEvent event)
 
boolean onKeyMultiple (int keyCode, int repeatCount, KeyEvent event)
 
void OnSettingsChanged (int width, int height, int bpp)
 
void OnGraphicsUpdate (int x, int y, int width, int height)
 
void OnGraphicsResize (int width, int height, int bpp)
 
boolean OnAuthenticate (StringBuilder username, StringBuilder domain, StringBuilder password)
 
boolean OnGatewayAuthenticate (StringBuilder username, StringBuilder domain, StringBuilder password)
 
int OnVerifiyCertificateEx (String host, long port, String commonName, String subject, String issuer, String fingerprint, long flags)
 
int OnVerifyChangedCertificateEx (String host, long port, String commonName, String subject, String issuer, String fingerprint, String oldSubject, String oldIssuer, String oldFingerprint, long flags)
 
void OnRemoteClipboardChanged (String data)
 
boolean onGenericMotionEvent (MotionEvent e)
 
void onClipboardChanged (String data)
 

Static Public Attributes

static final String PARAM_CONNECTION_REFERENCE = "conRef"
 
static final String PARAM_INSTANCE = "instance"
 

Protected Member Functions

void onStart ()
 
void onRestart ()
 
void onResume ()
 
void onPause ()
 
void onStop ()
 
void onDestroy ()
 

Detailed Description

Definition at line 63 of file SessionActivity.java.

Member Function Documentation

◆ handleBackPressed()

void com.freerdp.freerdpcore.presentation.SessionActivity.handleBackPressed ( )
inline

Definition at line 503 of file SessionActivity.java.

504 {
505 // hide keyboards (if any visible) or send alt+f4 to the session
506 if (inputManager.isAnyKeyboardVisible())
507 {
508 inputManager.hideKeyboards();
509 return;
510 }
511 if (inputManager.handleBackAsAltF4())
512 {
513 return;
514 }
515 if (System.currentTimeMillis() - backPressedTime < 2000)
516 {
517 LibFreeRDP.disconnect(session.getInstance());
518 }
519 else
520 {
521 backPressedTime = System.currentTimeMillis();
522 Toast.makeText(this, R.string.session_double_back_to_exit, Toast.LENGTH_SHORT).show();
523 }
524 }

◆ OnAuthenticate()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.OnAuthenticate ( StringBuilder  username,
StringBuilder  domain,
StringBuilder  password 
)
inline

Definition at line 629 of file SessionActivity.java.

631 {
632 return dialogs.promptCredentials(username, domain, password);
633 }
boolean promptCredentials(StringBuilder username, StringBuilder domain, StringBuilder password)

◆ onClipboardChanged()

void com.freerdp.freerdpcore.presentation.SessionActivity.onClipboardChanged ( String  data)
inline

Definition at line 680 of file SessionActivity.java.

681 {
682 Log.v(TAG, "onClipboardChanged: " + data);
683 LibFreeRDP.sendClipboardData(session.getInstance(), data);
684 }

◆ onConfigurationChanged()

void com.freerdp.freerdpcore.presentation.SessionActivity.onConfigurationChanged ( Configuration  newConfig)
inline

Definition at line 313 of file SessionActivity.java.

314 {
315 super.onConfigurationChanged(newConfig);
316
317 // reload keyboard resources (changed from landscape)
318 inputManager.reloadKeyboards();
319
320 hideSystemBars();
321 }

◆ onCreate()

void com.freerdp.freerdpcore.presentation.SessionActivity.onCreate ( Bundle  savedInstanceState)
inline

Definition at line 169 of file SessionActivity.java.

170 {
171 super.onCreate(savedInstanceState);
172
173 hideSystemBars();
174
175 this.setContentView(R.layout.session);
176
177 Log.v(TAG, "Session.onCreate");
178
179 // ATTENTION: We use the onGlobalLayout notification to start our
180 // session.
181 // This is because only then we can know the exact size of our session
182 // when using fit screen
183 // accounting for any status bars etc. that Android might throws on us.
184 // A bit weird looking
185 // but this is the only way ...
186 final View activityRootView = findViewById(R.id.session_root_view);
187 activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(
188 new OnGlobalLayoutListener() {
189 @Override public void onGlobalLayout()
190 {
191 screen_width = activityRootView.getWidth();
192 screen_height = activityRootView.getHeight();
193
194 // start session
195 if (!sessionRunning && getIntent() != null)
196 {
197 processIntent(getIntent());
198 sessionRunning = true;
199 }
200 }
201 });
202
203 sessionView = findViewById(R.id.sessionView);
204 sessionView.requestFocus();
205
206 touchPointerView = findViewById(R.id.touchPointerView);
207
208 KeyboardView keyboardView = findViewById(R.id.extended_keyboard);
209 KeyboardView modifiersKeyboardView = findViewById(R.id.extended_keyboard_header);
210
211 scrollView = findViewById(R.id.sessionScrollView);
212 sessionViewModel = new ViewModelProvider(this).get(SessionViewModel.class);
213 sessionViewModel.getState().observe(this, this::onConnectionStateChanged);
214
215 dialogs = new SessionDialogs(this, new SessionDialogs.OnUserCancelListener() {
216 @Override public void onUserCancel()
217 {
218 connectCancelledByUser = true;
219 }
220 });
221
222 // Wire up the input manager (instance is attached later in bindSession()).
223 inputManager = new SessionInputManager(this, scrollView, sessionView, touchPointerView,
224 keyboardView, modifiersKeyboardView);
225 sessionView.setSessionViewListener(inputManager);
226 touchPointerView.setTouchPointerListener(inputManager);
227 sessionView.setScaleGestureDetector(
228 new ScaleGestureDetector(this, inputManager.getPinchZoomListener()));
229
230 mClipboardManager = ClipboardManagerProxy.getClipboardManager(this);
231 mClipboardManager.addClipboardChangedListener(this);
232
233 getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
234 @Override public void handleOnBackPressed()
235 {
236 handleBackPressed();
237 }
238 });
239
240 hideSystemBars();
241 }

◆ onCreateOptionsMenu()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.onCreateOptionsMenu ( Menu  menu)
inline

Definition at line 470 of file SessionActivity.java.

471 {
472 getMenuInflater().inflate(R.menu.session_menu, menu);
473 return true;
474 }

◆ onDestroy()

void com.freerdp.freerdpcore.presentation.SessionActivity.onDestroy ( )
inlineprotected

Definition at line 284 of file SessionActivity.java.

285 {
286 if (connectThread != null)
287 {
288 connectThread.interrupt();
289 }
290 super.onDestroy();
291 Log.v(TAG, "Session.onDestroy");
292
293 // Cancel running disconnect timers.
294 GlobalApp.cancelDisconnectTimer();
295
296 // Disconnect all remaining sessions.
297 Collection<SessionState> sessions = GlobalApp.getSessions();
298 for (SessionState session : sessions)
299 LibFreeRDP.disconnect(session.getInstance());
300
301 // unregister freerdp session listener
302 sessionViewModel.unregister();
303
304 // remove clipboard listener
305 mClipboardManager.removeClipboardboardChangedListener(this);
306
307 // free session
308 GlobalApp.freeSession(session.getInstance());
309
310 session = null;
311 }

◆ OnGatewayAuthenticate()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.OnGatewayAuthenticate ( StringBuilder  username,
StringBuilder  domain,
StringBuilder  password 
)
inline

Definition at line 636 of file SessionActivity.java.

638 {
639 return dialogs.promptCredentials(username, domain, password);
640 }

◆ onGenericMotionEvent()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.onGenericMotionEvent ( MotionEvent  e)
inline

Definition at line 672 of file SessionActivity.java.

673 {
674 super.onGenericMotionEvent(e);
675 return inputManager != null && inputManager.onGenericMotionEvent(e);
676 }

◆ OnGraphicsResize()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnGraphicsResize ( int  width,
int  height,
int  bpp 
)
inline

Definition at line 609 of file SessionActivity.java.

610 {
611 // replace bitmap
612 if (bpp > 16)
613 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
614 else
615 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
616 session.setSurface(new BitmapDrawable(getResources(), bitmap));
617
618 if (inputManager != null)
619 inputManager.setBitmap(bitmap);
620
621 /*
622 * since sessionView can only be modified from the UI thread any
623 * modifications to it need to be scheduled
624 */
625 uiHandler.sendEmptyMessage(GRAPHICS_CHANGED);
626 }

◆ OnGraphicsUpdate()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnGraphicsUpdate ( int  x,
int  y,
int  width,
int  height 
)
inline

Definition at line 595 of file SessionActivity.java.

596 {
597 LibFreeRDP.updateGraphics(session.getInstance(), bitmap, x, y, width, height);
598
599 sessionView.addInvalidRegion(new Rect(x, y, x + width, y + height));
600
601 /*
602 * since sessionView can only be modified from the UI thread any
603 * modifications to it need to be scheduled
604 */
605
606 uiHandler.sendEmptyMessage(REFRESH_SESSIONVIEW);
607 }

◆ onKeyDown()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.onKeyDown ( int  keycode,
KeyEvent  event 
)
inline

Definition at line 539 of file SessionActivity.java.

540 {
541 if (keycode == KeyEvent.KEYCODE_BACK)
542 return super.onKeyDown(keycode, event);
543 return inputManager.onAndroidKeyEvent(event);
544 }

◆ onKeyLongPress()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.onKeyLongPress ( int  keyCode,
KeyEvent  event 
)
inline

Definition at line 526 of file SessionActivity.java.

527 {
528 if (inputManager.onAndroidKeyLongPress(keyCode))
529 return true;
530 return super.onKeyLongPress(keyCode, event);
531 }

◆ onKeyMultiple()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.onKeyMultiple ( int  keyCode,
int  repeatCount,
KeyEvent  event 
)
inline

Definition at line 555 of file SessionActivity.java.

556 {
557 return inputManager.onAndroidKeyEvent(event);
558 }

◆ onKeyUp()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.onKeyUp ( int  keycode,
KeyEvent  event 
)
inline

Definition at line 546 of file SessionActivity.java.

547 {
548 if (keycode == KeyEvent.KEYCODE_BACK)
549 return super.onKeyUp(keycode, event);
550 return inputManager.onAndroidKeyEvent(event);
551 }

◆ onOptionsItemSelected()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.onOptionsItemSelected ( MenuItem  item)
inline

Definition at line 476 of file SessionActivity.java.

477 {
478 // refer to http://tools.android.com/tips/non-constant-fields why we
479 // can't use switch/case here ..
480 int itemId = item.getItemId();
481
482 if (itemId == R.id.session_touch_pointer)
483 {
484 inputManager.toggleTouchPointer();
485 }
486 else if (itemId == R.id.session_sys_keyboard)
487 {
488 inputManager.toggleSystemKeyboard();
489 }
490 else if (itemId == R.id.session_ext_keyboard)
491 {
492 inputManager.toggleExtendedKeyboard();
493 }
494 else if (itemId == R.id.session_disconnect)
495 {
496 inputManager.hideKeyboards();
497 LibFreeRDP.disconnect(session.getInstance());
498 }
499
500 return true;
501 }

◆ onPause()

void com.freerdp.freerdpcore.presentation.SessionActivity.onPause ( )
inlineprotected

Definition at line 269 of file SessionActivity.java.

270 {
271 super.onPause();
272 Log.v(TAG, "Session.onPause");
273
274 // hide any visible keyboards
275 inputManager.hideKeyboards();
276 }

◆ OnRemoteClipboardChanged()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnRemoteClipboardChanged ( String  data)
inline

Definition at line 662 of file SessionActivity.java.

663 {
664 Log.v(TAG, "OnRemoteClipboardChanged: " + data);
665 mClipboardManager.setClipboardData(data);
666 }

◆ onRestart()

void com.freerdp.freerdpcore.presentation.SessionActivity.onRestart ( )
inlineprotected

Definition at line 257 of file SessionActivity.java.

258 {
259 super.onRestart();
260 Log.v(TAG, "Session.onRestart");
261 }

◆ onResume()

void com.freerdp.freerdpcore.presentation.SessionActivity.onResume ( )
inlineprotected

Definition at line 263 of file SessionActivity.java.

264 {
265 super.onResume();
266 Log.v(TAG, "Session.onResume");
267 }

◆ OnSettingsChanged()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnSettingsChanged ( int  width,
int  height,
int  bpp 
)
inline

Definition at line 565 of file SessionActivity.java.

566 {
567
568 if (bpp > 16)
569 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
570 else
571 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
572
573 session.setSurface(new BitmapDrawable(getResources(), bitmap));
574
575 if (inputManager != null)
576 inputManager.setBitmap(bitmap);
577
578 if (session.getBookmark() == null)
579 {
580 // Return immediately if we launch from URI
581 return;
582 }
583 // check this settings and initial settings - if they are not equal the
584 // server doesn't support our settings
585 // FIXME: the additional check (settings.getWidth() != width + 1) is for
586 // the RDVH bug fix to avoid accidental notifications
587 // (refer to android_freerdp.c for more info on this problem)
588 BookmarkBase.ScreenSettings settings = session.getBookmark().getActiveScreenSettings();
589 if ((settings.getWidth() != width && settings.getWidth() != width + 1) ||
590 settings.getHeight() != height || settings.getColors() != bpp)
591 uiHandler.sendMessage(Message.obtain(
592 null, DISPLAY_TOAST, getResources().getText(R.string.info_capabilities_changed)));
593 }

◆ onStart()

void com.freerdp.freerdpcore.presentation.SessionActivity.onStart ( )
inlineprotected

Definition at line 251 of file SessionActivity.java.

252 {
253 super.onStart();
254 Log.v(TAG, "Session.onStart");
255 }

◆ onStop()

void com.freerdp.freerdpcore.presentation.SessionActivity.onStop ( )
inlineprotected

Definition at line 278 of file SessionActivity.java.

279 {
280 super.onStop();
281 Log.v(TAG, "Session.onStop");
282 }

◆ OnVerifiyCertificateEx()

int com.freerdp.freerdpcore.presentation.SessionActivity.OnVerifiyCertificateEx ( String  host,
long  port,
String  commonName,
String  subject,
String  issuer,
String  fingerprint,
long  flags 
)
inline

Definition at line 643 of file SessionActivity.java.

645 {
646 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
647 return 0;
648 return dialogs.verifyCertificate(host, port, subject, issuer, fingerprint, flags);
649 }
int verifyCertificate(String host, long port, String subject, String issuer, String fingerprint, long flags)

◆ OnVerifyChangedCertificateEx()

int com.freerdp.freerdpcore.presentation.SessionActivity.OnVerifyChangedCertificateEx ( String  host,
long  port,
String  commonName,
String  subject,
String  issuer,
String  fingerprint,
String  oldSubject,
String  oldIssuer,
String  oldFingerprint,
long  flags 
)
inline

Definition at line 652 of file SessionActivity.java.

656 {
657 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
658 return 0;
659 return dialogs.verifyChangedCertificate(host, port, subject, issuer, fingerprint, flags);
660 }
int verifyChangedCertificate(String host, long port, String subject, String issuer, String fingerprint, long flags)

◆ onWindowFocusChanged()

void com.freerdp.freerdpcore.presentation.SessionActivity.onWindowFocusChanged ( boolean  hasFocus)
inline

Definition at line 243 of file SessionActivity.java.

244 {
245 super.onWindowFocusChanged(hasFocus);
246 if (hasFocus)
247 hideSystemBars();
248 mClipboardManager.getPrimaryClipManually();
249 }

Field Documentation

◆ PARAM_CONNECTION_REFERENCE

final String com.freerdp.freerdpcore.presentation.SessionActivity.PARAM_CONNECTION_REFERENCE = "conRef"
static

Definition at line 66 of file SessionActivity.java.

◆ PARAM_INSTANCE

final String com.freerdp.freerdpcore.presentation.SessionActivity.PARAM_INSTANCE = "instance"
static

Definition at line 67 of file SessionActivity.java.


The documentation for this class was generated from the following file: