Merge branch 'master' of github.com:FreeRDP/FreeRDP

This commit is contained in:
Marc-André Moreau 2013-10-17 17:34:16 -04:00
commit 8609a19cac
24 changed files with 619 additions and 167 deletions

8
.gitignore vendored
View File

@ -74,6 +74,14 @@ Thumbs.db
ipch ipch
Debug Debug
RelWithDebInfo RelWithDebInfo
*.lib
*.exp
*.pdb
*.dll
*.ilk
*.resource.txt
*.embed.manifest*
*.intermediate.manifest*
# Binaries # Binaries
*.a *.a

View File

@ -3,7 +3,7 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View File

@ -3,6 +3,7 @@
Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Copyright 2013 Thinstuff Technologies GmbH, Author: Martin Fleisz Copyright 2013 Thinstuff Technologies GmbH, Author: Martin Fleisz
Copyright 2013 Thinstuff Technologies GmbH, Author: Armin Novak
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
@ -13,6 +14,7 @@
#endif #endif
#include <assert.h> #include <assert.h>
#include <jni.h> #include <jni.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -35,6 +37,7 @@
#include "android_debug.h" #include "android_debug.h"
#include "android_cliprdr.h" #include "android_cliprdr.h"
#if defined(WITH_GPROF) #if defined(WITH_GPROF)
#include "jni/prof.h" #include "jni/prof.h"
#endif #endif
@ -139,7 +142,9 @@ BOOL android_post_connect(freerdp* instance)
{ {
DEBUG_ANDROID("android_post_connect"); DEBUG_ANDROID("android_post_connect");
freerdp_callback("OnSettingsChanged", "(IIII)V", instance, instance->settings->DesktopWidth, instance->settings->DesktopHeight, instance->settings->ColorDepth); freerdp_callback("OnSettingsChanged", "(IIII)V", instance,
instance->settings->DesktopWidth, instance->settings->DesktopHeight,
instance->settings->ColorDepth);
instance->context->cache = cache_new(instance->settings); instance->context->cache = cache_new(instance->settings);
@ -231,7 +236,7 @@ int android_receive_channel_data(freerdp* instance, int channelId, UINT8* data,
return freerdp_channels_data(instance, channelId, data, size, flags, total_size); return freerdp_channels_data(instance, channelId, data, size, flags, total_size);
} }
void android_process_channel_event(rdpChannels* channels, freerdp* instance) static void android_process_channel_event(rdpChannels* channels, freerdp* instance)
{ {
wMessage* event; wMessage* event;
@ -239,13 +244,15 @@ void android_process_channel_event(rdpChannels* channels, freerdp* instance)
if (event) if (event)
{ {
switch(GetMessageClass(event->id)) int ev = GetMessageClass(event->id);
switch(ev)
{ {
case CliprdrChannel_Class: case CliprdrChannel_Class:
android_process_cliprdr_event(instance, event); android_process_cliprdr_event(instance, event);
break; break;
default: default:
DEBUG_ANDROID("Unsupported channel event %08X", ev);
break; break;
} }
@ -253,13 +260,121 @@ void android_process_channel_event(rdpChannels* channels, freerdp* instance)
} }
} }
int android_freerdp_run(freerdp* instance) static void *jni_update_thread(void *arg)
{
int status;
wMessage message;
wMessageQueue* queue;
freerdp* instance = (freerdp*) arg;
assert( NULL != instance);
DEBUG_ANDROID("Start.");
status = 1;
queue = freerdp_get_message_queue(instance, FREERDP_UPDATE_MESSAGE_QUEUE);
while (MessageQueue_Wait(queue))
{
while (MessageQueue_Peek(queue, &message, TRUE))
{
status = freerdp_message_queue_process_message(instance, FREERDP_UPDATE_MESSAGE_QUEUE, &message);
if (!status)
break;
}
if (!status)
break;
}
DEBUG_ANDROID("Quit.");
ExitThread(0);
return NULL;
}
static void* jni_input_thread(void* arg)
{
HANDLE event[3];
wMessageQueue* queue;
freerdp* instance = (freerdp*) arg;
androidContext *aCtx = (androidContext*)instance->context;
assert(NULL != instance);
assert(NULL != aCtx);
DEBUG_ANDROID("Start.");
queue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE);
event[0] = CreateFileDescriptorEvent(NULL, FALSE, FALSE, aCtx->event_queue->pipe_fd[0]);
event[1] = CreateFileDescriptorEvent(NULL, FALSE, FALSE, aCtx->event_queue->pipe_fd[1]);
event[2] = freerdp_get_message_queue_event_handle(instance, FREERDP_INPUT_MESSAGE_QUEUE);
do
{
DWORD rc = WaitForMultipleObjects(3, event, FALSE, INFINITE);
if (rc == WAIT_OBJECT_0 + 2)
{
wMessage msg;
MessageQueue_Peek(queue, &msg, FALSE);
if (msg.id == WMQ_QUIT)
break;
}
if ((rc < WAIT_OBJECT_0) && (rc > WAIT_OBJECT_0 + 1))
break;
if (android_check_fds(instance) != TRUE)
break;
}
while(1);
DEBUG_ANDROID("Quit.");
MessageQueue_PostQuit(queue, 0);
ExitThread(0);
return NULL;
}
static void* jni_channels_thread(void* arg)
{
int status;
HANDLE event;
rdpChannels* channels;
freerdp* instance = (freerdp*) arg;
assert(NULL != instance);
DEBUG_ANDROID("Start.");
channels = instance->context->channels;
event = freerdp_channels_get_event_handle(instance);
while (WaitForSingleObject(event, INFINITE) == WAIT_OBJECT_0)
{
status = freerdp_channels_process_pending_messages(instance);
if (!status)
break;
android_process_channel_event(channels, instance);
}
DEBUG_ANDROID("Quit.");
ExitThread(0);
return NULL;
}
static int android_freerdp_run(freerdp* instance)
{ {
int i; int i;
int fds; int fds;
int max_fds; int max_fds;
int rcount; int rcount;
int wcount; int wcount;
int fd_input_event;
HANDLE input_event;
void* rfds[32]; void* rfds[32];
void* wfds[32]; void* wfds[32];
fd_set rfds_set; fd_set rfds_set;
@ -267,7 +382,21 @@ int android_freerdp_run(freerdp* instance)
int select_status; int select_status;
struct timeval timeout; struct timeval timeout;
assert(instance); const rdpSettings* settings = instance->context->settings;
HANDLE update_thread;
HANDLE input_thread;
HANDLE channels_thread;
BOOL async_update = settings->AsyncUpdate;
BOOL async_input = settings->AsyncInput;
BOOL async_channels = settings->AsyncChannels;
BOOL async_transport = settings->AsyncTransport;
DEBUG_ANDROID("AsyncUpdate=%d", settings->AsyncUpdate);
DEBUG_ANDROID("AsyncInput=%d", settings->AsyncInput);
DEBUG_ANDROID("AsyncChannels=%d", settings->AsyncChannels);
DEBUG_ANDROID("AsyncTransport=%d", settings->AsyncTransport);
memset(rfds, 0, sizeof(rfds)); memset(rfds, 0, sizeof(rfds));
memset(wfds, 0, sizeof(wfds)); memset(wfds, 0, sizeof(wfds));
@ -277,27 +406,62 @@ int android_freerdp_run(freerdp* instance)
freerdp_callback("OnConnectionFailure", "(I)V", instance); freerdp_callback("OnConnectionFailure", "(I)V", instance);
return 0; return 0;
} }
if (async_update)
{
update_thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) jni_update_thread, instance, 0, NULL);
}
if (async_input)
{
input_thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) jni_input_thread, instance, 0, NULL);
}
if (async_channels)
{
channels_thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) jni_channels_thread, instance, 0, NULL);
}
((androidContext*)instance->context)->is_connected = TRUE; ((androidContext*)instance->context)->is_connected = TRUE;
while (!freerdp_shall_disconnect(instance)) while (!freerdp_shall_disconnect(instance))
{ {
rcount = 0; rcount = 0;
wcount = 0; wcount = 0;
if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) if (!async_transport)
{ {
DEBUG_ANDROID("Failed to get FreeRDP file descriptor\n"); if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
break; {
DEBUG_ANDROID("Failed to get FreeRDP file descriptor\n");
break;
}
} }
if (freerdp_channels_get_fds(instance->context->channels, instance, rfds, &rcount, wfds, &wcount) != TRUE)
if (!async_channels)
{ {
DEBUG_ANDROID("Failed to get channel manager file descriptor\n"); if (freerdp_channels_get_fds(instance->context->channels, instance, rfds, &rcount, wfds, &wcount) != TRUE)
break; {
DEBUG_ANDROID("Failed to get channel manager file descriptor\n");
break;
}
} }
if (android_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
if (!async_input)
{ {
DEBUG_ANDROID("Failed to get android file descriptor\n"); if (android_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
break; {
DEBUG_ANDROID("Failed to get android file descriptor\n");
break;
}
}
else
{
input_event = freerdp_get_message_queue_event_handle(instance, FREERDP_INPUT_MESSAGE_QUEUE);
fd_input_event = GetEventFileDescriptor(input_event);
rfds[rcount++] = (void*) (long) fd_input_event;
} }
max_fds = 0; max_fds = 0;
@ -340,33 +504,89 @@ int android_freerdp_run(freerdp* instance)
if (freerdp_shall_disconnect(instance)) if (freerdp_shall_disconnect(instance))
break; break;
if (freerdp_check_fds(instance) != TRUE) if (!async_transport)
{ {
DEBUG_ANDROID("Failed to check FreeRDP file descriptor\n"); if (freerdp_check_fds(instance) != TRUE)
break; {
DEBUG_ANDROID("Failed to check FreeRDP file descriptor\n");
break;
}
} }
if (android_check_fds(instance) != TRUE)
if (!async_input)
{ {
DEBUG_ANDROID("Failed to check android file descriptor\n"); if (android_check_fds(instance) != TRUE)
break; {
DEBUG_ANDROID("Failed to check android file descriptor\n");
break;
}
} }
if (freerdp_channels_check_fds(instance->context->channels, instance) != TRUE) else
{ {
DEBUG_ANDROID("Failed to check channel manager file descriptor\n"); if (WaitForSingleObject(input_event, 0) == WAIT_OBJECT_0)
break; {
if (!freerdp_message_queue_process_pending_messages(instance,
FREERDP_INPUT_MESSAGE_QUEUE))
{
DEBUG_ANDROID("User Disconnect");
break;
}
}
}
if (!async_channels)
{
if (freerdp_channels_check_fds(instance->context->channels, instance) != TRUE)
{
DEBUG_ANDROID("Failed to check channel manager file descriptor\n");
break;
}
android_process_channel_event(instance->context->channels, instance);
} }
android_process_channel_event(instance->context->channels, instance);
} }
DEBUG_ANDROID("Prepare shutdown...");
// issue another OnDisconnecting here in case the disconnect was initiated by the sever and not our client // issue another OnDisconnecting here in case the disconnect was initiated by the sever and not our client
freerdp_callback("OnDisconnecting", "(I)V", instance); freerdp_callback("OnDisconnecting", "(I)V", instance);
DEBUG_ANDROID("Close channels...");
freerdp_channels_close(instance->context->channels, instance); freerdp_channels_close(instance->context->channels, instance);
DEBUG_ANDROID("Cleanup threads...");
if (async_update)
{
wMessageQueue* update_queue = freerdp_get_message_queue(instance, FREERDP_UPDATE_MESSAGE_QUEUE);
MessageQueue_PostQuit(update_queue, 0);
WaitForSingleObject(update_thread, INFINITE);
CloseHandle(update_thread);
}
if (async_input)
{
wMessageQueue* input_queue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE);
MessageQueue_PostQuit(input_queue, 0);
WaitForSingleObject(input_thread, INFINITE);
CloseHandle(input_thread);
}
if (async_channels)
{
WaitForSingleObject(channels_thread, INFINITE);
CloseHandle(channels_thread);
}
DEBUG_ANDROID("Disconnecting...");
freerdp_channels_free(instance->context->channels);
freerdp_disconnect(instance); freerdp_disconnect(instance);
gdi_free(instance); gdi_free(instance);
cache_free(instance->context->cache); cache_free(instance->context->cache);
android_cliprdr_uninit(instance); android_cliprdr_uninit(instance);
freerdp_callback("OnDisconnected", "(I)V", instance); freerdp_callback("OnDisconnected", "(I)V", instance);
DEBUG_ANDROID("Quit.");
return 0; return 0;
} }
@ -377,13 +597,16 @@ void* android_thread_func(void* param)
assert(data); assert(data);
assert(data->instance); assert(data->instance);
DEBUG_ANDROID("Start.");
freerdp* instance = data->instance; freerdp* instance = data->instance;
android_freerdp_run(instance); android_freerdp_run(instance);
free(data); free(data);
pthread_detach(pthread_self()); DEBUG_ANDROID("Quit.");
ExitThread(0);
return NULL; return NULL;
} }
@ -578,8 +801,10 @@ JNIEXPORT void JNICALL jni_freerdp_set_connection_info(JNIEnv *env, jclass cls,
} }
JNIEXPORT void JNICALL jni_freerdp_set_performance_flags( JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(
JNIEnv *env, jclass cls, jint instance, jboolean remotefx, jboolean disableWallpaper, jboolean disableFullWindowDrag, JNIEnv *env, jclass cls, jint instance, jboolean remotefx,
jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition) jboolean disableWallpaper, jboolean disableFullWindowDrag,
jboolean disableMenuAnimations, jboolean disableTheming,
jboolean enableFontSmoothing, jboolean enableDesktopComposition)
{ {
freerdp* inst = (freerdp*)instance; freerdp* inst = (freerdp*)instance;
rdpSettings * settings = inst->settings; rdpSettings * settings = inst->settings;
@ -642,7 +867,10 @@ JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(
DEBUG_ANDROID("performance_flags: %04X", settings->PerformanceFlags); DEBUG_ANDROID("performance_flags: %04X", settings->PerformanceFlags);
} }
JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir) JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls,
jint instance, jstring jRemoteProgram, jstring jWorkDir,
jboolean async_channel, jboolean async_transport, jboolean async_input,
jboolean async_update)
{ {
freerdp* inst = (freerdp*)instance; freerdp* inst = (freerdp*)instance;
rdpSettings * settings = inst->settings; rdpSettings * settings = inst->settings;
@ -653,6 +881,12 @@ JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls
DEBUG_ANDROID("Remote Program: %s", (char*) remote_program); DEBUG_ANDROID("Remote Program: %s", (char*) remote_program);
DEBUG_ANDROID("Work Dir: %s", (char*) work_dir); DEBUG_ANDROID("Work Dir: %s", (char*) work_dir);
/* Enable async mode. */
settings->AsyncUpdate = async_update;
settings->AsyncChannels = async_channel;
settings->AsyncTransport = async_transport;
settings->AsyncInput = async_input;
if(remote_program && strlen(remote_program) > 0) if(remote_program && strlen(remote_program) > 0)
settings->AlternateShell = strdup(remote_program); settings->AlternateShell = strdup(remote_program);

View File

@ -43,7 +43,10 @@ JNIEXPORT void JNICALL jni_freerdp_set_connection_info(JNIEnv *env, jclass cls,
jint height, jint color_depth, jint port, jboolean console, jint security, jstring jcertname); jint height, jint color_depth, jint port, jboolean console, jint security, jstring jcertname);
JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(JNIEnv *env, jclass cls, jint instance, jboolean remotefx, jboolean disableWallpaper, jboolean disableFullWindowDrag, JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(JNIEnv *env, jclass cls, jint instance, jboolean remotefx, jboolean disableWallpaper, jboolean disableFullWindowDrag,
jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition); jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition);
JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir); JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls,
jint instance, jstring jRemoteProgram, jstring jWorkDir,
jboolean async_channel, jboolean async_transport, jboolean async_input,
jboolean async_update);
JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath); JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath);
JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env, jclass cls, jint instance, jint redirect); JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env, jclass cls, jint instance, jint redirect);
JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable); JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);

