diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..30a4a09 --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.directory b/.directory new file mode 100644 index 0000000..9febeea --- /dev/null +++ b/.directory @@ -0,0 +1,3 @@ +[Dolphin] +ShowPreview=true +Timestamp=2010,9,24,20,26,16 diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 681f7af..664113d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,9 +1,9 @@ + package="org.onaips.vnc_donate" android:versionName="v0.91" android:versionCode="42"> + android:label="droid VNC server" android:name="MainApplication"> diff --git a/bin/avnc.apk b/bin/avnc.apk index 3e13a2a..73da014 100644 Binary files a/bin/avnc.apk and b/bin/avnc.apk differ diff --git a/bin/avnc_signed.apk b/bin/avnc_signed.apk index eef3bc2..bf2bfd2 100644 Binary files a/bin/avnc_signed.apk and b/bin/avnc_signed.apk differ diff --git a/bin/avnc_signed_free.apk b/bin/avnc_signed_free.apk new file mode 100644 index 0000000..e86e68f Binary files /dev/null and b/bin/avnc_signed_free.apk differ diff --git a/bin/classes.dex b/bin/classes.dex index df0fcc1..20552c9 100644 Binary files a/bin/classes.dex and b/bin/classes.dex differ diff --git a/bin/ndk/local/armeabi/androidvncserver b/bin/ndk/local/armeabi/androidvncserver index 3fb4d36..3f6393a 100755 Binary files a/bin/ndk/local/armeabi/androidvncserver and b/bin/ndk/local/armeabi/androidvncserver differ diff --git a/bin/ndk/local/armeabi/libjpeg.a b/bin/ndk/local/armeabi/libjpeg.a index 27650b3..d5d66a4 100644 Binary files a/bin/ndk/local/armeabi/libjpeg.a and b/bin/ndk/local/armeabi/libjpeg.a differ diff --git a/bin/ndk/local/armeabi/objs/androidvncserver/fbvncserver.o b/bin/ndk/local/armeabi/objs/androidvncserver/fbvncserver.o index f5ae126..1cd332f 100644 Binary files a/bin/ndk/local/armeabi/objs/androidvncserver/fbvncserver.o and b/bin/ndk/local/armeabi/objs/androidvncserver/fbvncserver.o differ diff --git a/bin/ndk/local/armeabi/objs/androidvncserver/suinput.o b/bin/ndk/local/armeabi/objs/androidvncserver/suinput.o index 0dc44a1..f5dfc37 100644 Binary files a/bin/ndk/local/armeabi/objs/androidvncserver/suinput.o and b/bin/ndk/local/armeabi/objs/androidvncserver/suinput.o differ diff --git a/bin/org/onaips/vnc/MainActivity$1$1.class b/bin/org/onaips/vnc/MainActivity$1$1.class deleted file mode 100644 index a8df503..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$1$1.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$1.class b/bin/org/onaips/vnc/MainActivity$1.class deleted file mode 100644 index 643661d..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$1.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$10.class b/bin/org/onaips/vnc/MainActivity$10.class deleted file mode 100644 index a2ca853..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$10.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$11.class b/bin/org/onaips/vnc/MainActivity$11.class deleted file mode 100644 index a2b8d09..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$11.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$12.class b/bin/org/onaips/vnc/MainActivity$12.class deleted file mode 100644 index aaec6f2..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$12.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$2$1.class b/bin/org/onaips/vnc/MainActivity$2$1.class deleted file mode 100644 index 6806b90..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$2$1.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$2.class b/bin/org/onaips/vnc/MainActivity$2.class deleted file mode 100644 index 881d29b..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$2.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$3.class b/bin/org/onaips/vnc/MainActivity$3.class deleted file mode 100644 index 7bcf4f2..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$3.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$4.class b/bin/org/onaips/vnc/MainActivity$4.class deleted file mode 100644 index 56c024c..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$4.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$5$1.class b/bin/org/onaips/vnc/MainActivity$5$1.class deleted file mode 100644 index e3ac8f4..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$5$1.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$5.class b/bin/org/onaips/vnc/MainActivity$5.class deleted file mode 100644 index 794c821..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$5.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$6.class b/bin/org/onaips/vnc/MainActivity$6.class deleted file mode 100644 index 5874091..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$6.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$7.class b/bin/org/onaips/vnc/MainActivity$7.class deleted file mode 100644 index daadd61..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$7.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$8.class b/bin/org/onaips/vnc/MainActivity$8.class deleted file mode 100644 index ae11590..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$8.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity$9.class b/bin/org/onaips/vnc/MainActivity$9.class deleted file mode 100644 index 6efcc6d..0000000 Binary files a/bin/org/onaips/vnc/MainActivity$9.class and /dev/null differ diff --git a/bin/org/onaips/vnc/MainActivity.class b/bin/org/onaips/vnc/MainActivity.class deleted file mode 100644 index 73ffffd..0000000 Binary files a/bin/org/onaips/vnc/MainActivity.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$array.class b/bin/org/onaips/vnc/R$array.class deleted file mode 100644 index 935110b..0000000 Binary files a/bin/org/onaips/vnc/R$array.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$attr.class b/bin/org/onaips/vnc/R$attr.class deleted file mode 100644 index 4131c26..0000000 Binary files a/bin/org/onaips/vnc/R$attr.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$drawable.class b/bin/org/onaips/vnc/R$drawable.class deleted file mode 100644 index 6b26f55..0000000 Binary files a/bin/org/onaips/vnc/R$drawable.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$id.class b/bin/org/onaips/vnc/R$id.class deleted file mode 100644 index dc2c137..0000000 Binary files a/bin/org/onaips/vnc/R$id.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$layout.class b/bin/org/onaips/vnc/R$layout.class deleted file mode 100644 index 0bea272..0000000 Binary files a/bin/org/onaips/vnc/R$layout.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$menu.class b/bin/org/onaips/vnc/R$menu.class deleted file mode 100644 index d70f9fe..0000000 Binary files a/bin/org/onaips/vnc/R$menu.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$raw.class b/bin/org/onaips/vnc/R$raw.class deleted file mode 100644 index c655ac9..0000000 Binary files a/bin/org/onaips/vnc/R$raw.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$string.class b/bin/org/onaips/vnc/R$string.class deleted file mode 100644 index c1c3154..0000000 Binary files a/bin/org/onaips/vnc/R$string.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$styleable.class b/bin/org/onaips/vnc/R$styleable.class deleted file mode 100644 index e5c5c8c..0000000 Binary files a/bin/org/onaips/vnc/R$styleable.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R$xml.class b/bin/org/onaips/vnc/R$xml.class deleted file mode 100644 index 06f4976..0000000 Binary files a/bin/org/onaips/vnc/R$xml.class and /dev/null differ diff --git a/bin/org/onaips/vnc/R.class b/bin/org/onaips/vnc/R.class deleted file mode 100644 index 151bceb..0000000 Binary files a/bin/org/onaips/vnc/R.class and /dev/null differ diff --git a/bin/org/onaips/vnc/preferences.class b/bin/org/onaips/vnc/preferences.class deleted file mode 100644 index 818b744..0000000 Binary files a/bin/org/onaips/vnc/preferences.class and /dev/null differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$1.class b/bin/org/onaips/vnc_donate/MainActivity$1.class index c6ba76c..e8d4d7b 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$1.class and b/bin/org/onaips/vnc_donate/MainActivity$1.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$10.class b/bin/org/onaips/vnc_donate/MainActivity$10.class index 9ea2695..01b0818 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$10.class and b/bin/org/onaips/vnc_donate/MainActivity$10.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$11.class b/bin/org/onaips/vnc_donate/MainActivity$11.class index c213b81..554922a 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$11.class and b/bin/org/onaips/vnc_donate/MainActivity$11.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$2$1.class b/bin/org/onaips/vnc_donate/MainActivity$2$1.class index 6b218cf..848ed1d 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$2$1.class and b/bin/org/onaips/vnc_donate/MainActivity$2$1.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$2.class b/bin/org/onaips/vnc_donate/MainActivity$2.class index 785991b..d120152 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$2.class and b/bin/org/onaips/vnc_donate/MainActivity$2.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$3.class b/bin/org/onaips/vnc_donate/MainActivity$3.class index a4fad5f..65a2bb4 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$3.class and b/bin/org/onaips/vnc_donate/MainActivity$3.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$4.class b/bin/org/onaips/vnc_donate/MainActivity$4.class index d961210..c2268dd 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$4.class and b/bin/org/onaips/vnc_donate/MainActivity$4.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$5.class b/bin/org/onaips/vnc_donate/MainActivity$5.class index 144525f..a53527f 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$5.class and b/bin/org/onaips/vnc_donate/MainActivity$5.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$6$1.class b/bin/org/onaips/vnc_donate/MainActivity$6$1.class index b9183df..fba9820 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$6$1.class and b/bin/org/onaips/vnc_donate/MainActivity$6$1.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$6.class b/bin/org/onaips/vnc_donate/MainActivity$6.class index 8aa0cb4..0cf442d 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$6.class and b/bin/org/onaips/vnc_donate/MainActivity$6.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$7.class b/bin/org/onaips/vnc_donate/MainActivity$7.class index 515ab30..ce5a7ad 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$7.class and b/bin/org/onaips/vnc_donate/MainActivity$7.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$8.class b/bin/org/onaips/vnc_donate/MainActivity$8.class index 77692bd..a9e662a 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$8.class and b/bin/org/onaips/vnc_donate/MainActivity$8.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$9.class b/bin/org/onaips/vnc_donate/MainActivity$9.class index 69300d3..fe2a877 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$9.class and b/bin/org/onaips/vnc_donate/MainActivity$9.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity$mReceiver.class b/bin/org/onaips/vnc_donate/MainActivity$mReceiver.class index f5def33..c709f50 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity$mReceiver.class and b/bin/org/onaips/vnc_donate/MainActivity$mReceiver.class differ diff --git a/bin/org/onaips/vnc_donate/MainActivity.class b/bin/org/onaips/vnc_donate/MainActivity.class index 0cbc8b0..69ca3cf 100644 Binary files a/bin/org/onaips/vnc_donate/MainActivity.class and b/bin/org/onaips/vnc_donate/MainActivity.class differ diff --git a/bin/org/onaips/vnc_donate/MainApplication.class b/bin/org/onaips/vnc_donate/MainApplication.class new file mode 100644 index 0000000..830dc92 Binary files /dev/null and b/bin/org/onaips/vnc_donate/MainApplication.class differ diff --git a/bin/org/onaips/vnc_donate/R$array.class b/bin/org/onaips/vnc_donate/R$array.class index 2dcec7e..6d9833c 100644 Binary files a/bin/org/onaips/vnc_donate/R$array.class and b/bin/org/onaips/vnc_donate/R$array.class differ diff --git a/bin/org/onaips/vnc_donate/R$attr.class b/bin/org/onaips/vnc_donate/R$attr.class index 70a54a3..fa53e1d 100644 Binary files a/bin/org/onaips/vnc_donate/R$attr.class and b/bin/org/onaips/vnc_donate/R$attr.class differ diff --git a/bin/org/onaips/vnc_donate/R$drawable.class b/bin/org/onaips/vnc_donate/R$drawable.class index 2369cd6..925f46c 100644 Binary files a/bin/org/onaips/vnc_donate/R$drawable.class and b/bin/org/onaips/vnc_donate/R$drawable.class differ diff --git a/bin/org/onaips/vnc_donate/R$id.class b/bin/org/onaips/vnc_donate/R$id.class index 9fbb5d1..e79b2f0 100644 Binary files a/bin/org/onaips/vnc_donate/R$id.class and b/bin/org/onaips/vnc_donate/R$id.class differ diff --git a/bin/org/onaips/vnc_donate/R$layout.class b/bin/org/onaips/vnc_donate/R$layout.class index c2c6bc8..5bf7a36 100644 Binary files a/bin/org/onaips/vnc_donate/R$layout.class and b/bin/org/onaips/vnc_donate/R$layout.class differ diff --git a/bin/org/onaips/vnc_donate/R$menu.class b/bin/org/onaips/vnc_donate/R$menu.class index eaa3a7b..04e4ea5 100644 Binary files a/bin/org/onaips/vnc_donate/R$menu.class and b/bin/org/onaips/vnc_donate/R$menu.class differ diff --git a/bin/org/onaips/vnc_donate/R$raw.class b/bin/org/onaips/vnc_donate/R$raw.class index c513a2b..fd39985 100644 Binary files a/bin/org/onaips/vnc_donate/R$raw.class and b/bin/org/onaips/vnc_donate/R$raw.class differ diff --git a/bin/org/onaips/vnc_donate/R$string.class b/bin/org/onaips/vnc_donate/R$string.class index eec2e30..879b410 100644 Binary files a/bin/org/onaips/vnc_donate/R$string.class and b/bin/org/onaips/vnc_donate/R$string.class differ diff --git a/bin/org/onaips/vnc_donate/R$styleable.class b/bin/org/onaips/vnc_donate/R$styleable.class index e82bf77..480e3bd 100644 Binary files a/bin/org/onaips/vnc_donate/R$styleable.class and b/bin/org/onaips/vnc_donate/R$styleable.class differ diff --git a/bin/org/onaips/vnc_donate/R$xml.class b/bin/org/onaips/vnc_donate/R$xml.class index 35272f5..fccea0f 100644 Binary files a/bin/org/onaips/vnc_donate/R$xml.class and b/bin/org/onaips/vnc_donate/R$xml.class differ diff --git a/bin/org/onaips/vnc_donate/StartAtBootService.class b/bin/org/onaips/vnc_donate/StartAtBootService.class index 2e94cb9..5b97075 100644 Binary files a/bin/org/onaips/vnc_donate/StartAtBootService.class and b/bin/org/onaips/vnc_donate/StartAtBootService.class differ diff --git a/bin/resources.ap_ b/bin/resources.ap_ index 198b6e5..406038e 100644 Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ diff --git a/gen/org/onaips/vnc/R.java b/gen/org/onaips/vnc/R.java deleted file mode 100644 index 8a89aa3..0000000 --- a/gen/org/onaips/vnc/R.java +++ /dev/null @@ -1,197 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package org.onaips.vnc; - -public final class R { - public static final class array { - public static final int rotation_values=0x7f070000; - public static final int scale_strings=0x7f070002; - public static final int scale_values=0x7f070001; - } - public static final class attr { - /**

Must be a color value, in the form of "#rgb", "#argb", -"#rrggbb", or "#aarrggbb". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - */ - public static final int backgroundColor=0x7f010000; - /**

Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - */ - public static final int keywords=0x7f010003; - /**

Must be a color value, in the form of "#rgb", "#argb", -"#rrggbb", or "#aarrggbb". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - */ - public static final int primaryTextColor=0x7f010001; - /**

Must be an integer value, such as "100". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - */ - public static final int refreshInterval=0x7f010004; - /**

Must be a color value, in the form of "#rgb", "#argb", -"#rrggbb", or "#aarrggbb". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - */ - public static final int secondaryTextColor=0x7f010002; - } - public static final class drawable { - public static final int bg=0x7f020000; - public static final int btnstart=0x7f020001; - public static final int btnstart_normal=0x7f020002; - public static final int btnstart_pressed=0x7f020003; - public static final int btnstop=0x7f020004; - public static final int btnstop_normal=0x7f020005; - public static final int btnstop_pressed=0x7f020006; - public static final int droidvnclogo=0x7f020007; - public static final int icon=0x7f020008; - } - public static final class id { - public static final int Button01=0x7f090000; - public static final int Button02=0x7f090001; - public static final int TextView01=0x7f090002; - public static final int TextView02=0x7f090004; - public static final int banner_adview=0x7f090005; - public static final int preferences=0x7f090006; - public static final int stateLabel=0x7f090003; - } - public static final class layout { - public static final int main=0x7f030000; - } - public static final class menu { - public static final int menu=0x7f080000; - } - public static final class raw { - public static final int androidvncserver=0x7f050000; - public static final int indexvnc=0x7f050001; - public static final int vncviewer=0x7f050002; - } - public static final class string { - public static final int app_name=0x7f060000; - public static final int device_info_fmt=0x7f060002; - public static final int password=0x7f060001; - } - public static final class xml { - public static final int preferences=0x7f040000; - } - public static final class styleable { - /** Attributes that can be used with a com_admob_android_ads_AdView. -

Includes the following attributes:

- - - - - - - - - -
AttributeDescription
{@link #com_admob_android_ads_AdView_backgroundColor org.onaips.vnc:backgroundColor}
{@link #com_admob_android_ads_AdView_keywords org.onaips.vnc:keywords}
{@link #com_admob_android_ads_AdView_primaryTextColor org.onaips.vnc:primaryTextColor}
{@link #com_admob_android_ads_AdView_refreshInterval org.onaips.vnc:refreshInterval}
{@link #com_admob_android_ads_AdView_secondaryTextColor org.onaips.vnc:secondaryTextColor}
- @see #com_admob_android_ads_AdView_backgroundColor - @see #com_admob_android_ads_AdView_keywords - @see #com_admob_android_ads_AdView_primaryTextColor - @see #com_admob_android_ads_AdView_refreshInterval - @see #com_admob_android_ads_AdView_secondaryTextColor - */ - public static final int[] com_admob_android_ads_AdView = { - 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, - 0x7f010004 - }; - /** -

This symbol is the offset where the {@link org.onaips.vnc.R.attr#backgroundColor} - attribute's value can be found in the {@link #com_admob_android_ads_AdView} array. - - -

Must be a color value, in the form of "#rgb", "#argb", -"#rrggbb", or "#aarrggbb". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - @attr name android:backgroundColor - */ - public static final int com_admob_android_ads_AdView_backgroundColor = 0; - /** -

This symbol is the offset where the {@link org.onaips.vnc.R.attr#keywords} - attribute's value can be found in the {@link #com_admob_android_ads_AdView} array. - - -

Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - @attr name android:keywords - */ - public static final int com_admob_android_ads_AdView_keywords = 3; - /** -

This symbol is the offset where the {@link org.onaips.vnc.R.attr#primaryTextColor} - attribute's value can be found in the {@link #com_admob_android_ads_AdView} array. - - -

Must be a color value, in the form of "#rgb", "#argb", -"#rrggbb", or "#aarrggbb". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - @attr name android:primaryTextColor - */ - public static final int com_admob_android_ads_AdView_primaryTextColor = 1; - /** -

This symbol is the offset where the {@link org.onaips.vnc.R.attr#refreshInterval} - attribute's value can be found in the {@link #com_admob_android_ads_AdView} array. - - -

Must be an integer value, such as "100". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - @attr name android:refreshInterval - */ - public static final int com_admob_android_ads_AdView_refreshInterval = 4; - /** -

This symbol is the offset where the {@link org.onaips.vnc.R.attr#secondaryTextColor} - attribute's value can be found in the {@link #com_admob_android_ads_AdView} array. - - -

Must be a color value, in the form of "#rgb", "#argb", -"#rrggbb", or "#aarrggbb". -

This may also be a reference to a resource (in the form -"@[package:]type:name") or -theme attribute (in the form -"?[package:][type:]name") -containing a value of this type. - @attr name android:secondaryTextColor - */ - public static final int com_admob_android_ads_AdView_secondaryTextColor = 2; - }; -} diff --git a/gen/org/onaips/vnc_donate/R.java b/gen/org/onaips/vnc_donate/R.java index 6f5b982..ec66fad 100644 --- a/gen/org/onaips/vnc_donate/R.java +++ b/gen/org/onaips/vnc_donate/R.java @@ -9,11 +9,13 @@ package org.onaips.vnc_donate; public final class R { public static final class array { + public static final int rotation_strings=0x7f070001; public static final int rotation_values=0x7f070000; - public static final int scale_strings=0x7f070002; - public static final int scale_values=0x7f070001; - public static final int sleep_strings=0x7f070003; - public static final int startonboot_values=0x7f070004; + public static final int scale_strings=0x7f070003; + public static final int scale_values=0x7f070002; + public static final int sleep_strings=0x7f070004; + public static final int startonboot_strings=0x7f070005; + public static final int startonboot_values=0x7f070006; } public static final class attr { /**

Must be a color value, in the form of "#rgb", "#argb", @@ -87,13 +89,13 @@ containing a value of this type. } public static final class raw { public static final int androidvncserver=0x7f050000; - public static final int indexvnc=0x7f050001; - public static final int vncviewer=0x7f050002; + public static final int busybox=0x7f050001; + public static final int indexvnc=0x7f050002; + public static final int vncviewer=0x7f050003; } public static final class string { public static final int app_name=0x7f060000; public static final int device_info_fmt=0x7f060001; - public static final int package_name=0x7f060002; } public static final class xml { public static final int preferences=0x7f040000; diff --git a/jni/vnc/fbvncserver.c b/jni/vnc/fbvncserver.c index f243634..a26cdde 100755 --- a/jni/vnc/fbvncserver.c +++ b/jni/vnc/fbvncserver.c @@ -143,7 +143,7 @@ static void init_fb(void) size_t fbSize = roundUpToPageSize(fscrinfo.line_length * scrinfo.yres_virtual); - fbmmap = mmap(NULL, fbSize , PROT_READ|PROT_WRITE , MAP_SHARED , fbfd, 0); + fbmmap = mmap(NULL, fbSize , PROT_READ|PROT_WRITE , MAP_SHARED , fbfd, 0); if (fbmmap == MAP_FAILED) @@ -238,10 +238,11 @@ static void init_fb_server(int argc, char **argv) } #ifdef DONATE_VERSION - vncscr->httpDir="/data/data/org.onaips.vnc_donate/"; + vncscr->httpDir="/data/data/org.onaips.vnc_donate/files/"; #else - vncscr->httpDir="/data/data/org.onaips.vnc/"; + vncscr->httpDir="/data/data/org.onaips.vnc/files/"; #endif + vncscr->serverFormat.redShift=scrinfo.red.offset; vncscr->serverFormat.greenShift=scrinfo.green.offset; vncscr->serverFormat.blueShift=scrinfo.blue.offset; @@ -315,7 +316,7 @@ static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl) else ;//ret=suinput_release(inputfd,code); - //__android_log_print(ANDROID_LOG_INFO,"VNC","injectKey (%d, %d) ret=%d\n", code , down,ret); + __android_log_print(ANDROID_LOG_INFO,"VNC","injectKey (%d, %d) ret=%d\n", code , down,ret); } } @@ -738,25 +739,8 @@ int main(int argc, char **argv) __android_log_print(ANDROID_LOG_INFO,"VNC"," bpp: %d\n", (int)scrinfo.bits_per_pixel); __android_log_print(ANDROID_LOG_INFO,"VNC"," port: %d\n", (int)VNC_PORT); init_fb_server(argc, argv); - /* - rfbRunEventLoop(vncscr,-1,TRUE); while (1) - { - while (vncscr->clientHead == NULL) - sleep(1); - - if (standby>60) - sleep(2); - else if (standby>30) - sleep(1); - else - usleep(100000); - - update_screen(); - }*/ - - while (1) { while (vncscr->clientHead == NULL) rfbProcessEvents(vncscr, 100000); diff --git a/jni/vnc/fbvncserver.c~ b/jni/vnc/fbvncserver.c~ index 049c81f..17d3c4f 100755 --- a/jni/vnc/fbvncserver.c~ +++ b/jni/vnc/fbvncserver.c~ @@ -57,7 +57,7 @@ char VNC_PASSWORD[256] = ""; char framebuffer_device[256] = "/dev/graphics/fb0"; -char VNC_PORT[10]="5901"; +int VNC_PORT=5901; static struct fb_var_screeninfo scrinfo; static struct fb_fix_screeninfo fscrinfo; @@ -143,7 +143,7 @@ static void init_fb(void) size_t fbSize = roundUpToPageSize(fscrinfo.line_length * scrinfo.yres_virtual); - fbmmap = mmap(NULL, fbSize , PROT_READ|PROT_WRITE , MAP_SHARED , fbfd, 0); + fbmmap = mmap(NULL, fbSize , PROT_READ|PROT_WRITE , MAP_SHARED , fbfd, 0); if (fbmmap == MAP_FAILED) @@ -238,9 +238,9 @@ static void init_fb_server(int argc, char **argv) } #ifdef DONATE_VERSION - vncscr->httpDir="/data/data/org.onaips.vnc_donate/"; + vncscr->httpDir="/data/data/org.onaips.vnc_donate/files/"; #else - vncscr->httpDir="/data/data/org.onaips.vnc/"; + vncscr->httpDir="/data/data/org.onaips.vnc/files/"; #endif vncscr->serverFormat.redShift=scrinfo.red.offset; vncscr->serverFormat.greenShift=scrinfo.green.offset; @@ -315,7 +315,7 @@ static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl) else ;//ret=suinput_release(inputfd,code); - //__android_log_print(ANDROID_LOG_INFO,"VNC","injectKey (%d, %d) ret=%d\n", code , down,ret); + __android_log_print(ANDROID_LOG_INFO,"VNC","injectKey (%d, %d) ret=%d\n", code , down,ret); } } @@ -738,25 +738,8 @@ int main(int argc, char **argv) __android_log_print(ANDROID_LOG_INFO,"VNC"," bpp: %d\n", (int)scrinfo.bits_per_pixel); __android_log_print(ANDROID_LOG_INFO,"VNC"," port: %d\n", (int)VNC_PORT); init_fb_server(argc, argv); - /* - rfbRunEventLoop(vncscr,-1,TRUE); while (1) - { - while (vncscr->clientHead == NULL) - sleep(1); - - if (standby>60) - sleep(2); - else if (standby>30) - sleep(1); - else - usleep(100000); - - update_screen(); - }*/ - - while (1) { while (vncscr->clientHead == NULL) rfbProcessEvents(vncscr, 100000); diff --git a/jni/vnc/suinput.c b/jni/vnc/suinput.c index 364a551..3f7f18d 100644 --- a/jni/vnc/suinput.c +++ b/jni/vnc/suinput.c @@ -209,12 +209,12 @@ int suinput_set_pointer(int uinput_fd, int32_t x, int32_t y) int suinput_press(int uinput_fd, uint16_t code) { - return suinput_write_syn(uinput_fd, EV_KEY, code, 1); + return suinput_write(uinput_fd, EV_KEY, code, 1); } int suinput_release(int uinput_fd, uint16_t code) { - return suinput_write_syn(uinput_fd, EV_KEY, code, 0); + return suinput_write(uinput_fd, EV_KEY, code, 0); } int suinput_click(int uinput_fd, uint16_t code) diff --git a/jni/vnc/suinput.c~ b/jni/vnc/suinput.c~ new file mode 100644 index 0000000..364a551 --- /dev/null +++ b/jni/vnc/suinput.c~ @@ -0,0 +1,225 @@ +/* +suinput - Simple C-API to the Linux uinput-system. +Copyright (C) 2009 Tuomas Räsänen + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include +#include +#include +#include +#include "suinput.h" + +char* UINPUT_FILEPATHS[] = { + "/android/dev/uinput", + "/dev/uinput", + "/dev/input/uinput", + "/dev/misc/uinput", +}; +#define UINPUT_FILEPATHS_COUNT (sizeof(UINPUT_FILEPATHS) / sizeof(char*)) + +int suinput_write(int uinput_fd, + uint16_t type, uint16_t code, int32_t value) +{ + struct input_event event; + memset(&event, 0, sizeof(event)); + gettimeofday(&event.time, 0); /* This should not be able to fail ever.. */ + event.type = type; + event.code = code; + event.value = value; + if (write(uinput_fd, &event, sizeof(event)) != sizeof(event)) + return -1; + return 0; +} + +int suinput_write_syn(int uinput_fd, + uint16_t type, uint16_t code, int32_t value) +{ + if (suinput_write(uinput_fd, type, code, value)) + return -1; + return suinput_write(uinput_fd, EV_SYN, SYN_REPORT, 0); +} + +int suinput_open(const char* device_name, const struct input_id* id) +{ + int original_errno = 0; + int uinput_fd = -1; + struct uinput_user_dev user_dev; + int i; + + for (i = 0; i < UINPUT_FILEPATHS_COUNT; ++i) { + uinput_fd = open(UINPUT_FILEPATHS[i], O_WRONLY | O_NONBLOCK); + if (uinput_fd != -1) + break; + } + + if (uinput_fd == -1) + return -1; + + + + /* Set device to handle following types of events: */ + + /* Key and button events */ + if (ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY) == -1) + goto err; +// +// /* Key and button repetition events */ + if (ioctl(uinput_fd, UI_SET_EVBIT, EV_REP) == -1) + goto err; +// +// /* Relative pointer motions */ +// if (ioctl(uinput_fd, UI_SET_EVBIT, EV_REL) == -1) +// goto err; + + /* Absolute pointer motions */ + + if (ioctl(uinput_fd, UI_SET_EVBIT, EV_ABS) == -1) + goto err; + + /* Synchronization events, this is probably set implicitely too. */ + if (ioctl(uinput_fd, UI_SET_EVBIT, EV_SYN) == -1) + goto err; + + + + /* Configure device to handle relative x and y axis. */ +// if (ioctl(uinput_fd, UI_SET_RELBIT, REL_X) == -1) +// goto err; +// if (ioctl(uinput_fd, UI_SET_RELBIT, REL_Y) == -1) +// goto err; + + /* Configure device to handle absolute x and y axis. */ + if (ioctl(uinput_fd, UI_SET_ABSBIT, ABS_X) == -1) + goto err; + if (ioctl(uinput_fd, UI_SET_ABSBIT, ABS_Y) == -1) + goto err; + + + + /* Configure device to handle all keys, see linux/input.h. */ + for (i = 0; i < KEY_MAX; i++) { + if (ioctl(uinput_fd, UI_SET_KEYBIT, i) == -1) + goto err; + } + + /* Set device-specific information. */ + memset(&user_dev, 0, sizeof(user_dev)); + strncpy(user_dev.name, device_name, UINPUT_MAX_NAME_SIZE); + user_dev.id.bustype = id->bustype; + user_dev.id.vendor = id->vendor; + user_dev.id.product = id->product; + user_dev.id.version = id->version; + + //minor tweak to support ABSolute events + user_dev.absmin[ABS_X] = -2047; + user_dev.absmax[ABS_X] = 2048; + user_dev.absfuzz[ABS_X] = 0; + user_dev.absflat[ABS_X] = 0; + + user_dev.absmin[ABS_Y] = -2047; + user_dev.absmax[ABS_Y] = 2048; + user_dev.absfuzz[ABS_Y] = 0; + user_dev.absflat[ABS_Y] = 0; + + if (write(uinput_fd, &user_dev, sizeof(user_dev)) != sizeof(user_dev)) + goto err; + + + if (ioctl(uinput_fd, UI_DEV_CREATE) == -1) + goto err; + + /* + The reason for generating a small delay is that creating succesfully + an uinput device does not guarantee that the device is ready to process + input events. It's probably due the asynchronous nature of the udev. + However, my experiments show that the device is not ready to process input + events even after a device creation event is received from udev. + */ + + //sleep(2); + + return uinput_fd; + + err: + + /* + At this point, errno is set for some reason. However, cleanup-actions + can also fail and reset errno, therefore we store the original one + and reset it before returning. + */ + original_errno = errno; + + /* Cleanup. */ + close(uinput_fd); /* Might fail, but we don't care anymore at this point. */ + + errno = original_errno; + return -1; +} + +int suinput_close(int uinput_fd) +{ + /* + Sleep before destroying the device because there still can be some + unprocessed events. This is not the right way, but I am still + looking for better ways. The question is: how to know whether there + are any unprocessed uinput events? + */ + sleep(2); + + if (ioctl(uinput_fd, UI_DEV_DESTROY) == -1) { + close(uinput_fd); + return -1; + } + + if (close(uinput_fd) == -1) + return -1; + + return 0; +} + +int suinput_move_pointer(int uinput_fd, int32_t x, int32_t y) +{ + if (suinput_write(uinput_fd, EV_REL, REL_X, x)) + return -1; + return suinput_write_syn(uinput_fd, EV_REL, REL_Y, y); +} + +int suinput_set_pointer(int uinput_fd, int32_t x, int32_t y) +{ + if (suinput_write(uinput_fd, EV_ABS, ABS_X, x)) + return -1; + return suinput_write_syn(uinput_fd, EV_ABS, ABS_Y, y); +} + +int suinput_press(int uinput_fd, uint16_t code) +{ + return suinput_write_syn(uinput_fd, EV_KEY, code, 1); +} + +int suinput_release(int uinput_fd, uint16_t code) +{ + return suinput_write_syn(uinput_fd, EV_KEY, code, 0); +} + +int suinput_click(int uinput_fd, uint16_t code) +{ + if (suinput_press(uinput_fd, code)) + return -1; + return suinput_release(uinput_fd, code); +} diff --git a/libs/armeabi/androidvncserver b/libs/armeabi/androidvncserver index 7ffb525..754ab5a 100755 Binary files a/libs/armeabi/androidvncserver and b/libs/armeabi/androidvncserver differ diff --git a/res/layout/main.xml b/res/layout/main.xml index 47322ee..1746d5f 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -54,19 +54,10 @@ android:gravity="center" > - + - + + + + + + \ No newline at end of file diff --git a/src/org/onaips/vnc/MainActivity.java b/src/org/onaips/vnc/MainActivity.java deleted file mode 100644 index 3ffb58d..0000000 --- a/src/org/onaips/vnc/MainActivity.java +++ /dev/null @@ -1,713 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * 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. - */ -package org.onaips.vnc; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - - -import android.app.Activity; -import android.app.AlertDialog; -import android.app.ProgressDialog; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.content.pm.PackageManager.NameNotFoundException; -import android.graphics.Color; -import android.net.DhcpInfo; -import android.net.Uri; -import android.net.wifi.WifiInfo; -import android.net.wifi.WifiManager; -import android.os.Build; -import android.os.Bundle; -import android.preference.PreferenceManager; -import android.text.Html; -import android.util.Log; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.TextView; -import android.widget.Toast; - -public class MainActivity extends Activity -{ - private static final int MENU_QUIT = 0; - private static final int MENU_HELP = 1; - private static final int MENU_ONAIPS = 2; - private static final int MENU_SENDLOG = 3; - private static final String changelog="-PLEASE REPORT FEEDBACK! (send debug info in menu)
- [Add] Server-side screen scaling (change it in preferences - BETA)
- [Fix] Half-screen bug
New icon
Courtesy of Sandro Forbice (@sandroforbice)
- [Fix] Double buffering now supported
- [Add] Low CPU on idle screen while connected
- [Fix] Update while rotated"; - - - SharedPreferences preferences; - ProgressDialog dialog=null; - AlertDialog startDialog; - - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main); - - - // Initialize preferences - preferences = PreferenceManager.getDefaultSharedPreferences(this); - - if (!hasRootPermission()) - { - Log.v("VNC","You don't have root permissions...!!!"); - showTextOnScreen("You don't have root permissions...Please ROOT your phone first!!!"); - //System.exit(-1); - } - - showInitialScreen(); - createBinary(); - - - boolean serverRunning=isAndroidServerRunning(); - - setStateLabel(serverRunning); - TextView t=(TextView)findViewById(R.id.TextView01); - - if (serverRunning) - t.setText("Connect to:\n" + getIpAddress()+":5901" + "\nor\nhttp://" + getIpAddress() + ":5801"); - else - t.setText(""); - - - findViewById(R.id.Button01).setOnClickListener(new OnClickListener() { - @Override - public void onClick(View arg0) { - Thread t=new Thread(){ - public void run() - { - startServerButtonClicked(); - - } - }; - t.start(); - - try { - Thread.sleep(1000); - for (int i=0;i<5;i++) - { - - if (!isAndroidServerRunning()) - Thread.sleep(1000); - else - break; - } - } catch (InterruptedException e) { - // TODO Auto-generated catch block - Log.v("VNC","Button01_click:"+ e.getMessage()); - } - - boolean s=isAndroidServerRunning(); - if (!s) - showTextOnScreen("Couldn't start VNC Server"); - //setStateLabel(s); - return; - } - }) ; - findViewById(R.id.Button02).setOnClickListener(new OnClickListener() { - @Override - public void onClick(View arg0) { - - Thread t=new Thread(){ - public void run() - { - stopServer(); - - } - }; - t.start(); - - try { - Thread.sleep(1000); - - - for (int i=0;i<5;i++) - { - if (isAndroidServerRunning()) - Thread.sleep(1000); - else - break; - } - } catch (InterruptedException e) { - Log.v("VNC","Button02_click:"+ e.getMessage()); - - } - boolean s=isAndroidServerRunning(); - if (s) - showTextOnScreen("Couldn't Stop VNC Server\nTry hitting F12 on a connected client"); - //setStateLabel(s); - return; - } - }); - - } - - public String packageVersion() - { - String version = ""; - try { - PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0); - version = pi.versionName; - } catch (NameNotFoundException e) { - // TODO Auto-generated catch block - Log.v("VNC","onOptionsItemSelected: "+ e.getMessage()); - }; - return version; - } - - public boolean free_version() - { - return getPackageName().equals("org.onaips.vnc"); - } - - public void showInitialScreen() - { - // Initialize preferences - preferences = PreferenceManager.getDefaultSharedPreferences(this ); - SharedPreferences.Editor editor = preferences.edit(); - - String message="Changelog:

" + changelog; - - String version=packageVersion(); - - if (!free_version()) - { - if (version.equals(preferences.getString("version", ""))) - return; - editor.putString("version", version); - editor.commit(); - } - - - startDialog = new AlertDialog.Builder(this).create(); - startDialog.setTitle("droid VNC Server " + version); - startDialog.setMessage(Html.fromHtml(message)); - startDialog.setIcon(R.drawable.icon); - - if (free_version()) - { - startDialog.setButton(AlertDialog.BUTTON1,"Wait...", new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface arg0, int arg1) { - startDialog.dismiss(); - } - }); - - - - startDialog.setButton2("Donate Version", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface arg0, int arg1) { - Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=org.onaips.vnc_donate")); - startActivity(myIntent); - - } - }); - - startDialog.setCancelable(false); - startDialog.show(); - - Button b=(Button)startDialog.getButton(AlertDialog.BUTTON1); - b.setEnabled(false); - - Timer t1=new Timer(); - t1.schedule(new TimerTask() { - @Override - public void run() { - runOnUiThread(new Runnable(){ - public void run() { - // ((DialogInterface) startDialog).dismiss(); - Button b=(Button)startDialog.getButton(AlertDialog.BUTTON1); - b.setEnabled(true); - b.setText("OK"); - } - }); - } - }, (long)10000); - } - else - startDialog.show(); - } - - static void writeCommand(OutputStream os, String command) throws Exception - { - os.write((command + "\n").getBytes("ASCII")); - } - - - - public void showTextOnScreen(final String t) - { - runOnUiThread(new Runnable(){ - public void run() { - Toast.makeText(MainActivity.this,t,Toast.LENGTH_LONG).show(); - } - }); - } - - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.menu, menu); - - menu.add(0,MENU_SENDLOG,0,"Send debug info"); - menu.add(0,MENU_ONAIPS,0,"About"); - menu.add(0, MENU_HELP, 0, "Help"); - menu.add(0, MENU_QUIT, 0, "Close"); - - return true; - } - - public void setStateLabel(boolean state) - { - TextView stateLabel=(TextView)findViewById(R.id.stateLabel); - stateLabel.setText(state?"Running":"Stopped"); - stateLabel.setTextColor(state?Color.GREEN:Color.RED); - } - - public String getIpAddress() - { - WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); - DhcpInfo dhcpInfo = wifiManager.getDhcpInfo(); - - - return intToIp(dhcpInfo.ipAddress); - } - - boolean wifiConnected() - { - WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); - WifiInfo info = wifi.getConnectionInfo(); - - return info.getBSSID()!=null; - } - - private String intToIp(int i) { - return ( i & 0xFF) + "." + ((i >> 8 ) & 0xFF) + "." + ((i >> 16 ) & 0xFF) + "." + ((i >> 24 ) & 0xFF); - } - - public void stopServer() - { - try{ - Process sh; - - sh = Runtime.getRuntime().exec("su"); - OutputStream os = sh.getOutputStream(); - writeCommand(os, "killall androidvncserver"); - writeCommand(os, "killall -KILL androidvncserver"); - writeCommand(os, "exit"); - - os.flush(); - os.close(); - } catch (IOException e) { - showTextOnScreen("stopServer()" + e.getMessage()); - Log.v("VNC","stopServer()" + e.getMessage()); - } catch (Exception e) { - Log.v("VNC","stopServer()" + e.getMessage()); - } - - } - - public void startServerButtonClicked() - { - if (isAndroidServerRunning()) - { - new AlertDialog.Builder(this) - .setTitle("Alert") - .setMessage(Html.fromHtml("There is another daemon already running, do you want to kill it?")) - .setPositiveButton("Yes", new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface arg0, int arg1) { - stopServer(); - startServer(); - } - }) - .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface arg0, int arg1) { - return; - } - }) - .show(); - } - else - startServer(); - } - - - public void startServer() - { - try{ - Process sh; - - String password=preferences.getString("password", ""); - String password_check=""; - if (!password.equals("")) - password_check="-p " + password; - - - String rotation=preferences.getString("rotation", "0"); - rotation="-r " + rotation; - - String scaling=preferences.getString("scale", "100"); - String scaling_string=""; - if (!scaling.equals("0")) - scaling_string="-s " + scaling; - - - sh = Runtime.getRuntime().exec("su"); - OutputStream os = sh.getOutputStream(); - writeCommand(os, "chmod 777 /data/data/"+getPackageName()+"/androidvncserver"); - writeCommand(os, "/data/data/"+getPackageName()+"/androidvncserver "+ password_check + " " + rotation + " " + scaling_string); - - - } catch (IOException e) { - Log.v("VNC","startServer():" + e.getMessage()); - showTextOnScreen("startServer():" + e.getMessage()); - } catch (Exception e) { - Log.v("VNC","startServer():" + e.getMessage()); - showTextOnScreen("startServer():" + e.getMessage()); - } - - } - - - - public void copyBinary(int id,String path) - { - try { - InputStream ins = getResources().openRawResource(id); - int size = ins.available(); - - // Read the entire resource into a local byte buffer. - byte[] buffer = new byte[size]; - ins.read(buffer); - ins.close(); - - FileOutputStream fos = new FileOutputStream(path); - fos.write(buffer); - fos.close(); - } - catch (Exception e) - { - Log.v("VNC","public void createBinary(): " + e.getMessage()); - } - - - } - public void createBinary() - { - copyBinary(R.raw.androidvncserver, "/data/data/" + getPackageName() + "/androidvncserver"); - copyBinary(R.raw.vncviewer, "/data/data/"+getPackageName()+"/VncViewer.jar"); - copyBinary(R.raw.indexvnc, "/data/data/"+getPackageName()+"/index.vnc"); - } - - public void showHelp() - { - new AlertDialog.Builder(this) - .setTitle("Help") - .setMessage(Html.fromHtml("Mouse Mappings:

Right Click -> Back
Middle Click -> End Call
Left Click -> Touch

Keyboard Mappings

" + - "Home Key -> Home
Escape -> Back
Page Up ->Menu
Left Ctrl -> Search
PgDown -> Start Call
" + - "End Key -> End Call
F4 -> Rotate
F11 -> Disconnect Server
F12 -> Stop Server Daemon")) - .setPositiveButton("Fechar", null) - .setNegativeButton("Open Website", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface arg0, int arg1) { - Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://onaips.blogspot.com")); - startActivity(myIntent); - } - }) - .show(); - } - - // This method is called once the menu is selected - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - // We have only one menu option - case R.id.preferences: - // Launch Preference activity - Intent i = new Intent(MainActivity.this, preferences.class); - startActivity(i); - - showTextOnScreen("Don't forget to stop/start the server after changes"); - - break; - case MENU_QUIT: - System.exit(1); - break; - case MENU_HELP: - showHelp(); - break; - case MENU_SENDLOG: - collectAndSendLog(); - break; - case MENU_ONAIPS: - - new AlertDialog.Builder(this) - .setTitle("About") - .setMessage(Html.fromHtml("version " + packageVersion() + "

