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)
 
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)
 
void OnRemoteClipboardImageChanged (byte[] data)
 
void OnPointerSet (int[] pixels, int width, int height, int hotX, int hotY)
 
void OnPointerSetNull ()
 
void OnPointerSetDefault ()
 
boolean onGenericMotionEvent (MotionEvent e)
 
void onClipboardChanged (String data)
 
void onClipboardImageChanged (byte[] data, String mimeType)
 

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 59 of file SessionActivity.java.

Member Function Documentation

◆ handleBackPressed()

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

Definition at line 590 of file SessionActivity.java.

591 {
592 // hide keyboards (if any visible) or send alt+f4 to the session
593 if (inputManager.isAnyKeyboardVisible())
594 {
595 inputManager.hideKeyboards();
596 return;
597 }
598 if (inputManager.handleBackAsAltF4())
599 {
600 return;
601 }
602 if (System.currentTimeMillis() - backPressedTime < 2000)
603 {
604 connectCancelledByUser = true;
605 LibFreeRDP.disconnect(session.getInstance());
606 }
607 else
608 {
609 backPressedTime = System.currentTimeMillis();
610 Toast.makeText(this, R.string.session_double_back_to_exit, Toast.LENGTH_SHORT).show();
611 }
612 }

◆ OnAuthenticate()

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

Definition at line 722 of file SessionActivity.java.

724 {
725 return dialogs.promptCredentials(username, domain, password);
726 }
boolean promptCredentials(StringBuilder username, StringBuilder domain, StringBuilder password)

◆ onClipboardChanged()

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

Definition at line 802 of file SessionActivity.java.

803 {
804 Log.v(TAG, "onClipboardChanged: " + data);
805 if (session != null)
806 LibFreeRDP.sendClipboardData(session.getInstance(), data);
807 }

◆ onClipboardImageChanged()

void com.freerdp.freerdpcore.presentation.SessionActivity.onClipboardImageChanged ( byte[]  data,
String  mimeType 
)
inline

Definition at line 809 of file SessionActivity.java.

810 {
811 if (session != null && data != null)
812 LibFreeRDP.sendClipboardImageData(session.getInstance(), data, mimeType);
813 }

◆ onConfigurationChanged()

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

Definition at line 370 of file SessionActivity.java.

371 {
372 super.onConfigurationChanged(newConfig);
373
374 // reload keyboard resources (changed from landscape)
375 inputManager.reloadKeyboards();
376
377 hideSystemBars();
378
379 // screen_width/screen_height will be updated by the next onGlobalLayout callback;
380 if (session != null && session.getBookmark() != null &&
381 session.getBookmark().getActiveScreenSettings().isFitScreen())
382 {
383 scrollView.post(() -> {
384 if (screen_width > 0 && screen_height > 0)
385 LibFreeRDP.sendMonitorLayout(session.getInstance(), screen_width,
386 screen_height);
387 });
388 }
389 }

◆ onCreate()

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

Definition at line 200 of file SessionActivity.java.

201 {
202 super.onCreate(savedInstanceState);
203
204 hideSystemBars();
205
206 this.setContentView(R.layout.session);
207
208 Log.v(TAG, "Session.onCreate");
209
210 // ATTENTION: We use the onGlobalLayout notification to start our
211 // session.
212 // This is because only then we can know the exact size of our session
213 // when using fit screen
214 // accounting for any status bars etc. that Android might throws on us.
215 // A bit weird looking
216 // but this is the only way ...
217 final View activityRootView = findViewById(R.id.session_root_view);
218 activityRootView.setFitsSystemWindows(false);
219 ViewCompat.setOnApplyWindowInsetsListener(activityRootView,
220 (v, insets) -> onWindowInsetsChanged(v, insets));
221 activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(
222 new OnGlobalLayoutListener() {
223 @Override public void onGlobalLayout()
224 {
225 screen_width = scrollView.getWidth() - scrollView.getPaddingLeft() -
226 scrollView.getPaddingRight();
227 screen_height = scrollView.getHeight() - scrollView.getPaddingTop() -
228 scrollView.getPaddingBottom();
229
230 // start session
231 if (!sessionRunning && getIntent() != null)
232 {
233 processIntent(getIntent());
234 sessionRunning = true;
235 }
236 }
237 });
238
239 sessionView = findViewById(R.id.sessionView);
240 sessionView.requestFocus();
241
242 touchPointerView = findViewById(R.id.touchPointerView);
243
244 floatingToolbar = new FloatingToolbar(this, new FloatingToolbar.Listener() {
245 @Override public void onToggleTouchPointer()
246 {
247 if (inputManager != null)
248 inputManager.toggleTouchPointer();
249 }
250 @Override public void onToggleSysKeyboard()
251 {
252 if (inputManager != null)
253 inputManager.toggleSystemKeyboard();
254 }
255 @Override public void onToggleExtKeyboard()
256 {
257 if (inputManager != null)
258 inputManager.toggleExtendedKeyboard();
259 }
260 });
261
262 KeyboardView keyboardView = findViewById(R.id.extended_keyboard);
263 KeyboardView modifiersKeyboardView = findViewById(R.id.extended_keyboard_header);
264
265 scrollView = findViewById(R.id.sessionScrollView);
266 sessionViewModel = new ViewModelProvider(this).get(SessionViewModel.class);
267 sessionViewModel.getState().observe(this, this::onConnectionStateChanged);
268
269 dialogs = new SessionDialogs(this, new SessionDialogs.OnUserCancelListener() {
270 @Override public void onUserCancel()
271 {
272 connectCancelledByUser = true;
273 }
274 });
275
276 // Wire up the input manager (instance is attached later in bindSession()).
277 inputManager = new SessionInputManager(this, scrollView, sessionView, touchPointerView,
278 keyboardView, modifiersKeyboardView);
279 sessionView.setSessionViewListener(inputManager);
280 touchPointerView.setTouchPointerListener(inputManager);
281 sessionView.setScaleGestureDetector(
282 new ScaleGestureDetector(this, inputManager.getPinchZoomListener()));
283
284 mClipboardManager = ClipboardManagerProxy.getClipboardManager(this);
285 mClipboardManager.addClipboardChangedListener(this);
286
287 getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
288 @Override public void handleOnBackPressed()
289 {
290 handleBackPressed();
291 }
292 });
293
294 hideSystemBars();
295 }

