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

633 {
634 // hide keyboards (if any visible) or send alt+f4 to the session
635 if (inputManager.isAnyKeyboardVisible())
636 {
637 inputManager.hideKeyboards();
638 return;
639 }
640 if (inputManager.handleBackAsAltF4())
641 {
642 return;
643 }
644 if (System.currentTimeMillis() - backPressedTime < 2000)
645 {
646 connectCancelledByUser = true;
647 LibFreeRDP.disconnect(session.getInstance());
648 }
649 else
650 {
651 backPressedTime = System.currentTimeMillis();
652 Toast.makeText(this, R.string.session_double_back_to_exit, Toast.LENGTH_SHORT).show();
653 }
654 }

◆ OnAuthenticate()

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

Definition at line 764 of file SessionActivity.java.

766 {
767 return dialogs.promptCredentials(username, domain, password);
768 }
boolean promptCredentials(StringBuilder username, StringBuilder domain, StringBuilder password)

◆ onClipboardChanged()

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

Definition at line 899 of file SessionActivity.java.

900 {
901 Log.v(TAG, "onClipboardChanged: " + data);
902 if (session != null)
903 LibFreeRDP.sendClipboardData(session.getInstance(), data);
904 }

◆ onClipboardImageChanged()

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

Definition at line 906 of file SessionActivity.java.

907 {
908 if (session != null && data != null)
909 LibFreeRDP.sendClipboardImageData(session.getInstance(), data, mimeType);
910 }

◆ onConfigurationChanged()

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

Definition at line 382 of file SessionActivity.java.

383 {
384 super.onConfigurationChanged(newConfig);
385
386 // reload keyboard resources (changed from landscape)
387 inputManager.reloadKeyboards();
388
389 hideSystemBars();
390
391 // screen_width/screen_height will be updated by the next onGlobalLayout callback;
392 if (session != null && session.getBookmark() != null &&
393 session.getBookmark().getActiveScreenSettings().isFitScreen())
394 {
395 scrollView.post(() -> {
396 if (screen_width > 0 && screen_height > 0)
397 LibFreeRDP.sendMonitorLayout(session.getInstance(), screen_width,
398 screen_height);
399 });
400 }
401 }

◆ onCreate()

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

Definition at line 210 of file SessionActivity.java.

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

◆ onDestroy()

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

Definition at line 354 of file SessionActivity.java.

355 {
356 if (connectThread != null)
357 {
358 connectThread.interrupt();
359 }
360 super.onDestroy();
361 Log.v(TAG, "Session.onDestroy");
362
363 // Cancel running disconnect timers.
364 GlobalApp.cancelDisconnectTimer();
365
366 // Disconnect only this activity's session.
367 if (session != null)
368 LibFreeRDP.disconnect(session.getInstance());
369
370 // unregister freerdp session listener
371 sessionViewModel.unregister();
372
373 // remove clipboard listener
374 mClipboardManager.removeClipboardboardChangedListener(this);
375
376 // free session
377 GlobalApp.freeSession(session.getInstance());
378
379 session = null;
380 }

◆ OnExperimentalFeature()

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

Definition at line 797 of file SessionActivity.java.

798 {
799 final String featureKey;
800 final String displayName;
801 switch (feature)
802 {
803 case LibFreeRDP.EXPERIMENTAL_REMOTEAPP:
804 featureKey = "remoteapp";
805 displayName = getString(R.string.experimental_feature_remoteapp);
806 break;
807 case LibFreeRDP.EXPERIMENTAL_CAMERA:
808 featureKey = "camera";
809 displayName = getString(R.string.experimental_feature_camera);
810 break;
811 default:
812 return true;
813 }
814 if (ApplicationSettingsActivity.isExperimentalEnabled(this, featureKey))
815 return true;
816 // suppress the generic failure toast; the dialog explains the abort
817 connectCancelledByUser = true;
818 dialogs.showExperimentalBlocked(displayName);
819 return false;
820 }

◆ OnGatewayAuthenticate()

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

