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 onRequestPermissionsResult (int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
 
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)
 
boolean OnExperimentalFeature (int feature)
 
void OnRemoteClipboardChanged (String data)
 
void OnRemoteClipboardImageChanged (byte[] data)
 
void OnPointerSet (int[] pixels, int width, int height, int hotX, int hotY)
 
void OnPointerSetNull ()
 
void OnPointerSetDefault ()
 
void OnRailWindowUpdate (long windowId, int width, int height, int[] pixels)
 
void OnRailWindowMove (long windowId, int x, int y, int w, int h)
 
void OnRailWindowHide (long windowId)
 
void OnRailWindowDestroy (long windowId)
 
void OnRailSessionEnd ()
 
void OnRailMonitoredDesktop (long[] windowIds, long activeWindowId)
 
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 61 of file SessionActivity.java.

Member Function Documentation

◆ handleBackPressed()

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

Definition at line 668 of file SessionActivity.java.

669 {
670 // hide keyboards (if any visible) or send alt+f4 to the session
671 if (inputManager != null)
672 {
673 if (inputManager.handleKeyboardBack())
674 return;
675 if (inputManager.handleBackAsAltF4())
676 return;
677 }
678 if (System.currentTimeMillis() - backPressedTime < 2000)
679 {
680 connectCancelledByUser = true;
681 LibFreeRDP.disconnect(session.getInstance());
682 }
683 else
684 {
685 backPressedTime = System.currentTimeMillis();
686 Toast.makeText(this, R.string.session_double_back_to_exit, Toast.LENGTH_SHORT).show();
687 }
688 }

◆ OnAuthenticate()

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

Definition at line 798 of file SessionActivity.java.

800 {
801 return dialogs.promptCredentials(username, domain, password);
802 }
boolean promptCredentials(StringBuilder username, StringBuilder domain, StringBuilder password)

◆ onClipboardChanged()

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

Definition at line 933 of file SessionActivity.java.

934 {
935 Log.v(TAG, "onClipboardChanged: " + data);
936 if (session != null)
937 LibFreeRDP.sendClipboardData(session.getInstance(), data);
938 }

◆ onClipboardImageChanged()

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

Definition at line 940 of file SessionActivity.java.

941 {
942 if (session != null && data != null)
943 LibFreeRDP.sendClipboardImageData(session.getInstance(), data, mimeType);
944 }

◆ onConfigurationChanged()

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

Definition at line 391 of file SessionActivity.java.

392 {
393 super.onConfigurationChanged(newConfig);
394
395 hideSystemBars();
396
397 // screen_width/screen_height will be updated by the next onGlobalLayout callback;
398 if (session != null && session.getBookmark() != null &&
399 session.getBookmark().getActiveScreenSettings().isFitScreen())
400 {
401 scrollView.post(() -> {
402 if (screen_width > 0 && screen_height > 0)
403 LibFreeRDP.sendMonitorLayout(session.getInstance(), screen_width,
404 screen_height);
405 });
406 }
407 }

◆ onCreate()

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

Definition at line 225 of file SessionActivity.java.

