diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8510028..931e430 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="org.onaips.vnc" android:versionName="0.991" android:versionCode="52">
@@ -19,6 +19,7 @@
+
@@ -34,14 +35,8 @@
-
-
-
-
-
-
-
-
+
+
@@ -51,5 +46,6 @@
+
\ No newline at end of file
diff --git a/bin/avnc.apk b/bin/avnc.apk
index 39b4e13..859a6e4 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 9019fa3..1586504 100644
Binary files a/bin/avnc_signed.apk and b/bin/avnc_signed.apk differ
diff --git a/bin/classes.dex b/bin/classes.dex
index cb8d04c..f6d79d5 100644
Binary files a/bin/classes.dex and b/bin/classes.dex differ
diff --git a/bin/org/onaips/vnc/DaemonCommunication$1.class b/bin/org/onaips/vnc/DaemonCommunication$1.class
deleted file mode 100644
index 611f302..0000000
Binary files a/bin/org/onaips/vnc/DaemonCommunication$1.class and /dev/null differ
diff --git a/bin/org/onaips/vnc/DaemonCommunication.class b/bin/org/onaips/vnc/DaemonCommunication.class
deleted file mode 100644
index f7bc55c..0000000
Binary files a/bin/org/onaips/vnc/DaemonCommunication.class and /dev/null differ
diff --git a/bin/org/onaips/vnc/MainActivity$1.class b/bin/org/onaips/vnc/MainActivity$1.class
index caf8948..56dca58 100644
Binary files a/bin/org/onaips/vnc/MainActivity$1.class and b/bin/org/onaips/vnc/MainActivity$1.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$10.class b/bin/org/onaips/vnc/MainActivity$10.class
index b51a012..3478e59 100644
Binary files a/bin/org/onaips/vnc/MainActivity$10.class and b/bin/org/onaips/vnc/MainActivity$10.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$11.class b/bin/org/onaips/vnc/MainActivity$11.class
index f9aa742..cce8531 100644
Binary files a/bin/org/onaips/vnc/MainActivity$11.class and b/bin/org/onaips/vnc/MainActivity$11.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$12.class b/bin/org/onaips/vnc/MainActivity$12.class
index 67f61aa..1df0c00 100644
Binary files a/bin/org/onaips/vnc/MainActivity$12.class and b/bin/org/onaips/vnc/MainActivity$12.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$2.class b/bin/org/onaips/vnc/MainActivity$2.class
index 33f3440..ca163e2 100644
Binary files a/bin/org/onaips/vnc/MainActivity$2.class and b/bin/org/onaips/vnc/MainActivity$2.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$3.class b/bin/org/onaips/vnc/MainActivity$3.class
index fd891d1..faa702a 100644
Binary files a/bin/org/onaips/vnc/MainActivity$3.class and b/bin/org/onaips/vnc/MainActivity$3.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$4.class b/bin/org/onaips/vnc/MainActivity$4.class
index 667b790..dac09a0 100644
Binary files a/bin/org/onaips/vnc/MainActivity$4.class and b/bin/org/onaips/vnc/MainActivity$4.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$5.class b/bin/org/onaips/vnc/MainActivity$5.class
index aac402d..c10a1ab 100644
Binary files a/bin/org/onaips/vnc/MainActivity$5.class and b/bin/org/onaips/vnc/MainActivity$5.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$6.class b/bin/org/onaips/vnc/MainActivity$6.class
index 4300708..b552314 100644
Binary files a/bin/org/onaips/vnc/MainActivity$6.class and b/bin/org/onaips/vnc/MainActivity$6.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$7.class b/bin/org/onaips/vnc/MainActivity$7.class
index e05c1a9..8b68856 100644
Binary files a/bin/org/onaips/vnc/MainActivity$7.class and b/bin/org/onaips/vnc/MainActivity$7.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$8.class b/bin/org/onaips/vnc/MainActivity$8.class
index cefb2e9..aecfb8b 100644
Binary files a/bin/org/onaips/vnc/MainActivity$8.class and b/bin/org/onaips/vnc/MainActivity$8.class differ
diff --git a/bin/org/onaips/vnc/MainActivity$9.class b/bin/org/onaips/vnc/MainActivity$9.class
index 702c12f..582c793 100644
Binary files a/bin/org/onaips/vnc/MainActivity$9.class and b/bin/org/onaips/vnc/MainActivity$9.class differ
diff --git a/bin/org/onaips/vnc/MainActivity.class b/bin/org/onaips/vnc/MainActivity.class
index 1cd9157..fb71a09 100644
Binary files a/bin/org/onaips/vnc/MainActivity.class and b/bin/org/onaips/vnc/MainActivity.class differ
diff --git a/bin/org/onaips/vnc/MainApplication.class b/bin/org/onaips/vnc/MainApplication.class
index 6de5d70..a90e410 100644
Binary files a/bin/org/onaips/vnc/MainApplication.class and b/bin/org/onaips/vnc/MainApplication.class differ
diff --git a/bin/org/onaips/vnc/R$array.class b/bin/org/onaips/vnc/R$array.class
index a53f4c8..94d60f9 100644
Binary files a/bin/org/onaips/vnc/R$array.class and b/bin/org/onaips/vnc/R$array.class differ
diff --git a/bin/org/onaips/vnc/R$attr.class b/bin/org/onaips/vnc/R$attr.class
index 942efc3..3974a7d 100644
Binary files a/bin/org/onaips/vnc/R$attr.class and b/bin/org/onaips/vnc/R$attr.class differ
diff --git a/bin/org/onaips/vnc/R$drawable.class b/bin/org/onaips/vnc/R$drawable.class
index 11819b0..892d3ef 100644
Binary files a/bin/org/onaips/vnc/R$drawable.class and b/bin/org/onaips/vnc/R$drawable.class differ
diff --git a/bin/org/onaips/vnc/R$id.class b/bin/org/onaips/vnc/R$id.class
index b08ebf8..2e5580b 100644
Binary files a/bin/org/onaips/vnc/R$id.class and b/bin/org/onaips/vnc/R$id.class differ
diff --git a/bin/org/onaips/vnc/R$layout.class b/bin/org/onaips/vnc/R$layout.class
index c92703b..6635963c 100644
Binary files a/bin/org/onaips/vnc/R$layout.class and b/bin/org/onaips/vnc/R$layout.class differ
diff --git a/bin/org/onaips/vnc/R$menu.class b/bin/org/onaips/vnc/R$menu.class
index a0941fe..920073c 100644
Binary files a/bin/org/onaips/vnc/R$menu.class and b/bin/org/onaips/vnc/R$menu.class differ
diff --git a/bin/org/onaips/vnc/R$raw.class b/bin/org/onaips/vnc/R$raw.class
index 2217189..a8f92a5 100644
Binary files a/bin/org/onaips/vnc/R$raw.class and b/bin/org/onaips/vnc/R$raw.class differ
diff --git a/bin/org/onaips/vnc/R$string.class b/bin/org/onaips/vnc/R$string.class
index bef15d8..f430eef 100644
Binary files a/bin/org/onaips/vnc/R$string.class and b/bin/org/onaips/vnc/R$string.class differ
diff --git a/bin/org/onaips/vnc/R$styleable.class b/bin/org/onaips/vnc/R$styleable.class
index 8c0717b..abe9e12 100644
Binary files a/bin/org/onaips/vnc/R$styleable.class and b/bin/org/onaips/vnc/R$styleable.class differ
diff --git a/bin/org/onaips/vnc/R$xml.class b/bin/org/onaips/vnc/R$xml.class
index 5db20e7..26eff24 100644
Binary files a/bin/org/onaips/vnc/R$xml.class and b/bin/org/onaips/vnc/R$xml.class differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
index d7c9ba4..6c08be0 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
index 0f8c5db..ce75435 100644
--- a/gen/org/onaips/vnc/R.java
+++ b/gen/org/onaips/vnc/R.java
@@ -13,9 +13,10 @@ public final class R {
public static final int rotation_values=0x7f070000;
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 int sleep_strings=0x7f070005;
+ public static final int startonboot_strings=0x7f070006;
+ public static final int startonboot_values=0x7f070007;
+ public static final int test_mode_strings=0x7f070004;
}
public static final class attr {
/**
Must be a color value, in the form of "#rgb
", "#argb
",
diff --git a/res/raw/androidvncserver b/res/raw/androidvncserver
index f4f3655..b29f891 100755
Binary files a/res/raw/androidvncserver and b/res/raw/androidvncserver differ
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 78f3f71..91578b9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -27,6 +27,13 @@
- 30
- 20
+
+- 0
+- 1
+- 2
+- 3
+- 4
+
- On
- Off
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 702535f..d4dfdaf 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -11,5 +11,7 @@
+
+
\ No newline at end of file
diff --git a/src/org/onaips/vnc/DaemonCommunication.java b/src/org/onaips/vnc/DaemonCommunication.java
deleted file mode 100644
index 9d251c0..0000000
--- a/src/org/onaips/vnc/DaemonCommunication.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.onaips.vnc;
-
-import android.app.Activity;
-import android.app.NotificationManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentSender.SendIntentException;
-import android.util.Log;
-
-public class DaemonCommunication extends BroadcastReceiver {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
-
- Log.v("VNC","daemoncom" + action);
- Intent i=null;
-
- if (action.equalsIgnoreCase("org.onaips.vnc.intent.action.DaemonCommunication.ClientConnected"))
- {
-
- i = new Intent("org.onaips.vnc.CLIENTCONNECTED");
- i.putExtra("clientip", intent.getStringExtra("clientip"));
-
- }
- else if (action.equalsIgnoreCase("org.onaips.vnc.intent.action.DaemonCommunication.ClientDisconnected"))
- {
-
- i = new Intent("org.onaips.vnc.CLIENTDISCONNECTED");
-
- }
-
- context.sendOrderedBroadcast(i, null, new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- int result = getResultCode();
- if (result != Activity.RESULT_CANCELED) {
- Log.d("VNC", "Activity caught the broadcast, result "+result);
- return; // Activity caught it
- }
- Log.d("VNC", "Activity did not catch the broadcast");
- }
- }, null, Activity.RESULT_CANCELED, null, null);
- }
-}
-
-
diff --git a/src/org/onaips/vnc/MainActivity.java b/src/org/onaips/vnc/MainActivity.java
index 723257d..98e90c0 100644
--- a/src/org/onaips/vnc/MainActivity.java
+++ b/src/org/onaips/vnc/MainActivity.java
@@ -23,9 +23,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.lang.reflect.Array;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Timer;
@@ -59,6 +61,8 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.DhcpInfo;
+import android.net.LocalServerSocket;
+import android.net.LocalSocket;
import android.net.NetworkInfo;
import android.net.Uri;
import android.net.NetworkInfo.DetailedState;
@@ -66,8 +70,10 @@ import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
+import android.os.Handler;
import android.os.PowerManager;
import android.preference.PreferenceManager;
+import android.text.ClipboardManager;
import android.text.Html;
import android.util.Log;
import android.view.Menu;
@@ -90,7 +96,9 @@ public class MainActivity extends Activity
private static final int MENU_SENDLOG = 3;
private static final int MENU_CHANGELOG = 4;
private static final int APP_ID = 123;
- private static final String changelog="- [Fix] Start/stop server now handled by busybox, it will ask if you don't have it (please report if you still have the issue) - Sorry for that";
+ private static final String changelog="- [Add] Clipboard text support!";
+ public static String SOCKET_ADDRESS = "org.onaips.vnc.localsocket";
+
private PowerManager.WakeLock wakeLock = null;
private Timer watchdogTimer=null;
@@ -99,13 +107,12 @@ public class MainActivity extends Activity
ProgressDialog dialog=null;
AlertDialog startDialog;
-
- @Override
+
+ @Override
protected void onDestroy()
{
super.onDestroy();
unregisterReceiver(mReceiver);
- unregisterReceiver(activityReceiver);
}
@@ -161,8 +168,9 @@ public class MainActivity extends Activity
// register wifi event receiver
registerReceiver(mReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
- registerReceiver(activityReceiver, new IntentFilter("org.onaips.vnc.CLIENTCONNECTED"));
- registerReceiver(activityReceiver, new IntentFilter("org.onaips.vnc.CLIENTDISCONNECTED"));
+
+ SocketListener s=new SocketListener();
+ s.start();
setStateLabels(isAndroidServerRunning());
@@ -258,10 +266,6 @@ public class MainActivity extends Activity
return version;
}
- public boolean free_version()
- {
- return getPackageName().equals("org.onaips.vnc");
- }
public void showInitialScreen(boolean forceShow)
{
@@ -282,29 +286,26 @@ public class MainActivity extends Activity
startDialog.setMessage(Html.fromHtml(changelog));
startDialog.setIcon(R.drawable.icon);
- if (free_version())
- {
- startDialog.setButton(AlertDialog.BUTTON1,"OK", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface arg0, int arg1) {
- startDialog.dismiss();
- }
- });
+ startDialog.setButton(AlertDialog.BUTTON1,"OK", new DialogInterface.OnClickListener() {
- 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);
+ @Override
+ public void onClick(DialogInterface arg0, int arg1) {
+ startDialog.dismiss();
+ }
+ });
- }
- });
+ startDialog.setButton2("Donate", 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.donate"));
+ startActivity(myIntent);
+
+ }
+ });
+
+ startDialog.show();
- startDialog.show();
- }
- else
- startDialog.show();
}
@@ -431,13 +432,13 @@ public class MainActivity extends Activity
}
else
{
+ writeCommand(os, "killall androidvncserver");
+ writeCommand(os, "killall -KILL androidvncserver");
if (findExecutableOnPath("killall")==null)
{
showTextOnScreen("I couldn't find the killall executable, please install busybox or i can't stop server");
Log.v("VNC","I couldn't find the killall executable, please install busybox or i can't stop server");
}
- writeCommand(os, "killall androidvncserver");
- writeCommand(os, "killall -KILL androidvncserver");
}
writeCommand(os, "exit");
@@ -497,9 +498,10 @@ public class MainActivity extends Activity
if (!scaling.equals("0"))
scaling_string="-s " + scaling;
- String donate=free_version()?"":" -d ";
-
String port=preferences.getString("port", "5901");
+
+ String tm=preferences.getString("testmode", "0");
+ String testmode="-t " + tm;
try
{
int port1=Integer.parseInt(port);
@@ -516,10 +518,10 @@ public class MainActivity extends Activity
OutputStream os = sh.getOutputStream();
writeCommand(os, "chmod 777 " + getFilesDir().getAbsolutePath() + "/androidvncserver");
- writeCommand(os,getFilesDir().getAbsolutePath() + "/androidvncserver "+ password_check + " " + rotation + " " + scaling_string + " " + port_string + donate);
+ writeCommand(os,getFilesDir().getAbsolutePath() + "/androidvncserver "+ password_check + " " + rotation + " " + scaling_string + " " + port_string +" " + testmode);
//dont show password on logcat
- Log.v("VNC","Starting " + getFilesDir().getAbsolutePath() + "/androidvncserver " + " " + rotation + " " + scaling_string + " " + port_string + donate);
+ Log.v("VNC","Starting " + getFilesDir().getAbsolutePath() + "/androidvncserver " + " " + rotation + " " + scaling_string + " " + port_string + " " + testmode);
} catch (IOException e) {
@@ -603,16 +605,16 @@ public class MainActivity extends Activity
sh = Runtime.getRuntime().exec("ps");
else*/
if (hasBusybox())
- {
+ {
sh = Runtime.getRuntime().exec("busybox ps w");
- }
+ }
else
- {
+ {
if (findExecutableOnPath("ps")==null)
showTextOnScreen("I cant find the ps executable, please install busybox or i'm wont be able to check server state");
sh = Runtime.getRuntime().exec("ps");
- }
-
+ }
+
InputStream is=sh.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
@@ -789,53 +791,96 @@ public class MainActivity extends Activity
}
};
- public BroadcastReceiver activityReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context1, Intent intent) {
- if (intent.getAction().equalsIgnoreCase("org.onaips.vnc.CLIENTCONNECTED") && (preferences.getBoolean("notifyclient", true)))
- {
- String ns = Context.NOTIFICATION_SERVICE;
- NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
+ public void showClientConnected(String c)
+ {
+ String ns = Context.NOTIFICATION_SERVICE;
+ NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
- int icon = R.drawable.icon;
- CharSequence tickerText = intent.getStringExtra("clientip") + " connected to VNC server";
- long when = System.currentTimeMillis();
+ int icon = R.drawable.icon;
+ CharSequence tickerText = c + " connected to VNC server";
+ long when = System.currentTimeMillis();
- Notification notification = new Notification(icon, tickerText, when);
+ Notification notification = new Notification(icon, tickerText, when);
- Context context = getApplicationContext();
- CharSequence contentTitle = "Droid VNC Server";
- CharSequence contentText = "Client Connected from " + intent.getStringExtra("clientip");
- Intent notificationIntent = new Intent();
- PendingIntent contentIntent = PendingIntent.getActivity(context1, 0, notificationIntent, 0);
+ Context context = getApplicationContext();
+ CharSequence contentTitle = "Droid VNC Server";
+ CharSequence contentText = "Client Connected from " + c;
+ Intent notificationIntent = new Intent();
+ PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0);
- notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
+ notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
+ mNotificationManager.notify(APP_ID, notification);
- mNotificationManager.notify(APP_ID, notification);
-
- //lets see if we should keep screen on
- if (preferences.getBoolean("screenturnoff", false))
- {
- PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,"VNC");
- wakeLock.acquire();
- }
- }
- else if (intent.getAction().equalsIgnoreCase("org.onaips.vnc.CLIENTDISCONNECTED"))
- {
- String ns = Context.NOTIFICATION_SERVICE;
- NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
- mNotificationManager.cancel(APP_ID);
-
- if (wakeLock!=null && wakeLock.isHeld())
- wakeLock.release();
- }
-
+ //lets see if we should keep screen on
+ if (preferences.getBoolean("screenturnoff", false))
+ {
+ PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,"VNC");
+ wakeLock.acquire();
}
- };
+ }
+
+ void showClientDisconnected()
+ {
+ String ns = Context.NOTIFICATION_SERVICE;
+ NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
+ mNotificationManager.cancel(APP_ID);
+
+ if (wakeLock!=null && wakeLock.isHeld())
+ wakeLock.release();
+ }
+
+
+ class SocketListener extends Thread {
+ @Override
+ public void run() {
+ try {
+ LocalServerSocket server = new LocalServerSocket(SOCKET_ADDRESS);
+ while (true) {
+ LocalSocket receiver = server.accept();
+ if (receiver != null) {
+ InputStream input = receiver.getInputStream();
+
+ int readed = input.read();
+
+ StringBuffer bytes=new StringBuffer(2048);
+ while (readed != -1) {
+ bytes.append((char) readed);
+ readed = input.read();
+ }
+ //showTextOnScreen(bytes.toString());
+ Log.v("VNC",bytes.substring(0, 6));
+
+
+ if (bytes.substring(0, 6).equals("~CLIP|"))
+ {
+ bytes.delete(0, 6);
+ ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
+
+ clipboard.setText(bytes.toString());
+ }
+ else if (preferences.getBoolean("notifyclient", true))
+ {
+ if (bytes.substring(0, 11).equals("~CONNECTED|"))
+ {
+ bytes.delete(0, 11);
+ showClientConnected(bytes.toString());
+ }
+ else if (bytes.substring(0, 14).equals("~DISCONNECTED|"))
+ {
+ showClientDisconnected();
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ Log.e(getClass().getName(), e.getMessage());
+ }
+ }
+ }
private static File findExecutableOnPath(String executableName)
{
diff --git a/src/org/onaips/vnc/MainApplication.java b/src/org/onaips/vnc/MainApplication.java
index db949e4..29ab977 100644
--- a/src/org/onaips/vnc/MainApplication.java
+++ b/src/org/onaips/vnc/MainApplication.java
@@ -60,6 +60,8 @@ public class MainApplication extends Application {
OutputStream os = sh.getOutputStream();
+ writeCommand(os, "killall androidvncserver");
+ writeCommand(os, "killall -KILL androidvncserver");
//chmod 777 SHOULD exist
writeCommand(os, "chmod 777 " + getFilesDir().getAbsolutePath() + "/androidvncserver");
os.close();