Merge pull request #3097 from akallabeth/android_api_upgrade_v4

Android api upgrade and restructuring
This commit is contained in:
Martin Fleisz 2016-02-04 16:20:59 +01:00
commit 56a0c4c336
297 changed files with 3657 additions and 4109 deletions

View File

@ -81,17 +81,27 @@ else()
endif()
set(FREERDP_INCLUDE_DIR "include/freerdp${FREERDP_VERSION_MAJOR}/")
# Make paths absolute
if (CMAKE_INSTALL_PREFIX)
get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
endif()
if (FREERDP_EXTERNAL_PATH)
get_filename_component (FREERDP_EXTERNAL_PATH "${FREERDP_EXTERNAL_PATH}" ABSOLUTE)
endif()
# Allow to search the host machine for git
if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
endif(ANDROID OR IOS)
include(GetGitRevisionDescription)
git_get_exact_tag(GIT_REVISION --tags --always)
if (${GIT_REVISION} STREQUAL "n/a")
git_rev_parse(GIT_REVISION --short)
git_rev_parse (GIT_REVISION --short)
endif()
if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
endif(ANDROID OR IOS)
message(STATUS "Git Revision ${GIT_REVISION}")
@ -105,7 +115,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
if(NOT DEFINED BUILD_SHARED_LIBS)
if(ANDROID OR IOS OR APPLE)
if(IOS OR APPLE)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
@ -299,11 +309,11 @@ if(MSVC)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
if(CMAKE_BUILD_TYPE STREQUAL "Release")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
endif()
endif()
@ -402,9 +412,9 @@ if(APPLE)
# Temporarily disabled, causes the cmake script to be reexecuted, causing the compilation to fail.
# Workaround: specify the parameter in the command-line
# if(WITH_CLANG)
# set(CMAKE_C_COMPILER "clang")
# endif()
# if(WITH_CLANG)
# set(CMAKE_C_COMPILER "clang")
# endif()
if (WITH_VERBOSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v")
@ -416,14 +426,18 @@ endif(APPLE)
if(OPENBSD)
set(WITH_MANPAGES "ON")
set(WITH_ALSA "OFF")
set(WITH_PULSE "OFF")
set(WITH_OSS "ON")
set(WITH_PULSE "OFF")
set(WITH_OSS "ON")
set(WITH_WAYLAND "OFF")
endif()
# Android
if(ANDROID)
set(WITH_LIBRARY_VERSIONING "OFF")
set(WITH_LIBRARY_VERSIONING "OFF")
if (${ANDROID_ABI} STREQUAL "armeabi")
set (WITH_NEON OFF)
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_definitions(-DNDK_DEBUG=1)
@ -435,40 +449,23 @@ if(ANDROID)
endif()
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog")
if (NOT FREERDP_EXTERNAL_JPEG_PATH)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg8d")
set(FREERDP_EXTERNAL_JPEG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg8d")
if (NOT FREERDP_EXTERNAL_PATH)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/")
set (FREERDP_EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/")
else()
message(STATUS "FREERDP_EXTERNAL_SSL_PATH not set! - Needs to be set if openssl is not found in the android NDK (which usually isn't)")
message(STATUS "FREERDP_EXTERNAL_PATH not set!")
endif()
endif()
if (NOT FREERDP_EXTERNAL_SSL_PATH)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
set(FREERDP_EXTERNAL_SSL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
else()
message(STATUS "FREERDP_EXTERNAL_SSL_PATH not set! - Needs to be set if openssl is not found in the android NDK (which usually isn't)")
endif()
if(WITH_GPROF)
if (NOT FREERDP_EXTERNAL_PROFILER_PATH)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/android-ndk-profiler")
set(FREERDP_EXTERNAL_PROFILER_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/external/android-ndk-profiler")
else()
message(STATUS "FREERDP_EXTERNAL_PROFILER_PATH not set!")
endif()
endif()
endif()
endif()
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_EXTERNAL_SSL_PATH} ${FREERDP_EXTERNAL_JPEG_PATH})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_EXTERNAL_PROFILER_PATH})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/client/Android/FreeRDPCore/jni/${ANDROID_ABI})
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/regenerate_jni_headers.sh.cmake
${CMAKE_BINARY_DIR}/scripts/regenerate_jni_headers.sh @ONLY)
list (APPEND CMAKE_INCLUDE_PATH ${FREERDP_EXTERNAL_PATH}/include)
list (APPEND CMAKE_LIBRARY_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/ )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )
if (WITH_GPROF)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/gprof_generate.sh.cmake ${CMAKE_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/gprof_generate.sh.cmake
${CMAKE_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
endif(WITH_GPROF)
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
@ -482,9 +479,9 @@ if(NOT WIN32)
endif()
if(WITH_VALGRIND_MEMCHECK)
check_include_files(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
check_include_files(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
else()
unset(HAVE_VALGRIND_MEMCHECK_H CACHE)
unset(HAVE_VALGRIND_MEMCHECK_H CACHE)
endif()
if(UNIX OR CYGWIN)
@ -622,6 +619,21 @@ if(APPLE)
set(OPENSLES_FEATURE_TYPE "DISABLED")
endif()
if(UNIX AND NOT ANDROID)
set(WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE "RECOMMENDED")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE "systemd journal appender")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION "allows to export wLog to systemd journal")
#include(Findlibsystemd)
find_feature(libsystemd ${WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION})
if(LIBSYSTEMD_FOUND)
set(HAVE_JOURNALD_H TRUE)
else()
unset(HAVE_JOURNALD_H)
endif()
endif(UNIX AND NOT ANDROID)
if(ANDROID)
set(X11_FEATURE_TYPE "DISABLED")
set(WAYLAND_FEATURE_TYPE "DISABLED")
@ -637,21 +649,6 @@ if(ANDROID)
set(OPENSLES_FEATURE_TYPE "REQUIRED")
endif()
if(UNIX)
set(WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE "RECOMMENDED")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE "systemd journal appender")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION "allows to export wLog to systemd journal")
#include(Findlibsystemd)
find_feature(libsystemd ${WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION})
if(LIBSYSTEMD_FOUND)
set(HAVE_JOURNALD_H TRUE)
else()
unset(HAVE_JOURNALD_H)
endif()
endif(UNIX)
find_feature(X11 ${X11_FEATURE_TYPE} ${X11_FEATURE_PURPOSE} ${X11_FEATURE_DESCRIPTION})
find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAND_FEATURE_DESCRIPTION})
find_feature(DirectFB ${DIRECTFB_FEATURE_TYPE} ${DIRECTFB_FEATURE_PURPOSE} ${DIRECTFB_FEATURE_DESCRIPTION})
@ -724,8 +721,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DI
# RPATH configuration
if(CMAKE_SKIP_RPATH)
set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
endif()
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

View File