226 {
227 super.onCreate(savedInstanceState);
228
229 hideSystemBars();
230
231 this.setContentView(R.layout.session);
232
233 Log.v(TAG, "Session.onCreate");
234
235 // ATTENTION: We use the onGlobalLayout notification to start our
236 // session.
237 // This is because only then we can know the exact size of our session
238 // when using fit screen
239 // accounting for any status bars etc. that Android might throws on us.
240 // A bit weird looking
241 // but this is the only way ...
242 final View activityRootView = findViewById(R.id.session_root_view);
243 activityRootView.setFitsSystemWindows(false);
244 ViewCompat.setOnApplyWindowInsetsListener(activityRootView,
245 (v, insets) -> onWindowInsetsChanged(v, insets));
246 activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(
247 new OnGlobalLayoutListener() {
248 @Override public void onGlobalLayout()
249 {
250 screen_width = scrollView.getWidth() - scrollView.getPaddingLeft() -
251 scrollView.getPaddingRight();
252 screen_height = scrollView.getHeight() - scrollView.getPaddingTop() -
253 scrollView.getPaddingBottom();
254
255 // start session
256 if (!sessionRunning && getIntent() != null)
257 {
258 processIntent(getIntent());
259 sessionRunning = true;
260 }
261 }
262 });
263
264 sessionView = findViewById(R.id.sessionView);
265 sessionView.requestFocus();
266
267 touchPointerView = findViewById(R.id.touchPointerView);
268
269 floatingToolbar = new FloatingToolbar(this, new FloatingToolbar.Listener() {
270 @Override public void onToggleTouchPointer()
271 {
272 if (inputManager != null)
273 inputManager.toggleTouchPointer();
274 }
275 @Override public void onToggleKeyboard()
276 {
277 if (inputManager != null)
278 inputManager.toggleKeyboard();
279 }
280 });
281
282 ExtendedKeyboardView keyboard = findViewById(R.id.extended_keyboard);
283
284 scrollView = findViewById(R.id.sessionScrollView);
285 scrollView.setScrollViewListener(null);
286 railManager = new RailWindowManager(this, findViewById(R.id.railContainer), sessionView);
287 sessionViewModel = new ViewModelProvider(this).get(SessionViewModel.class);
288 sessionViewModel.getState().observe(this, this::onConnectionStateChanged);
289
290 dialogs = new SessionDialogs(this, new SessionDialogs.OnUserCancelListener() {
291 @Override public void onUserCancel()
292 {
293 connectCancelledByUser = true;
294 }
295 });
296
297 // Wire up the input manager (instance is attached later in bindSession()).
298 inputManager =
299 new SessionInputManager(this, scrollView, sessionView, touchPointerView, keyboard);
300 sessionView.setSessionViewListener(inputManager);
301 touchPointerView.setTouchPointerListener(inputManager);
302 sessionView.setScaleGestureDetector(
303 new ScaleGestureDetector(this, inputManager.getPinchZoomListener()));
304
305 mClipboardManager = ClipboardManagerProxy.getClipboardManager(this);
306 mClipboardManager.addClipboardChangedListener(this);
307
308 getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
309 @Override public void handleOnBackPressed()
310 {
311 handleBackPressed();
312 }
313 });
314
315 hideSystemBars();
316 }

◆ onDestroy()

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

Definition at line 363 of file SessionActivity.java.

364 {
365 if (connectThread != null)
366 {
367 connectThread.interrupt();
368 }
369 super.onDestroy();
370 Log.v(TAG, "Session.onDestroy");
371
372 // Cancel running disconnect timers.
373 GlobalApp.cancelDisconnectTimer();
374
375 // Disconnect only this activity's session.
376 if (session != null)
377 LibFreeRDP.disconnect(session.getInstance());
378
379 // unregister freerdp session listener
380 sessionViewModel.unregister();
381
382 // remove clipboard listener
383 mClipboardManager.removeClipboardboardChangedListener(this);
384
385 // free session
386 GlobalApp.freeSession(session.getInstance());
387
388 session = null;
389 }

◆ OnExperimentalFeature()

boolean com.freerdp.freerdpcore.presentation.SessionActivity.OnExperimentalFeature ( int  feature)
inline

Definition at line 831 of file SessionActivity.java.

832 {
833 final String featureKey;
834 final String displayName;
835 switch (feature)
836 {
837 case LibFreeRDP.EXPERIMENTAL_REMOTEAPP:
838 featureKey = "remoteapp";
839 displayName = getString(R.string.experimental_feature_remoteapp);
840 break;
841 case LibFreeRDP.EXPERIMENTAL_CAMERA:
842 featureKey = "camera";
843 displayName = getString(R.string.experimental_feature_camera);
844 break;
845 default:
846 return true;
847 }
848 if (ApplicationSettingsActivity.isExperimentalEnabled(this, featureKey))
849 return true;
850 // suppress the generic failure toast; the dialog explains the abort
851 connectCancelledByUser = true;
852 dialogs.showExperimentalBlocked(displayName);
853 return false;
854 }

◆ OnGatewayAuthenticate()

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

Definition at line 805 of file SessionActivity.java.

807 {
808 return dialogs.promptCredentials(username, domain, password);
809 }

◆ onGenericMotionEvent()

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

Definition at line 925 of file SessionActivity.java.

926 {
927 super.onGenericMotionEvent(e);
928 return inputManager != null && inputManager.onGenericMotionEvent(e);
929 }