developed by oNaiPs

Graphics: Sandro Forbice (@sandroforbice)

Open-Source Software")) - .setPositiveButton("Close", null) - .setNegativeButton("Open Website", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface arg0, int arg1) { - Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://onaips.blogspot.com")); - startActivity(myIntent); - - } - }) - .show(); - } - return true; - } - - public boolean isAndroidServerRunning() - { - String result=""; - Process sh; - try { - sh = Runtime.getRuntime().exec("ps"); - - - InputStream is=sh.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - String line; - - while ((line = br.readLine()) != null) { - result+=line; - if (result.indexOf("androidvncserver")>0) - return true; - } - OutputStream os = sh.getOutputStream(); - writeCommand(os, "exit"); - os.flush(); - os.close(); - } catch (IOException e) { - Log.v("VNC"," isAndroidServerRunning():" + e.getMessage()); - } catch (Exception e) { - Log.v("VNC"," isAndroidServerRunning():" + e.getMessage()); - } - - //Log.v("VNC",result); - - return false; - } - - - public boolean hasRootPermission() { - boolean rooted = true; - try { - File su = new File("/system/bin/su"); - if (su.exists() == false) { - su = new File("/system/xbin/su"); - if (su.exists() == false) { - rooted = false; - } - } - } catch (Exception e) { - Log.v("VNC", "Can't obtain root - Here is what I know: "+e.getMessage()); - rooted = false; - } - Process sh; - try { - String result=""; - - sh = Runtime.getRuntime().exec("whoami"); - - InputStream is=sh.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - String line; - - while ((line = br.readLine()) != null) { - result+=line; - if (result.indexOf("androidvncserver")>0) - return true; - } - - Process sh1=Runtime.getRuntime().exec("su"); - - //Log.v("aaaaaa","chgrp -R " + result + " /data/data/org.onaips.vnc/"); - - OutputStream os = sh1.getOutputStream(); - - writeCommand(os, "chown -R " + result + " /data/data/" + getPackageName() + "/"); - writeCommand(os, "chgrp -R " + result + " /data/data/" + getPackageName() + "/"); - os.flush(); - os.close(); - isr.close(); - is.close(); - - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - }catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return rooted; - } - - public static final String LOG_COLLECTOR_PACKAGE_NAME = "com.xtralogic.android.logcollector";//$NON-NLS-1$ - public static final String ACTION_SEND_LOG = "com.xtralogic.logcollector.intent.action.SEND_LOG";//$NON-NLS-1$ - public static final String EXTRA_SEND_INTENT_ACTION = "com.xtralogic.logcollector.intent.extra.SEND_INTENT_ACTION";//$NON-NLS-1$ - public static final String EXTRA_DATA = "com.xtralogic.logcollector.intent.extra.DATA";//$NON-NLS-1$ - public static final String EXTRA_ADDITIONAL_INFO = "com.xtralogic.logcollector.intent.extra.ADDITIONAL_INFO";//$NON-NLS-1$ - public static final String EXTRA_SHOW_UI = "com.xtralogic.logcollector.intent.extra.SHOW_UI";//$NON-NLS-1$ - public static final String EXTRA_FILTER_SPECS = "com.xtralogic.logcollector.intent.extra.FILTER_SPECS";//$NON-NLS-1$ - public static final String EXTRA_FORMAT = "com.xtralogic.logcollector.intent.extra.FORMAT";//$NON-NLS-1$ - public static final String EXTRA_BUFFER = "com.xtralogic.logcollector.intent.extra.BUFFER";//$NON-NLS-1$ - - void collectAndSendLog(){ - final PackageManager packageManager = getPackageManager(); - final Intent intent = new Intent(ACTION_SEND_LOG); - List list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); - final boolean isInstalled = list.size() > 0; - - if (!isInstalled){ - new AlertDialog.Builder(this) - .setTitle(getString(R.string.app_name)) - .setIcon(android.R.drawable.ic_dialog_info) - .setMessage("Please install Log Collector application to collect the device log and send it to dev.") - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){ - public void onClick(DialogInterface dialog, int whichButton){ - Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + LOG_COLLECTOR_PACKAGE_NAME)); - marketIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(marketIntent); - } - }) - .setNegativeButton(android.R.string.cancel, null) - .show(); - } - else{ - new AlertDialog.Builder(this) - .setTitle(getString(R.string.app_name)) - .setIcon(android.R.drawable.ic_dialog_info) - .setMessage("Do you want to send debug info to the dev? Please specify what problem is ocurring.\n\nMake sure you started/stopped the server before submitting") - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){ - public void onClick(DialogInterface dialog, int whichButton){ - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra(EXTRA_SEND_INTENT_ACTION, Intent.ACTION_SENDTO); - final String email = "onaips@gmail.com"; - intent.putExtra(EXTRA_DATA, Uri.parse("mailto:" + email)); - intent.putExtra(EXTRA_ADDITIONAL_INFO,"Problem Description: \n\n\n\n---------DEBUG--------\n" + getString(R.string.device_info_fmt,getVersionNumber(getApplicationContext()),Build.MODEL,Build.VERSION.RELEASE, getFormattedKernelVersion(), Build.DISPLAY)); - - intent.putExtra(Intent.EXTRA_SUBJECT, "droid VNC server: Debug Info"); - - intent.putExtra(EXTRA_FORMAT, "time"); - - //The log can be filtered to contain data relevant only to your app - String[] filterSpecs = new String[4]; - filterSpecs[0] = "VNC:I"; - filterSpecs[1] = "VNC:D"; - filterSpecs[2] = "VNC:V"; - filterSpecs[3] = "*:S"; - intent.putExtra(EXTRA_FILTER_SPECS, filterSpecs); - - startActivity(intent); - } - }) - .setNegativeButton(android.R.string.cancel, null) - .show(); - } - } - - private String getFormattedKernelVersion() - { - String procVersionStr; - - try { - BufferedReader reader = new BufferedReader(new FileReader("/proc/version"), 256); - try { - procVersionStr = reader.readLine(); - } finally { - reader.close(); - } - - final String PROC_VERSION_REGEX = - "\\w+\\s+" + /* ignore: Linux */ - "\\w+\\s+" + /* ignore: version */ - "([^\\s]+)\\s+" + /* group 1: 2.6.22-omap1 */ - "\\(([^\\s@]+(?:@[^\\s.]+)?)[^)]*\\)\\s+" + /* group 2: (xxxxxx@xxxxx.constant) */ - "\\([^)]+\\)\\s+" + /* ignore: (gcc ..) */ - "([^\\s]+)\\s+" + /* group 3: #26 */ - "(?:PREEMPT\\s+)?" + /* ignore: PREEMPT (optional) */ - "(.+)"; /* group 4: date */ - - Pattern p = Pattern.compile(PROC_VERSION_REGEX); - Matcher m = p.matcher(procVersionStr); - - if (!m.matches()) { - Log.e("VNC", "Regex did not match on /proc/version: " + procVersionStr); - return "Unavailable"; - } else if (m.groupCount() < 4) { - Log.e("VNC", "Regex match on /proc/version only returned " + m.groupCount() - + " groups"); - return "Unavailable"; - } else { - return (new StringBuilder(m.group(1)).append("\n").append( - m.group(2)).append(" ").append(m.group(3)).append("\n") - .append(m.group(4))).toString(); - } - } catch (IOException e) { - Log.e("VNC", "IO Exception when getting kernel version for Device Info screen", e); - - return "Unavailable"; - } - } - - private static String getVersionNumber(Context context) - { - String version = "?"; - try - { - PackageInfo packagInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); - version = packagInfo.versionName; - } - catch (PackageManager.NameNotFoundException e){}; - - return version; - } -} - diff --git a/src/org/onaips/vnc/preferences.java b/src/org/onaips/vnc/preferences.java deleted file mode 100644 index f3443f6..0000000 --- a/src/org/onaips/vnc/preferences.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.onaips.vnc; - - - - -import android.os.Bundle; -import android.preference.PreferenceActivity; - -public class preferences extends PreferenceActivity { - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.preferences); - } -} diff --git a/src/org/onaips/vnc_donate/MainActivity.java b/src/org/onaips/vnc_donate/MainActivity.java index ddf69f6..ba02b8a 100644 --- a/src/org/onaips/vnc_donate/MainActivity.java +++ b/src/org/onaips/vnc_donate/MainActivity.java @@ -72,13 +72,13 @@ import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity -{ +{ private static final int MENU_QUIT = 0; private static final int MENU_HELP = 1; private static final int MENU_ONAIPS = 2; private static final int MENU_SENDLOG = 3; private static final int MENU_CHANGELOG = 4; - private static final String changelog="-PLEASE GIVE FEEDBACK! (send debug info in menu)

- [Add] Start daemon on boot (set on prefs)
-[Add] Change port on preferences
- [Add] Changelog on menu
- [Add] Dynamic network state detection
- [Fix] HTTP client now working again
- [Rem] Initial screen is only showed on new versions
- [Add] Don't let device sleep (set on prefs)
- [Fix] Better start/stop handling"; + private static final String changelog="(i'm looking for someone to write a tutorial for vnc server)

- [Fix] Everything working again :D
- [Fix] Now contains busybox binary for better device compatibility
- [Fix] FC on preferences menu, for real this time (thanks Piki for the hints)"; private PowerManager.WakeLock wakeLock = null; private Timer watchdogTimer=null; @@ -112,19 +112,11 @@ public class MainActivity extends Activity //System.exit(-1); } - if (!hasBusybox()) - { - - showTextOnScreen("I didn't find busybox, you may not be able to close server"); - } showInitialScreen(false); - createBinary(); - boolean serverRunning=isAndroidServerRunning(); - if (("On".equals(preferences.getString("sleep", "Off"))) && serverRunning) { PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); @@ -142,14 +134,12 @@ public class MainActivity extends Activity mReceiver receiver=new mReceiver(); this.registerReceiver(receiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); + setStateLabels(isAndroidServerRunning()); findViewById(R.id.Button01).setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { - startServerButtonClicked(); - - return; } }) ; @@ -162,8 +152,6 @@ public class MainActivity extends Activity return; } - - prepareWatchdog("Stopping server. Please wait...","Couldn't Stop server",false); Thread t=new Thread(){ @@ -206,17 +194,14 @@ public class MainActivity extends Activity String version=packageVersion(); - { - if (forceShow) - ; - else if (version.equals(preferences.getString("version", ""))) - return; - editor.putString("version", version); - editor.commit(); - } + if ((!forceShow) && (version.equals(preferences.getString("version", "")))) + return; + + editor.putString("version", version); + editor.commit(); startDialog = new AlertDialog.Builder(this).create(); - startDialog.setTitle("Changelog"); + startDialog.setTitle("Version " + version); startDialog.setMessage(Html.fromHtml(changelog)); startDialog.setIcon(R.drawable.icon); @@ -230,8 +215,6 @@ public class MainActivity extends Activity } }); - - startDialog.setButton2("Donate Version", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { @@ -247,10 +230,6 @@ public class MainActivity extends Activity startDialog.show(); } - static void writeCommand(OutputStream os, String command) throws Exception - { - os.write((command + "\n").getBytes("ASCII")); - } @@ -267,11 +246,11 @@ public class MainActivity extends Activity MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); - menu.add(0,MENU_SENDLOG,0,"Send debug info"); - menu.add(0,MENU_CHANGELOG,0,"Changelog"); - menu.add(0,MENU_ONAIPS,0,"About"); - menu.add(0, MENU_HELP, 0, "Help"); - menu.add(0, MENU_QUIT, 0, "Close"); + menu.add(0, MENU_SENDLOG ,0,"Report issue"); + menu.add(0, MENU_CHANGELOG,0,"Changelog"); + menu.add(0, MENU_ONAIPS ,0,"About"); + menu.add(0, MENU_HELP ,0, "Help"); + menu.add(0, MENU_QUIT ,0, "Close"); return true; } @@ -303,6 +282,23 @@ public class MainActivity extends Activity }, (long)5000); } + public boolean hasExecutable(String s) + { + boolean has = true; + try { + File exe = new File("/system/bin/" + s); + if (exe.exists() == false) { + exe = new File("/system/xbin/" + s); + if (exe.exists() == false) { + has = false; + } + } + } catch (Exception e) { + has = false; + } + + return has; + } public void setStateLabels(boolean state) { @@ -327,13 +323,14 @@ public class MainActivity extends Activity port="5901"; httpport="5801"; } - + String ip=getIpAddress(); if (ip.equals("")) - t.setText("Not connected to a network"); + t.setText(Html.fromHtml("Not connected to a network.
You can connect through USB with:
localhost:" + port + "
or
http://localhost:" + httpport + "
(use adb to forward ports)")); else - t.setText(Html.fromHtml("Connect to:
" + getIpAddress()+":" + port + "
or
http://" + getIpAddress() + ":" + httpport + "
")); + t.setText(Html.fromHtml("Connect to:
" + ip+":" + port + "
or
http://" + ip + ":" + httpport + "
")); + } else t.setText(""); @@ -357,17 +354,6 @@ public class MainActivity extends Activity return ""; } - boolean wifiConnected() - { - WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); - WifiInfo info = wifi.getConnectionInfo(); - - return info.getBSSID()!=null; - } - - private String intToIp(int i) { - return ( i & 0xFF) + "." + ((i >> 8 ) & 0xFF) + "." + ((i >> 16 ) & 0xFF) + "." + ((i >> 24 ) & 0xFF); - } public void stopServer() { @@ -378,16 +364,16 @@ public class MainActivity extends Activity OutputStream os = sh.getOutputStream(); - if (hasBusybox()) - { - writeCommand(os, "busybox killall androidvncserver"); - writeCommand(os, "busybox killall -KILL androidvncserver"); - } - else + if (hasExecutable("killall")) { writeCommand(os, "killall androidvncserver"); writeCommand(os, "killall -KILL androidvncserver"); } + else + { + writeCommand(os, getFilesDir().getAbsolutePath() + "/busybox killall androidvncserver"); + writeCommand(os, getFilesDir().getAbsolutePath() + "/busybox killall -KILL androidvncserver"); + } writeCommand(os, "exit"); @@ -405,10 +391,7 @@ public class MainActivity extends Activity public void startServerButtonClicked() { if (isAndroidServerRunning()) - { - showTextOnScreen("Server is already running, stop it first"); - } else { prepareWatchdog("Starting server. Please wait...","Couldn't Start server", true); @@ -439,6 +422,7 @@ public class MainActivity extends Activity rotation="-r " + rotation; String scaling=preferences.getString("scale", "100"); + String scaling_string=""; if (!scaling.equals("0")) scaling_string="-s " + scaling; @@ -458,8 +442,7 @@ public class MainActivity extends Activity sh = Runtime.getRuntime().exec("su"); OutputStream os = sh.getOutputStream(); - writeCommand(os, "chmod 777 /data/data/"+getPackageName()+"/androidvncserver"); - writeCommand(os, "/data/data/"+getPackageName()+"/androidvncserver "+ password_check + " " + rotation + " " + scaling_string + " " + port_string); + writeCommand(os, getFilesDir().getAbsolutePath() + "/androidvncserver "+ password_check + " " + rotation + " " + scaling_string + " " + port_string); } catch (IOException e) { @@ -473,36 +456,6 @@ public class MainActivity extends Activity } - - public void copyBinary(int id,String path) - { - try { - InputStream ins = getResources().openRawResource(id); - int size = ins.available(); - - // Read the entire resource into a local byte buffer. - byte[] buffer = new byte[size]; - ins.read(buffer); - ins.close(); - - FileOutputStream fos = new FileOutputStream(path); - fos.write(buffer); - fos.close(); - } - catch (Exception e) - { - Log.v("VNC","public void createBinary(): " + e.getMessage()); - } - - - } - public void createBinary() - { - copyBinary(R.raw.androidvncserver, "/data/data/" + getPackageName() + "/androidvncserver"); - copyBinary(R.raw.vncviewer, "/data/data/"+getPackageName()+"/VncViewer.jar"); - copyBinary(R.raw.indexvnc, "/data/data/"+getPackageName()+"/index.vnc"); - } - public void showHelp() { new AlertDialog.Builder(this) @@ -510,7 +463,7 @@ public class MainActivity extends Activity .setMessage(Html.fromHtml("Mouse Mappings:

Right Click -> Back
Middle Click -> End Call
Left Click -> Touch

Keyboard Mappings

" + "Home Key -> Home
Escape -> Back
Page Up ->Menu
Left Ctrl -> Search
PgDown -> Start Call
" + "End Key -> End Call
F4 -> Rotate
F11 -> Disconnect Server
F12 -> Stop Server Daemon")) - .setPositiveButton("Fechar", null) + .setPositiveButton("Quit", null) .setNegativeButton("Open Website", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { @@ -570,11 +523,10 @@ public class MainActivity extends Activity String result=""; Process sh; try { - if (hasBusybox()) - sh = Runtime.getRuntime().exec("busybox ps"); - else + if (hasExecutable("ps")) sh = Runtime.getRuntime().exec("ps"); - + else + sh = Runtime.getRuntime().exec(getFilesDir().getAbsolutePath() + "/busybox ps w"); InputStream is=sh.getInputStream(); InputStreamReader isr = new InputStreamReader(is); @@ -596,28 +548,10 @@ public class MainActivity extends Activity Log.v("VNC"," isAndroidServerRunning():" + e.getMessage()); } - //Log.v("VNC",result); - return false; } - public static boolean hasBusybox() - { - boolean has = true; - try { - File su = new File("/system/bin/busybox"); - if (su.exists() == false) { - su = new File("/system/xbin/busybox"); - if (su.exists() == false) { - has = false; - } - } - } catch (Exception e) { - Log.v("VNC", "I didn't find busybox, you may not be able to close server - Here is what I know: "+e.getMessage()); - has = false; - } - return has; - } + public boolean hasRootPermission() { boolean rooted = true; @@ -634,54 +568,6 @@ public class MainActivity extends Activity rooted = false; } - - Process sh; - try { - String result=""; - - sh = Runtime.getRuntime().exec("whoami"); - - InputStream is=sh.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - String line; - - while ((line = br.readLine()) != null) { - result+=line; - if (result.indexOf("androidvncserver")>0) - return true; - } - - Process sh1=Runtime.getRuntime().exec("su"); - - //Log.v("aaaaaa","chgrp -R " + result + " /data/data/org.onaips.vnc/"); - - OutputStream os = sh1.getOutputStream(); - - if (hasBusybox()) - { - writeCommand(os, "busybox chown -R " + result + " /data/data/" + getPackageName() + "/"); - writeCommand(os, "busybox chgrp -R " + result + " /data/data/" + getPackageName() + "/"); - } - else - { - writeCommand(os, "chown -R " + result + " /data/data/" + getPackageName() + "/"); - writeCommand(os, "chgrp -R " + result + " /data/data/" + getPackageName() + "/"); - } - - os.flush(); - os.close(); - isr.close(); - is.close(); - - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - }catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } return rooted; } @@ -720,7 +606,7 @@ public class MainActivity extends Activity new AlertDialog.Builder(this) .setTitle(getString(R.string.app_name)) .setIcon(android.R.drawable.ic_dialog_info) - .setMessage("Do you want to send debug info to the dev? Please specify what problem is ocurring.\n\nMake sure you started/stopped the server before submitting") + .setMessage("Do you want to send a bug report to the dev? Please specify what problem is ocurring.\n\nMake sure you started & stopped the server before submitting") .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int whichButton){ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -728,9 +614,7 @@ public class MainActivity extends Activity final String email = "onaips@gmail.com"; intent.putExtra(EXTRA_DATA, Uri.parse("mailto:" + email)); intent.putExtra(EXTRA_ADDITIONAL_INFO,"Problem Description: \n\n\n\n---------DEBUG--------\n" + getString(R.string.device_info_fmt,getVersionNumber(getApplicationContext()),Build.MODEL,Build.VERSION.RELEASE, getFormattedKernelVersion(), Build.DISPLAY)); - intent.putExtra(Intent.EXTRA_SUBJECT, "droid VNC server: Debug Info"); - intent.putExtra(EXTRA_FORMAT, "time"); //The log can be filtered to contain data relevant only to your app @@ -806,6 +690,12 @@ public class MainActivity extends Activity return version; } + + static void writeCommand(OutputStream os, String command) throws Exception + { + os.write((command + "\n").getBytes("ASCII")); + } + class mReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { NetworkInfo info = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); @@ -814,8 +704,4 @@ public class MainActivity extends Activity } } }; -} - - - - +} \ No newline at end of file diff --git a/src/org/onaips/vnc_donate/MainApplication.java b/src/org/onaips/vnc_donate/MainApplication.java new file mode 100644 index 0000000..db2fc17 --- /dev/null +++ b/src/org/onaips/vnc_donate/MainApplication.java @@ -0,0 +1,73 @@ +package org.onaips.vnc_donate; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import android.app.Application; +import android.util.Log; + +public class MainApplication extends Application { + + @Override + public void onCreate() { + // TODO Auto-generated method stub + super.onCreate(); + + createBinary(); + } + + + public void createBinary() + { + copyBinary(R.raw.androidvncserver, getFilesDir().getAbsolutePath() + "/androidvncserver"); + copyBinary(R.raw.vncviewer, getFilesDir().getAbsolutePath()+"/VncViewer.jar"); + copyBinary(R.raw.indexvnc, getFilesDir().getAbsolutePath()+"/index.vnc"); + copyBinary(R.raw.busybox, getFilesDir().getAbsolutePath()+"/busybox"); + Process sh; + try { + sh = Runtime.getRuntime().exec("su"); + + OutputStream os = sh.getOutputStream(); + + //chmod 777 SHOULD exist + writeCommand(os, "chmod 777 " + getFilesDir().getAbsolutePath() + "/androidvncserver"); + writeCommand(os, "chmod 777 " + getFilesDir().getAbsolutePath() +"/busybox"); + } catch (IOException e) { + Log.v("VNC",e.getMessage()); + }catch (Exception e) { + Log.v("VNC",e.getMessage()); + } + } + + + + public void copyBinary(int id,String path) + { + try { + InputStream ins = getResources().openRawResource(id); + int size = ins.available(); + + // Read the entire resource into a local byte buffer. + byte[] buffer = new byte[size]; + ins.read(buffer); + ins.close(); + + FileOutputStream fos = new FileOutputStream(path); + fos.write(buffer); + fos.close(); + } + catch (Exception e) + { + Log.v("VNC","public void createBinary(): " + e.getMessage()); + } + + + } + + static void writeCommand(OutputStream os, String command) throws Exception + { + os.write((command + "\n").getBytes("ASCII")); + } +} diff --git a/src/org/onaips/vnc_donate/StartAtBootService.java b/src/org/onaips/vnc_donate/StartAtBootService.java index 8ad64ce..f5dad2d 100644 --- a/src/org/onaips/vnc_donate/StartAtBootService.java +++ b/src/org/onaips/vnc_donate/StartAtBootService.java @@ -34,8 +34,8 @@ public class StartAtBootService extends Service { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); //Lets see if i need to boot daemon... - String startOnBoot=preferences.getString("startonboot", "False"); - if (startOnBoot.equals("False")) + String startOnBoot=preferences.getString("startonboot", "Off"); + if (startOnBoot.equals("Off")) return; @@ -53,6 +53,7 @@ public class StartAtBootService extends Service { rotation="-r " + rotation; String scaling=preferences.getString("scale", "100"); + String scaling_string=""; if (!scaling.equals("0")) scaling_string="-s " + scaling; @@ -72,9 +73,7 @@ public class StartAtBootService extends Service { sh = Runtime.getRuntime().exec("su"); OutputStream os = sh.getOutputStream(); - writeCommand(os, "chmod 777 /data/data/"+getPackageName()+"/androidvncserver"); - writeCommand(os, "/data/data/"+getPackageName()+"/androidvncserver "+ password_check + " " + rotation + " " + scaling_string + " " + port_string); - + writeCommand(os, getFilesDir().getAbsolutePath() + "/androidvncserver "+ password_check + " " + rotation + " " + scaling_string + " " + port_string); } catch (IOException e) { Log.v("VNC","startServer():" + e.getMessage());