@ -1,15 +0,0 @@
# Ignore directories
bin/
obj/
gen/
jni/external/*
!libs
libs/armeabi*
AndroidManifest.xml
local.properties
!.project
appcompat_v7
FreeRDPCore/project.properties
FreeRDPCore/src/com/freerdp/freerdpcore/utils/BuildConfiguration.java
aFreeRDP/project.properties

View File

@ -1,6 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# Android Client
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2013 Bernhard Miklautz <bernhard.miklautz@thincast.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -15,68 +16,39 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (NOT ANDROID_NDK)
message(FATAL_ERROR "ANDROID_NDK not set but required for building android native library.")
set(MODULE_NAME "freerdp-android")
set(MODULE_PREFIX "FREERDP_CLIENT_ANDROID")
include_directories(.)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-sign")
endif()
set(CMAKE_PROGRAM_PATH ${ANDROID_NDK})
find_program(NDK_COMMAND ndk-build CMAKE_FIND_ROOT_PATH_BOTH)
set(${MODULE_PREFIX}_SRCS
android_event.c
android_event.h
android_freerdp.c
android_freerdp.h
android_jni_utils.c
android_jni_utils.h
android_jni_callback.c
android_jni_callback.h)
if(NDK_COMMAND STREQUAL "NDK_COMMAND-NOTFOUND")
message(FATAL_ERROR "ndk-build not found but required to build native lib")
if(WITH_CLIENT_CHANNELS)
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
android_cliprdr.c
android_cliprdr.h)
endif()
set(NDK_LIB_CFG "${CMAKE_CURRENT_BINARY_DIR}/FreeRDPCore/jni/Android.mk")
if(ANDROID_BUILD_JAVA)
if (NOT ANDROID_SDK)
message(FATAL_ERROR "ANDROID_SDK not set but required for building the java gui (ANDROID_BUILD_JAVA)")
endif()
# And isn't shiped with the android ndk/sdk so
# we need to find it on the local machine
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
find_program(ANT_COMMAND ant)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
if(ANT_COMMAND STREQUAL "ANT_COMMAND-NOTFOUND")
message(FATAL_ERROR "ant not found but required to build android java")
endif()
endif(ANDROID_BUILD_JAVA)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr freerdp)
set(ANDROID_COMMAND "${ANDROID_SDK}/tools/android")
if(NOT EXISTS ${ANDROID_COMMAND})
message(FATAL_ERROR "android not found but required to build android java")
endif()
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} dl)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} log)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} jnigraphics)
if(ANDROID_BUILD_JAVA_DEBUG)
set(ANDROID_BUILD_TYPE "debug")
else()
set(ANDROID_BUILD_TYPE "release")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(ANDROID_DEBUG_ENABLE "true")
set(NDK_DEBUG "1")
else()
set(ANDROID_DEBUG_ENABLE "false")
set(NDK_DEBUG "0")
endif()
set(APPCOMPAT_DIR "${CMAKE_CURRENT_BINARY_DIR}/appcompat_v7")
set(supportdir "${ANDROID_SDK}/extras/android/support/v7/appcompat")
set(compatibilitydir "${ANDROID_SDK}/extras/android/compatibility/v7/appcompat")
if(EXISTS "${supportdir}" AND IS_DIRECTORY "${supportdir}")
add_custom_target(copy_appcompat ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${supportdir}" ${APPCOMPAT_DIR}
COMMAND ${ANDROID_COMMAND} update lib-project -p ${APPCOMPAT_DIR} -t android-${ANDROID_APP_TARGET_SDK}
)
elseif(EXISTS "${compatibilitydir}" AND IS_DIRECTORY "${compatibilitydir}")
add_custom_target(copy_appcompat ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${compatibilitydir}" ${APPCOMPAT_DIR}
COMMAND ${ANDROID_COMMAND} update lib-project -p ${APPCOMPAT_DIR} -t android-${ANDROID_APP_TARGET_SDK}
)
else()
message( FATAL_ERROR "${ANDROID_SDK}/extras/android/{support|compatibility}/v7/appcompat directory not found. Please install a recent version of Android Support Library, CMake will now exit." )
endif()
add_subdirectory(FreeRDPCore)
add_subdirectory(aFreeRDP)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT AndroidTargets)

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<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.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -1,4 +0,0 @@
ant.properties
build.xml
jni/Android.mk
jni/Application.mk

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FreeRDPCore</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@ -1,48 +0,0 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# Android Client
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2013 Bernhard Miklautz <bernhard.miklautz@thincast.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(ANDROID_PACKAGE_NAME "aFreeRDPCore")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake
${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build.xml.cmake
${CMAKE_CURRENT_BINARY_DIR}/build.xml @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/project.properties.cmake
${CMAKE_CURRENT_BINARY_DIR}/project.properties @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ant.properties.cmake
${CMAKE_CURRENT_BINARY_DIR}/ant.properties @ONLY)
# Generate a Java class with static members set to the CMake
# configuration properties.
set(JAVA_CFG "src/com/freerdp/freerdpcore/utils/BuildConfiguration.java")
set(JAVA_CFG_OUT "${CMAKE_CURRENT_BINARY_DIR}/${JAVA_CFG}")
set(JAVA_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/${JAVA_CFG}.in")
CONFIGURE_FILE(${JAVA_CFG_IN} ${JAVA_CFG_OUT})
file(COPY res DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
if (ANDROID_SDK)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/local.properties.cmake
${CMAKE_CURRENT_BINARY_DIR}/local.properties @ONLY)
endif()
add_subdirectory(jni)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "gen;bin;obj;libs")

View File

@ -1,20 +0,0 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
build.dir=@CMAKE_CURRENT_BINARY_DIR@
source.path=@CMAKE_CURRENT_SOURCE_DIR@/src:@CMAKE_CURRENT_BINARY_DIR@/src
out.dir=@CMAKE_CURRENT_BINARY_DIR@/bin

View File

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="." default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View File

@ -1,8 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := freerdp-android
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfreerdp-android.so
LOCAL_EXPORT_C_INCLUDES := ../../../../include
include $(PREBUILT_SHARED_LIBRARY)

View File

@ -1 +0,0 @@
APP_ABI := @ANDROID_ABI@

View File

@ -1,73 +0,0 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# Android Client
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2013 Bernhard Miklautz <bernhard.miklautz@thincast.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(MODULE_NAME "freerdp-android")
set(MODULE_PREFIX "FREERDP_CLIENT_ANDROID")
include_directories(.)
include_directories(generated)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Application.mk.cmake
${CMAKE_CURRENT_BINARY_DIR}/Application.mk @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Android.mk.cmake
${CMAKE_CURRENT_BINARY_DIR}/Android.mk @ONLY)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-sign")
endif()
set(${MODULE_PREFIX}_SRCS
android_debug.h
android_event.c
android_event.h
android_freerdp.c
android_freerdp.h
android_jni_utils.c
android_jni_utils.h
android_jni_callback.c
android_jni_callback.h)
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
generated/android_freerdp_jni.c
generated/android_freerdp_jni.h)
if(WITH_CLIENT_CHANNELS)
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
android_cliprdr.c
android_cliprdr.h)
endif()
add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr freerdp)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} dl)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} log)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} jnigraphics)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${ANDROID_ABI}")
set_target_properties(${MODULE_NAME}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${ANDROID_ABI}")
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Android")
get_property(LIB_ABSNAME TARGET ${MODULE_NAME} PROPERTY LOCATION)

View File

@ -1,31 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Android Debug Interface
*
* Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
*
* 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/.
*/
#ifndef FREERDP_ANDROID_DEBUG_H
#define FREERDP_ANDROID_DEBUG_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <freerdp/log.h>
#define ANDROID_TAG CLIENT_TAG("android")
#ifdef WITH_DEBUG_ANDROID_JNI
#define DEBUG_ANDROID(fmt, ...) WLog_DBG(ANDROID_TAG, fmt, ## __VA_ARGS__)
#else
#define DEBUG_ANDROID(fmt, ...) do { } while (0)
#endif
#endif /* FREERDP_ANDROID_DEBUG_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +0,0 @@
/*
Android JNI Client Layer
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
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/.
*/
#ifndef __ANDROID_FREERDP_H
#define __ANDROID_FREERDP_H
#include <jni.h>
#include <winpr/crt.h>
#include <winpr/clipboard.h>
#include <freerdp/freerdp.h>
#include <freerdp/client/cliprdr.h>
#include "android_event.h"
struct android_context
{
rdpContext rdpCtx;
ANDROID_EVENT_QUEUE* event_queue;
HANDLE thread;
BOOL is_connected;
BOOL clipboardSync;
wClipboard* clipboard;
UINT32 numServerFormats;
UINT32 requestedFormatId;
HANDLE clipboardRequestEvent;
CLIPRDR_FORMAT* serverFormats;
CliprdrClientContext* cliprdr;
UINT32 clipboardCapabilities;
};
typedef struct android_context androidContext;
JNIEXPORT jint JNICALL jni_freerdp_new(JNIEnv *env, jclass cls);
JNIEXPORT void JNICALL jni_freerdp_free(JNIEnv *env, jclass cls, jint instance);
JNIEXPORT jboolean JNICALL jni_freerdp_connect(JNIEnv *env, jclass cls, jint instance);
JNIEXPORT jboolean JNICALL jni_freerdp_disconnect(JNIEnv *env, jclass cls, jint instance);
JNIEXPORT jboolean JNICALL jni_freerdp_cancel_connection(JNIEnv *env, jclass cls, jint instance);
JNIEXPORT jboolean JNICALL jni_freerdp_set_connection_info(JNIEnv *env, jclass cls, jint instance,
jstring jhostname, jstring jusername, jstring jpassword, jstring jdomain, jint width,
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,
jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition);
JNIEXPORT jboolean 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 jboolean JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath);
JNIEXPORT jboolean JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env, jclass cls, jint instance, jint redirect);
JNIEXPORT jboolean JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
JNIEXPORT jboolean JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jint instance, jstring jgatewayhostname, jint port, jstring jgatewayusername, jstring jgatewaypassword, jstring jgatewaydomain);
JNIEXPORT jboolean JNICALL jni_freerdp_set_data_directory(JNIEnv *env, jclass cls, jint instance, jstring jdirectory);
JNIEXPORT jboolean JNICALL jni_freerdp_update_graphics(JNIEnv *env, jclass cls, jint instance, jobject bitmap, jint x, jint y, jint width, jint height);
JNIEXPORT jboolean JNICALL jni_freerdp_send_cursor_event(JNIEnv *env, jclass cls, jint instance, jint x, jint y, jint flags);
JNIEXPORT jboolean JNICALL jni_freerdp_send_key_event(JNIEnv *env, jclass cls, jint instance, jint keycode, jboolean down);
JNIEXPORT jboolean JNICALL jni_freerdp_send_unicodekey_event(JNIEnv *env, jclass cls, jint instance, jint keycode);
JNIEXPORT jboolean JNICALL jni_freerdp_send_clipboard_data(JNIEnv *env, jclass cls, jint instance, jstring jdata);
JNIEXPORT jstring JNICALL jni_freerdp_get_version(JNIEnv *env, jclass cls);
#endif /* __ANDROID_FREERDP_H */

View File

@ -1,142 +0,0 @@
/*
FreeRDP: A Remote Desktop Protocol client.
Android JNI Bindings and Native Code
Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "android_freerdp.h"
#include "android_freerdp_jni.h"
JNIEXPORT jint JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1new(JNIEnv *env, jclass cls)
{
return jni_freerdp_new(env, cls);
}
JNIEXPORT void JNICALL JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1free(JNIEnv *env, jclass cls, jint instance)
{
jni_freerdp_free(env, cls, instance);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1connect(JNIEnv *env, jclass cls, jint instance)
{
return jni_freerdp_connect(env, cls, instance);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1disconnect(JNIEnv *env, jclass cls, jint instance)
{
return jni_freerdp_disconnect(env, cls, instance);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1cancel_1connection(JNIEnv *env, jclass cls, jint instance)
{
return jni_freerdp_cancel_connection(env, cls, instance);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1connection_1info(JNIEnv *env, jclass cls, jint instance,
jstring jhostname, jstring jusername, jstring jpassword, jstring jdomain, jint width, jint height, jint color_depth, jint port,
jboolean console, jint security, jstring certname)
{
return jni_freerdp_set_connection_info(env, cls, instance, jhostname, jusername, jpassword, jdomain,
width, height, color_depth, port, console, security, certname);
}
JNIEXPORT jboolean 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)
{
return jni_freerdp_set_advanced_settings(env, cls, instance, remote_program, work_dir,
async_channel, async_transport, async_input, async_update);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1data_1directory(JNIEnv *env, jclass cls, jint instance, jstring directory)
{
return jni_freerdp_set_data_directory(env, cls, instance, directory);
}
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1performance_1flags(
JNIEnv *env, jclass cls, jint instance, jboolean remotefx, jboolean disableWallpaper, jboolean disableFullWindowDrag,
jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition)
{
jni_freerdp_set_performance_flags(env, cls, instance, remotefx, disableWallpaper, disableFullWindowDrag, disableMenuAnimations, disableTheming, enableFontSmoothing, enableDesktopComposition);
}
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1clipboard_1redirection
(JNIEnv *env, jclass cls, jint inst, jboolean enable)
{
jni_freerdp_set_clipboard_redirection(env, cls, inst, enable);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection
(JNIEnv *env, jclass cls, jint inst, jint redirect)
{
return jni_freerdp_set_sound_redirection(env, cls, inst, redirect);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1microphone_1redirection
(JNIEnv *env, jclass cls, jint inst, jboolean redirect)
{
return jni_freerdp_set_microphone_redirection(env, cls, inst, redirect);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1drive_1redirection
(JNIEnv *env, jclass cls, jint inst, jstring path)
{
return jni_freerdp_set_drive_redirection(env, cls, inst, path);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1gateway_1info
(JNIEnv *env, jclass cls, jint inst, jstring hostname, jint port, jstring username, jstring password, jstring domain)
{
return jni_freerdp_set_gateway_info(env, cls, inst, hostname, port, username, password, domain);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1update_1graphics(
JNIEnv *env, jclass cls, jint instance, jobject bitmap, jint x, jint y, jint width, jint height)
{
return jni_freerdp_update_graphics(env, cls, instance, bitmap, x, y, width, height);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1cursor_1event(
JNIEnv *env, jclass cls, jint instance, jint x, jint y, jint flags)
{
return jni_freerdp_send_cursor_event(env, cls, instance, x, y, flags);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1key_1event(
JNIEnv *env, jclass cls, jint instance, jint keycode, jboolean down)
{
return jni_freerdp_send_key_event(env, cls, instance, keycode, down);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1unicodekey_1event
(JNIEnv *env, jclass cls, jint instance, jint keycode)
{
return jni_freerdp_send_unicodekey_event(env, cls, instance, keycode);
}
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1clipboard_1data
(JNIEnv *env, jclass cls, jint instance, jstring data)
{
return jni_freerdp_send_clipboard_data(env, cls, instance, data);
}
JNIEXPORT jstring JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1get_1version(JNIEnv *env, jclass cls)
{
return jni_freerdp_get_version(env, cls);
}

View File

@ -1,173 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_freerdp_freerdpcore_services_LibFreeRDP */
#ifndef _Included_com_freerdp_freerdpcore_services_LibFreeRDP
#define _Included_com_freerdp_freerdpcore_services_LibFreeRDP
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_new
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1new
(JNIEnv *, jclass);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_free
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1free
(JNIEnv *, jclass, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_connect
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1connect
(JNIEnv *, jclass, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_disconnect
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1disconnect
(JNIEnv *, jclass, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_cancel_connection
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1cancel_1connection
(JNIEnv *, jclass, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_connection_info
* Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIIIZILjava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1connection_1info
(JNIEnv *, jclass, jint, jstring, jstring, jstring, jstring, jint, jint, jint, jint, jboolean, jint, jstring);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_performance_flags
* Signature: (IZZZZZZZ)V
*/
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1performance_1flags
(JNIEnv *, jclass, jint, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_advanced_settings
* Signature: (ILjava/lang/String;Ljava/lang/String;ZZZZ)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1advanced_1settings
(JNIEnv *, jclass, jint, jstring, jstring, jboolean, jboolean, jboolean, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_data_directory
* Signature: (ILjava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1data_1directory
(JNIEnv *, jclass, jint, jstring);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_clipboard_redirection
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1clipboard_1redirection
(JNIEnv *, jclass, jint, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_sound_redirection
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection
(JNIEnv *, jclass, jint, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_microphone_redirection
* Signature: (IZ)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1microphone_1redirection
(JNIEnv *, jclass, jint, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_drive_redirection
* Signature: (ILjava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1drive_1redirection
(JNIEnv *, jclass, jint, jstring);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_gateway_info
* Signature: (ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1gateway_1info
(JNIEnv *, jclass, jint, jstring, jint, jstring, jstring, jstring);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_update_graphics
* Signature: (ILandroid/graphics/Bitmap;IIII)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1update_1graphics
(JNIEnv *, jclass, jint, jobject, jint, jint, jint, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_send_cursor_event
* Signature: (IIII)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1cursor_1event
(JNIEnv *, jclass, jint, jint, jint, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_send_key_event
* Signature: (IIZ)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1key_1event
(JNIEnv *, jclass, jint, jint, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_send_unicodekey_event
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1unicodekey_1event
(JNIEnv *, jclass, jint, jint);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_send_clipboard_data
* Signature: (ILjava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1clipboard_1data
(JNIEnv *, jclass, jint, jstring);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_get_version
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1get_1version
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>

View File

@ -1,2 +0,0 @@
# This file is automatically generated by cmake.
sdk.dir=@ANDROID_SDK@

View File

@ -1,16 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-@ANDROID_APP_TARGET_SDK@
android.library=true
android.library.reference.1=../appcompat_v7

View File

@ -1,214 +0,0 @@
/*
Android Main Application
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
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/.
*/
package com.freerdp.freerdpcore.application;
import android.app.Application;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;
import java.util.*;
import com.freerdp.freerdpcore.application.SessionState;
import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.services.BookmarkDB;
import com.freerdp.freerdpcore.services.HistoryDB;
import com.freerdp.freerdpcore.services.LibFreeRDP;
import com.freerdp.freerdpcore.services.ManualBookmarkGateway;
import com.freerdp.freerdpcore.services.QuickConnectHistoryGateway;
public class GlobalApp extends Application implements LibFreeRDP.EventListener
{
private static Map<Integer, SessionState> sessionMap;
public static boolean ConnectedTo3G = false;
// event notification defines
public static final String EVENT_TYPE = "EVENT_TYPE";
public static final String EVENT_PARAM = "EVENT_PARAM";
public static final String EVENT_STATUS = "EVENT_STATUS";
public static final String EVENT_ERROR = "EVENT_ERROR";
public static final String ACTION_EVENT_FREERDP = "com.freerdp.freerdp.event.freerdp";
public static final int FREERDP_EVENT_CONNECTION_SUCCESS = 1;
public static final int FREERDP_EVENT_CONNECTION_FAILURE = 2;
public static final int FREERDP_EVENT_DISCONNECTED = 3;
private static BookmarkDB bookmarkDB;
private static ManualBookmarkGateway manualBookmarkGateway;
private static HistoryDB historyDB;
private static QuickConnectHistoryGateway quickConnectHistoryGateway;
// timer for disconnecting sessions after the screen was turned off
private static Timer disconnectTimer = null;
// TimerTask for disconnecting sessions after screen was turned off
private static class DisconnectTask extends TimerTask
{
@Override
public void run() {
Log.v("DisconnectTask", "Doing action");
// disconnect any running rdp session
Collection<SessionState> sessions = GlobalApp.getSessions();
for (SessionState session : sessions)
{
LibFreeRDP.disconnect(session.getInstance());
}
}
}
public GlobalApp()
{
sessionMap = Collections.synchronizedMap(new HashMap<Integer, SessionState>());
GlobalApp.load();
LibFreeRDP.setEventListener(this);
}
@Override
public void onCreate()
{
super.onCreate();
bookmarkDB = new BookmarkDB(this);
manualBookmarkGateway = new ManualBookmarkGateway(bookmarkDB);
historyDB = new HistoryDB(this);
quickConnectHistoryGateway = new QuickConnectHistoryGateway(historyDB);
GlobalSettings.init(this);
ConnectedTo3G = NetworkStateReceiver.isConnectedTo3G(this);
// init screen receiver here (this can't be declared in AndroidManifest - refer to:
// http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(new ScreenReceiver(), filter);
}
public static ManualBookmarkGateway getManualBookmarkGateway()
{
return manualBookmarkGateway;
}
public static QuickConnectHistoryGateway getQuickConnectHistoryGateway()
{
return quickConnectHistoryGateway;
}
static private void load()
{
final String libname = "freerdp-android";
final String LD_PATH = System.getProperty("java.library.path");
Log.v("LibFreeRDP", "Trying to load library " + libname + " from LD_PATH: " + LD_PATH);
try {
System.loadLibrary(libname);
} catch (UnsatisfiedLinkError e) {
Log.e("LibFreeRDP", e.toString());
}
}
// Disconnect handling for Screen on/off events
static public void startDisconnectTimer()
{
int timeoutMinutes = GlobalSettings.getDisconnectTimeout();
if (timeoutMinutes > 0)
{
// start disconnect timeout...
disconnectTimer = new Timer();
disconnectTimer.schedule(new DisconnectTask(), timeoutMinutes * 60 * 1000);
}
}
static public void cancelDisconnectTimer()
{
// cancel any pending timer events
if (disconnectTimer != null)
{
disconnectTimer.cancel();
disconnectTimer.purge();
disconnectTimer = null;
}
}
// RDP session handling
static public SessionState createSession(BookmarkBase bookmark)
{
SessionState session = new SessionState(LibFreeRDP.newInstance(), bookmark);
sessionMap.put(Integer.valueOf(session.getInstance()), session);
return session;
}
static public SessionState getSession(int instance)
{
return sessionMap.get(instance);
}
static public Collection<SessionState> getSessions()
{
// return a copy of the session items
return new ArrayList<SessionState>(sessionMap.values());
}
static public void freeSession(int instance)
{
if (GlobalApp.sessionMap.containsKey(instance))
{
GlobalApp.sessionMap.remove(instance);
LibFreeRDP.freeInstance(instance);
}
}
// helper to send FreeRDP notifications
private void sendRDPNotification(int type, int param)
{
// send broadcast
Intent intent = new Intent(ACTION_EVENT_FREERDP);
intent.putExtra(EVENT_TYPE, type);
intent.putExtra(EVENT_PARAM, param);
sendBroadcast(intent);
}
// //////////////////////////////////////////////////////////////////////
// Implementation of LibFreeRDP.EventListener
public void OnConnectionSuccess(int instance)
{
Log.v("LibFreeRDP", "OnConnectionSuccess");
sendRDPNotification(FREERDP_EVENT_CONNECTION_SUCCESS, instance);
}
public void OnConnectionFailure(int instance)
{
Log.v("LibFreeRDP", "OnConnectionFailure");
// send notification to session activity
sendRDPNotification(FREERDP_EVENT_CONNECTION_FAILURE, instance);
}
public void OnDisconnecting(int instance)
{
Log.v("LibFreeRDP", "OnDisconnecting");
// send disconnect notification
sendRDPNotification(FREERDP_EVENT_DISCONNECTED, instance);
}
public void OnDisconnected(int instance)
{
Log.v("LibFreeRDP", "OnDisconnected");
}
}

View File

@ -1,228 +0,0 @@
/*
Android Bookmark Database
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
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/.
*/
package com.freerdp.freerdpcore.services;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import android.content.Context;
import android.provider.BaseColumns;
import android.util.Log;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class BookmarkDB extends SQLiteOpenHelper
{
private static final int DB_VERSION = 6;
private static final String DB_NAME = "bookmarks.db";
public static final String ID = BaseColumns._ID;
public BookmarkDB(Context context)
{
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db)
{
String sqlScreenSettings =
"CREATE TABLE tbl_screen_settings ("
+ ID + " INTEGER PRIMARY KEY, "
+ "colors INTEGER DEFAULT 16, "
+ "resolution INTEGER DEFAULT 0, "
+ "width, "
+ "height);";
db.execSQL(sqlScreenSettings);
String sqlPerformanceFlags =
"CREATE TABLE tbl_performance_flags ("
+ ID + " INTEGER PRIMARY KEY, "
+ "perf_remotefx INTEGER, "
+ "perf_wallpaper INTEGER, "
+ "perf_theming INTEGER, "
+ "perf_full_window_drag INTEGER, "
+ "perf_menu_animations INTEGER, "
+ "perf_font_smoothing INTEGER, "
+ "perf_desktop_composition INTEGER);";
db.execSQL(sqlPerformanceFlags);
String sqlManualBookmarks = getManualBookmarksCreationString();
db.execSQL(sqlManualBookmarks);
// Insert a test entry
String sqlInsertDefaultScreenEntry =
"INSERT INTO tbl_screen_settings ("
+ "colors, "
+ "resolution, "
+ "width, "
+ "height) "
+ "VALUES ( "
+ "32, 1, 1024, 768);";
db.execSQL(sqlInsertDefaultScreenEntry);
db.execSQL(sqlInsertDefaultScreenEntry);
String sqlInsertDefaultPerfFlags =
"INSERT INTO tbl_performance_flags ("
+ "perf_remotefx, "
+ "perf_wallpaper, "
+ "perf_theming, "
+ "perf_full_window_drag, "
+ "perf_menu_animations, "
+ "perf_font_smoothing, "
+ "perf_desktop_composition) "
+ "VALUES ( "
+ "1, 0, 0, 0, 0, 0, 0);";
db.execSQL(sqlInsertDefaultPerfFlags);
db.execSQL(sqlInsertDefaultPerfFlags);
String sqlInsertDefaultSessionEntry =
"INSERT INTO tbl_manual_bookmarks ("
+ "label, "
+ "hostname, "
+ "username, "
+ "password, "
+ "domain, "
+ "port, "
+ "screen_settings, "
+ "performance_flags, "
+ "screen_3g, "
+ "performance_3g, "
+ "redirect_sdcard, "
+ "redirect_sound, "
+ "redirect_microphone, "
+ "security, "
+ "remote_program, "
+ "work_dir, "
+ "async_channel, "
+ "async_transport, "
+ "async_input, "
+ "async_update, "
+ "console_mode, "
+ "debug_level ) "
+ "VALUES ( "
+ "'Test Server', "
+ "'testservice.afreerdp.com', "
+ "'', "
+ "'', "
+ "'', "
+ "3389, "
+ "1, 1, 2, 2, 0, 0, 0, 0, "
+ "'', '', "
+ "1, 1, 1, 1, 0, 0);";
db.execSQL(sqlInsertDefaultSessionEntry);
}
private String getManualBookmarksCreationString()
{
return (
"CREATE TABLE IF NOT EXISTS tbl_manual_bookmarks ("
+ ID + " INTEGER PRIMARY KEY, "
+ "label TEXT NOT NULL, "
+ "hostname TEXT NOT NULL, "
+ "username TEXT NOT NULL, "
+ "password TEXT, "
+ "domain TEXT, "
+ "port TEXT, "
+ "screen_settings INTEGER NOT NULL, "
+ "performance_flags INTEGER NOT NULL, "
+ "enable_gateway_settings INTEGER DEFAULT 0, "
+ "gateway_hostname TEXT, "
+ "gateway_port INTEGER DEFAULT 443, "
+ "gateway_username TEXT, "
+ "gateway_password TEXT, "
+ "gateway_domain TEXT, "
+ "enable_3g_settings INTEGER DEFAULT 0, "
+ "screen_3g INTEGER NOT NULL, "
+ "performance_3g INTEGER NOT NULL, "
+ "redirect_sdcard INTEGER DEFAULT 0, "
+ "redirect_sound INTEGER DEFAULT 0, "
+ "redirect_microphone INTEGER DEFAULT 0, "
+ "security INTEGER, "
+ "remote_program 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, "
+ "debug_level INTEGER DEFAULT 0, "
+ "FOREIGN KEY(screen_settings) REFERENCES tbl_screen_settings(" + ID + "), "
+ "FOREIGN KEY(performance_flags) REFERENCES tbl_performance_flags(" + ID + "), "
+ "FOREIGN KEY(screen_3g) REFERENCES tbl_screen_settings(" + ID + "), "
+ "FOREIGN KEY(performance_3g) REFERENCES tbl_performance_flags(" + ID + ") "
+ ");");
}
// from http://stackoverflow.com/questions/3424156/upgrade-sqlite-database-from-one-version-to-another
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
db.beginTransaction();
// run a table creation with if not exists (we are doing an upgrade, so the table might
// not exists yet, it will fail alter and drop)
db.execSQL(getManualBookmarksCreationString());
// put in a list the existing columns
List<String> columns = GetColumns(db, "tbl_manual_bookmarks");
// backup table
db.execSQL("ALTER TABLE tbl_manual_bookmarks RENAME TO 'temp_tbl_manual_bookmarks'");
// create new table (with new scheme)
db.execSQL(getManualBookmarksCreationString());
// get the intersection with the new columns, this time columns taken from the upgraded table
columns.retainAll(GetColumns(db, "tbl_manual_bookmarks"));
// restore data
String cols = joinStrings(columns, ",");
db.execSQL(String.format("INSERT INTO %s (%s) SELECT %s from 'temp_%s", "tbl_manual_bookmarks", cols, cols, "tbl_manual_bookmarks'"));
// remove backup table
db.execSQL("DROP table 'temp_tbl_manual_bookmarks'");
db.setTransactionSuccessful();
db.endTransaction();
}
private static List<String> GetColumns(SQLiteDatabase db, String tableName) {
List<String> ar = null;
Cursor c = null;
try {
c = db.rawQuery("SELECT * FROM " + tableName + " LIMIT 1", null);
if (c != null) {
ar = new ArrayList<String>(Arrays.asList(c.getColumnNames()));
}
} catch (Exception e) {
Log.v(tableName, e.getMessage(), e);
e.printStackTrace();
} finally {
if (c != null)
c.close();
}
return ar;
}
private static String joinStrings(List<String> list, String delim) {
StringBuilder buf = new StringBuilder();
int num = list.size();
for (int i = 0; i < num; i++) {
if (i != 0)
buf.append(delim);
buf.append((String) list.get(i));
}
return buf.toString();
}
}

View File

@ -1,308 +0,0 @@
/*
Android FreeRDP JNI Wrapper
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
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/.
*/
package com.freerdp.freerdpcore.services;
import com.freerdp.freerdpcore.application.GlobalApp;
import com.freerdp.freerdpcore.application.SessionState;
import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.domain.ManualBookmark;
import android.graphics.Bitmap;
public class LibFreeRDP
{
private static native int freerdp_new();
private static native void freerdp_free(int inst);
private static native boolean freerdp_connect(int inst);
private static native boolean freerdp_disconnect(int inst);
private static native boolean freerdp_cancel_connection(int inst);
private static native boolean freerdp_set_connection_info(int inst,
String hostname, String username, String password, String domain,
int width, int height, int color_depth, int port, boolean console,
int security, String certname);
private static native void freerdp_set_performance_flags(int inst,
boolean remotefx, boolean disableWallpaper, boolean disableFullWindowDrag,
boolean disableMenuAnimations, boolean disableTheming,
boolean enableFontSmoothing, boolean enableDesktopComposition);
private static native boolean 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 boolean freerdp_set_data_directory(int inst, String directory);
private static native void freerdp_set_clipboard_redirection(int inst, boolean enable);
private static native boolean freerdp_set_sound_redirection(int inst, int redirect);
private static native boolean freerdp_set_microphone_redirection(int inst, boolean enable);
private static native boolean freerdp_set_drive_redirection(int inst, String path);
private static native boolean freerdp_set_gateway_info(int inst, String gatewayhostname, int port,
String gatewayusername, String gatewaypassword, String gatewaydomain);
private static native boolean freerdp_update_graphics(int inst,
Bitmap bitmap, int x, int y, int width, int height);
private static native boolean freerdp_send_cursor_event(int inst, int x, int y, int flags);
private static native boolean freerdp_send_key_event(int inst, int keycode, boolean down);
private static native boolean freerdp_send_unicodekey_event(int inst, int keycode);
private static native boolean freerdp_send_clipboard_data(int inst, String data);
private static native String freerdp_get_version();
private static final String TAG = "LibFreeRDP";
public static interface EventListener
{
void OnConnectionSuccess(int instance);
void OnConnectionFailure(int instance);
void OnDisconnecting(int instance);
void OnDisconnected(int instance);
}
public static interface UIEventListener
{
void OnSettingsChanged(int width, int height, int bpp);
boolean OnAuthenticate(StringBuilder username, StringBuilder domain, StringBuilder password);
boolean OnVerifiyCertificate(String subject, String issuer, String fingerprint);
void OnGraphicsUpdate(int x, int y, int width, int height);
void OnGraphicsResize(int width, int height, int bpp);
void OnRemoteClipboardChanged(String data);
}
private static EventListener listener;
public static void setEventListener(EventListener l)
{
listener = l;
}
public static int newInstance()
{
return freerdp_new();
}
public static void freeInstance(int inst)
{
freerdp_free(inst);
}
public static boolean connect(int inst)
{
return freerdp_connect(inst);
}
public static boolean disconnect(int inst)
{
return freerdp_disconnect(inst);
}
public static boolean cancelConnection(int inst)
{
return freerdp_cancel_connection(inst);
}
public static boolean setConnectionInfo(int inst, BookmarkBase bookmark)
{
BookmarkBase.ScreenSettings screenSettings = bookmark.getActiveScreenSettings();
int port;
String hostname;
String certName = "";
if(bookmark.getType() == BookmarkBase.TYPE_MANUAL)
{
port = bookmark.<ManualBookmark>get().getPort();
hostname = bookmark.<ManualBookmark>get().getHostname();
}
else
{
assert false;
return false;
}
freerdp_set_connection_info(inst,
hostname,
bookmark.getUsername(),
bookmark.getPassword(),
bookmark.getDomain(),
screenSettings.getWidth(),
screenSettings.getHeight(),
screenSettings.getColors(),
port,
bookmark.getAdvancedSettings().getConsoleMode(),
bookmark.getAdvancedSettings().getSecurity(),
certName);
BookmarkBase.PerformanceFlags flags = bookmark.getActivePerformanceFlags();
freerdp_set_performance_flags(inst,
flags.getRemoteFX(),
!flags.getWallpaper(),
!flags.getFullWindowDrag(),
!flags.getMenuAnimations(),
!flags.getTheming(),
flags.getFontSmoothing(),
flags.getDesktopComposition());
BookmarkBase.AdvancedSettings advancedSettings = bookmark.getAdvancedSettings();
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?
if (advancedSettings.getRedirectSDCard())
freerdp_set_drive_redirection(inst, android.os.Environment.getExternalStorageDirectory().getPath());
// always enable clipboard redirection
freerdp_set_clipboard_redirection(inst, true);
// Gateway enabled?
if (bookmark.getType() == BookmarkBase.TYPE_MANUAL && bookmark.<ManualBookmark>get().getEnableGatewaySettings())
{
ManualBookmark.GatewaySettings gatewaySettings = bookmark.<ManualBookmark>get().getGatewaySettings();
freerdp_set_gateway_info(inst, gatewaySettings.getHostname(), gatewaySettings.getPort(),
gatewaySettings.getUsername(), gatewaySettings.getPassword(), gatewaySettings.getDomain());
}
// Sound redirection
freerdp_set_sound_redirection(inst,
advancedSettings.getRedirectSound());
// Microphone redirection
freerdp_set_microphone_redirection(inst,
advancedSettings.getRedirectMicrophone());
return true;
}
public static boolean setDataDirectory(int inst, String directory)
{
return freerdp_set_data_directory(inst, directory);
}
public static boolean updateGraphics(int inst, Bitmap bitmap, int x, int y, int width, int height)
{
return freerdp_update_graphics(inst, bitmap, x, y, width, height);
}
public static boolean sendCursorEvent(int inst, int x, int y, int flags)
{
return freerdp_send_cursor_event(inst, x, y, flags);
}
public static boolean sendKeyEvent(int inst, int keycode, boolean down)
{
return freerdp_send_key_event(inst, keycode, down);
}
public static boolean sendUnicodeKeyEvent(int inst, int keycode)
{
return freerdp_send_unicodekey_event(inst, keycode);
}
public static boolean sendClipboardData(int inst, String data)
{
return freerdp_send_clipboard_data(inst, data);
}
private static void OnConnectionSuccess(int inst)
{
if (listener != null)
listener.OnConnectionSuccess(inst);
}
private static void OnConnectionFailure(int inst)
{
if (listener != null)
listener.OnConnectionFailure(inst);
}
private static void OnDisconnecting(int inst)
{
if (listener != null)
listener.OnDisconnecting(inst);
}
private static void OnDisconnected(int inst)
{
if (listener != null)
listener.OnDisconnected(inst);
}
private static void OnSettingsChanged(int inst, int width, int height, int bpp)
{
SessionState s = GlobalApp.getSession(inst);
if (s == null)
return;
UIEventListener uiEventListener = s.getUIEventListener();
if (uiEventListener != null)
uiEventListener.OnSettingsChanged(width, height, bpp);
}
private static boolean OnAuthenticate(int inst, StringBuilder username, StringBuilder domain, StringBuilder password)
{
SessionState s = GlobalApp.getSession(inst);
if (s == null)
return false;
UIEventListener uiEventListener = s.getUIEventListener();
if (uiEventListener != null)
return uiEventListener.OnAuthenticate(username, domain, password);
return false;
}
private static boolean OnVerifyCertificate(int inst, String subject, String issuer, String fingerprint)
{
SessionState s = GlobalApp.getSession(inst);
if (s == null)
return false;
UIEventListener uiEventListener = s.getUIEventListener();
if (uiEventListener != null)
return uiEventListener.OnVerifiyCertificate(subject, issuer, fingerprint);
return false;
}
private static void OnGraphicsUpdate(int inst, int x, int y, int width, int height)
{
SessionState s = GlobalApp.getSession(inst);
if (s == null)
return;
UIEventListener uiEventListener = s.getUIEventListener();
if (uiEventListener != null)
uiEventListener.OnGraphicsUpdate(x, y, width, height);
}
private static void OnGraphicsResize(int inst, int width, int height, int bpp)
{
SessionState s = GlobalApp.getSession(inst);
if (s == null)
return;
UIEventListener uiEventListener = s.getUIEventListener();
if (uiEventListener != null)
uiEventListener.OnGraphicsResize(width, height, bpp);
}
private static void OnRemoteClipboardChanged(int inst, String data)
{
SessionState s = GlobalApp.getSession(inst);
if (s == null)
return;
UIEventListener uiEventListener = s.getUIEventListener();
if (uiEventListener != null)
uiEventListener.OnRemoteClipboardChanged(data);
}
public static String getVersion()
{
return freerdp_get_version();
}
}

View File

@ -1,15 +0,0 @@
package com.freerdp.freerdpcore.utils;
public class BuildConfiguration {
public static final String WITH_ANDROID_DEBUG_MENU = "@WITH_ANDROID_DEBUG_MENU@";
public static final int FREERDP_VERSION_MAJOR = @FREERDP_VERSION_MAJOR@;
public static final int FREERDP_VERSION_MINOR = @FREERDP_VERSION_MINOR@;
public static final int FREERDP_VERSION_REVISION = @FREERDP_VERSION_REVISION@;
public static final String FREERDP_VERSION_SUFFIX = "@FREERDP_VERSION_SUFFIX@";
public static final String FREERDP_API_VERSION = "@FREERDP_API_VERSION@";
public static final String FREERDP_VERSION = "@FREERDP_VERSION@";
public static final String FREERDP_VERSION_FULL = "@FREERDP_VERSION_FULL@";
public static final String GIT_REVISION = "@GIT_REVISION@";
}

View File

@ -1,4 +0,0 @@
set(FREERDP_CLIENT_NAME "afreerdp")
set(FREERDP_CLIENT_PLATFORM "Android")
set(FREERDP_CLIENT_VENDOR "FreeRDP")

37
client/Android/Studio/.gitignore vendored Normal file
View File

@ -0,0 +1,37 @@
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
# Android Studio
*.iml
.idea
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
.gradle
build/
#NDK
obj/
jniLibs/

View File

@ -0,0 +1,23 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.freerdp.afreerdp"
minSdkVersion 14
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':freeRDPCore')
}

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<lint>
</lint>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
package="com.freerdp.afreerdp"
android:versionCode="@ANDROID_APP_VERSION@"
android:versionName="@GIT_REVISION@" >
android:versionCode="3"
android:versionName="e83f97b" >
<uses-sdk
android:targetSdkVersion="@ANDROID_APP_TARGET_SDK@"
android:minSdkVersion="@ANDROID_APP_MIN_SDK@"/>
android:targetSdkVersion="21"
android:minSdkVersion="14"/>
<supports-screens
android:anyDensity="true"
@ -19,7 +19,6 @@
<application android:name="com.freerdp.afreerdp.application.GlobalApp"
android:label="aFreeRDP"
android:debuggable="@ANDROID_DEBUG_ENABLE@"
android:icon="@drawable/icon_launcher_freerdp" >
<!-- Main activity -->

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_title">aFreeRDP</string>
<!-- Search strings -->

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_title">aFreeRDP</string>
<!-- Search strings -->

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_title">aFreeRDP</string>
<!-- Search strings -->

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_title">aFreeRDP</string>
<!-- Search strings -->

View File

@ -0,0 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}

View File

@ -0,0 +1,22 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
}

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<lint>
</lint>

View File

@ -1,21 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
package="com.freerdp.freerdpcore"
android:versionCode="@ANDROID_APP_VERSION@"
android:versionName="@GIT_REVISION@" >
android:versionCode="3"
android:versionName="e83f97b" >
<uses-sdk
android:targetSdkVersion="@ANDROID_APP_TARGET_SDK@"
android:minSdkVersion="@ANDROID_APP_MIN_SDK@"/>
android:targetSdkVersion="21"
android:minSdkVersion="14"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<supports-screens
android:anyDensity="true"
@ -25,8 +27,7 @@
android:xlargeScreens="true" />
<application
android:theme="@style/Theme.Main"
android:debuggable="@ANDROID_DEBUG_ENABLE@">
android:theme="@style/Theme.Main">
<!-- Activity to create shortcuts -->
<activity android:name=".presentation.ShortcutsActivity"

View File

@ -0,0 +1,186 @@
/*
Android Main Application
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
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/.
*/
package com.freerdp.freerdpcore.application;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;
import java.util.*;
import com.freerdp.freerdpcore.application.SessionState;
import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.services.BookmarkDB;
import com.freerdp.freerdpcore.services.HistoryDB;
import com.freerdp.freerdpcore.services.LibFreeRDP;
import com.freerdp.freerdpcore.services.ManualBookmarkGateway;
import com.freerdp.freerdpcore.services.QuickConnectHistoryGateway;
public class GlobalApp extends Application implements LibFreeRDP.EventListener {
private static Map<Integer, SessionState> sessionMap;
private static final String TAG = "GlobalApp";
public static boolean ConnectedTo3G = false;
// event notification defines
public static final String EVENT_TYPE = "EVENT_TYPE";
public static final String EVENT_PARAM = "EVENT_PARAM";
public static final String EVENT_STATUS = "EVENT_STATUS";
public static final String EVENT_ERROR = "EVENT_ERROR";
public static final String ACTION_EVENT_FREERDP = "com.freerdp.freerdp.event.freerdp";
public static final int FREERDP_EVENT_CONNECTION_SUCCESS = 1;
public static final int FREERDP_EVENT_CONNECTION_FAILURE = 2;
public static final int FREERDP_EVENT_DISCONNECTED = 3;
private static BookmarkDB bookmarkDB;
private static ManualBookmarkGateway manualBookmarkGateway;
private static HistoryDB historyDB;
private static QuickConnectHistoryGateway quickConnectHistoryGateway;
// timer for disconnecting sessions after the screen was turned off
private static Timer disconnectTimer = null;
// TimerTask for disconnecting sessions after screen was turned off
private static class DisconnectTask extends TimerTask {
@Override
public void run() {
Log.v("DisconnectTask", "Doing action");
// disconnect any running rdp session
Collection<SessionState> sessions = GlobalApp.getSessions();
for (SessionState session : sessions) {
LibFreeRDP.disconnect(session.getInstance());
}
}
}
public GlobalApp() {
sessionMap = Collections.synchronizedMap(new HashMap<Integer, SessionState>());
LibFreeRDP.setEventListener(this);
}
@Override
public void onCreate() {
super.onCreate();
bookmarkDB = new BookmarkDB(this);
manualBookmarkGateway = new ManualBookmarkGateway(bookmarkDB);
historyDB = new HistoryDB(this);
quickConnectHistoryGateway = new QuickConnectHistoryGateway(historyDB);
GlobalSettings.init(this);
ConnectedTo3G = NetworkStateReceiver.isConnectedTo3G(this);
// init screen receiver here (this can't be declared in AndroidManifest - refer to:
// http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(new ScreenReceiver(), filter);
}
public static ManualBookmarkGateway getManualBookmarkGateway() {
return manualBookmarkGateway;
}
public static QuickConnectHistoryGateway getQuickConnectHistoryGateway() {
return quickConnectHistoryGateway;
}
// Disconnect handling for Screen on/off events
static public void startDisconnectTimer() {
int timeoutMinutes = GlobalSettings.getDisconnectTimeout();
if (timeoutMinutes > 0) {
// start disconnect timeout...
disconnectTimer = new Timer();
disconnectTimer.schedule(new DisconnectTask(), timeoutMinutes * 60 * 1000);
}
}
static public void cancelDisconnectTimer() {
// cancel any pending timer events
if (disconnectTimer != null) {
disconnectTimer.cancel();
disconnectTimer.purge();
disconnectTimer = null;
}
}
// RDP session handling
static public SessionState createSession(BookmarkBase bookmark, Context context) {
SessionState session = new SessionState(LibFreeRDP.newInstance(context), bookmark);
sessionMap.put(Integer.valueOf(session.getInstance()), session);
return session;
}
static public SessionState getSession(int instance) {
return sessionMap.get(instance);
}
static public Collection<SessionState> getSessions() {
// return a copy of the session items
return new ArrayList<SessionState>(sessionMap.values());
}
static public void freeSession(int instance) {
if (GlobalApp.sessionMap.containsKey(instance)) {
GlobalApp.sessionMap.remove(instance);
LibFreeRDP.freeInstance(instance);
}
}
// helper to send FreeRDP notifications
private void sendRDPNotification(int type, int param) {
// send broadcast
Intent intent = new Intent(ACTION_EVENT_FREERDP);
intent.putExtra(EVENT_TYPE, type);
intent.putExtra(EVENT_PARAM, param);
sendBroadcast(intent);
}
@Override
public void OnPreConnect(int instance) {
Log.v(TAG, "OnPreConnect");
}
// //////////////////////////////////////////////////////////////////////
// Implementation of LibFreeRDP.EventListener
public void OnConnectionSuccess(int instance) {
Log.v(TAG, "OnConnectionSuccess");
sendRDPNotification(FREERDP_EVENT_CONNECTION_SUCCESS, instance);
}
public void OnConnectionFailure(int instance) {
Log.v(TAG, "OnConnectionFailure");
// send notification to session activity
sendRDPNotification(FREERDP_EVENT_CONNECTION_FAILURE, instance);
}
public void OnDisconnecting(int instance) {
Log.v(TAG, "OnDisconnecting");
// send disconnect notification
sendRDPNotification(FREERDP_EVENT_DISCONNECTED, instance);
}
public void OnDisconnected(int instance) {
Log.v(TAG, "OnDisconnected");
}
}

View File

@ -27,6 +27,8 @@ public class BookmarkBase implements Parcelable, Cloneable {
// performance flags
public static class PerformanceFlags implements Parcelable {
private boolean remotefx;
private boolean gfx;
private boolean h264;
private boolean wallpaper;
private boolean theming;
private boolean fullWindowDrag;
@ -36,6 +38,8 @@ public class BookmarkBase implements Parcelable, Cloneable {
public PerformanceFlags() {
remotefx = false;
gfx = false;
h264 = false;
wallpaper = false;
theming = false;
fullWindowDrag = false;
@ -46,6 +50,8 @@ public class BookmarkBase implements Parcelable, Cloneable {
public PerformanceFlags(Parcel parcel) {
remotefx = parcel.readInt() == 1;
gfx = parcel.readInt() == 1;
h264 = parcel.readInt() == 1;
wallpaper = parcel.readInt() == 1;
theming = parcel.readInt() == 1;
fullWindowDrag = (parcel.readInt() == 1);
@ -57,11 +63,27 @@ public class BookmarkBase implements Parcelable, Cloneable {
public boolean getRemoteFX() {
return remotefx;
}
public void setRemoteFX(boolean remotefx) {
this.remotefx = remotefx;
}
public boolean getGfx() {
return gfx;
}
public void setGfx(boolean gfx) {
this.gfx = gfx;
}
public boolean getH264() {
return h264;
}
public void setH264(boolean h264) {
this.h264 = h264;
}
public boolean getWallpaper() {
return wallpaper;
}
@ -129,6 +151,8 @@ public class BookmarkBase implements Parcelable, Cloneable {
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(remotefx ? 1 : 0);
out.writeInt(gfx ? 1 : 0);
out.writeInt(h264 ? 1 : 0);
out.writeInt(wallpaper ? 1 : 0);
out.writeInt(theming ? 1 : 0);
out.writeInt(fullWindowDrag ? 1 : 0);

View File

@ -20,7 +20,6 @@ import com.freerdp.freerdpcore.domain.ConnectionReference;
import com.freerdp.freerdpcore.domain.ManualBookmark;
import com.freerdp.freerdpcore.services.BookmarkBaseGateway;
import com.freerdp.freerdpcore.utils.RDPFileParser;
import com.freerdp.freerdpcore.utils.BuildConfiguration;
import android.app.AlertDialog;
import android.content.ComponentName;
@ -172,16 +171,6 @@ public class BookmarkActivity extends PreferenceActivity implements
current_preferences = PREFERENCES_BOOKMARK;
}
// Hide debug settings, if not activated.
if (!BuildConfiguration.WITH_ANDROID_DEBUG_MENU
.equalsIgnoreCase("ON")) {
Preference pref = findPreference("bookmark.debug");
PreferenceCategory cat = (PreferenceCategory)findPreference("category.settings");
if (pref != null) {
cat.removePreference(pref);
}
}
// update UI with bookmark data
SharedPreferences spref = getPreferenceManager().getSharedPreferences();
initSettings(spref);

View File

@ -83,71 +83,71 @@ public class SessionActivity extends ActionBarActivity implements
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case GRAPHICS_CHANGED: {
sessionView.onSurfaceChange(session);
scrollView.requestLayout();
break;
}
case REFRESH_SESSIONVIEW: {
sessionView.invalidateRegion();
break;
}
case DISPLAY_TOAST: {
Toast errorToast = Toast.makeText(getApplicationContext(),
msg.obj.toString(), Toast.LENGTH_LONG);
errorToast.show();
break;
}
case HIDE_ZOOMCONTROLS: {
zoomControls.hide();
break;
}
case SEND_MOVE_EVENT: {
LibFreeRDP.sendCursorEvent(session.getInstance(), msg.arg1,
msg.arg2, Mouse.getMoveEvent());
break;
}
case SHOW_DIALOG: {
// create and show the dialog
((Dialog) msg.obj).show();
break;
}
case SCROLLING_REQUESTED: {
int scrollX = 0;
int scrollY = 0;
float[] pointerPos = touchPointerView.getPointerPosition();
case GRAPHICS_CHANGED: {
sessionView.onSurfaceChange(session);
scrollView.requestLayout();
break;
}
case REFRESH_SESSIONVIEW: {
sessionView.invalidateRegion();
break;
}
case DISPLAY_TOAST: {
Toast errorToast = Toast.makeText(getApplicationContext(),
msg.obj.toString(), Toast.LENGTH_LONG);
errorToast.show();
break;
}
case HIDE_ZOOMCONTROLS: {
zoomControls.hide();
break;
}
case SEND_MOVE_EVENT: {
LibFreeRDP.sendCursorEvent(session.getInstance(), msg.arg1,
msg.arg2, Mouse.getMoveEvent());
break;
}
case SHOW_DIALOG: {
// create and show the dialog
((Dialog) msg.obj).show();
break;
}
case SCROLLING_REQUESTED: {
int scrollX = 0;
int scrollY = 0;
float[] pointerPos = touchPointerView.getPointerPosition();
if (pointerPos[0] > (screen_width - touchPointerView
.getPointerWidth()))
scrollX = SCROLLING_DISTANCE;
else if (pointerPos[0] < 0)
scrollX = -SCROLLING_DISTANCE;
if (pointerPos[0] > (screen_width - touchPointerView
.getPointerWidth()))
scrollX = SCROLLING_DISTANCE;
else if (pointerPos[0] < 0)
scrollX = -SCROLLING_DISTANCE;
if (pointerPos[1] > (screen_height - touchPointerView
.getPointerHeight()))
scrollY = SCROLLING_DISTANCE;
else if (pointerPos[1] < 0)
scrollY = -SCROLLING_DISTANCE;
if (pointerPos[1] > (screen_height - touchPointerView
.getPointerHeight()))
scrollY = SCROLLING_DISTANCE;
else if (pointerPos[1] < 0)
scrollY = -SCROLLING_DISTANCE;
scrollView.scrollBy(scrollX, scrollY);
scrollView.scrollBy(scrollX, scrollY);
// see if we reached the min/max scroll positions
if (scrollView.getScrollX() == 0
|| scrollView.getScrollX() == (sessionView.getWidth() - scrollView
.getWidth()))
scrollX = 0;
if (scrollView.getScrollY() == 0
|| scrollView.getScrollY() == (sessionView.getHeight() - scrollView
.getHeight()))
scrollY = 0;
// see if we reached the min/max scroll positions
if (scrollView.getScrollX() == 0
|| scrollView.getScrollX() == (sessionView.getWidth() - scrollView
.getWidth()))
scrollX = 0;
if (scrollView.getScrollY() == 0
|| scrollView.getScrollY() == (sessionView.getHeight() - scrollView
.getHeight()))
scrollY = 0;
if (scrollX != 0 || scrollY != 0)
uiHandler.sendEmptyMessageDelayed(SCROLLING_REQUESTED,
SCROLLING_TIMEOUT);
else
Log.v(TAG, "Stopping auto-scroll");
break;
}
if (scrollX != 0 || scrollY != 0)
uiHandler.sendEmptyMessageDelayed(SCROLLING_REQUESTED,
SCROLLING_TIMEOUT);
else
Log.v(TAG, "Stopping auto-scroll");
break;
}
}
}
}
@ -216,16 +216,16 @@ public class SessionActivity extends ActionBarActivity implements
return;
switch (intent.getExtras().getInt(GlobalApp.EVENT_TYPE, -1)) {
case GlobalApp.FREERDP_EVENT_CONNECTION_SUCCESS:
OnConnectionSuccess(context);
break;
case GlobalApp.FREERDP_EVENT_CONNECTION_SUCCESS:
OnConnectionSuccess(context);
break;
case GlobalApp.FREERDP_EVENT_CONNECTION_FAILURE:
OnConnectionFailure(context);
break;
case GlobalApp.FREERDP_EVENT_DISCONNECTED:
OnDisconnected(context);
break;
case GlobalApp.FREERDP_EVENT_CONNECTION_FAILURE:
OnConnectionFailure(context);
break;
case GlobalApp.FREERDP_EVENT_DISCONNECTED:
OnDisconnected(context);
break;
}
}
@ -247,7 +247,7 @@ public class SessionActivity extends ActionBarActivity implements
if (ConnectionReference.isHostnameReference(bundle
.getString(PARAM_CONNECTION_REFERENCE))) {
assert session.getBookmark().getType() == BookmarkBase.TYPE_MANUAL;
String item = session.getBookmark().<ManualBookmark> get()
String item = session.getBookmark().<ManualBookmark>get()
.getHostname();
if (!GlobalApp.getQuickConnectHistoryGateway()
.historyItemExists(item))
@ -361,7 +361,7 @@ public class SessionActivity extends ActionBarActivity implements
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
int which) {
callbackDialogResult = true;
synchronized (dialog) {
dialog.notify();
@ -372,7 +372,7 @@ public class SessionActivity extends ActionBarActivity implements
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
int which) {
callbackDialogResult = false;
connectCancelledByUser = true;
synchronized (dialog) {
@ -391,7 +391,7 @@ public class SessionActivity extends ActionBarActivity implements
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
int which) {
callbackDialogResult = true;
synchronized (dialog) {
dialog.notify();
@ -402,7 +402,7 @@ public class SessionActivity extends ActionBarActivity implements
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
int which) {
callbackDialogResult = false;
connectCancelledByUser = true;
synchronized (dialog) {
@ -415,14 +415,14 @@ public class SessionActivity extends ActionBarActivity implements
private boolean hasHardwareMenuButton() {
if (Build.VERSION.SDK_INT <= 10)
return true;
if (Build.VERSION.SDK_INT >= 14) {
boolean rc = false;
final ViewConfiguration cfg = ViewConfiguration.get(this);
return cfg.hasPermanentMenuKey();
}
return false;
}
@ -626,7 +626,7 @@ public class SessionActivity extends ActionBarActivity implements
String refStr = bundle.getString(PARAM_CONNECTION_REFERENCE);
if (ConnectionReference.isHostnameReference(refStr)) {
bookmark = new ManualBookmark();
bookmark.<ManualBookmark> get().setHostname(
bookmark.<ManualBookmark>get().setHostname(
ConnectionReference.getHostname(refStr));
} else if (ConnectionReference.isBookmarkReference(refStr)) {
if (ConnectionReference.isManualBookmarkReference(refStr))
@ -647,13 +647,9 @@ public class SessionActivity extends ActionBarActivity implements
}
private void connect(BookmarkBase bookmark) {
session = GlobalApp.createSession(bookmark);
session = GlobalApp.createSession(bookmark, getApplicationContext());
session.setUIEventListener(this);
// set writeable data directory
LibFreeRDP.setDataDirectory(session.getInstance(), getFilesDir()
.toString());
BookmarkBase.ScreenSettings screenSettings = session.getBookmark()
.getActiveScreenSettings();
Log.v(TAG, "Screen Resolution: " + screenSettings.getResolutionString());
@ -712,7 +708,7 @@ public class SessionActivity extends ActionBarActivity implements
// displays either the system or the extended keyboard or non of them
private void showKeyboard(boolean showSystemKeyboard,
boolean showExtendedKeyboard) {
boolean showExtendedKeyboard) {
// no matter what we are doing ... hide the zoom controls
// TODO: this is not working correctly as hiding the keyboard issues a
// onScrollChange notification showing the control again ...
@ -769,25 +765,25 @@ public class SessionActivity extends ActionBarActivity implements
// check if any key is in the keycodes list
List<Keyboard.Key> keys = modifiersKeyboard.getKeys();
for (Iterator<Keyboard.Key> it = keys.iterator(); it.hasNext();) {
for (Iterator<Keyboard.Key> it = keys.iterator(); it.hasNext(); ) {
// if the key is a sticky key - just set it to off
Keyboard.Key curKey = it.next();
if (curKey.sticky) {
switch (keyboardMapper.getModifierState(curKey.codes[0])) {
case KeyboardMapper.KEYSTATE_ON:
curKey.on = true;
curKey.pressed = false;
break;
case KeyboardMapper.KEYSTATE_ON:
curKey.on = true;
curKey.pressed = false;
break;
case KeyboardMapper.KEYSTATE_OFF:
curKey.on = false;
curKey.pressed = false;
break;
case KeyboardMapper.KEYSTATE_OFF:
curKey.on = false;
curKey.pressed = false;
break;
case KeyboardMapper.KEYSTATE_LOCKED:
curKey.on = true;
curKey.pressed = true;
break;
case KeyboardMapper.KEYSTATE_LOCKED:
curKey.on = true;
curKey.pressed = true;
break;
}
}
}
@ -860,6 +856,15 @@ public class SessionActivity extends ActionBarActivity implements
keyboardMapper.sendAltF4();
}
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
LibFreeRDP.disconnect(session.getInstance());
return true;
}
return super.onKeyLongPress(keyCode, event);
}
// android keyboard input handling
// We always use the unicode value to process input from the android
// keyboard except if key modifiers
@ -933,20 +938,20 @@ public class SessionActivity extends ActionBarActivity implements
@Override
public void switchKeyboard(int keyboardType) {
switch (keyboardType) {
case KeyboardMapper.KEYBOARD_TYPE_FUNCTIONKEYS:
keyboardView.setKeyboard(specialkeysKeyboard);
break;
case KeyboardMapper.KEYBOARD_TYPE_FUNCTIONKEYS:
keyboardView.setKeyboard(specialkeysKeyboard);
break;
case KeyboardMapper.KEYBOARD_TYPE_NUMPAD:
keyboardView.setKeyboard(numpadKeyboard);
break;
case KeyboardMapper.KEYBOARD_TYPE_NUMPAD:
keyboardView.setKeyboard(numpadKeyboard);
break;
case KeyboardMapper.KEYBOARD_TYPE_CURSOR:
keyboardView.setKeyboard(cursorKeyboard);
break;
case KeyboardMapper.KEYBOARD_TYPE_CURSOR:
keyboardView.setKeyboard(cursorKeyboard);
break;
default:
break;
default:
break;
}
}
@ -1020,7 +1025,7 @@ public class SessionActivity extends ActionBarActivity implements
@Override
public boolean OnAuthenticate(StringBuilder username, StringBuilder domain,
StringBuilder password) {
StringBuilder password) {
// this is where the return code of our dialog will be stored
callbackDialogResult = false;
@ -1062,7 +1067,7 @@ public class SessionActivity extends ActionBarActivity implements
@Override
public boolean OnVerifiyCertificate(String subject, String issuer,
String fingerprint) {
String fingerprint) {
// see if global settings says accept all
if (GlobalSettings.getAcceptAllCertificates())
@ -1109,7 +1114,7 @@ public class SessionActivity extends ActionBarActivity implements
@Override
public void onScrollChanged(ScrollView2D scrollView, int x, int y,
int oldx, int oldy) {
int oldx, int oldy) {
zoomControls.setIsZoomInEnabled(!sessionView.isAtMaxZoom());
zoomControls.setIsZoomOutEnabled(!sessionView.isAtMinZoom());
if (!GlobalSettings.getHideZoomControls()

Some files were not shown because too many files have changed in this diff Show More