◆ OnGraphicsResize()

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

Definition at line 778 of file SessionActivity.java.

779 {
780 // replace bitmap
781 if (bpp > 16)
782 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
783 else
784 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
785 session.setSurface(new BitmapDrawable(getResources(), bitmap));
786
787 if (inputManager != null)
788 inputManager.setBitmap(bitmap);
789
790 /*
791 * since sessionView can only be modified from the UI thread any
792 * modifications to it need to be scheduled
793 */
794 uiHandler.sendEmptyMessage(GRAPHICS_CHANGED);
795 }

◆ OnGraphicsUpdate()

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

Definition at line 764 of file SessionActivity.java.

765 {
766 LibFreeRDP.updateGraphics(session.getInstance(), bitmap, x, y, width, height);
767
768 sessionView.addInvalidRegion(new Rect(x, y, x + width, y + height));
769
770 /*
771 * since sessionView can only be modified from the UI thread any
772 * modifications to it need to be scheduled
773 */
774
775 uiHandler.sendEmptyMessage(REFRESH_SESSIONVIEW);
776 }

◆ onKeyDown()

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

Definition at line 708 of file SessionActivity.java.

709 {
710 if (keycode == KeyEvent.KEYCODE_BACK)
711 return super.onKeyDown(keycode, event);
712 return inputManager.onAndroidKeyEvent(event);
713 }

◆ onKeyLongPress()

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

Definition at line 690 of file SessionActivity.java.

691 {
692 if (inputManager.onAndroidKeyLongPress(keyCode))
693 return true;
694 return super.onKeyLongPress(keyCode, event);
695 }

◆ onKeyMultiple()

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

Definition at line 724 of file SessionActivity.java.

725 {
726 return inputManager.onAndroidKeyEvent(event);
727 }

◆ onKeyUp()

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

Definition at line 715 of file SessionActivity.java.

716 {
717 if (keycode == KeyEvent.KEYCODE_BACK)
718 return super.onKeyUp(keycode, event);
719 return inputManager.onAndroidKeyEvent(event);
720 }

◆ onPause()

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

Definition at line 347 of file SessionActivity.java.

348 {
349 super.onPause();
350 Log.v(TAG, "Session.onPause");
351 if (activeSession == this)
352 activeSession = null;
353 // hide any visible keyboards
354 inputManager.hideKeyboards();
355 }

◆ OnPointerSet()

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

Definition at line 868 of file SessionActivity.java.

869 {
870 Bundle data = new Bundle();
871 data.putIntArray("pixels", pixels);
872 data.putInt("width", width);
873 data.putInt("height", height);
874 data.putInt("hotX", hotX);
875 data.putInt("hotY", hotY);
876 Message msg = uiHandler.obtainMessage(POINTER_SET);
877 msg.setData(data);
878 uiHandler.sendMessage(msg);
879 }

◆ OnPointerSetDefault()

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

Definition at line 886 of file SessionActivity.java.

887 {
888 sessionView.setDefaultCursor();
889 }

◆ OnPointerSetNull()

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

Definition at line 881 of file SessionActivity.java.

882 {
883 uiHandler.sendEmptyMessage(POINTER_SET);
884 }

◆ OnRailMonitoredDesktop()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnRailMonitoredDesktop ( long[]  windowIds,
long  activeWindowId 
)
inline

Definition at line 916 of file SessionActivity.java.

917 {
918 railManager.onMonitoredDesktop(windowIds, activeWindowId);
919 }

◆ OnRailSessionEnd()

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

Definition at line 911 of file SessionActivity.java.

912 {
913 railManager.onSessionEnd();
914 }

◆ OnRailWindowDestroy()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnRailWindowDestroy ( long  windowId)
inline

Definition at line 906 of file SessionActivity.java.

907 {
908 railManager.onWindowDestroy(windowId);
909 }

◆ OnRailWindowHide()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnRailWindowHide ( long  windowId)
inline

Definition at line 901 of file SessionActivity.java.

902 {
903 railManager.onWindowHide(windowId);
904 }

◆ OnRailWindowMove()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnRailWindowMove ( long  windowId,
int  x,
int  y,
int  w,
int  h 
)
inline

Definition at line 896 of file SessionActivity.java.

