Skip to content

Commit

Permalink
some fix, dri3, wps, readme, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
Cateners committed Sep 21, 2024
1 parent a117050 commit 49c2377
Show file tree
Hide file tree
Showing 14 changed files with 347 additions and 160 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ app.*.symbols
app.*.map.json

# Android Studio will place build artifacts here
/android/app/build
/android/app/debug
/android/app/profile
/android/app/release
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

给所有安卓arm64设备的“PC应用引擎”平替

Click-to-run debian bookworm xfce on android for Chinese users, with fcitx pinyin input method preinstalled. No termux required.
Click-to-run Debian Bookworm XFCE on Android for Chinese users, with the Fcitx Pinyin input method preinstalled. No Termux is required. If you want to change the language in the container, run "tmoe", since this root filesystem is made using [tmoe](https://github.com/2moe/tmoe).

## 特点

Expand Down Expand Up @@ -33,7 +33,7 @@ Click-to-run debian bookworm xfce on android for Chinese users, with fcitx pinyi

使用proot运行debian环境

内置[noVNC](https://github.com/novnc/noVNC)显示图形界面
内置[noVNC](https://github.com/novnc/noVNC)/[AVNC](https://github.com/gujjwal00/avnc)/[Termux:X11](https://github.com/termux/termux-x11)显示图形界面

## 项目结构

Expand All @@ -54,16 +54,22 @@ lib目录:

## 编译

你需要配置好flutter和安卓sdk,然后克隆此项目。
你需要配置好flutter和安卓sdk,还需安装python3、bison、patch、gcc,然后克隆此项目。

在编译之前,需要在release中下载系统rootfs(或者[自行制作](extra/build-tiny-rootfs.md)),之后使用split命令分割,拷贝到assets。一般我将其分为98MB。

`split -b 98M debian.tar.xz`

还需要对flutter的一些默认配置作修改,因为其与项目中build.gradle的一些设置冲突。
- 删除`flutter\packages\flutter_tools\gradle\src\main\flutter.groovy`路径下与`ShrinkResources`相关的`if`代码块。

接下来就可以编译了。我使用的命令如下:

`flutter build apk --target-platform android-arm64 --split-per-abi --obfuscate --split-debug-info=tiny_computer/sdi`

有一些C代码可能报错。比如KeyBind.c等文件,报错一些符号未定义。但其实包含那些符号的函数并没有被使用,所以可以把它们删掉再编译。
应该有编译选项可以避免这种情况,但我对cmake不熟,就先这样了:P

## 目前已知bug

多用户/分身情形无法sudo, 其它见issue
Expand Down
108 changes: 0 additions & 108 deletions android/app/build/generated/java/com/termux/x11/Prefs.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@Keep @SuppressLint({"StaticFieldLeak", "UnsafeDynamicallyLoadedCode"})
public class CmdEntryPoint extends ICmdEntryInterface.Stub {
public static final String ACTION_START = "com.termux.x11.CmdEntryPoint.ACTION_START";
public static final int PORT = 7892;
public static final int PORT = 7897;
public static final byte[] MAGIC = "0xDEADBEEF".getBytes();
private static final Handler handler;
public static Context ctx;
Expand Down
28 changes: 24 additions & 4 deletions android/app/src/main/java/com/termux/x11/LoriePreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,28 @@ public String[] getValues() {
return getArrayItems(values, ctx.getResources());
}

// private String[] getArrayItems(int resourceId, Resources resources) {
// ArrayList<String> itemList = new ArrayList<>();
// try(TypedArray typedArray = resources.obtainTypedArray(resourceId)) {
// for (int i = 0; i < typedArray.length(); i++) {
// int type = typedArray.getType(i);
// if (type == TypedValue.TYPE_STRING) {
// itemList.add(typedArray.getString(i));
// } else if (type == TypedValue.TYPE_REFERENCE) {
// int resIdOfArray = typedArray.getResourceId(i, 0);
// itemList.addAll(Arrays.asList(resources.getStringArray(resIdOfArray)));
// }
// }
// }

// Object[] objectArray = itemList.toArray();
// return Arrays.copyOf(objectArray, objectArray.length, String[].class);
// }

private String[] getArrayItems(int resourceId, Resources resources) {
ArrayList<String> itemList = new ArrayList<>();
try(TypedArray typedArray = resources.obtainTypedArray(resourceId)) {
TypedArray typedArray = resources.obtainTypedArray(resourceId);
try {
for (int i = 0; i < typedArray.length(); i++) {
int type = typedArray.getType(i);
if (type == TypedValue.TYPE_STRING) {
Expand All @@ -748,11 +767,12 @@ private String[] getArrayItems(int resourceId, Resources resources) {
itemList.addAll(Arrays.asList(resources.getStringArray(resIdOfArray)));
}
}
} finally {
typedArray.recycle();
}

Object[] objectArray = itemList.toArray();
return Arrays.copyOf(objectArray, objectArray.length, String[].class);
return itemList.toArray(new String[0]);
}


}

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/java/com/termux/x11/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class MainActivity extends AppCompatActivity implements View.OnApplyWindo
protected ICmdEntryInterface service = null;
public TermuxX11ExtraKeys mExtraKeys;
private Notification mNotification;
private final int mNotificationId = 7892;
private final int mNotificationId = 7897;
NotificationManager mNotificationManager;
static InputMethodManager inputMethodManager;
private static boolean showIMEWhileExternalConnected = true;
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PreferenceScreen app:key="kbd">
<SwitchPreferenceCompat app:key="showAdditionalKbd" app:defaultValue="true" />
<!-- this preference should be a part of `Prefs` but should not appear in PreferenceScreen -->
<SwitchPreferenceCompat app:key="additionalKbdVisible" app:defaultValue="true" app:isPreferenceVisible="false" />
<SwitchPreferenceCompat app:key="additionalKbdVisible" app:defaultValue="false" app:isPreferenceVisible="false" />
<SwitchPreferenceCompat app:key="showIMEWhileExternalConnected" app:defaultValue="true" />
<SwitchPreferenceCompat app:key="preferScancodes" app:defaultValue="false" />
<SwitchPreferenceCompat app:key="hardwareKbdScancodesWorkaround" app:defaultValue="true" />
Expand Down
Loading

0 comments on commit 49c2377

Please sign in to comment.