Skip to content

Commit

Permalink
Integration with XServer XSDL
Browse files Browse the repository at this point in the history
Former-commit-id: a59ced5
  • Loading branch information
meefik committed Sep 11, 2015
1 parent c764f99 commit f507ec1
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 55 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog (English)
Added an option to change the chroot directory
Added unchroot script
Implemented integration with Android
Implemented integration with XServer XSDL

1.5.2
Added support Slackware
Expand Down Expand Up @@ -312,6 +313,7 @@ Updated list packages of base system installation
Добавлена опция изменения chroot директории
Добавлен скрипт unchroot
Реализована интеграция с Android
Реализована интеграция с XServer XSDL

1.5.2
Добавлена поддержка Slackware
Expand Down
2 changes: 2 additions & 0 deletions res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<string name="dialog_title_xdisplay_preference">X: Bildschirm Nummer</string>
<string name="title_xhost_preference">X Server Addrese</string>
<string name="dialog_title_xhost_preference">X: IP oder Host Name</string>
<string name="title_xserverxsdl_preference">XServer XSDL</string>
<string name="summary_xserverxsdl_preference">Automatically open XServer XSDL</string>
<string name="fb_preferences">Framebuffer</string>
<string name="title_fbdisplay_preference">Bildschirm</string>
<string name="dialog_title_fbdisplay_preference">FB: Bildschirm Nummer</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<string name="dialog_title_xdisplay_preference">X: número pantalla</string>
<string name="title_xhost_preference">X server Dirección</string>
<string name="dialog_title_xhost_preference">X: IP o hombre host</string>
<string name="title_xserverxsdl_preference">XServer XSDL</string>
<string name="summary_xserverxsdl_preference">Automatically open XServer XSDL</string>
<string name="fb_preferences">Framebuffer</string>
<string name="title_fbdisplay_preference">Pantalla</string>
<string name="dialog_title_fbdisplay_preference">FB: numero pantalla</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<string name="dialog_title_xdisplay_preference">Numero schermo X:</string>
<string name="title_xhost_preference">Indirizzo server X</string>
<string name="dialog_title_xhost_preference">IP o nome host X:</string>
<string name="title_xserverxsdl_preference">XServer XSDL</string>
<string name="summary_xserverxsdl_preference">Automatically open XServer XSDL</string>
<string name="fb_preferences">Framebuffer</string>
<string name="title_fbdisplay_preference">Schermo</string>
<string name="dialog_title_fbdisplay_preference">Numero schermo FB:</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<string name="dialog_title_xdisplay_preference">X: номер дисплея</string>
<string name="title_xhost_preference">Адрес X-сервера</string>
<string name="dialog_title_xhost_preference">X: IP или имя хоста</string>
<string name="title_xserverxsdl_preference">XServer XSDL</string>
<string name="summary_xserverxsdl_preference">Автоматически открывать XServer XSDL</string>
<string name="fb_preferences">Framebuffer</string>
<string name="title_fbdisplay_preference">Номер дисплея</string>
<string name="dialog_title_fbdisplay_preference">FB: номер дисплея</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<string name="dialog_title_xdisplay_preference">X: số hiển thị</string>
<string name="title_xhost_preference">Địa chỉ máy chủ X</string>
<string name="dialog_title_xhost_preference">X: IP hoặc tên máy chủ</string>
<string name="title_xserverxsdl_preference">XServer XSDL</string>
<string name="summary_xserverxsdl_preference">Automatically open XServer XSDL</string>
<string name="fb_preferences">Framebuffer</string>
<string name="title_fbdisplay_preference">Hiển thị</string>
<string name="dialog_title_fbdisplay_preference">FB: hiển thị số</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<string name="dialog_title_xdisplay_preference">X: 窗口序号</string>
<string name="title_xhost_preference">X11 服务器地址</string>
<string name="dialog_title_xhost_preference">X: IP地址或域名</string>
<string name="title_xserverxsdl_preference">XServer XSDL</string>
<string name="summary_xserverxsdl_preference">Automatically open XServer XSDL</string>
<string name="fb_preferences">Framebuffer</string>
<string name="title_fbdisplay_preference">显示</string>
<string name="dialog_title_fbdisplay_preference">FB: 窗口序号</string>
Expand Down
3 changes: 2 additions & 1 deletion res/values/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<string name="customstartup" translatable="false">false</string>
<string name="scripts" translatable="false">/etc/init.d/myscript</string>
<string name="custommount" translatable="false">false</string>
<string name="mounts" translatable="false">{storage} /system</string>
<string name="mounts" translatable="false">/system {storage}</string>
<string name="guistartup" translatable="false">true</string>
<string name="guitype" translatable="false">vnc</string>
<string name="sshstartup" translatable="false">true</string>
Expand All @@ -48,6 +48,7 @@
<string name="vncargs" translatable="false"></string>
<string name="xdisplay" translatable="false">0</string>
<string name="xhost" translatable="false">127.0.0.1</string>
<string name="xserverxsdl" translatable="false">false</string>
<string name="fbdisplay" translatable="false">0</string>
<string name="fbdpi" translatable="false">100</string>
<string name="fbdev" translatable="false">/dev/graphics/fb0</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<string name="dialog_title_xdisplay_preference">X: display number</string>
<string name="title_xhost_preference">X server address</string>
<string name="dialog_title_xhost_preference">X: IP or host name</string>
<string name="title_xserverxsdl_preference">XServer XSDL</string>
<string name="summary_xserverxsdl_preference">Automatically open XServer XSDL</string>
<string name="fb_preferences">Framebuffer</string>
<string name="title_fbdisplay_preference">Display</string>
<string name="dialog_title_fbdisplay_preference">FB: display number</string>
Expand Down
5 changes: 5 additions & 0 deletions res/xml/properties_xserver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
android:key="xhost"
android:summary="@string/xhost"
android:title="@string/title_xhost_preference" />
<CheckBoxPreference
android:defaultValue="@string/xserverxsdl"
android:key="xserverxsdl"
android:summary="@string/summary_xserverxsdl_preference"
android:title="@string/title_xserverxsdl_preference" />
</PreferenceCategory>

