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

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

◆ OnAuthenticate()

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

Definition at line 760 of file SessionActivity.java.

762 {
763 return dialogs.promptCredentials(username, domain, password);
764 }
boolean promptCredentials(StringBuilder username, StringBuilder domain, StringBuilder password)

◆ onClipboardChanged()

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

Definition at line 895 of file SessionActivity.java.

896 {
897 Log.v(TAG, "onClipboardChanged: " + data);
898 if (session != null)
899 LibFreeRDP.sendClipboardData(session.getInstance(), data);
900 }

◆ onClipboardImageChanged()

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

Definition at line 902 of file SessionActivity.java.

903 {
904 if (session != null && data != null)
905 LibFreeRDP.sendClipboardImageData(session.getInstance(), data, mimeType);
906 }

◆ onConfigurationChanged()

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

Definition at line 378 of file SessionActivity.java.

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

◆ onCreate()

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

Definition at line 206 of file SessionActivity.java.

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

◆ onDestroy()

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

Definition at line 350 of file SessionActivity.java.

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

◆ OnExperimentalFeature()

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

Definition at line 793 of file SessionActivity.java.

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

◆ OnGatewayAuthenticate()

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

Definition at line 767 of file SessionActivity.java.

769 {
770 return dialogs.promptCredentials(username, domain, password);
771 }

◆ onGenericMotionEvent()

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

Definition at line 887 of file SessionActivity.java.

888 {
889 super.onGenericMotionEvent(e);
890 return inputManager != null && inputManager.onGenericMotionEvent(e);
891 }

◆ OnGraphicsResize()

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

Definition at line 740 of file SessionActivity.java.

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

◆ OnGraphicsUpdate()

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

Definition at line 726 of file SessionActivity.java.

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

◆ onKeyDown()

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

Definition at line 670 of file SessionActivity.java.

671 {
672 if (keycode == KeyEvent.KEYCODE_BACK)
673 return super.onKeyDown(keycode, event);
674 return inputManager.onAndroidKeyEvent(event);
675 }

◆ onKeyLongPress()

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

Definition at line 652 of file SessionActivity.java.

653 {
654 if (inputManager.onAndroidKeyLongPress(keyCode))
655 return true;
656 return super.onKeyLongPress(keyCode, event);
657 }

◆ onKeyMultiple()

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

Definition at line 686 of file SessionActivity.java.

687 {
688 return inputManager.onAndroidKeyEvent(event);
689 }

◆ onKeyUp()

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

Definition at line 677 of file SessionActivity.java.

678 {
679 if (keycode == KeyEvent.KEYCODE_BACK)
680 return super.onKeyUp(keycode, event);
681 return inputManager.onAndroidKeyEvent(event);
682 }

◆ onPause()

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

Definition at line 334 of file SessionActivity.java.

335 {
336 super.onPause();
337 Log.v(TAG, "Session.onPause");
338 if (activeSession == this)
339 activeSession = null;
340 // hide any visible keyboards
341 inputManager.hideKeyboards();
342 }

◆ OnPointerSet()

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

Definition at line 830 of file SessionActivity.java.

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

◆ OnPointerSetDefault()

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

Definition at line 848 of file SessionActivity.java.

849 {
850 sessionView.setDefaultCursor();
851 }

◆ OnPointerSetNull()

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

Definition at line 843 of file SessionActivity.java.

844 {
845 uiHandler.sendEmptyMessage(POINTER_SET);
846 }

◆ OnRailMonitoredDesktop()

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

Definition at line 878 of file SessionActivity.java.

879 {
880 railManager.onMonitoredDesktop(windowIds, activeWindowId);
881 }

◆ OnRailSessionEnd()

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

Definition at line 873 of file SessionActivity.java.

874 {
875 railManager.onSessionEnd();
876 }

◆ OnRailWindowDestroy()

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

Definition at line 868 of file SessionActivity.java.

869 {
870 railManager.onWindowDestroy(windowId);
871 }

◆ OnRailWindowHide()

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

Definition at line 863 of file SessionActivity.java.

864 {
865 railManager.onWindowHide(windowId);
866 }

◆ OnRailWindowMove()

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

Definition at line 858 of file SessionActivity.java.

859 {
860 railManager.onWindowMove(windowId, x, y, w, h);
861 }

◆ OnRailWindowUpdate()

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

Definition at line 853 of file SessionActivity.java.

854 {
855 railManager.onWindowUpdate(windowId, width, height, pixels);
856 }

◆ OnRemoteClipboardChanged()

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

Definition at line 818 of file SessionActivity.java.

819 {
820 Log.v(TAG, "OnRemoteClipboardChanged: " + data);
821 mClipboardManager.setClipboardData(data);
822 }

◆ OnRemoteClipboardImageChanged()

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

Definition at line 824 of file SessionActivity.java.

825 {
826 Log.v(TAG, "OnRemoteClipboardImageChanged: " + data.length + " bytes");
827 mClipboardManager.setClipboardImage(data);
828 }

◆ onRequestPermissionsResult()

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

Definition at line 550 of file SessionActivity.java.

552 {
553 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
554 if (requestCode == REQUEST_MEDIA_PERMISSIONS && pendingConnectBookmark != null)
555 {
556 BookmarkBase bookmark = pendingConnectBookmark;
557 pendingConnectBookmark = null;
558 connectWithTitle(bookmark.getLabel());
559 }
560 }

◆ onRestart()

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

Definition at line 321 of file SessionActivity.java.

322 {
323 super.onRestart();
324 Log.v(TAG, "Session.onRestart");
325 }

◆ onResume()

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

Definition at line 327 of file SessionActivity.java.

328 {
329 super.onResume();
330 Log.v(TAG, "Session.onResume");
331 activeSession = this;
332 }

◆ OnSettingsChanged()

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

Definition at line 696 of file SessionActivity.java.

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

◆ onStart()

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

Definition at line 315 of file SessionActivity.java.

316 {
317 super.onStart();
318 Log.v(TAG, "Session.onStart");
319 }

◆ onStop()

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

Definition at line 344 of file SessionActivity.java.

345 {
346 super.onStop();
347 Log.v(TAG, "Session.onStop");
348 }

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

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

787 {
788 if (ApplicationSettingsActivity.getAcceptAllCertificates(this))
789 return 0;
790 return dialogs.verifyChangedCertificate(host, port, subject, issuer, fingerprint, flags);
791 }
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 305 of file SessionActivity.java.

306 {
307 super.onWindowFocusChanged(hasFocus);
308 if (hasFocus)
309 {
310 hideSystemBars();
311 mClipboardManager.getPrimaryClipManually();
312 }
313 }

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: