Skip to content

Commit 7510c40

Browse files
committed
Merge branch 'release/v0.0.12s'
2 parents 98058f3 + 0f30a3b commit 7510c40

25 files changed

+173
-87
lines changed

.mvn/wrapper/maven-wrapper.jar

100644100755
-1.7 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,66 @@ This project gives the opportunity to use your phone even with a broken screen.
2626

2727
[wiki]: https://github.com/xSAVIKx/AndroidScreencast/wiki
2828

29+
## Configuration
30+
31+
There are 2 ways to run application:
32+
1. Run ADB server on your own
33+
2. Provide correct `app.properties` file
34+
35+
### Run ADB server on your own
36+
37+
In order to run server on your own you have to run already installed (or one from our OS-specific bundle) `adb`
38+
with following command:
39+
```
40+
adb start-server
41+
```
42+
43+
**Note**:
44+
45+
If `app.properties` will have `adb.path` filled - AndroidScreencast will shutdown ADB server on application termination.
46+
47+
Additionally, in order to use, for example, remote ADB server with ssh forwarding you should not use `app.properties` or `adb.path`
48+
property should be commented.
49+
50+
### Provide correct `app.properties` file
51+
52+
Right now to successfully run application you **should** create `app.properties` file in the same folder as
53+
AndroidScreencast's jar and provide at least one property - `adb.path` which should point to the `adb` executable file
54+
within your OS, for example such location could be configured for Windows OS:
55+
```properties
56+
adb.path=adb/windows/adb.exe
57+
```
58+
59+
Both absolute and relative paths are supported.
60+
61+
Example of valid `app.properties` could be find [here](app.properties).
62+
63+
Also we have got some valid OS-specific examples:
64+
* [OSX app.properties](adb/macosx/app.properties)
65+
* [Windows app.properties](adb/windows/app.properties)
66+
* [Linux app.properties](adb/linux/app.properties)
67+
68+
They are actually the same, just `adb.path` is OS-specific. Files listed above are automatically included into OS-specific bundles.
69+
70+
71+
### Additional properties
72+
Here is the full list of available properties for application configuration.
73+
Properties should be places in the `app.properties` file in the same folder as AndroidScreencast's jar file.
74+
75+
```properties
76+
#relative or absolute path to ADB
77+
adb.path=./adb
78+
#maximum time to wait for device (in seconds)
79+
adb.device.timeout=30
80+
#maximum time to execute adb command (in seconds)
81+
adb.command.timeout=5
82+
#initial application window width (in pixels)
83+
app.window.width=1024
84+
#initial application window height (in pixels)
85+
app.window.height=768
86+
#Defines whether application should look 'natively' to OS. Possible values: true/false
87+
app.native.look=false
88+
```
2989
## JNLP
3090

3191
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:
59119
* `androidscreencast-VERSION-linux.tar.gz`
60120
* `androidscreencast-VERSION-macosx.tar.gz`
61121

122+
In order to provide correct configuration see [configuration][configuration_section] section.
123+
124+
[configuration_section]: https://github.com/xSAVIKx/AndroidScreencast/blob/develop/README.md#configuration
125+
62126
# Requirements
63127