</PreferenceScreen>
30 changes: 17 additions & 13 deletions src/ru/meefik/linuxdeploy/EnvUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ private static boolean isRooted() {

if (n > 0) {
result = true;
} else {
Logger.log("Require superuser privileges (root).\n");
}
stdout.close();
stdin.close();
Expand Down Expand Up @@ -196,16 +194,17 @@ public void run() {
return result;
}

public static void updateEnv(Context c) {
public static boolean updateEnv(Context c) {
if (!isRooted()) {
return;
Logger.log("Require superuser privileges (root).\n");
return false;
}

Logger.log("Updating environment ... ");

if (PrefStore.ENV_DIR.length() == 0) {
Logger.log("fail\n");
return;
return false;
}

// clean env directory
Expand All @@ -216,22 +215,22 @@ public static void updateEnv(Context c) {
// extract assets
if (!extractDir(c, PrefStore.ROOT_ASSETS, "")) {
Logger.log("fail\n");
return;
return false;
}
if (!extractDir(c, PrefStore.MARCH + "/all", "")) {
Logger.log("fail\n");
return;
return false;
}
// PIE for Android L
if (android.os.Build.VERSION.SDK_INT >= 21) {
if (!extractDir(c, PrefStore.MARCH + "/pie", "")) {
Logger.log("fail\n");
return;
return false;
}
} else {
if (!extractDir(c, PrefStore.MARCH + "/nopie", "")) {
Logger.log("fail\n");
return;
return false;
}
}

Expand Down Expand Up @@ -275,19 +274,20 @@ public static void updateEnv(Context c) {
}
if (!exec(params)) {
Logger.log("fail\n");
return;
return false;
}

// update version
if (!PrefStore.setVersion()) {
Logger.log("fail\n");
return;
return false;
}

Logger.log("done\n");
return true;
}

public static void removeEnv(Context c) {
public static boolean removeEnv(Context c) {
Logger.log("Removing environment ... ");

// exec shell commands
Expand All @@ -302,18 +302,22 @@ public static void removeEnv(Context c) {

if (exec(params)) {
Logger.log("done\n");
return true;
} else {
Logger.log("fail\n");
return false;
}
}

public static void updateConf() {
public static boolean updateConf() {
Logger.log("Updating configuration file ... ");
// update config file
if (PrefStore.storeConfig()) {
Logger.log("done\n");
return true;
} else {
Logger.log("fail\n");
return false;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/ru/meefik/linuxdeploy/ExecScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public ExecScript(Context c, String arg) {
this.arg = arg;
PrefStore.get(c);
}


@Override
public void run() {
switch (arg) {
case "update":
Expand Down
33 changes: 25 additions & 8 deletions src/ru/meefik/linuxdeploy/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiManager.WifiLock;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.util.TypedValue;
Expand All @@ -35,7 +37,8 @@ private static void clearLog() {
}

public static void showLog() {
if (logView == null || logScroll == null) return;
if (logView == null || logScroll == null)
return;
// show log in TextView
logView.post(new Runnable() {
@Override
Expand Down Expand Up @@ -63,7 +66,7 @@ public void onCreate(Bundle savedInstanceState) {

logView = (TextView) findViewById(R.id.LogView);
logScroll = (ScrollView) findViewById(R.id.LogScrollView);

// WiFi lock init
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL,
Expand Down Expand Up @@ -112,12 +115,26 @@ public void onClick(DialogInterface dialog,
int id) {
new ExecScript(getApplicationContext(),
"start").start();
if (PrefStore.STARTUP
.contains("framebuffer")) {
Intent intent_fb = new Intent(
getApplicationContext(),
FullscreenActivity.class);
startActivity(intent_fb);
// actions
Handler h = new Handler();
if (PrefStore.STARTUP.contains("xserver") && PrefStore.XSERVER_XSDL) {
h.postDelayed(new Runnable() {
public void run() {
PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("x.org.server");
if (intent != null) startActivity(intent);
}
}, 1000);
}
if (PrefStore.STARTUP.contains("framebuffer")) {
h.postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent(
getApplicationContext(),
FullscreenActivity.class);
if (intent != null) startActivity(intent);
}
}, 1000);
}
}
})
Expand Down
32 changes: 15 additions & 17 deletions src/ru/meefik/linuxdeploy/PrefStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class PrefStore {
public static String VNC_ARGS;
public static String XSERVER_DISPLAY;
public static String XSERVER_HOST;
public static Boolean XSERVER_XSDL;
public static String FB_DISPLAY;
public static String FB_DPI;
public static String FB_DEV;
Expand Down Expand Up @@ -212,9 +213,9 @@ public static void get(Context c) {
SharedPreferences.Editor prefEditor = sp.edit();

SCREEN_LOCK = sp.getBoolean("screenlock",
c.getString(R.string.screenlock).equals("true") ? true : false);
c.getString(R.string.screenlock).equals("true"));
WIFI_LOCK = sp.getBoolean("wifilock", c.getString(R.string.wifilock)
.equals("true") ? true : false);
.equals("true"));
FONT_SIZE = Integer.parseInt(sp.getString("fontsize",
c.getString(R.string.fontsize)));
MAX_LINE = Integer.parseInt(sp.getString("maxline",
Expand All @@ -228,29 +229,27 @@ public static void get(Context c) {
prefEditor.putString("envdir", ENV_DIR);

BUILTIN_SHELL = sp.getBoolean("builtinshell",
c.getString(R.string.builtinshell).equals("true") ? true
: false);
c.getString(R.string.builtinshell).equals("true"));
if (BUILTIN_SHELL) {
SHELL = ENV_DIR + "/bin/ash";
} else {
SHELL = "/system/xbin/ash";
}
SYMLINK = sp.getBoolean("symlink", c.getString(R.string.symlink)
.equals("true") ? true : false);
.equals("true"));
CURRENT_PROFILE = sp.getString("profile", null);
if (CURRENT_PROFILE == null)
setCurrentProfile(c, String.valueOf(System.currentTimeMillis()));

DEBUG_MODE = sp.getBoolean("debug",
c.getString(R.string.debug).equals("true") ? true : false) ? "y"
c.getString(R.string.debug).equals("true")) ? "y"
: "n";
TRACE_MODE = sp.getBoolean("debug",
c.getString(R.string.debug).equals("true") ? true : false)
c.getString(R.string.debug).equals("true"))
&& sp.getBoolean("trace",
c.getString(R.string.trace).equals("true") ? true
: false) ? "y" : "n";
c.getString(R.string.trace).equals("true")) ? "y" : "n";
LOGGING = sp.getBoolean("logs",
c.getString(R.string.logs).equals("true") ? true : false);
c.getString(R.string.logs).equals("true"));
LOG_FILE = sp.getString("logfile", EXTERNAL_STORAGE
+ "/linuxdeploy.log");

Expand Down Expand Up @@ -294,23 +293,21 @@ public static void get(Context c) {
}
USE_COMPONENTS = components.trim();
String startup_ssh = sp.getBoolean("sshstartup",
c.getString(R.string.sshstartup).equals("true") ? true : false) ? "ssh"
c.getString(R.string.sshstartup).equals("true")) ? "ssh"
: "";
String startup_gui = sp.getBoolean("guistartup",
c.getString(R.string.guistartup).equals("true") ? true : false) ? sp
c.getString(R.string.guistartup).equals("true")) ? sp
.getString("guitype", c.getString(R.string.guitype)) : "";
String startup_custom = sp.getBoolean("customstartup",
c.getString(R.string.customstartup).equals("true") ? true
: false) ? "custom" : "";
c.getString(R.string.customstartup).equals("true")) ? "custom" : "";
STARTUP = (startup_ssh + " " + startup_gui + " " + startup_custom)
.trim();
CUSTOM_SCRIPTS = sp.getBoolean("customstartup",
c.getString(R.string.customstartup).equals("true") ? true
: false) ? sp.getString("scripts",
c.getString(R.string.customstartup).equals("true")) ? sp.getString("scripts",
c.getString(R.string.scripts)).trim() : "";
CUSTOM_MOUNTS = sp
.getBoolean("custommounts", c.getString(R.string.custommount)
.equals("true") ? true : false) ? sp.getString(
.equals("true")) ? sp.getString(
"mounts", EXTERNAL_STORAGE).trim() : "";
SSH_PORT = sp.getString("sshport", c.getString(R.string.sshport));
VNC_DISPLAY = sp.getString("vncdisplay",
Expand All @@ -323,6 +320,7 @@ public static void get(Context c) {
XSERVER_DISPLAY = sp.getString("xdisplay",
c.getString(R.string.xdisplay));
XSERVER_HOST = sp.getString("xhost", c.getString(R.string.xhost));
XSERVER_XSDL = sp.getBoolean("xserverxsdl", c.getString(R.string.xserverxsdl).equals("true"));
FB_DISPLAY = sp.getString("fbdisplay", c.getString(R.string.fbdisplay));
FB_DPI = sp.getString("fbdpi", c.getString(R.string.fbdpi));
FB_DEV = sp.getString("fbdev", c.getString(R.string.fbdev));
Expand Down
Loading

0 comments on commit f507ec1

Please sign in to comment.