diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
old mode 100644
new mode 100755
index c6feb8b..41c70a7
Binary files a/.mvn/wrapper/maven-wrapper.jar and b/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
old mode 100644
new mode 100755
index 6637ced..20297d0
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1 +1,2 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
\ No newline at end of file
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar
diff --git a/README.md b/README.md
index 550960a..0f74e24 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,66 @@ This project gives the opportunity to use your phone even with a broken screen.
[wiki]: https://github.com/xSAVIKx/AndroidScreencast/wiki
+## Configuration
+
+There are 2 ways to run application:
+1. Run ADB server on your own
+2. Provide correct `app.properties` file
+
+### Run ADB server on your own
+
+In order to run server on your own you have to run already installed (or one from our OS-specific bundle) `adb`
+with following command:
+```
+adb start-server
+```
+
+**Note**:
+
+If `app.properties` will have `adb.path` filled - AndroidScreencast will shutdown ADB server on application termination.
+
+Additionally, in order to use, for example, remote ADB server with ssh forwarding you should not use `app.properties` or `adb.path`
+property should be commented.
+
+### Provide correct `app.properties` file
+
+Right now to successfully run application you **should** create `app.properties` file in the same folder as
+AndroidScreencast's jar and provide at least one property - `adb.path` which should point to the `adb` executable file
+within your OS, for example such location could be configured for Windows OS:
+```properties
+adb.path=adb/windows/adb.exe
+```
+
+Both absolute and relative paths are supported.
+
+Example of valid `app.properties` could be find [here](app.properties).
+
+Also we have got some valid OS-specific examples:
+* [OSX app.properties](adb/macosx/app.properties)
+* [Windows app.properties](adb/windows/app.properties)
+* [Linux app.properties](adb/linux/app.properties)
+
+They are actually the same, just `adb.path` is OS-specific. Files listed above are automatically included into OS-specific bundles.
+
+
+### Additional properties
+Here is the full list of available properties for application configuration.
+Properties should be places in the `app.properties` file in the same folder as AndroidScreencast's jar file.
+
+```properties
+#relative or absolute path to ADB
+adb.path=./adb
+#maximum time to wait for device (in seconds)
+adb.device.timeout=30
+#maximum time to execute adb command (in seconds)
+adb.command.timeout=5
+#initial application window width (in pixels)
+app.window.width=1024
+#initial application window height (in pixels)
+app.window.height=768
+#Defines whether application should look 'natively' to OS. Possible values: true/false
+app.native.look=false
+```
## JNLP
Application is available using Java web start technology via [androidscreencast.jnlp][jnlp].
@@ -59,6 +119,10 @@ Additionally OS-packages would be created with ADB executables bundled:
* `androidscreencast-VERSION-linux.tar.gz`
* `androidscreencast-VERSION-macosx.tar.gz`
+In order to provide correct configuration see [configuration][configuration_section] section.
+
+[configuration_section]: https://github.com/xSAVIKx/AndroidScreencast/blob/develop/README.md#configuration
+
# Requirements
Currently AndroidScreencast works directly with `adb input` program through `ddmlib` and abuse functionality of:
@@ -81,6 +145,7 @@ Also, to run AndroidScreencast you will need *adb* installed (or you can use bun
[Android_4_1_1_Input]: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/com/android/commands/input/Input.java#Input
[seven_square]: https://github.com/yangh/sevensquare
[droid_at_screen]: http://droid-at-screen.org/droid-at-screen/
+[android_screen_monitor]: https://github.com/adakoda/android-screen-monitor
[travis_badge]: https://travis-ci.org/xSAVIKx/AndroidScreencast.svg?branch=master
[travis]: https://travis-ci.org/xSAVIKx/AndroidScreencast
diff --git a/adb/linux/adb b/adb/linux/adb
old mode 100644
new mode 100755
index 3c28311..c1e3d42
Binary files a/adb/linux/adb and b/adb/linux/adb differ
diff --git a/adb/linux/app.properties b/adb/linux/app.properties
index 6781907..af5cee1 100644
--- a/adb/linux/app.properties
+++ b/adb/linux/app.properties
@@ -4,7 +4,7 @@ adb.path=./adb
#adb.device.timeout=30
#maximum time to execute adb command (in seconds)
#adb.command.timeout=5
-#default.window.width=1024
-#default.window.height=768
+#app.window.width=1024
+#app.window.height=768
#Defines whether application should look 'natively' to OS
#app.native.look=false
\ No newline at end of file
diff --git a/adb/linux/fastboot b/adb/linux/fastboot
old mode 100644
new mode 100755
index b147d23..cd47678
Binary files a/adb/linux/fastboot and b/adb/linux/fastboot differ
diff --git a/adb/macosx/adb b/adb/macosx/adb
old mode 100644
new mode 100755
index 738344f..751186a
Binary files a/adb/macosx/adb and b/adb/macosx/adb differ
diff --git a/adb/macosx/app.properties b/adb/macosx/app.properties
index 6781907..af5cee1 100644
--- a/adb/macosx/app.properties
+++ b/adb/macosx/app.properties
@@ -4,7 +4,7 @@ adb.path=./adb
#adb.device.timeout=30
#maximum time to execute adb command (in seconds)
#adb.command.timeout=5
-#default.window.width=1024
-#default.window.height=768
+#app.window.width=1024
+#app.window.height=768
#Defines whether application should look 'natively' to OS
#app.native.look=false
\ No newline at end of file
diff --git a/adb/macosx/fastboot b/adb/macosx/fastboot
old mode 100644
new mode 100755
index d918163..4b97b63
Binary files a/adb/macosx/fastboot and b/adb/macosx/fastboot differ
diff --git a/adb/windows/AdbWinApi.dll b/adb/windows/AdbWinApi.dll
old mode 100644
new mode 100755
diff --git a/adb/windows/AdbWinUsbApi.dll b/adb/windows/AdbWinUsbApi.dll
old mode 100644
new mode 100755
diff --git a/adb/windows/adb.exe b/adb/windows/adb.exe
old mode 100644
new mode 100755
index ca474cd..75a803f
Binary files a/adb/windows/adb.exe and b/adb/windows/adb.exe differ
diff --git a/adb/windows/app.properties b/adb/windows/app.properties
index 5f42323..0ec58b6 100644
--- a/adb/windows/app.properties
+++ b/adb/windows/app.properties
@@ -4,7 +4,7 @@ adb.path=./adb.exe
#adb.device.timeout=30
#maximum time to execute adb command (in seconds)
#adb.command.timeout=5
-#default.window.width=1024
-#default.window.height=768
+#app.window.width=1024
+#app.window.height=768
#Defines whether application should look 'natively' to OS
#app.native.look=false
\ No newline at end of file
diff --git a/adb/windows/fastboot.exe b/adb/windows/fastboot.exe
old mode 100644
new mode 100755
index c28d87a..9511d87
Binary files a/adb/windows/fastboot.exe and b/adb/windows/fastboot.exe differ
diff --git a/app.properties b/app.properties
index 1175efc..729b7f1 100644
--- a/app.properties
+++ b/app.properties
@@ -1,3 +1,3 @@
-adb.path=adb/windows/adb2.exe
-default.window.width=1024
-default.window.height=768
\ No newline at end of file
+adb.path=./adb/linux/adb
+app.window.width=1024
+app.window.height=768
\ No newline at end of file
diff --git a/mvnw b/mvnw
old mode 100644
new mode 100755
index 6ecc150..e96ccd5
--- a/mvnw
+++ b/mvnw
@@ -54,38 +54,16 @@ case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
- #
- # Look for the Apple JDKs first to preserve the existing behaviour, and then look
- # for the new JDKs provided by Oracle.
- #
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
- #
- # Oracle JDKs
- #
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=`/usr/libexec/java_home`
- fi
- ;;
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
esac
if [ -z "$JAVA_HOME" ] ; then
@@ -130,7 +108,7 @@ if $cygwin ; then
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
-# For Migwn, ensure paths are in UNIX format before anything is touched
+# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
@@ -187,14 +165,25 @@ CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
- local basedir=$(pwd)
- local wdir=$(pwd)
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
- wdir=$(cd "$wdir/.."; pwd)
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
done
echo "${basedir}"
}
@@ -206,7 +195,15 @@ concat_lines() {
fi
}
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
@@ -221,14 +218,8 @@ if $cygwin; then
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
-export MAVEN_CMD_LINE_ARGS
-
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in $@
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
diff --git a/mvnw.cmd b/mvnw.cmd
old mode 100644
new mode 100755
index 8bb8275..019bd74
--- a/mvnw.cmd
+++ b/mvnw.cmd
@@ -80,8 +80,6 @@ goto error
:init
-set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*
-
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
@@ -118,10 +116,9 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
diff --git a/pom.xml b/pom.xml
index a004b8e..dfa43b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,15 +3,15 @@
4.0.0com.github.xsavikxandroidscreencast
- 0.0.10s
+ 0.0.12sAndroid Screencastjar
- 2.9
- 25.2.0
- 1.7.24
- 1.2.1
- 21.0
+ 2.16
+ 26.1.2
+ 1.7.25
+ 1.2.3
+ 25.1-jrecom.github.xsavikx.androidscreencast.Main1.8UTF-8
@@ -63,7 +63,7 @@
maven-compiler-plugin
- 3.6.1
+ 3.7.0${jdk.version}
@@ -72,7 +72,7 @@
org.apache.maven.pluginsmaven-jar-plugin
- 3.0.2
+ 3.1.0
@@ -84,7 +84,7 @@
org.apache.maven.pluginsmaven-shade-plugin
- 3.0.0
+ 3.1.1package
@@ -107,7 +107,7 @@
org.apache.maven.pluginsmaven-assembly-plugin
- 3.0.0
+ 3.1.0src/assembly/windows.xml
@@ -163,6 +163,13 @@
+
+
+ google
+ Google Maven Repository
+ https://maven.google.com/
+
+ http://xsavikx.github.io/AndroidScreencasthttps://travis-ci.org/xSAVIKx/AndroidScreencast
diff --git a/src/main/java/com/github/xsavikx/androidscreencast/api/adb/AndroidDebugBridgeWrapper.java b/src/main/java/com/github/xsavikx/androidscreencast/api/adb/AndroidDebugBridgeWrapper.java
index d9e9a90..78502cd 100644
--- a/src/main/java/com/github/xsavikx/androidscreencast/api/adb/AndroidDebugBridgeWrapper.java
+++ b/src/main/java/com/github/xsavikx/androidscreencast/api/adb/AndroidDebugBridgeWrapper.java
@@ -4,6 +4,7 @@
import com.android.ddmlib.IDevice;
import com.github.xsavikx.androidscreencast.exception.IllegalAdbConfigurationException;
import com.github.xsavikx.androidscreencast.util.StringUtils;
+import com.google.common.annotations.VisibleForTesting;
import javax.inject.Inject;
import javax.inject.Named;
@@ -31,7 +32,9 @@ public boolean hasInitialDeviceList() {
}
public void stop() {
- AndroidDebugBridge.disconnectBridge();
+ if (hasAdbPathFilled()) {
+ AndroidDebugBridge.disconnectBridge();
+ }
AndroidDebugBridge.terminate();
}
@@ -47,12 +50,7 @@ private void init() {
return;
}
try {
- AndroidDebugBridge.initIfNeeded(false);
- if (StringUtils.isNotEmpty(adbPath)) {
- adb = AndroidDebugBridge.createBridge(adbPath, false);
- } else {
- adb = AndroidDebugBridge.createBridge();
- }
+ adb = createAndroidDebugBridge();
} catch (IllegalArgumentException e) {
if (hasAdbProcFailed(e)) {
throw new IllegalAdbConfigurationException(adbPath);
@@ -61,6 +59,19 @@ private void init() {
}
}
+ @VisibleForTesting
+ AndroidDebugBridge createAndroidDebugBridge() {
+ AndroidDebugBridge.initIfNeeded(false);
+ if (hasAdbPathFilled()) {
+ return AndroidDebugBridge.createBridge(adbPath, false);
+ }
+ return AndroidDebugBridge.createBridge();
+ }
+
+ private boolean hasAdbPathFilled() {
+ return StringUtils.isNotEmpty(adbPath);
+ }
+
private boolean hasAdbProcFailed(IllegalArgumentException e) {
return e.getCause() != null
&& e.getCause() instanceof IOException
diff --git a/src/main/java/com/github/xsavikx/androidscreencast/api/command/executor/ShellCommandExecutor.java b/src/main/java/com/github/xsavikx/androidscreencast/api/command/executor/ShellCommandExecutor.java
index 41a3830..3c02ccb 100644
--- a/src/main/java/com/github/xsavikx/androidscreencast/api/command/executor/ShellCommandExecutor.java
+++ b/src/main/java/com/github/xsavikx/androidscreencast/api/command/executor/ShellCommandExecutor.java
@@ -1,12 +1,8 @@
package com.github.xsavikx.androidscreencast.api.command.executor;
-import com.android.ddmlib.AdbCommandRejectedException;
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.ShellCommandUnresponsiveException;
-import com.android.ddmlib.TimeoutException;
+import com.android.ddmlib.*;
import com.github.xsavikx.androidscreencast.api.command.Command;
import com.github.xsavikx.androidscreencast.api.command.exception.AdbShellCommandExecutionException;
-import com.github.xsavikx.androidscreencast.api.injector.MultiLineReceiverPrinter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,15 +18,15 @@
public class ShellCommandExecutor implements CommandExecutor {
private static final Logger LOGGER = LoggerFactory.getLogger(ShellCommandExecutor.class);
private final IDevice device;
- private final MultiLineReceiverPrinter multiLineReceiverPrinter;
+ private final IShellOutputReceiver shellOutputReceiver;
private final long adbCommandTimeout;
@Inject
public ShellCommandExecutor(final IDevice device,
- final MultiLineReceiverPrinter multiLineReceiverPrinter,
+ final IShellOutputReceiver shellOutputReceiver,
@Named(ADB_COMMAND_TIMEOUT_KEY) long adbCommandTimeout) {
this.device = device;
- this.multiLineReceiverPrinter = multiLineReceiverPrinter;
+ this.shellOutputReceiver = shellOutputReceiver;
this.adbCommandTimeout = adbCommandTimeout;
}
@@ -39,7 +35,7 @@ public void execute(Command command) {
LOGGER.debug("execute(Command command={}) - start", command);
try {
- device.executeShellCommand(command.getFormattedCommand(), multiLineReceiverPrinter,
+ device.executeShellCommand(command.getFormattedCommand(), shellOutputReceiver,
adbCommandTimeout, TimeUnit.SECONDS);
} catch (TimeoutException | AdbCommandRejectedException | ShellCommandUnresponsiveException | IOException e) {
LOGGER.error("execute(Command command={})", command, e);
diff --git a/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationProperty.java b/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationProperty.java
index 25e1fa1..fbf53ab 100644
--- a/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationProperty.java
+++ b/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationProperty.java
@@ -8,7 +8,8 @@ public enum ApplicationConfigurationProperty {
ADB_COMMAND_TIMEOUT(ADB_COMMAND_TIMEOUT_KEY, "5"),
APP_WINDOW_WIDTH(APP_WINDOW_WIDTH_KEY, "1024"),
APP_WINDOW_HEIGHT(APP_WINDOW_HEIGHT_KEY, "768"),
- APP_NATIVE_LOOK(APP_NATIVE_LOOK_KEY, "true");
+ APP_NATIVE_LOOK(APP_NATIVE_LOOK_KEY, "true"),
+ APP_DEBUG_ENABLED(APP_DEBUG_ENABLED_KEY, "false");
private final String propertyKey;
private final String defaultValue;
diff --git a/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationPropertyKeys.java b/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationPropertyKeys.java
index 32c489c..18023f5 100644
--- a/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationPropertyKeys.java
+++ b/src/main/java/com/github/xsavikx/androidscreencast/configuration/ApplicationConfigurationPropertyKeys.java
@@ -7,6 +7,7 @@ public final class ApplicationConfigurationPropertyKeys {
public static final String APP_WINDOW_WIDTH_KEY = "app.window.width";
public static final String APP_WINDOW_HEIGHT_KEY = "app.window.height";
public static final String APP_NATIVE_LOOK_KEY = "app.native.look";
+ public static final String APP_DEBUG_ENABLED_KEY = "app.debug.enabled";
private ApplicationConfigurationPropertyKeys() {
//
diff --git a/src/main/java/com/github/xsavikx/androidscreencast/dagger/ApiModule.java b/src/main/java/com/github/xsavikx/androidscreencast/dagger/ApiModule.java
index 4e88110..2725c83 100644
--- a/src/main/java/com/github/xsavikx/androidscreencast/dagger/ApiModule.java
+++ b/src/main/java/com/github/xsavikx/androidscreencast/dagger/ApiModule.java
@@ -1,11 +1,14 @@
package com.github.xsavikx.androidscreencast.dagger;
+import com.android.ddmlib.IShellOutputReceiver;
+import com.android.ddmlib.NullOutputReceiver;
import com.github.xsavikx.androidscreencast.api.AndroidDevice;
import com.github.xsavikx.androidscreencast.api.AndroidDeviceImpl;
import com.github.xsavikx.androidscreencast.api.command.executor.CommandExecutor;
import com.github.xsavikx.androidscreencast.api.command.executor.ShellCommandExecutor;
import com.github.xsavikx.androidscreencast.api.command.factory.AdbInputCommandFactory;
import com.github.xsavikx.androidscreencast.api.command.factory.InputCommandFactory;
+import com.github.xsavikx.androidscreencast.api.injector.MultiLineReceiverPrinter;
import com.github.xsavikx.androidscreencast.configuration.ApplicationConfiguration;
import dagger.Module;
import dagger.Provides;
@@ -16,7 +19,6 @@
import static com.github.xsavikx.androidscreencast.configuration.ApplicationConfigurationProperty.*;
import static com.github.xsavikx.androidscreencast.configuration.ApplicationConfigurationPropertyKeys.*;
-@Singleton
@Module
public class ApiModule {
@Singleton
@@ -57,4 +59,20 @@ public static AndroidDevice androidDevice(AndroidDeviceImpl androidDevice) {
public static InputCommandFactory inputCommandFactory(AdbInputCommandFactory adbInputCommandFactory) {
return adbInputCommandFactory;
}
+
+ @Singleton
+ @Named(APP_DEBUG_ENABLED_KEY)
+ @Provides
+ public static boolean isDebugEnabled(ApplicationConfiguration applicationConfiguration) {
+ return Boolean.valueOf(applicationConfiguration.getProperty(APP_DEBUG_ENABLED));
+ }
+
+ @Singleton
+ @Provides
+ public static IShellOutputReceiver iShellOutputReceiver(@Named(APP_DEBUG_ENABLED_KEY) boolean isDebugEnabled, MultiLineReceiverPrinter multiLineReceiverPrinter) {
+ if (isDebugEnabled) {
+ return multiLineReceiverPrinter;
+ }
+ return NullOutputReceiver.getReceiver();
+ }
}
diff --git a/src/main/java/com/github/xsavikx/androidscreencast/dagger/AppModule.java b/src/main/java/com/github/xsavikx/androidscreencast/dagger/AppModule.java
index 0672b8d..8af41b8 100644
--- a/src/main/java/com/github/xsavikx/androidscreencast/dagger/AppModule.java
+++ b/src/main/java/com/github/xsavikx/androidscreencast/dagger/AppModule.java
@@ -9,7 +9,6 @@
import javax.inject.Singleton;
-@Singleton
@Module
public class AppModule {
@Singleton
diff --git a/src/main/java/com/github/xsavikx/androidscreencast/dagger/UiModule.java b/src/main/java/com/github/xsavikx/androidscreencast/dagger/UiModule.java
index f3f460b..94c0e77 100644
--- a/src/main/java/com/github/xsavikx/androidscreencast/dagger/UiModule.java
+++ b/src/main/java/com/github/xsavikx/androidscreencast/dagger/UiModule.java
@@ -12,7 +12,6 @@
import static com.github.xsavikx.androidscreencast.configuration.ApplicationConfigurationPropertyKeys.APP_WINDOW_HEIGHT_KEY;
import static com.github.xsavikx.androidscreencast.configuration.ApplicationConfigurationPropertyKeys.APP_WINDOW_WIDTH_KEY;
-@Singleton
@Module
public class UiModule {
@Singleton