◆ onDestroy()

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

Definition at line 342 of file SessionActivity.java.

343 {
344 if (connectThread != null)
345 {
346 connectThread.interrupt();
347 }
348 super.onDestroy();
349 Log.v(TAG, "Session.onDestroy");
350
351 // Cancel running disconnect timers.
352 GlobalApp.cancelDisconnectTimer();
353
354 // Disconnect only this activity's session.
355 if (session != null)
356 LibFreeRDP.disconnect(session.getInstance());
357
358 // unregister freerdp session listener
359 sessionViewModel.unregister();
360
361 // remove clipboard listener
362 mClipboardManager.removeClipboardboardChangedListener(this);
363
364 // free session
365 GlobalApp.freeSession(session.getInstance());
366
367 session = null;
368 }

◆ OnGatewayAuthenticate()

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

Definition at line 729 of file SessionActivity.java.

731 {
732 return dialogs.promptCredentials(username, domain, password);
733 }

◆ onGenericMotionEvent()

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

Definition at line 794 of file SessionActivity.java.

795 {
796 super.onGenericMotionEvent(e);
797 return inputManager != null && inputManager.onGenericMotionEvent(e);
798 }

◆ OnGraphicsResize()

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

Definition at line 702 of file SessionActivity.java.

703 {
704 // replace bitmap
705 if (bpp > 16)
706 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
707 else
708 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
709 session.setSurface(new BitmapDrawable(getResources(), bitmap));
710
711 if (inputManager != null)
712 inputManager.setBitmap(bitmap);
713
714 /*
715 * since sessionView can only be modified from the UI thread any
716 * modifications to it need to be scheduled
717 */
718 uiHandler.sendEmptyMessage(GRAPHICS_CHANGED);
719 }

◆ OnGraphicsUpdate()

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

Definition at line 688 of file SessionActivity.java.

689 {
690 LibFreeRDP.updateGraphics(session.getInstance(), bitmap, x, y, width, height);
691
692 sessionView.addInvalidRegion(new Rect(x, y, x + width, y + height));
693
694 /*
695 * since sessionView can only be modified from the UI thread any
696 * modifications to it need to be scheduled
697 */
698
699 uiHandler.sendEmptyMessage(REFRESH_SESSIONVIEW);
700 }

◆ onKeyDown()

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

Definition at line 632 of file SessionActivity.java.

633 {
634 if (keycode == KeyEvent.KEYCODE_BACK)
635 return super.onKeyDown(keycode, event);
636 return inputManager.onAndroidKeyEvent(event);
637 }

◆ onKeyLongPress()

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

Definition at line 614 of file SessionActivity.java.

615 {
616 if (inputManager.onAndroidKeyLongPress(keyCode))
617 return true;
618 return super.onKeyLongPress(keyCode, event);
619 }

◆ onKeyMultiple()

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

Definition at line 648 of file SessionActivity.java.

649 {
650 return inputManager.onAndroidKeyEvent(event);
651 }

◆ onKeyUp()

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

Definition at line 639 of file SessionActivity.java.