64128
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
81145
[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
82146
[seven_square]: https://github.com/yangh/sevensquare
83147
[droid_at_screen]: http://droid-at-screen.org/droid-at-screen/
148+
[android_screen_monitor]: https://github.com/adakoda/android-screen-monitor
84149

85150
[travis_badge]: https://travis-ci.org/xSAVIKx/AndroidScreencast.svg?branch=master
86151
[travis]: https://travis-ci.org/xSAVIKx/AndroidScreencast

adb/linux/adb

100644100755
347 KB
Binary file not shown.

adb/linux/app.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ adb.path=./adb
44
#adb.device.timeout=30
55
#maximum time to execute adb command (in seconds)
66
#adb.command.timeout=5
7-
#default.window.width=1024
8-
#default.window.height=768
7+
#app.window.width=1024
8+
#app.window.height=768
99
#Defines whether application should look 'natively' to OS
1010
#app.native.look=false

adb/linux/fastboot

100644100755
-220 KB
Binary file not shown.

adb/macosx/adb

100644100755
567 KB
Binary file not shown.

adb/macosx/app.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ adb.path=./adb
44
#adb.device.timeout=30
55
#maximum time to execute adb command (in seconds)
66
#adb.command.timeout=5
7-
#default.window.width=1024
8-
#default.window.height=768
7+
#app.window.width=1024
8+
#app.window.height=768
99
#Defines whether application should look 'natively' to OS
1010
#app.native.look=false

adb/macosx/fastboot

100644100755
107 KB
Binary file not shown.

adb/windows/AdbWinApi.dll

100644100755
File mode changed.

adb/windows/AdbWinUsbApi.dll

100644100755
File mode changed.

adb/windows/adb.exe

100644100755
288 KB
Binary file not shown.

adb/windows/app.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ adb.path=./adb.exe
44
#adb.device.timeout=30
55
#maximum time to execute adb command (in seconds)
66
#adb.command.timeout=5
7-
#default.window.width=1024
8-
#default.window.height=768
7+
#app.window.width=1024
8+
#app.window.height=768
99
#Defines whether application should look 'natively' to OS
1010
#app.native.look=false

adb/windows/fastboot.exe

100644100755
45.5 KB
Binary file not shown.

app.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
adb.path=adb/windows/adb2.exe
2-
default.window.width=1024
3-
default.window.height=768
1+
adb.path=./adb/linux/adb
2+
app.window.width=1024
3+
app.window.height=768

mvnw

100644100755
Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -54,38 +54,16 @@ case "`uname`" in
5454
CYGWIN*) cygwin=true ;;
5555
MINGW*) mingw=true;;
5656
Darwin*) darwin=true
57-
#
58-
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
59-
# for the new JDKs provided by Oracle.
60-
#
61-
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
62-
#
63-
# Apple JDKs
64-
#
65-
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
66-
fi
67-
68-
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
69-
#
70-
# Apple JDKs
71-
#
72-
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
73-
fi
74-
75-
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
76-
#
77-
# Oracle JDKs
78-
#
79-
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
80-
fi
81-
82-
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
83-
#
84-
# Apple JDKs
85-
#
86-
export JAVA_HOME=`/usr/libexec/java_home`
87-
fi
88-
;;
57+
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58+
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59+
if [ -z "$JAVA_HOME" ]; then
60+
if [ -x "/usr/libexec/java_home" ]; then
61+
export JAVA_HOME="`/usr/libexec/java_home`"
62+
else
63+
export JAVA_HOME="/Library/Java/Home"
64+
fi
65+
fi
66+
;;
8967
esac
9068

9169
if [ -z "$JAVA_HOME" ] ; then
@@ -130,7 +108,7 @@ if $cygwin ; then
130108
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
131109
fi
132110

133-
# For Migwn, ensure paths are in UNIX format before anything is touched
111+
# For Mingw, ensure paths are in UNIX format before anything is touched
134112
if $mingw ; then
135113
[ -n "$M2_HOME" ] &&
136114
M2_HOME="`(cd "$M2_HOME"; pwd)`"
@@ -187,14 +165,25 @@ CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
187165
# traverses directory structure from process work directory to filesystem root
188166
# first directory with .mvn subdirectory is considered project base directory
189167
find_maven_basedir() {
190-
local basedir=$(pwd)
191-
local wdir=$(pwd)
168+
169+
if [ -z "$1" ]
170+
then
171+
echo "Path not specified to find_maven_basedir"
172+
return 1
173+
fi
174+
175+
basedir="$1"
176+
wdir="$1"
192177
while [ "$wdir" != '/' ] ; do
193178
if [ -d "$wdir"/.mvn ] ; then
194179
basedir=$wdir
195180
break
196181
fi
197-
wdir=$(cd "$wdir/.."; pwd)
182+
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
183+
if [ -d "${wdir}" ]; then
184+
wdir=`cd "$wdir/.."; pwd`
185+
fi
186+
# end of workaround
198187
done
199188
echo "${basedir}"
200189
}
@@ -206,7 +195,15 @@ concat_lines() {
206195
fi
207196
}
208197

209-
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
198+
BASE_DIR=`find_maven_basedir "$(pwd)"`
199+
if [ -z "$BASE_DIR" ]; then
200+
exit 1;
201+
fi
202+
203+
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
204+
if [ "$MVNW_VERBOSE" = true ]; then
205+
echo $MAVEN_PROJECTBASEDIR
206+
fi
210207
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
211208

212209
# For Cygwin, switch paths to Windows format before running java
@@ -221,14 +218,8 @@ if $cygwin; then
221218
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
222219
fi
223220

224-
# Provide a "standardized" way to retrieve the CLI args that will
225-
# work with both Windows and non-Windows executions.
226-
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
227-
export MAVEN_CMD_LINE_ARGS
228-
229221
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
230222

231-
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in $@
232223
exec "$JAVACMD" \
233224
$MAVEN_OPTS \
234225
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \

mvnw.cmd

100644100755
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ goto error
8080

8181
:init
8282

83-
set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*
84-
8583
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
8684
@REM Fallback to current working directory if not found.
8785

@@ -118,10 +116,9 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
118116

119117
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120118

121-
set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
119+
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
122120
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
123121

124-
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %*
125122
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
126123
if ERRORLEVEL 1 goto error
127124
goto end