Definition at line 771 of file SessionActivity.java.

773 {
774 return dialogs.promptCredentials(username, domain, password);
775 }

◆ onGenericMotionEvent()

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

Definition at line 891 of file SessionActivity.java.

892 {
893 super.onGenericMotionEvent(e);
894 return inputManager != null && inputManager.onGenericMotionEvent(e);
895 }

◆ OnGraphicsResize()

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

Definition at line 744 of file SessionActivity.java.

745 {
746 // replace bitmap
747 if (bpp > 16)
748 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
749 else
750 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
751 session.setSurface(new BitmapDrawable(getResources(), bitmap));
752
753 if (inputManager != null)
754 inputManager.setBitmap(bitmap);
755
756 /*
757 * since sessionView can only be modified from the UI thread any
758 * modifications to it need to be scheduled
759 */
760 uiHandler.sendEmptyMessage(GRAPHICS_CHANGED);
761 }

◆ OnGraphicsUpdate()

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

Definition at line 730 of file SessionActivity.java.

731 {
732 LibFreeRDP.updateGraphics(session.getInstance(), bitmap, x, y, width, height);
733
734 sessionView.addInvalidRegion(new Rect(x, y, x + width, y + height));
735
736 /*
737 * since sessionView can only be modified from the UI thread any
738 * modifications to it need to be scheduled
739 */
740
741 uiHandler.sendEmptyMessage(REFRESH_SESSIONVIEW);
742 }

◆ onKeyDown()

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

Definition at line 674 of file SessionActivity.java.

675 {
676 if (keycode == KeyEvent.KEYCODE_BACK)
677 return super.onKeyDown(keycode, event);
678 return inputManager.onAndroidKeyEvent(event);
679 }

◆ onKeyLongPress()

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

Definition at line 656 of file SessionActivity.java.

657 {
658 if (inputManager.onAndroidKeyLongPress(keyCode))
659 return true;
660 return super.onKeyLongPress(keyCode, event);
661 }

◆ onKeyMultiple()

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

Definition at line 690 of file SessionActivity.java.

691 {
692 return inputManager.onAndroidKeyEvent(event);
693 }

◆ onKeyUp()

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

Definition at line 681 of file SessionActivity.java.

682 {
683 if (keycode == KeyEvent.KEYCODE_BACK)
684 return super.onKeyUp(keycode, event);
685 return inputManager.onAndroidKeyEvent(event);
686 }

◆ onPause()

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

Definition at line 338 of file SessionActivity.java.

339 {
340 super.onPause();
341 Log.v(TAG, "Session.onPause");
342 if (activeSession == this)
343 activeSession = null;
344 // hide any visible keyboards
345 inputManager.hideKeyboards();
346 }

◆ OnPointerSet()

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

Definition at line 834 of file SessionActivity.java.

835 {
836 Bundle data = new Bundle();
837 data.putIntArray("pixels", pixels);
838 data.putInt("width", width);
839 data.putInt("height", height);
840 data.putInt("hotX", hotX);
841 data.putInt("hotY", hotY);
842 Message msg = uiHandler.obtainMessage(POINTER_SET);
843 msg.setData(data);
844 uiHandler.sendMessage(msg);
845 }

◆ OnPointerSetDefault()

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

Definition at line 852 of file SessionActivity.java.

853 {
854 sessionView.setDefaultCursor();
855 }

◆ OnPointerSetNull()

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

Definition at line 847 of file SessionActivity.java.

848 {
849 uiHandler.sendEmptyMessage(POINTER_SET);
850 }

◆ OnRailMonitoredDesktop()

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

Definition at line 882 of file SessionActivity.java.

883 {
884 railManager.onMonitoredDesktop(windowIds, activeWindowId);
885 }

◆ OnRailSessionEnd()

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

Definition at line 877 of file SessionActivity.java.

878 {
879 railManager.onSessionEnd();
880 }

◆ OnRailWindowDestroy()

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

Definition at line 872 of file SessionActivity.java.