897 {
898 railManager.onWindowMove(windowId, x, y, w, h);
899 }

◆ OnRailWindowUpdate()

void com.freerdp.freerdpcore.presentation.SessionActivity.OnRailWindowUpdate ( long  windowId,
int  width,
int  height,
int[]  pixels 
)
inline

Definition at line 891 of file SessionActivity.java.

892 {
893 railManager.onWindowUpdate(windowId, width, height, pixels);
894 }

◆ OnRemoteClipboardChanged()

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

Definition at line 856 of file SessionActivity.java.

857 {
858 Log.v(TAG, "OnRemoteClipboardChanged: " + data);
859 mClipboardManager.setClipboardData(data);
860 }

◆ OnRemoteClipboardImageChanged()

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

Definition at line 862 of file SessionActivity.java.

863 {
864 Log.v(TAG, "OnRemoteClipboardImageChanged: " + data.length + " bytes");
865 mClipboardManager.setClipboardImage(data);
866 }

◆ onRequestPermissionsResult()

void com.freerdp.freerdpcore.presentation.SessionActivity.onRequestPermissionsResult ( int  requestCode,
@NonNull String[]  permissions,
@NonNull int[]  grantResults 
)
inline

Definition at line 590 of file SessionActivity.java.

592 {
593 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
594 if (requestCode == REQUEST_MEDIA_PERMISSIONS && pendingConnectBookmark != null)
595 {
596 BookmarkBase bookmark = pendingConnectBookmark;
597 pendingConnectBookmark = null;
598 connectWithTitle(bookmark.getLabel());
599 }
600 }

◆ onRestart()

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

Definition at line 334 of file SessionActivity.java.

335 {
336 super.onRestart();
337 Log.v(TAG, "Session.onRestart");
338 }

◆ onResume()

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

Definition at line 340 of file SessionActivity.java.

341 {
342 super.onResume();
343 Log.v(TAG, "Session.onResume");
344 activeSession = this;
345 }

◆ OnSettingsChanged()

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

Definition at line 734 of file SessionActivity.java.

735 {
736
737 if (bpp > 16)
738 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
739 else
740 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
741
742 session.setSurface(new BitmapDrawable(getResources(), bitmap));
743
744 if (inputManager != null)
745 inputManager.setBitmap(bitmap);
746
747 if (session.getBookmark() == null)
748 {
749 // Return immediately if we launch from URI
750 return;
751 }
752 // check this settings and initial settings - if they are not equal the
753 // server doesn't support our settings
754 // FIXME: the additional check (settings.getWidth() != width + 1) is for
755 // the RDVH bug fix to avoid accidental notifications
756 // (refer to android_freerdp.c for more info on this problem)
757 BookmarkBase.ScreenSettings settings = session.getBookmark().getActiveScreenSettings();
758 if ((settings.getWidth() != width && settings.getWidth() != width + 1) ||
759 settings.getHeight() != height || settings.getColors() != bpp)
760 uiHandler.sendMessage(Message.obtain(
761 null, DISPLAY_TOAST, getResources().getText(R.string.info_capabilities_changed)));
762 }

◆ onStart()

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

Definition at line 328 of file SessionActivity.java.

329 {
330 super.onStart();
331 Log.v(TAG, "Session.onStart");
332 }

◆ onStop()

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

Definition at line 357 of file SessionActivity.java.

358 {
359 super.onStop();
360 Log.v(TAG, "Session.onStop");
361 }

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

814 {
815 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
816 return 0;
817 return dialogs.verifyCertificate(host, port, subject, issuer, fingerprint, flags);
818 }
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 821 of file SessionActivity.java.

825 {
826 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
827 return 0;
828 return dialogs.verifyChangedCertificate(host, port, subject, issuer, fingerprint, flags);
829 }
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 318 of file SessionActivity.java.

319 {
320 super.onWindowFocusChanged(hasFocus);
321 if (hasFocus)
322 {
323 hideSystemBars();
324 mClipboardManager.getPrimaryClipManually();
325 }
326 }

Field Documentation

◆ PARAM_CONNECTION_REFERENCE

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

Definition at line 64 of file SessionActivity.java.

◆ PARAM_INSTANCE

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

Definition at line 65 of file SessionActivity.java.


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