640 {
641 if (keycode == KeyEvent.KEYCODE_BACK)
642 return super.onKeyUp(keycode, event);
643 return inputManager.onAndroidKeyEvent(event);
644 }

◆ onPause()

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

Definition at line 326 of file SessionActivity.java.

327 {
328 super.onPause();
329 Log.v(TAG, "Session.onPause");
330 if (activeSession == this)
331 activeSession = null;
332 // hide any visible keyboards
333 inputManager.hideKeyboards();
334 }

◆ OnPointerSet()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnPointerSet ( int[]  pixels,
int  width,
int  height,
int  hotX,
int  hotY 
)
inline

Definition at line 767 of file SessionActivity.java.

768 {
769 Bundle data = new Bundle();
770 data.putIntArray("pixels", pixels);
771 data.putInt("width", width);
772 data.putInt("height", height);
773 data.putInt("hotX", hotX);
774 data.putInt("hotY", hotY);
775 Message msg = uiHandler.obtainMessage(POINTER_SET);
776 msg.setData(data);
777 uiHandler.sendMessage(msg);
778 }

◆ OnPointerSetDefault()

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

Definition at line 785 of file SessionActivity.java.

786 {
787 sessionView.setDefaultCursor();
788 }

◆ OnPointerSetNull()

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

Definition at line 780 of file SessionActivity.java.

781 {
782 uiHandler.sendEmptyMessage(POINTER_SET);
783 }

◆ OnRemoteClipboardChanged()

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

Definition at line 755 of file SessionActivity.java.

756 {
757 Log.v(TAG, "OnRemoteClipboardChanged: " + data);
758 mClipboardManager.setClipboardData(data);
759 }

◆ OnRemoteClipboardImageChanged()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnRemoteClipboardImageChanged ( byte[]  data)
inline

Definition at line 761 of file SessionActivity.java.

762 {
763 Log.v(TAG, "OnRemoteClipboardImageChanged: " + data.length + " bytes");
764 mClipboardManager.setClipboardImage(data);
765 }

◆ onRestart()

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

Definition at line 313 of file SessionActivity.java.

314 {
315 super.onRestart();
316 Log.v(TAG, "Session.onRestart");
317 }

◆ onResume()

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

Definition at line 319 of file SessionActivity.java.

320 {
321 super.onResume();
322 Log.v(TAG, "Session.onResume");
323 activeSession = this;
324 }

◆ OnSettingsChanged()

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

Definition at line 658 of file SessionActivity.java.

659 {
660
661 if (bpp > 16)
662 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
663 else
664 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
665
666 session.setSurface(new BitmapDrawable(getResources(), bitmap));
667
668 if (inputManager != null)
669 inputManager.setBitmap(bitmap);
670
671 if (session.getBookmark() == null)
672 {
673 // Return immediately if we launch from URI
674 return;
675 }
676 // check this settings and initial settings - if they are not equal the
677 // server doesn't support our settings
678 // FIXME: the additional check (settings.getWidth() != width + 1) is for
679 // the RDVH bug fix to avoid accidental notifications
680 // (refer to android_freerdp.c for more info on this problem)
681 BookmarkBase.ScreenSettings settings = session.getBookmark().getActiveScreenSettings();
682 if ((settings.getWidth() != width && settings.getWidth() != width + 1) ||
683 settings.getHeight() != height || settings.getColors() != bpp)
684 uiHandler.sendMessage(Message.obtain(
685 null, DISPLAY_TOAST, getResources().getText(R.string.info_capabilities_changed)));
686 }

◆ onStart()

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

Definition at line 307 of file SessionActivity.java.

308 {
309 super.onStart();
310 Log.v(TAG, "Session.onStart");
311 }

◆ onStop()

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

Definition at line 336 of file SessionActivity.java.

337 {
338 super.onStop();
339 Log.v(TAG, "Session.onStop");
340 }

◆ 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 736 of file SessionActivity.java.

738 {
739 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
740 return 0;
741 return dialogs.verifyCertificate(host, port, subject, issuer, fingerprint, flags);
742 }
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 745 of file SessionActivity.java.

749 {
750 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
751 return 0;
752 return dialogs.verifyChangedCertificate(host, port, subject, issuer, fingerprint, flags);
753 }
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 297 of file SessionActivity.java.

298 {
299 super.onWindowFocusChanged(hasFocus);
300 if (hasFocus)
301 {
302 hideSystemBars();
303 mClipboardManager.getPrimaryClipManually();
304 }
305 }

Field Documentation

◆ PARAM_CONNECTION_REFERENCE

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

Definition at line 62 of file SessionActivity.java.

◆ PARAM_INSTANCE

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

Definition at line 63 of file SessionActivity.java.


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