View File

@ -53,9 +53,14 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
width, height, color_depth, port, console, security, certname); width, height, color_depth, port, console, security, certname);
} }
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings(JNIEnv *env, jclass cls, jint instance, jstring remote_program, jstring work_dir) JNIEXPORT void JNICALL
Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings(
JNIEnv *env, jclass cls, jint instance, jstring remote_program, jstring work_dir,
jboolean async_channel, jboolean async_transport, jboolean async_input,
jboolean async_update)
{ {
jni_freerdp_set_advanced_settings(env, cls, instance, remote_program, work_dir); jni_freerdp_set_advanced_settings(env, cls, instance, remote_program, work_dir,
async_channel, async_transport, async_input, async_update);
} }
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1data_1directory(JNIEnv *env, jclass cls, jint instance, jstring directory) JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1data_1directory(JNIEnv *env, jclass cls, jint instance, jstring directory)

View File

@ -66,10 +66,10 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
/* /*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP * Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_advanced_settings * Method: freerdp_set_advanced_settings
* Signature: (ILjava/lang/String;Ljava/lang/String;)V * Signature: (ILjava/lang/String;Ljava/lang/String;ZZZZ)V
*/ */
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings
(JNIEnv *, jclass, jint, jstring, jstring); (JNIEnv *, jclass, jint, jstring, jstring, jboolean, jboolean, jboolean, jboolean);
/* /*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP * Class: com_freerdp_freerdpcore_services_LibFreeRDP

View File

@ -142,6 +142,10 @@
</string-array> </string-array>
<string name="settings_remote_program">Programa Remoto</string> <string name="settings_remote_program">Programa Remoto</string>
<string name="settings_work_dir">Directorio de trabajo</string> <string name="settings_work_dir">Directorio de trabajo</string>
<string name="settings_async_channel">Async channel</string>
<string name="settings_async_transport">Async transport</string>
<string name="settings_async_input">Async input</string>
<string name="settings_async_update">Async update</string>
<string name="settings_console_mode">Modo Consola</string> <string name="settings_console_mode">Modo Consola</string>
<!-- App settings strings --> <!-- App settings strings -->
<string name="settings_password_present">*******</string> <string name="settings_password_present">*******</string>

View File

@ -141,6 +141,10 @@
</string-array> </string-array>
<string name="settings_remote_program">"Lancement de programme"</string> <string name="settings_remote_program">"Lancement de programme"</string>
<string name="settings_work_dir">"Répertoire de travail"</string> <string name="settings_work_dir">"Répertoire de travail"</string>
<string name="settings_async_channel">Async channel</string>
<string name="settings_async_transport">Async transport</string>
<string name="settings_async_input">Async input</string>
<string name="settings_async_update">Async update</string>
<string name="settings_console_mode">"Mode console"</string> <string name="settings_console_mode">"Mode console"</string>
<!-- App settings strings --> <!-- App settings strings -->
<string name="settings_password_present">"*******"</string> <string name="settings_password_present">"*******"</string>

View File

@ -142,6 +142,10 @@
</string-array> </string-array>
<string name="settings_remote_program">Extern programma</string> <string name="settings_remote_program">Extern programma</string>
<string name="settings_work_dir">Werkmap</string> <string name="settings_work_dir">Werkmap</string>
<string name="settings_async_channel">Async channel</string>
<string name="settings_async_transport">Async transport</string>
<string name="settings_async_input">Async input</string>
<string name="settings_async_update">Async update</string>
<string name="settings_console_mode">Console modus</string> <string name="settings_console_mode">Console modus</string>
<!-- App settings strings --> <!-- App settings strings -->
<string name="settings_password_present">*******</string> <string name="settings_password_present">*******</string>

View File

@ -139,6 +139,10 @@
</string-array> </string-array>
<string name="settings_remote_program">Remote Program</string> <string name="settings_remote_program">Remote Program</string>
<string name="settings_work_dir">Working Directory</string> <string name="settings_work_dir">Working Directory</string>
<string name="settings_async_channel">Async channel</string>
<string name="settings_async_transport">Async transport</string>
<string name="settings_async_input">Async input</string>
<string name="settings_async_update">Async update</string>
<string name="settings_console_mode">Console Mode</string> <string name="settings_console_mode">Console Mode</string>
<!-- App settings strings --> <!-- App settings strings -->
<string name="settings_password_present">*******</string> <string name="settings_password_present">*******</string>

View File

@ -31,5 +31,13 @@
freerdp:bounds_min="0" freerdp:bounds_min="0"
freerdp:bounds_max="10" freerdp:bounds_max="10"
freerdp:bounds_default="0" /> freerdp:bounds_default="0" />
<CheckBoxPreference android:key="bookmark.async_channel"
android:title="@string/settings_async_channel"/>
<CheckBoxPreference android:key="bookmark.async_transport"
android:title="@string/settings_async_transport"/>
<CheckBoxPreference android:key="bookmark.async_update"
android:title="@string/settings_async_update"/>
<CheckBoxPreference android:key="bookmark.async_input"
android:title="@string/settings_async_input"/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@ -5,7 +5,7 @@
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
package com.freerdp.freerdpcore.domain; package com.freerdp.freerdpcore.domain;
@ -23,7 +23,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
public static final int TYPE_QUICKCONNECT = 2; public static final int TYPE_QUICKCONNECT = 2;
public static final int TYPE_PLACEHOLDER = 3; public static final int TYPE_PLACEHOLDER = 3;
public static final int TYPE_CUSTOM_BASE = 1000; public static final int TYPE_CUSTOM_BASE = 1000;
// performance flags // performance flags
public static class PerformanceFlags implements Parcelable { public static class PerformanceFlags implements Parcelable {
private boolean remotefx; private boolean remotefx;
@ -33,7 +33,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
private boolean menuAnimations; private boolean menuAnimations;
private boolean fontSmoothing; private boolean fontSmoothing;
private boolean desktopComposition; private boolean desktopComposition;
public PerformanceFlags() { public PerformanceFlags() {
remotefx = false; remotefx = false;
wallpaper = false; wallpaper = false;
@ -43,13 +43,13 @@ public class BookmarkBase implements Parcelable, Cloneable {
fontSmoothing = false; fontSmoothing = false;
desktopComposition = false; desktopComposition = false;
} }
public PerformanceFlags(Parcel parcel) { public PerformanceFlags(Parcel parcel) {
remotefx = (parcel.readInt() == 1) ? true : false; remotefx = (parcel.readInt() == 1) ? true : false;
wallpaper = (parcel.readInt() == 1) ? true : false; wallpaper = (parcel.readInt() == 1) ? true : false;
theming = (parcel.readInt() == 1) ? true : false; theming = (parcel.readInt() == 1) ? true : false;
fullWindowDrag = (parcel.readInt() == 1) ? true : false; fullWindowDrag = (parcel.readInt() == 1) ? true : false;
menuAnimations = (parcel.readInt() == 1) ? true : false; menuAnimations = (parcel.readInt() == 1) ? true : false;
fontSmoothing = (parcel.readInt() == 1) ? true : false; fontSmoothing = (parcel.readInt() == 1) ? true : false;
desktopComposition = (parcel.readInt() == 1) ? true : false; desktopComposition = (parcel.readInt() == 1) ? true : false;
} }
@ -57,7 +57,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
public boolean getRemoteFX() { public boolean getRemoteFX() {
return remotefx; return remotefx;
} }
public void setRemoteFX(boolean remotefx) { public void setRemoteFX(boolean remotefx) {
this.remotefx = remotefx; this.remotefx = remotefx;
} }
@ -65,15 +65,15 @@ public class BookmarkBase implements Parcelable, Cloneable {
public boolean getWallpaper() { public boolean getWallpaper() {
return wallpaper; return wallpaper;
} }
public void setWallpaper(boolean wallpaper) { public void setWallpaper(boolean wallpaper) {
this.wallpaper = wallpaper; this.wallpaper = wallpaper;
} }
public boolean getTheming() { public boolean getTheming() {
return theming; return theming;
} }
public void setTheming(boolean theming) { public void setTheming(boolean theming) {
this.theming = theming; this.theming = theming;
} }
@ -81,7 +81,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
public boolean getFullWindowDrag() { public boolean getFullWindowDrag() {
return fullWindowDrag; return fullWindowDrag;
} }
public void setFullWindowDrag(boolean fullWindowDrag) { public void setFullWindowDrag(boolean fullWindowDrag) {
this.fullWindowDrag = fullWindowDrag; this.fullWindowDrag = fullWindowDrag;
} }
@ -89,7 +89,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
public boolean getMenuAnimations() { public boolean getMenuAnimations() {
return menuAnimations; return menuAnimations;
} }
public void setMenuAnimations(boolean menuAnimations) { public void setMenuAnimations(boolean menuAnimations) {
this.menuAnimations = menuAnimations; this.menuAnimations = menuAnimations;
} }
@ -97,15 +97,15 @@ public class BookmarkBase implements Parcelable, Cloneable {
public boolean getFontSmoothing() { public boolean getFontSmoothing() {
return fontSmoothing; return fontSmoothing;
} }
public void setFontSmoothing(boolean fontSmoothing) { public void setFontSmoothing(boolean fontSmoothing) {
this.fontSmoothing = fontSmoothing; this.fontSmoothing = fontSmoothing;
} }
public boolean getDesktopComposition() { public boolean getDesktopComposition() {
return desktopComposition; return desktopComposition;
} }
public void setDesktopComposition(boolean desktopComposition) { public void setDesktopComposition(boolean desktopComposition) {
this.desktopComposition = desktopComposition; this.desktopComposition = desktopComposition;
} }
@ -129,13 +129,13 @@ public class BookmarkBase implements Parcelable, Cloneable {
@Override @Override
public void writeToParcel(Parcel out, int flags) { public void writeToParcel(Parcel out, int flags) {
out.writeInt(remotefx ? 1 : 0); out.writeInt(remotefx ? 1 : 0);
out.writeInt(wallpaper ? 1 : 0); out.writeInt(wallpaper ? 1 : 0);
out.writeInt(theming ? 1 : 0); out.writeInt(theming ? 1 : 0);
out.writeInt(fullWindowDrag ? 1 : 0); out.writeInt(fullWindowDrag ? 1 : 0);
out.writeInt(menuAnimations ? 1 : 0); out.writeInt(menuAnimations ? 1 : 0);
out.writeInt(fontSmoothing ? 1 : 0); out.writeInt(fontSmoothing ? 1 : 0);
out.writeInt(desktopComposition ? 1 : 0); out.writeInt(desktopComposition ? 1 : 0);
} }
} }
// Screen Settings class // Screen Settings class
@ -144,7 +144,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
public static final int AUTOMATIC = -1; public static final int AUTOMATIC = -1;
public static final int CUSTOM = 0; public static final int CUSTOM = 0;
public static final int PREDEFINED = 1; public static final int PREDEFINED = 1;
private int resolution; private int resolution;
private int colors; private int colors;
private int width; private int width;
@ -160,23 +160,23 @@ public class BookmarkBase implements Parcelable, Cloneable {
width = parcel.readInt(); width = parcel.readInt();
height = parcel.readInt(); height = parcel.readInt();
} }
private void init() { private void init() {
resolution = AUTOMATIC; resolution = AUTOMATIC;
colors = 16; colors = 16;
width = 0; width = 0;
height = 0; height = 0;
} }
public void setResolution(int resolution) { public void setResolution(int resolution) {
this.resolution = resolution; this.resolution = resolution;
if (resolution == AUTOMATIC || resolution == FITSCREEN) { if (resolution == AUTOMATIC || resolution == FITSCREEN) {
width = 0; width = 0;
height = 0; height = 0;
} }
} }
public void setResolution(String resolution, int width, int height) { public void setResolution(String resolution, int width, int height) {
if (resolution.contains("x")) { if (resolution.contains("x")) {
String[] dimensions = resolution.split("x"); String[] dimensions = resolution.split("x");
@ -184,8 +184,8 @@ public class BookmarkBase implements Parcelable, Cloneable {
this.height = Integer.valueOf(dimensions[1]); this.height = Integer.valueOf(dimensions[1]);
this.resolution = PREDEFINED; this.resolution = PREDEFINED;
} else if (resolution.equalsIgnoreCase("custom")) { } else if (resolution.equalsIgnoreCase("custom")) {
this.width = width; this.width = width;
this.height = height; this.height = height;
this.resolution = CUSTOM; this.resolution = CUSTOM;
} else if (resolution.equalsIgnoreCase("fitscreen")) { } else if (resolution.equalsIgnoreCase("fitscreen")) {
this.width = this.height = 0; this.width = this.height = 0;
@ -199,7 +199,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
public int getResolution() { public int getResolution() {
return resolution; return resolution;
} }
public String getResolutionString() { public String getResolutionString() {
if (isPredefined()) if (isPredefined())
return (width + "x" + height); return (width + "x" + height);
@ -209,9 +209,9 @@ public class BookmarkBase implements Parcelable, Cloneable {
} }
public boolean isPredefined() { public boolean isPredefined() {
return (resolution == PREDEFINED); return (resolution == PREDEFINED);
} }
public boolean isAutomatic() { public boolean isAutomatic() {
return (resolution == AUTOMATIC); return (resolution == AUTOMATIC);
} }
@ -227,27 +227,27 @@ public class BookmarkBase implements Parcelable, Cloneable {
public void setWidth(int width) { public void setWidth(int width) {
this.width = width; this.width = width;
} }
public int getWidth() { public int getWidth() {
return width; return width;
} }
public int getHeight() { public int getHeight() {
return height; return height;
} }
public void setHeight(int height) { public void setHeight(int height) {
this.height = height; this.height = height;
} }
public void setColors(int colors) { public void setColors(int colors) {
this.colors = colors; this.colors = colors;
} }
public int getColors() { public int getColors() {
return colors; return colors;
} }
public static final Parcelable.Creator<ScreenSettings> CREATOR = new Parcelable.Creator<ScreenSettings>() { public static final Parcelable.Creator<ScreenSettings> CREATOR = new Parcelable.Creator<ScreenSettings>() {
public ScreenSettings createFromParcel(Parcel in) { public ScreenSettings createFromParcel(Parcel in) {
return new ScreenSettings(in); return new ScreenSettings(in);
@ -270,22 +270,35 @@ public class BookmarkBase implements Parcelable, Cloneable {
out.writeInt(colors); out.writeInt(colors);
out.writeInt(width); out.writeInt(width);
out.writeInt(height); out.writeInt(height);
} }
} }
public static class DebugSettings implements Parcelable { public static class DebugSettings implements Parcelable {
private int debug; private int debug;
private boolean asyncChannel;
private boolean asyncTransport;
private boolean asyncInput;
private boolean asyncUpdate;
public DebugSettings() { public DebugSettings() {
init(); init();
} }
// Session Settings
public DebugSettings(Parcel parcel) { public DebugSettings(Parcel parcel) {
asyncChannel = (parcel.readInt() == 1) ? true : false;
asyncTransport = (parcel.readInt() == 1) ? true : false;
asyncInput = (parcel.readInt() == 1) ? true : false;
asyncUpdate = (parcel.readInt() == 1) ? true : false;
debug = parcel.readInt(); debug = parcel.readInt();
} }
private void init() { private void init() {
debug = 0; debug = 0;
asyncChannel = true;
asyncTransport = true;
asyncInput = true;
asyncUpdate = true;
} }
public int getDebugLevel() { public int getDebugLevel() {
@ -296,6 +309,46 @@ public class BookmarkBase implements Parcelable, Cloneable {
this.debug = debug; this.debug = debug;
} }
public boolean getAsyncTransport()
{
return asyncTransport;
}
public void setAsyncTransport(boolean enabled)
{
asyncTransport = enabled;
}
public boolean getAsyncUpdate()
{
return asyncUpdate;
}
public void setAsyncUpdate(boolean enabled)
{
asyncUpdate = enabled;
}
public boolean getAsyncInput()
{
return asyncInput;
}
public void setAsyncInput(boolean enabled)
{
asyncInput = enabled;
}
public void setAsyncChannel(boolean enabled)
{
asyncChannel = enabled;
}
public boolean getAsyncChannel()
{
return asyncChannel;
}
public static final Parcelable.Creator<DebugSettings> CREATOR = new Parcelable.Creator<DebugSettings>() { public static final Parcelable.Creator<DebugSettings> CREATOR = new Parcelable.Creator<DebugSettings>() {
public DebugSettings createFromParcel(Parcel in) { public DebugSettings createFromParcel(Parcel in) {
return new DebugSettings(in); return new DebugSettings(in);
@ -314,6 +367,10 @@ public class BookmarkBase implements Parcelable, Cloneable {
@Override @Override
public void writeToParcel(Parcel out, int flags) { public void writeToParcel(Parcel out, int flags) {
out.writeInt(asyncChannel ? 1 : 0);
out.writeInt(asyncTransport ? 1 : 0);
out.writeInt(asyncInput ? 1 : 0);
out.writeInt(asyncUpdate ? 1 : 0);
out.writeInt(debug); out.writeInt(debug);
} }
} }
@ -347,9 +404,9 @@ public class BookmarkBase implements Parcelable, Cloneable {
security = parcel.readInt(); security = parcel.readInt();
consoleMode = (parcel.readInt() == 1) ? true : false; consoleMode = (parcel.readInt() == 1) ? true : false;
remoteProgram = parcel.readString(); remoteProgram = parcel.readString();
workDir = parcel.readString(); workDir = parcel.readString();
} }
private void init() { private void init() {
enable3GSettings = false; enable3GSettings = false;
screen3G = new ScreenSettings(); screen3G = new ScreenSettings();
@ -362,11 +419,11 @@ public class BookmarkBase implements Parcelable, Cloneable {
remoteProgram = ""; remoteProgram = "";
workDir = ""; workDir = "";
} }
public void setEnable3GSettings(boolean enable3GSettings) { public void setEnable3GSettings(boolean enable3GSettings) {
this.enable3GSettings = enable3GSettings; this.enable3GSettings = enable3GSettings;
} }
public boolean getEnable3GSettings() { public boolean getEnable3GSettings() {
return enable3GSettings; return enable3GSettings;
} }
@ -374,76 +431,77 @@ public class BookmarkBase implements Parcelable, Cloneable {
public ScreenSettings getScreen3G() { public ScreenSettings getScreen3G() {
return screen3G; return screen3G;
} }
public void setScreen3G(ScreenSettings screen3G) { public void setScreen3G(ScreenSettings screen3G) {
this.screen3G = screen3G; this.screen3G = screen3G;
} }
public PerformanceFlags getPerformance3G() { public PerformanceFlags getPerformance3G() {
return performance3G; return performance3G;
} }
public void setPerformance3G(PerformanceFlags performance3G) { public void setPerformance3G(PerformanceFlags performance3G) {
this.performance3G = performance3G; this.performance3G = performance3G;
} }
public void setRedirectSDCard(boolean redirectSDCard) { public void setRedirectSDCard(boolean redirectSDCard) {
this.redirectSDCard = redirectSDCard; this.redirectSDCard = redirectSDCard;
} }
public boolean getRedirectSDCard() { public boolean getRedirectSDCard() {
return redirectSDCard; return redirectSDCard;
} }
public void setRedirectSound(int redirect) { public void setRedirectSound(int redirect) {
this.redirectSound = redirect; this.redirectSound = redirect;
} }
public int getRedirectSound() { public int getRedirectSound() {
return redirectSound; return redirectSound;
} }
public void setRedirectMicrophone(boolean redirect) { public void setRedirectMicrophone(boolean redirect) {
this.redirectMicrophone = redirect; this.redirectMicrophone = redirect;
} }
public boolean getRedirectMicrophone() { public boolean getRedirectMicrophone() {
return redirectMicrophone; return redirectMicrophone;
} }
public void setSecurity(int security) { public void setSecurity(int security) {
this.security = security; this.security = security;
} }
public int getSecurity() { public int getSecurity() {
return security; return security;
} }
public void setConsoleMode(boolean consoleMode) { public void setConsoleMode(boolean consoleMode) {
this.consoleMode = consoleMode; this.consoleMode = consoleMode;
} }
public boolean getConsoleMode() { public boolean getConsoleMode() {
return consoleMode; return consoleMode;
} }
public void setRemoteProgram(String remoteProgram) { public void setRemoteProgram(String remoteProgram) {
this.remoteProgram = remoteProgram; this.remoteProgram = remoteProgram;
} }
public String getRemoteProgram() { public String getRemoteProgram() {
return remoteProgram; return remoteProgram;
} }
public void setWorkDir(String workDir) { public void setWorkDir(String workDir) {
this.workDir = workDir; this.workDir = workDir;
} }
public String getWorkDir() { public String getWorkDir() {
return workDir; return workDir;
} }
public static final Parcelable.Creator<AdvancedSettings> CREATOR = new Parcelable.Creator<AdvancedSettings>() { public static final Parcelable.Creator<AdvancedSettings> CREATOR = new Parcelable.Creator<AdvancedSettings>()
{
public AdvancedSettings createFromParcel(Parcel in) { public AdvancedSettings createFromParcel(Parcel in) {
return new AdvancedSettings(in); return new AdvancedSettings(in);
} }
@ -467,15 +525,15 @@ public class BookmarkBase implements Parcelable, Cloneable {
out.writeInt(redirectSDCard ? 1 : 0); out.writeInt(redirectSDCard ? 1 : 0);
out.writeInt(redirectSound); out.writeInt(redirectSound);
out.writeInt(redirectMicrophone ? 1 : 0); out.writeInt(redirectMicrophone ? 1 : 0);
out.writeInt(security); out.writeInt(security);
out.writeInt(consoleMode ? 1 : 0); out.writeInt(consoleMode ? 1 : 0);
out.writeString(remoteProgram); out.writeString(remoteProgram);
out.writeString(workDir); out.writeString(workDir);
} }
} }
protected int type; protected int type;
private long id; private long id;
private String label; private String label;
private String username; private String username;
private String password; private String password;
@ -485,21 +543,21 @@ public class BookmarkBase implements Parcelable, Cloneable {
private PerformanceFlags performanceFlags; private PerformanceFlags performanceFlags;
private AdvancedSettings advancedSettings; private AdvancedSettings advancedSettings;
private DebugSettings debugSettings; private DebugSettings debugSettings;
private void init() { private void init() {
type = TYPE_INVALID; type = TYPE_INVALID;
id = -1; id = -1;
label = ""; label = "";
username = ""; username = "";
password = ""; password = "";
domain = ""; domain = "";
screenSettings = new ScreenSettings(); screenSettings = new ScreenSettings();
performanceFlags = new PerformanceFlags(); performanceFlags = new PerformanceFlags();
advancedSettings = new AdvancedSettings(); advancedSettings = new AdvancedSettings();
debugSettings = new DebugSettings(); debugSettings = new DebugSettings();
} }
public BookmarkBase(Parcel parcel) { public BookmarkBase(Parcel parcel) {
type = parcel.readInt(); type = parcel.readInt();
id = parcel.readLong(); id = parcel.readLong();
@ -517,7 +575,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
debugSettings = parcel.readParcelable(DebugSettings.class debugSettings = parcel.readParcelable(DebugSettings.class
.getClassLoader()); .getClassLoader());
} }
public BookmarkBase() { public BookmarkBase() {
init(); init();
} }
@ -530,47 +588,47 @@ public class BookmarkBase implements Parcelable, Cloneable {
public int getType() { public int getType() {
return type; return type;
} }
public void setId(long id) { public void setId(long id) {
this.id = id; this.id = id;
} }
public long getId() { public long getId() {
return id; return id;
} }
public void setLabel(String label) { public void setLabel(String label) {
this.label = label; this.label = label;
} }
public String getLabel() { public String getLabel() {
return label; return label;
} }
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
public String getUsername() { public String getUsername() {
return username; return username;
} }
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setDomain(String domain) { public void setDomain(String domain) {
this.domain = domain; this.domain = domain;
} }
public String getDomain() { public String getDomain() {
return domain; return domain;
} }
public void setScreenSettings(ScreenSettings screenSettings) { public void setScreenSettings(ScreenSettings screenSettings) {
this.screenSettings = screenSettings; this.screenSettings = screenSettings;
} }
@ -582,11 +640,11 @@ public class BookmarkBase implements Parcelable, Cloneable {
public void setPerformanceFlags(PerformanceFlags performanceFlags) { public void setPerformanceFlags(PerformanceFlags performanceFlags) {
this.performanceFlags = performanceFlags; this.performanceFlags = performanceFlags;
} }
public PerformanceFlags getPerformanceFlags() { public PerformanceFlags getPerformanceFlags() {
return performanceFlags; return performanceFlags;
} }
public void setAdvancedSettings(AdvancedSettings advancedSettings) { public void setAdvancedSettings(AdvancedSettings advancedSettings) {
this.advancedSettings = advancedSettings; this.advancedSettings = advancedSettings;
} }
@ -594,11 +652,11 @@ public class BookmarkBase implements Parcelable, Cloneable {
public AdvancedSettings getAdvancedSettings() { public AdvancedSettings getAdvancedSettings() {
return advancedSettings; return advancedSettings;
} }
public void setDebugSettings(DebugSettings debugSettings) { public void setDebugSettings(DebugSettings debugSettings) {
this.debugSettings = debugSettings; this.debugSettings = debugSettings;
} }
public DebugSettings getDebugSettings() { public DebugSettings getDebugSettings() {
return debugSettings; return debugSettings;
} }
@ -625,7 +683,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
return new BookmarkBase[size]; return new BookmarkBase[size];
} }
}; };
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
@ -677,7 +735,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
editor.putBoolean("bookmark.perf_menu_animation", editor.putBoolean("bookmark.perf_menu_animation",
performanceFlags.getMenuAnimations()); performanceFlags.getMenuAnimations());
editor.putBoolean("bookmark.perf_themes", performanceFlags.getTheming()); editor.putBoolean("bookmark.perf_themes", performanceFlags.getTheming());
editor.putBoolean("bookmark.enable_3g_settings", editor.putBoolean("bookmark.enable_3g_settings",
advancedSettings.getEnable3GSettings()); advancedSettings.getEnable3GSettings());
@ -718,6 +776,10 @@ public class BookmarkBase implements Parcelable, Cloneable {
editor.putBoolean("bookmark.console_mode", editor.putBoolean("bookmark.console_mode",
advancedSettings.getConsoleMode()); advancedSettings.getConsoleMode());
editor.putBoolean("bookmark.async_channel", debugSettings.getAsyncChannel());
editor.putBoolean("bookmark.async_transport", debugSettings.getAsyncTransport());
editor.putBoolean("bookmark.async_input", debugSettings.getAsyncInput());
editor.putBoolean("bookmark.async_update", debugSettings.getAsyncUpdate());
editor.putInt("bookmark.debug_level", editor.putInt("bookmark.debug_level",
debugSettings.getDebugLevel()); debugSettings.getDebugLevel());
@ -751,7 +813,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
"bookmark.perf_menu_animation", false)); "bookmark.perf_menu_animation", false));
performanceFlags.setTheming(sharedPrefs.getBoolean( performanceFlags.setTheming(sharedPrefs.getBoolean(
"bookmark.perf_themes", false)); "bookmark.perf_themes", false));
advancedSettings.setEnable3GSettings(sharedPrefs.getBoolean( advancedSettings.setEnable3GSettings(sharedPrefs.getBoolean(
"bookmark.enable_3g_settings", false)); "bookmark.enable_3g_settings", false));
@ -781,28 +843,25 @@ public class BookmarkBase implements Parcelable, Cloneable {
advancedSettings.getPerformance3G().setTheming( advancedSettings.getPerformance3G().setTheming(
sharedPrefs.getBoolean("bookmark.perf_themes_3g", false)); sharedPrefs.getBoolean("bookmark.perf_themes_3g", false));
advancedSettings.setRedirectSDCard(sharedPrefs.getBoolean( advancedSettings.setRedirectSDCard(sharedPrefs.getBoolean("bookmark.redirect_sdcard", false));
"bookmark.redirect_sdcard", false)); advancedSettings.setRedirectSound(sharedPrefs.getInt("bookmark.redirect_sound", 0));
advancedSettings.setRedirectSound(sharedPrefs.getInt( advancedSettings.setRedirectMicrophone(sharedPrefs.getBoolean("bookmark.redirect_microphone", false));
"bookmark.redirect_sound", 0)); advancedSettings.setSecurity(sharedPrefs.getInt("bookmark.security", 0));
advancedSettings.setRedirectMicrophone(sharedPrefs.getBoolean( advancedSettings.setRemoteProgram(sharedPrefs.getString("bookmark.remote_program", ""));
"bookmark.redirect_microphone", false)); advancedSettings.setWorkDir(sharedPrefs.getString("bookmark.work_dir", ""));
advancedSettings advancedSettings.setConsoleMode(sharedPrefs.getBoolean("bookmark.console_mode", false));
.setSecurity(sharedPrefs.getInt("bookmark.security", 0));
advancedSettings.setRemoteProgram(sharedPrefs.getString(
"bookmark.remote_program", ""));
advancedSettings.setWorkDir(sharedPrefs.getString("bookmark.work_dir",
""));
advancedSettings.setConsoleMode(sharedPrefs.getBoolean(
"bookmark.console_mode", false));
debugSettings.setAsyncChannel(sharedPrefs.getBoolean("bookmark.async_channel", true));
debugSettings.setAsyncTransport(sharedPrefs.getBoolean("bookmark.async_transport", true));
debugSettings.setAsyncInput(sharedPrefs.getBoolean("bookmark.async_input", true));
debugSettings.setAsyncUpdate(sharedPrefs.getBoolean("bookmark.async_update", true));
debugSettings.setDebugLevel(sharedPrefs.getInt("bookmark.debug_level", 0)); debugSettings.setDebugLevel(sharedPrefs.getInt("bookmark.debug_level", 0));
} }
// Cloneable // Cloneable
public Object clone() { public Object clone() {
try { try {
return super.clone(); return super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
return null; return null;
} }

View File

@ -504,6 +504,10 @@ public class BookmarkActivity extends PreferenceActivity implements
private void initDebugSettings(SharedPreferences sharedPreferences) { private void initDebugSettings(SharedPreferences sharedPreferences) {
debugSettingsChanged(sharedPreferences, "bookmark.debug_level"); debugSettingsChanged(sharedPreferences, "bookmark.debug_level");
debugSettingsChanged(sharedPreferences, "bookmark.async_channel");
debugSettingsChanged(sharedPreferences, "bookmark.async_transport");
debugSettingsChanged(sharedPreferences, "bookmark.async_update");
debugSettingsChanged(sharedPreferences, "bookmark.async_input");
} }
private void initGatewaySettings(SharedPreferences sharedPreferences) { private void initGatewaySettings(SharedPreferences sharedPreferences) {
@ -520,6 +524,22 @@ public class BookmarkActivity extends PreferenceActivity implements
int level = sharedPreferences.getInt(key, 0); int level = sharedPreferences.getInt(key, 0);
Preference pref = findPreference("bookmark.debug_level"); Preference pref = findPreference("bookmark.debug_level");
pref.setDefaultValue(level); pref.setDefaultValue(level);
} else if (key.equals("bookmark.async_channel")) {
boolean enabled = sharedPreferences.getBoolean(key, false);
Preference pref = findPreference("bookmark.async_channel");
pref.setDefaultValue(enabled);
}else if (key.equals("bookmark.async_transport")) {
boolean enabled = sharedPreferences.getBoolean(key, false);
Preference pref = findPreference("bookmark.async_transport");
pref.setDefaultValue(enabled);
}else if (key.equals("bookmark.async_update")) {
boolean enabled = sharedPreferences.getBoolean(key, false);
Preference pref = findPreference("bookmark.async_update");
pref.setDefaultValue(enabled);
}else if (key.equals("bookmark.async_input")) {
boolean enabled = sharedPreferences.getBoolean(key, false);
Preference pref = findPreference("bookmark.async_input");
pref.setDefaultValue(enabled);
} }
} }

View File

@ -71,6 +71,10 @@ public abstract class BookmarkBaseGateway
values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram()); values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram());
values.put("work_dir", bookmark.getAdvancedSettings().getWorkDir()); values.put("work_dir", bookmark.getAdvancedSettings().getWorkDir());
values.put("async_channel", bookmark.getDebugSettings().getAsyncChannel());
values.put("async_transport", bookmark.getDebugSettings().getAsyncTransport());
values.put("async_input", bookmark.getDebugSettings().getAsyncInput());
values.put("async_update", bookmark.getDebugSettings().getAsyncUpdate());
values.put("debug_level", bookmark.getDebugSettings().getDebugLevel()); values.put("debug_level", bookmark.getDebugSettings().getDebugLevel());
// add any special columns // add any special columns
@ -111,6 +115,10 @@ public abstract class BookmarkBaseGateway
values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram()); values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram());
values.put("work_dir", bookmark.getAdvancedSettings().getWorkDir()); values.put("work_dir", bookmark.getAdvancedSettings().getWorkDir());
values.put("async_channel", bookmark.getDebugSettings().getAsyncChannel());
values.put("async_transport", bookmark.getDebugSettings().getAsyncTransport());
values.put("async_input", bookmark.getDebugSettings().getAsyncInput());
values.put("async_update", bookmark.getDebugSettings().getAsyncUpdate());
values.put("debug_level", bookmark.getDebugSettings().getDebugLevel()); values.put("debug_level", bookmark.getDebugSettings().getDebugLevel());
addBookmarkSpecificColumns(bookmark, values); addBookmarkSpecificColumns(bookmark, values);
@ -233,9 +241,13 @@ public abstract class BookmarkBaseGateway
columns.add("console_mode"); columns.add("console_mode");
columns.add("remote_program"); columns.add("remote_program");
columns.add("work_dir"); columns.add("work_dir");
// debug settings // debug settings
columns.add("debug_level"); columns.add("debug_level");
columns.add("async_channel");
columns.add("async_transport");
columns.add("async_update");
columns.add("async_input");
addBookmarkSpecificColumns(columns); addBookmarkSpecificColumns(columns);
} }
@ -297,8 +309,16 @@ public abstract class BookmarkBaseGateway
bookmark.getAdvancedSettings().setRemoteProgram(cursor.getString(cursor.getColumnIndex("remote_program"))); bookmark.getAdvancedSettings().setRemoteProgram(cursor.getString(cursor.getColumnIndex("remote_program")));
bookmark.getAdvancedSettings().setWorkDir(cursor.getString(cursor.getColumnIndex("work_dir"))); bookmark.getAdvancedSettings().setWorkDir(cursor.getString(cursor.getColumnIndex("work_dir")));
bookmark.getDebugSettings().setAsyncChannel(
cursor.getInt(cursor.getColumnIndex("async_channel")) == 1 ? true : false);
bookmark.getDebugSettings().setAsyncTransport(
cursor.getInt(cursor.getColumnIndex("async_transport")) == 1 ? true : false);
bookmark.getDebugSettings().setAsyncInput(
cursor.getInt(cursor.getColumnIndex("async_input")) == 1 ? true : false);
bookmark.getDebugSettings().setAsyncUpdate(
cursor.getInt(cursor.getColumnIndex("async_update")) == 1 ? true : false);
bookmark.getDebugSettings().setDebugLevel(cursor.getInt(cursor.getColumnIndex("debug_level"))); bookmark.getDebugSettings().setDebugLevel(cursor.getInt(cursor.getColumnIndex("debug_level")));
readBookmarkSpecificColumns(bookmark, cursor); readBookmarkSpecificColumns(bookmark, cursor);
return bookmark; return bookmark;

View File

@ -106,8 +106,12 @@ public class BookmarkDB extends SQLiteOpenHelper
+ "security, " + "security, "
+ "remote_program, " + "remote_program, "
+ "work_dir, " + "work_dir, "
+ "async_channel, "
+ "async_transport, "
+ "async_input, "
+ "async_update, "
+ "console_mode, " + "console_mode, "
+ "debug_level ) " + "debug_level ) "
+ "VALUES ( " + "VALUES ( "
+ "'Test Server', " + "'Test Server', "
+ "'testservice.afreerdp.com', " + "'testservice.afreerdp.com', "
@ -115,7 +119,9 @@ public class BookmarkDB extends SQLiteOpenHelper
+ "'', " + "'', "
+ "'', " + "'', "
+ "3389, " + "3389, "
+ "1, 1, 2, 2, 0, 0, 0, 0, '', '', 0, 0);"; + "1, 1, 2, 2, 0, 0, 0, 0, "
+ "'', '', "
+ "1, 1, 1, 1, 0, 0);";
db.execSQL(sqlInsertDefaultSessionEntry); db.execSQL(sqlInsertDefaultSessionEntry);
} }
@ -149,6 +155,10 @@ public class BookmarkDB extends SQLiteOpenHelper
+ "security INTEGER, " + "security INTEGER, "
+ "remote_program TEXT, " + "remote_program TEXT, "
+ "work_dir TEXT, " + "work_dir TEXT, "
+ "async_channel INTEGER DEFAULT 0, "
+ "async_transport INTEGER DEFAULT 0, "
+ "async_input INTEGER DEFAULT 0, "
+ "async_update INTEGER DEFAULT 0, "
+ "console_mode INTEGER, " + "console_mode INTEGER, "
+ "debug_level INTEGER DEFAULT 0, " + "debug_level INTEGER DEFAULT 0, "

View File

@ -35,7 +35,9 @@ public class LibFreeRDP
boolean disableMenuAnimations, boolean disableTheming, boolean disableMenuAnimations, boolean disableTheming,
boolean enableFontSmoothing, boolean enableDesktopComposition); boolean enableFontSmoothing, boolean enableDesktopComposition);
private static native void freerdp_set_advanced_settings(int inst, String remoteProgram, String workDir); private static native void freerdp_set_advanced_settings(int inst,
String remoteProgram, String workDir, boolean async_channel,
boolean async_transport, boolean async_input, boolean async_update);
private static native void freerdp_set_data_directory(int inst, String directory); private static native void freerdp_set_data_directory(int inst, String directory);
@ -151,7 +153,11 @@ public class LibFreeRDP
flags.getDesktopComposition()); flags.getDesktopComposition());
BookmarkBase.AdvancedSettings advancedSettings = bookmark.getAdvancedSettings(); BookmarkBase.AdvancedSettings advancedSettings = bookmark.getAdvancedSettings();
freerdp_set_advanced_settings(inst, advancedSettings.getRemoteProgram(), advancedSettings.getWorkDir()); BookmarkBase.DebugSettings debugSettings = bookmark.getDebugSettings();
freerdp_set_advanced_settings(inst, advancedSettings.getRemoteProgram(),
advancedSettings.getWorkDir(), debugSettings.getAsyncChannel(),
debugSettings.getAsyncTransport(), debugSettings.getAsyncInput(),
debugSettings.getAsyncUpdate());
// drive redirection enabled? // drive redirection enabled?
if (advancedSettings.getRedirectSDCard()) if (advancedSettings.getRedirectSDCard())

View File

@ -52,7 +52,10 @@ public class RDPFileParser {
lines++; ok = false; lines++; ok = false;
if (errors > MAX_ERRORS || lines > MAX_LINES) if (errors > MAX_ERRORS || lines > MAX_LINES)
{
br.close();
throw new IOException("Parsing limits exceeded"); throw new IOException("Parsing limits exceeded");
}
String[] fields = line.split(":", 3); String[] fields = line.split(":", 3);
@ -81,6 +84,7 @@ public class RDPFileParser {
if (!ok) errors++; if (!ok) errors++;
} }
br.close();
} }
public String getString(String optionName) public String getString(String optionName)

View File

@ -3,5 +3,7 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View File

@ -503,8 +503,6 @@ static void* rpc_client_thread(void* arg)
CloseHandle(ReadEvent); CloseHandle(ReadEvent);
rpc_client_free(rpc);
return NULL; return NULL;
} }
@ -572,6 +570,8 @@ int rpc_client_stop(rdpRpc* rpc)
WaitForSingleObject(rpc->client->Thread, INFINITE); WaitForSingleObject(rpc->client->Thread, INFINITE);
rpc_client_free(rpc);
return 0; return 0;
} }

View File

@ -210,6 +210,9 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
UINT32 Pointer; UINT32 Pointer;
PTSG_PACKET packet; PTSG_PACKET packet;
UINT32 SwitchValue; UINT32 SwitchValue;
UINT32 MessageSwitchValue;
UINT32 IsMessagePresent;
UINT32 MsgBytes;
rdpRpc* rpc = tsg->rpc; rdpRpc* rpc = tsg->rpc;
PTSG_PACKET_CAPABILITIES tsgCaps; PTSG_PACKET_CAPABILITIES tsgCaps;
PTSG_PACKET_VERSIONCAPS versionCaps; PTSG_PACKET_VERSIONCAPS versionCaps;
@ -228,7 +231,7 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
packet = (PTSG_PACKET) malloc(sizeof(TSG_PACKET)); packet = (PTSG_PACKET) malloc(sizeof(TSG_PACKET));
ZeroMemory(packet, sizeof(TSG_PACKET)); ZeroMemory(packet, sizeof(TSG_PACKET));
offset = 4; offset = 4; // Skip Packet Pointer
packet->packetId = *((UINT32*) &buffer[offset]); /* PacketId */ packet->packetId = *((UINT32*) &buffer[offset]); /* PacketId */
SwitchValue = *((UINT32*) &buffer[offset + 4]); /* SwitchValue */ SwitchValue = *((UINT32*) &buffer[offset + 4]); /* SwitchValue */
@ -245,21 +248,24 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
CopyMemory(&packetCapsResponse->pktQuarEncResponse.nonce, &buffer[offset + 24], 16); /* Nonce */ CopyMemory(&packetCapsResponse->pktQuarEncResponse.nonce, &buffer[offset + 24], 16); /* Nonce */
offset += 40; offset += 40;
Pointer = *((UINT32*) &buffer[offset]); /* Ptr */ Pointer = *((UINT32*) &buffer[offset]); /* VersionCapsPtr */
offset += 4; offset += 4;
if ((Pointer == 0x0002000C) || (Pointer == 0x00020008)) if ((Pointer == 0x0002000C) || (Pointer == 0x00020008))
{ {
/* Not sure exactly what this is */ offset += 4; /* MsgID */
offset += 4; /* 0x00000001 (4 bytes) */ offset += 4; /* MsgType */
offset += 4; /* 0x00000001 (4 bytes) */ IsMessagePresent = *((UINT32*) &buffer[offset]);
offset += 4; /* 0x00000000 (4 bytes) */ offset += 4;
offset += 4; /* 0x00000001 (4 bytes) */ MessageSwitchValue = *((UINT32*) &buffer[offset]);
DEBUG_TSG("IsMessagePresent %d MessageSwitchValue %d",
IsMessagePresent, MessageSwitchValue);
offset += 4;
} }
if (packetCapsResponse->pktQuarEncResponse.certChainLen > 0) if (packetCapsResponse->pktQuarEncResponse.certChainLen > 0)
{ {
Pointer = *((UINT32*) &buffer[offset]); /* Ptr (4 bytes): 0x00020014 */ Pointer = *((UINT32*) &buffer[offset]); /* MsgPtr (4 bytes): 0x00020014 */
offset += 4; offset += 4;
offset += 4; /* MaxCount (4 bytes) */ offset += 4; /* MaxCount (4 bytes) */
@ -304,7 +310,7 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
Pointer = *((UINT32*) &buffer[offset]); /* TsgCapsPtr */ Pointer = *((UINT32*) &buffer[offset]); /* TsgCapsPtr */
versionCaps->numCapabilities = *((UINT32*) &buffer[offset + 4]); /* NumCapabilities */ versionCaps->numCapabilities = *((UINT32*) &buffer[offset + 4]); /* NumCapabilities */
versionCaps->majorVersion = *((UINT16*) &buffer[offset + 8]); /* MajorVersion */ versionCaps->majorVersion = *((UINT16*) &buffer[offset + 8]); /* MajorVersion */
versionCaps->majorVersion = *((UINT16*) &buffer[offset + 10]); /* MinorVersion */ versionCaps->minorVersion = *((UINT16*) &buffer[offset + 10]); /* MinorVersion */
versionCaps->quarantineCapabilities = *((UINT16*) &buffer[offset + 12]); /* QuarantineCapabilities */ versionCaps->quarantineCapabilities = *((UINT16*) &buffer[offset + 12]); /* QuarantineCapabilities */
offset += 14; offset += 14;
@ -334,13 +340,45 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
tsgCaps->tsgPacket.tsgCapNap.capabilities = *((UINT32*) &buffer[offset]); /* Capabilities */ tsgCaps->tsgPacket.tsgCapNap.capabilities = *((UINT32*) &buffer[offset]); /* Capabilities */
offset += 4; offset += 4;
/* ??? (16 bytes): all zeros */ switch(MessageSwitchValue)
offset += 16; {
case TSG_ASYNC_MESSAGE_CONSENT_MESSAGE:
case TSG_ASYNC_MESSAGE_SERVICE_MESSAGE:
offset += 4; // IsDisplayMandatory
offset += 4; // IsConsent Mandatory
MsgBytes = *((UINT32*) &buffer[offset]);
offset += 4;
Pointer = *((UINT32*) &buffer[offset]);
offset += 4;
if(Pointer) {
offset += 4; // MaxCount
offset += 8; // UnicodeString Offset, Length
}
if(MsgBytes > TSG_MESSAGING_MAX_MESSAGE_LENGTH) {
fprintf(stderr, "Out of Spec Message Length %d");
return FALSE;
}
offset += MsgBytes;
break;
case TSG_ASYNC_MESSAGE_REAUTH:
rpc_offset_align(&offset, 8);
offset += 8; // UINT64 TunnelContext, not to be confused with
// the ContextHandle TunnelContext below.
break;
default:
fprintf(stderr, "Unexpected Message Type: 0x%X\n", MessageSwitchValue);
return FALSE;
}
rpc_offset_align(&offset, 4);
/* TunnelContext (20 bytes) */ /* TunnelContext (20 bytes) */
CopyMemory(&tsg->TunnelContext.ContextType, &buffer[offset], 4); /* ContextType */ CopyMemory(&tsg->TunnelContext.ContextType, &buffer[offset], 4); /* ContextType */
CopyMemory(tsg->TunnelContext.ContextUuid, &buffer[offset + 4], 16); /* ContextUuid */ CopyMemory(tsg->TunnelContext.ContextUuid, &buffer[offset + 4], 16); /* ContextUuid */
offset += 20; offset += 20;
// UINT32 TunnelId
// HRESULT ReturnValue
#ifdef WITH_DEBUG_TSG #ifdef WITH_DEBUG_TSG
fprintf(stderr, "TSG TunnelContext:\n"); fprintf(stderr, "TSG TunnelContext:\n");

View File

@ -121,6 +121,7 @@ typedef struct _tsendpointinfo
#define TSG_MESSAGING_CAP_CONSENT_SIGN 0x00000004 #define TSG_MESSAGING_CAP_CONSENT_SIGN 0x00000004
#define TSG_MESSAGING_CAP_SERVICE_MSG 0x00000008 #define TSG_MESSAGING_CAP_SERVICE_MSG 0x00000008
#define TSG_MESSAGING_CAP_REAUTH 0x00000010 #define TSG_MESSAGING_CAP_REAUTH 0x00000010
#define TSG_MESSAGING_MAX_MESSAGE_LENGTH 65536
/* Error Codes */ /* Error Codes */

View File

@ -22,7 +22,11 @@ set(${MODULE_PREFIX}_SRCS
interlocked.c) interlocked.c)
if(MSVC AND (NOT MONOLITHIC_BUILD)) if(MSVC AND (NOT MONOLITHIC_BUILD))
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) if (${CMAKE_SYSTEM_VERSION} GREATER "5.1")
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
else()
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module_5.1.def)
endif()
endif() endif()
add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT" add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT"

View File

@ -1,6 +1,7 @@
LIBRARY "libwinpr-interlocked" LIBRARY "libwinpr-interlocked"
EXPORTS EXPORTS
InterlockedCompareExchange64 @1 ; Not required on windows > 5.1
; InterlockedCompareExchange64 @1
InitializeListHead @2 InitializeListHead @2
IsListEmpty @3 IsListEmpty @3
RemoveEntryList @4 RemoveEntryList @4

View File

@ -0,0 +1,13 @@
LIBRARY "libwinpr-interlocked"
EXPORTS
InterlockedCompareExchange64 @1
InitializeListHead @2
IsListEmpty @3
RemoveEntryList @4
InsertHeadList @5
RemoveHeadList @6
InsertTailList @7
RemoveTailList @8
AppendTailList @9
PushEntryList @10
PopEntryList @11