pom.xml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.github.xsavikx</groupId>
55
<artifactId>androidscreencast</artifactId>
6-
<version>0.0.10s</version>
6+
<version>0.0.12s</version>
77
<name>Android Screencast</name>
88
<packaging>jar</packaging>
99
<properties>
10-
<dagger2.version>2.9</dagger2.version>
11-
<ddmlib.version>25.2.0</ddmlib.version>
12-
<slf4j.version>1.7.24</slf4j.version>
13-
<logback-classic.version>1.2.1</logback-classic.version>
14-
<guava.version>21.0</guava.version>
10+
<dagger2.version>2.16</dagger2.version>
11+
<ddmlib.version>26.1.2</ddmlib.version>
12+
<slf4j.version>1.7.25</slf4j.version>
13+
<logback-classic.version>1.2.3</logback-classic.version>
14+
<guava.version>25.1-jre</guava.version>
1515
<main.class>com.github.xsavikx.androidscreencast.Main</main.class>
1616
<jdk.version>1.8</jdk.version>
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -63,7 +63,7 @@
6363
<plugins>
6464
<plugin>
6565
<artifactId>maven-compiler-plugin</artifactId>
66-
<version>3.6.1</version>
66+
<version>3.7.0</version>
6767
<configuration>
6868
<source>${jdk.version}</source>
6969
<target>${jdk.version}</target>
@@ -72,7 +72,7 @@
7272
<plugin>
7373
<groupId>org.apache.maven.plugins</groupId>
7474
<artifactId>maven-jar-plugin</artifactId>
75-
<version>3.0.2</version>
75+
<version>3.1.0</version>
7676
<configuration>
7777
<archive>
7878
<manifest>
@@ -84,7 +84,7 @@
8484
<plugin>
8585
<groupId>org.apache.maven.plugins</groupId>
8686
<artifactId>maven-shade-plugin</artifactId>
87-
<version>3.0.0</version>
87+
<version>3.1.1</version>
8888
<executions>
8989
<execution>
9090
<phase>package</phase>
@@ -107,7 +107,7 @@
107107
<plugin>
108108
<groupId>org.apache.maven.plugins</groupId>
109109
<artifactId>maven-assembly-plugin</artifactId>
110-
<version>3.0.0</version>
110+
<version>3.1.0</version>
111111
<configuration>
112112
<descriptors>
113113
<descriptor>src/assembly/windows.xml</descriptor>
@@ -163,6 +163,13 @@
163163
</build>
164164
</profile>
165165
</profiles>
166+
<repositories>
167+
<repository>
168+
<id>google</id>
169+
<name>Google Maven Repository</name>
170+
<url>https://maven.google.com/</url>
171+
</repository>
172+
</repositories>
166173
<url>http://xsavikx.github.io/AndroidScreencast</url>
167174
<ciManagement>
168175
<url>https://travis-ci.org/xSAVIKx/AndroidScreencast</url>

src/main/java/com/github/xsavikx/androidscreencast/api/adb/AndroidDebugBridgeWrapper.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.android.ddmlib.IDevice;
55
import com.github.xsavikx.androidscreencast.exception.IllegalAdbConfigurationException;
66
import com.github.xsavikx.androidscreencast.util.StringUtils;
7+
import com.google.common.annotations.VisibleForTesting;
78

89
import javax.inject.Inject;
910
import javax.inject.Named;
@@ -31,7 +32,9 @@ public boolean hasInitialDeviceList() {
3132
}
3233

3334
public void stop() {
34-
AndroidDebugBridge.disconnectBridge();
35+
if (hasAdbPathFilled()) {
36+
AndroidDebugBridge.disconnectBridge();
37+
}
3538
AndroidDebugBridge.terminate();
3639
}
3740

@@ -47,12 +50,7 @@ private void init() {
4750
return;
4851
}
4952
try {
50-
AndroidDebugBridge.initIfNeeded(false);
51-
if (StringUtils.isNotEmpty(adbPath)) {
52-
adb = AndroidDebugBridge.createBridge(adbPath, false);
53-
} else {
54-
adb = AndroidDebugBridge.createBridge();
55-
}
53+
adb = createAndroidDebugBridge();
5654
} catch (IllegalArgumentException e) {
5755
if (hasAdbProcFailed(e)) {
5856
throw new IllegalAdbConfigurationException(adbPath);
@@ -61,6 +59,19 @@ private void init() {
6159
}
6260
}
6361

62+
@VisibleForTesting
63+
AndroidDebugBridge createAndroidDebugBridge() {
64+
AndroidDebugBridge.initIfNeeded(false);
65+
if (hasAdbPathFilled()) {
66+
return AndroidDebugBridge.createBridge(adbPath, false);
67+
}
68+
return AndroidDebugBridge.createBridge();
69+
}
70+
71+
private boolean hasAdbPathFilled() {
72+
return StringUtils.isNotEmpty(adbPath);
73+
}
74+
6475
private boolean hasAdbProcFailed(IllegalArgumentException e) {
6576
return e.getCause() != null
6677
&& e.getCause() instanceof IOException

0 commit comments

Comments
 (0)