873 {
874 railManager.onWindowDestroy(windowId);
875 }

◆ OnRailWindowHide()

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

Definition at line 867 of file SessionActivity.java.

868 {
869 railManager.onWindowHide(windowId);
870 }

◆ OnRailWindowMove()

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

Definition at line 862 of file SessionActivity.java.

863 {
864 railManager.onWindowMove(windowId, x, y, w, h);
865 }

◆ OnRailWindowUpdate()

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

Definition at line 857 of file SessionActivity.java.

858 {
859 railManager.onWindowUpdate(windowId, width, height, pixels);
860 }

◆ OnRemoteClipboardChanged()

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

Definition at line 822 of file SessionActivity.java.

823 {
824 Log.v(TAG, "OnRemoteClipboardChanged: " + data);
825 mClipboardManager.setClipboardData(data);
826 }

◆ OnRemoteClipboardImageChanged()

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

Definition at line 828 of file SessionActivity.java.

829 {
830 Log.v(TAG, "OnRemoteClipboardImageChanged: " + data.length + " bytes");
831 mClipboardManager.setClipboardImage(data);
832 }

◆ onRequestPermissionsResult()

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

Definition at line 554 of file SessionActivity.java.

556 {
557 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
558 if (requestCode == REQUEST_MEDIA_PERMISSIONS && pendingConnectBookmark != null)
559 {
560 BookmarkBase bookmark = pendingConnectBookmark;
561 pendingConnectBookmark = null;
562 connectWithTitle(bookmark.getLabel());
563 }
564 }

◆ onRestart()

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

Definition at line 325 of file SessionActivity.java.

326 {
327 super.onRestart();
328 Log.v(TAG, "Session.onRestart");
329 }

◆ onResume()

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

Definition at line 331 of file SessionActivity.java.

332 {
333 super.onResume();
334 Log.v(TAG, "Session.onResume");
335 activeSession = this;
336 }

◆ OnSettingsChanged()

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

Definition at line 700 of file SessionActivity.java.

701 {
702
703 if (bpp > 16)
704 bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
705 else
706 bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
707
708 session.setSurface(new BitmapDrawable(getResources(), bitmap));
709
710 if (inputManager != null)
711 inputManager.setBitmap(bitmap);
712
713 if (session.getBookmark() == null)
714 {
715 // Return immediately if we launch from URI
716 return;
717 }
718 // check this settings and initial settings - if they are not equal the
719 // server doesn't support our settings
720 // FIXME: the additional check (settings.getWidth() != width + 1) is for
721 // the RDVH bug fix to avoid accidental notifications
722 // (refer to android_freerdp.c for more info on this problem)
723 BookmarkBase.ScreenSettings settings = session.getBookmark().getActiveScreenSettings();
724 if ((settings.getWidth() != width && settings.getWidth() != width + 1) ||
725 settings.getHeight() != height || settings.getColors() != bpp)
726 uiHandler.sendMessage(Message.obtain(
727 null, DISPLAY_TOAST, getResources().getText(R.string.info_capabilities_changed)));
728 }

◆ onStart()

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

Definition at line 319 of file SessionActivity.java.

320 {
321 super.onStart();
322 Log.v(TAG, "Session.onStart");
323 }

◆ onStop()

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

Definition at line 348 of file SessionActivity.java.

349 {
350 super.onStop();
351 Log.v(TAG, "Session.onStop");
352 }

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

780 {
781 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
782 return 0;
783 return dialogs.verifyCertificate(host, port, subject, issuer, fingerprint, flags);
784 }
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 787 of file SessionActivity.java.

791 {
792 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
793 return 0;
794 return dialogs.verifyChangedCertificate(host, port, subject, issuer, fingerprint, flags);
795 }
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 309 of file SessionActivity.java.

310 {
311 super.onWindowFocusChanged(hasFocus);
312 if (hasFocus)
313 {
314 hideSystemBars();
315 mClipboardManager.getPrimaryClipManually();
316 }
317 }

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: