1.0a3
This commit is contained in:
parent
eb916b76d2
commit
026e1b8cd0
2
.classpath
Normal file → Executable file
2
.classpath
Normal file → Executable file
@ -3,6 +3,6 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="gen"/>
|
<classpathentry kind="src" path="gen"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry kind="lib" path="libs/mobclix.jar"/>
|
<classpathentry kind="lib" path="/home/onaips/Dropbox/projectos/workspace/droidVNCserver/libs/GoogleAdMobAdsSdk-4.1.1.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
2
.project
2
.project
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>avnc</name>
|
<name>droidVNCserver</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
BIN
res/raw/busybox
BIN
res/raw/busybox
Binary file not shown.
@ -1,20 +0,0 @@
|
|||||||
<!-- index.vnc - default html page for Java VNC viewer applet. On any file
|
|
||||||
ending in .vnc, the HTTP server embedded in Xvnc will substitute the
|
|
||||||
following variables when preceded by a dollar: USER, DESKTOP, DISPLAY,
|
|
||||||
APPLETWIDTH, APPLETHEIGHT, WIDTH, HEIGHT, PORT, PARAMS. Use two dollar
|
|
||||||
signs ($$) to get a dollar sign in the generated html. -->
|
|
||||||
|
|
||||||
<HTML>
|
|
||||||
<TITLE>
|
|
||||||
$USER's $DESKTOP desktop ($DISPLAY)
|
|
||||||
</TITLE>
|
|
||||||
<APPLET CODE=VncViewer.class ARCHIVE=VncViewer.jar
|
|
||||||
WIDTH=$APPLETWIDTH HEIGHT=$APPLETHEIGHT>
|
|
||||||
<param name=PORT value=$PORT>
|
|
||||||
<param name="Open New Window" value=yes>
|
|
||||||
</APPLET>
|
|
||||||
<BR>
|
|
||||||
Further help: <BR>
|
|
||||||
<A href="http://onaips.blogspot.com/">oNaiPs Blog</A><BR>
|
|
||||||
<A href="http://www.tightvnc.com/">www.TightVNC.com</A>
|
|
||||||
</HTML>
|
|
@ -1,107 +0,0 @@
|
|||||||
package org.onaips.vnc;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class StartAtBootService extends Service {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent arg0) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId)
|
|
||||||
{
|
|
||||||
startServer();
|
|
||||||
// We want this service to continue running until it is explicitly
|
|
||||||
// stopped, so return sticky.
|
|
||||||
return START_STICKY;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean free_version()
|
|
||||||
{
|
|
||||||
return getPackageName().equals("org.onaips.vnc");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void startServer()
|
|
||||||
{
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
|
|
||||||
Boolean startdaemon=preferences.getBoolean("startdaemononboot", false);
|
|
||||||
|
|
||||||
//Lets see if i need to boot daemon...
|
|
||||||
Log.v("VNC","Let me see if we need to start daemon..." + (startdaemon?"Yes":"No"));
|
|
||||||
if (startdaemon==false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
//this code is redundant, how to merge it?
|
|
||||||
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;
|
|
||||||
|
|
||||||
String donate=free_version()?"":" -d ";
|
|
||||||
|
|
||||||
String port=preferences.getString("port", "5901");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int port1=Integer.parseInt(port);
|
|
||||||
port=String.valueOf(port1);
|
|
||||||
}
|
|
||||||
catch(NumberFormatException e)
|
|
||||||
{
|
|
||||||
port="5901";
|
|
||||||
}
|
|
||||||
String port_string="-P " + port;
|
|
||||||
|
|
||||||
|
|
||||||
sh = Runtime.getRuntime().exec("su");
|
|
||||||
OutputStream os = sh.getOutputStream();
|
|
||||||
|
|
||||||
|
|
||||||
writeCommand(os, "chmod 777 " + getFilesDir().getAbsolutePath() + "/androidvncserver");
|
|
||||||
writeCommand(os,getFilesDir().getAbsolutePath() + "/androidvncserver "+ password_check + " " + rotation + " " + scaling_string + " " + port_string + donate);
|
|
||||||
|
|
||||||
//dont show password on logcat
|
|
||||||
Log.v("VNC","Starting " + getFilesDir().getAbsolutePath() + "/androidvncserver " + " " + rotation + " " + scaling_string + " " + port_string + donate);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.v("VNC","startServer():" + e.getMessage());
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.v("VNC","startServer():" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void writeCommand(OutputStream os, String command) throws Exception
|
|
||||||
{
|
|
||||||
os.write((command + "\n").getBytes("ASCII"));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package org.onaips.vnc;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
public class StartAtBootServiceReceiver extends BroadcastReceiver
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent)
|
|
||||||
{
|
|
||||||
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
|
||||||
Intent i = new Intent();
|
|
||||||
i.setAction("org.onaips.vnc.StartAtBootService");
|
|
||||||
context.startService(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user