├── .github └── ISSUE_TEMPLATE │ ├── 01-bug-report.yml │ └── config.yml ├── .gitignore ├── LICENSE ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ │ ├── bios-256k.bin │ │ │ ├── console_font.ttf │ │ │ ├── efi-virtio.rom │ │ │ ├── kvmvapic.bin │ │ │ ├── userdata-01.qcow2 │ │ │ └── userdata-02.qcow2 │ │ ├── java │ │ │ └── sylirre │ │ │ │ └── vmconsole │ │ │ │ ├── Bell.java │ │ │ │ ├── Config.java │ │ │ │ ├── ExtraKeysView.java │ │ │ │ ├── InputDispatcher.java │ │ │ │ ├── Installer.java │ │ │ │ ├── TerminalActivity.java │ │ │ │ ├── TerminalPreferences.java │ │ │ │ ├── TerminalService.java │ │ │ │ ├── termlib │ │ │ │ ├── ByteQueue.java │ │ │ │ ├── EmulatorDebug.java │ │ │ │ ├── JNI.java │ │ │ │ ├── KeyHandler.java │ │ │ │ ├── TerminalBuffer.java │ │ │ │ ├── TerminalColorScheme.java │ │ │ │ ├── TerminalColors.java │ │ │ │ ├── TerminalEmulator.java │ │ │ │ ├── TerminalOutput.java │ │ │ │ ├── TerminalRow.java │ │ │ │ ├── TerminalSession.java │ │ │ │ ├── TextStyle.java │ │ │ │ └── WcWidth.java │ │ │ │ └── termview │ │ │ │ ├── CursorController.java │ │ │ │ ├── GestureAndScaleRecognizer.java │ │ │ │ ├── TerminalRenderer.java │ │ │ │ ├── TerminalView.java │ │ │ │ ├── TerminalViewClient.java │ │ │ │ ├── TextSelectionCursorController.java │ │ │ │ └── TextSelectionHandleView.java │ │ ├── jniLibs │ │ └── res │ │ │ ├── drawable-xhdpi │ │ │ └── banner.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── text_select_handle_left_mtrl_alpha.png │ │ │ └── text_select_handle_right_mtrl_alpha.png │ │ │ ├── drawable │ │ │ ├── ic_launcher_background.xml │ │ │ ├── ic_launcher_foreground.xml │ │ │ ├── ic_service_notification.png │ │ │ ├── terminal_scroll_shape.xml │ │ │ ├── text_select_handle_left_material.xml │ │ │ └── text_select_handle_right_material.xml │ │ │ ├── layout │ │ │ ├── installer_progress.xml │ │ │ └── main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── test │ │ └── java │ │ └── sylirre │ │ └── vmconsole │ │ └── termlib │ │ ├── ByteQueueTest.java │ │ ├── ControlSequenceIntroducerTest.java │ │ ├── CursorAndScreenTest.java │ │ ├── DecSetTest.java │ │ ├── DeviceControlStringTest.java │ │ ├── HistoryTest.java │ │ ├── KeyHandlerTest.java │ │ ├── OperatingSystemControlTest.java │ │ ├── RectangularAreasTest.java │ │ ├── ResizeTest.java │ │ ├── ScreenBufferTest.java │ │ ├── ScrollRegionTest.java │ │ ├── TerminalRowTest.java │ │ ├── TerminalTest.java │ │ ├── TerminalTestCase.java │ │ ├── TextStyleTest.java │ │ ├── UnicodeInputTest.java │ │ └── WcWidthTest.java └── vmconsole.jks ├── build.gradle ├── docs ├── .gitignore ├── 404.html ├── Gemfile ├── Gemfile.lock ├── README.md ├── _config.yml ├── _includes │ ├── anchor_headings.html │ ├── category.html │ ├── disqus_comments.html │ ├── footer.html │ ├── head.html │ ├── header.html │ ├── icon-github.html │ ├── icon-github.svg │ ├── icon-twitter.html │ ├── icon-twitter.svg │ └── social.html ├── _layouts │ ├── default.html │ ├── get.html │ ├── home.html │ ├── page.html │ ├── post.html │ └── redirect.html ├── _sass │ └── minima │ │ ├── _base.scss │ │ ├── _layout.scss │ │ ├── custom-styles.scss │ │ ├── custom-variables.scss │ │ ├── initialize.scss │ │ └── skins │ │ ├── classic.scss │ │ ├── dark.scss │ │ ├── solarized-dark.scss │ │ └── solarized.scss ├── assets │ ├── css │ │ └── style.scss │ └── minima-social-icons.svg ├── favicon.ico ├── files │ ├── demo_boot-logs.png │ ├── demo_btop.png │ ├── demo_dns-dig.png │ ├── demo_docker.png │ ├── demo_metasploit.png │ ├── demo_nvim.png │ ├── get-it-on-github.png │ ├── get-it-on-google-play.png │ └── slider.js ├── google8e6c3fd31cf1f2d8.html ├── index.md └── pages │ ├── get.md │ └── privacy-policy.md ├── external ├── alpine_iso │ ├── Dockerfile │ ├── Makefile │ ├── README.md │ ├── abuild-keys │ │ ├── vmconsole-dev.rsa.enc │ │ └── vmconsole-dev.rsa.pub │ ├── extras │ │ └── .placeholder │ ├── files │ │ ├── issue │ │ └── motd │ ├── genapkovl.sh │ ├── mkimage.sh │ ├── mkimg.profile.sh │ └── packages.txt └── libvmc │ ├── README.md │ ├── build-package.sh │ ├── clean.sh │ ├── jniLibs │ ├── arm64-v8a │ │ └── libVMC.so │ ├── armeabi-v7a │ │ └── libVMC.so │ ├── x86 │ │ └── libVMC.so │ └── x86_64 │ │ └── libVMC.so │ ├── packages │ ├── glib │ │ ├── 0000-configure-no-posix-spawn.patch │ │ ├── 0001-support-android-timezone-info.patch │ │ ├── 0002-fix-hardcoded-paths.patch │ │ └── build.sh │ ├── libandroid-cpufeatures │ │ ├── build.sh │ │ └── sources │ │ │ ├── NOTICE │ │ │ ├── cpu-features.c │ │ │ └── cpu-features.h │ ├── libandroid-support │ │ ├── build.sh │ │ └── sources │ │ │ ├── LICENSE.txt │ │ │ ├── README.md │ │ │ └── src │ │ │ ├── musl-ctype │ │ │ ├── alpha.h │ │ │ ├── iswalnum.c │ │ │ ├── iswalpha.c │ │ │ ├── iswblank.c │ │ │ ├── iswcntrl.c │ │ │ ├── iswctype.c │ │ │ ├── iswdigit.c │ │ │ ├── iswgraph.c │ │ │ ├── iswlower.c │ │ │ ├── iswpunct.c │ │ │ ├── iswspace.c │ │ │ ├── iswupper.c │ │ │ ├── iswxdigit.c │ │ │ ├── nonspacing.h │ │ │ ├── punct.h │ │ │ ├── towctrans.c │ │ │ ├── wcswidth.c │ │ │ ├── wctrans.c │ │ │ └── wcwidth.c │ │ │ ├── musl-locale │ │ │ ├── big5.h │ │ │ ├── codepages.h │ │ │ ├── gb18030.h │ │ │ ├── hkscs.h │ │ │ ├── iconv.c │ │ │ ├── intl.c │ │ │ ├── jis0208.h │ │ │ ├── ksc.h │ │ │ └── legacychars.h │ │ │ └── musl-multibyte │ │ │ ├── internal.c │ │ │ ├── internal.h │ │ │ ├── libc.h │ │ │ ├── mblen.c │ │ │ ├── mbsnrtowcs.c │ │ │ └── mbsrtowcs.c │ ├── libffi │ │ ├── 0001-fix-hardcoded-paths.patch │ │ └── build.sh │ ├── libiconv │ │ └── build.sh │ ├── pixman │ │ ├── 0000-fix-pkgconfig-defs.patch │ │ └── build.sh │ ├── qemu-system │ │ ├── 0000-android-config-support.patch │ │ ├── 0001-fix-hardcoded-paths.patch │ │ ├── 0002-fix-soundcard.h-location.patch │ │ ├── 0003-fix-time_nsec-defs.patch │ │ ├── 0004-add-missing-telldir-seekdir.patch │ │ ├── 0005-add-missing-sigorset.patch │ │ ├── 0006-fix-sem.h-location.patch │ │ ├── 0007-fix-syscalls.patch │ │ ├── 0008-fix-struct-member-conflicts.patch │ │ ├── 0009-fix-mman.h-defs.patch │ │ ├── 0010-disable-glob.h-include.patch │ │ ├── 0011-misc-build-fixes.patch │ │ ├── 0012-add-missing-arch_prctl.patch │ │ ├── 0014-app_dns-from-envvar.patch │ │ ├── 0015-app_no-libcap-attr-deps.patch │ │ ├── 0016-app-jni-shared-library.patch │ │ ├── 0017-9pfs-dont-chmod-mapfile.patch │ │ ├── 0018-iconv.patch │ │ ├── 0019-disable-signalfd.patch │ │ └── build.sh │ └── zlib │ │ └── build.sh │ └── scripts │ ├── Dockerfile │ ├── buildorder.py │ ├── config.guess │ ├── config.sub │ ├── run-docker.sh │ └── toolchain │ ├── create-standalone-toolchain.sh │ ├── ndk-headers │ ├── iconv.h │ ├── langinfo.h │ └── libintl.h │ └── ndk-patches │ ├── android_api-level.h.patch │ ├── asm-generic_termbits.h.patch │ ├── linux_fcntl.h.patch │ ├── stdio.h.patch │ ├── stdlib.h.patch │ ├── sys_wait.h.patch │ └── unistd.h.patch ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── images ├── banner.png ├── google-play-badge.png ├── logo.png ├── logo_source.svg └── screenshots.gif └── settings.gradle /.github/ISSUE_TEMPLATE/01-bug-report.yml: -------------------------------------------------------------------------------- 1 | name: "Bug report" 2 | description: "Report an issue if you have found that application is malfunctioning." 3 | title: "[Bug]: " 4 | labels: ["bug report"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | This is a form you required to fill in order to submit a bug report of vmConsole. Use it to submit issues only of application itself. 10 | 11 | Alpine Linux is not affiliated with vmConsole. Package bugs are not subject to be reported there. 12 | - type: textarea 13 | attributes: 14 | label: Problem description 15 | description: | 16 | Provide a clear description of the problem. Please attach screenshots, video recording or other information which may help us to understand the problem. 17 | 18 | Issues without proper description will be instantly closed. 19 | validations: 20 | required: true 21 | - type: textarea 22 | attributes: 23 | label: Steps to reproduce the behavior. 24 | description: | 25 | Describe steps which will let us to reproduce the issue. 26 | validations: 27 | required: true 28 | - type: textarea 29 | attributes: 30 | label: What is the expected behavior? 31 | description: 32 | Describe the result you have expected when performing above steps. That will help us to determine whether bug really exists or that was just application usage misunderstanding. 33 | - type: textarea 34 | attributes: 35 | label: System information 36 | description: Please provide info about your device 37 | value: | 38 | * Application version: 39 | * Android OS version: 40 | * Device model: 41 | validations: 42 | required: true 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Want ask questions about the project? 4 | url: https://github.com/sylirre/vmConsole/discussions 5 | about: Join GitHub Discussions 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated. 2 | /app/.cxx 3 | /app/build 4 | /app/debug 5 | /app/release 6 | /.gradle 7 | *.aab 8 | *.apk 9 | *.iso 10 | *.so 11 | 12 | # Local configuration. 13 | /.idea 14 | *.iml 15 | local.properties 16 | 17 | # Project doesn't support building on Windows. 18 | /gradlew.bat 19 | 20 | # OS-specific files. 21 | .DS_Store 22 | .DS_Store? 23 | ._* 24 | .Spotlight-V100 25 | .Trashes 26 | ehthumbs.db 27 | Thumbs.db 28 | 29 | # Don't ignore prebuilt libraries. 30 | !/external/libvmc/jniLibs/*/*.so 31 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 32 5 | 6 | dependencies { 7 | implementation "androidx.annotation:annotation:1.3.0" 8 | implementation "androidx.preference:preference:1.2.0" 9 | } 10 | 11 | defaultConfig { 12 | applicationId "sylirre.vmconsole" 13 | minSdkVersion 24 14 | targetSdkVersion 32 15 | versionCode 2 16 | versionName "1.1.0" 17 | 18 | archivesBaseName = "vmConsole-$versionName" 19 | 20 | splits { 21 | abi { 22 | enable false 23 | reset() 24 | include 'arm64-v8a', 'x86_64', 'armeabi-v7a', 'x86' 25 | universalApk true 26 | } 27 | } 28 | } 29 | 30 | signingConfigs { 31 | release { 32 | storeFile file('vmconsole.jks') 33 | keyAlias 'vmconsole' 34 | storePassword System.getenv("KEY_PASSPHRASE") 35 | keyPassword System.getenv("KEY_PASSPHRASE") 36 | } 37 | } 38 | 39 | buildTypes { 40 | release { 41 | minifyEnabled true 42 | shrinkResources true 43 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 44 | signingConfig signingConfigs.release 45 | } 46 | } 47 | 48 | compileOptions { 49 | sourceCompatibility JavaVersion.VERSION_1_8 50 | targetCompatibility JavaVersion.VERSION_1_8 51 | } 52 | 53 | packagingOptions { 54 | jniLibs.useLegacyPackaging = true 55 | } 56 | 57 | testOptions { 58 | unitTests.returnDefaultValues = true 59 | } 60 | } 61 | 62 | tasks.withType(Test) { 63 | testLogging { 64 | events "started", "passed", "skipped", "failed" 65 | } 66 | } 67 | 68 | dependencies { 69 | testImplementation 'junit:junit:4.13.2' 70 | } 71 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | -dontobfuscate 11 | #-renamesourcefileattribute SourceFile 12 | #-keepattributes SourceFile,LineNumberTable 13 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 58 | 59 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /app/src/main/assets/bios-256k.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/assets/bios-256k.bin -------------------------------------------------------------------------------- /app/src/main/assets/console_font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/assets/console_font.ttf -------------------------------------------------------------------------------- /app/src/main/assets/efi-virtio.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/assets/efi-virtio.rom -------------------------------------------------------------------------------- /app/src/main/assets/kvmvapic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/assets/kvmvapic.bin -------------------------------------------------------------------------------- /app/src/main/assets/userdata-01.qcow2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/assets/userdata-01.qcow2 -------------------------------------------------------------------------------- /app/src/main/assets/userdata-02.qcow2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/assets/userdata-02.qcow2 -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/Bell.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole; 18 | 19 | import android.content.Context; 20 | import android.os.Build; 21 | import android.os.Handler; 22 | import android.os.Looper; 23 | import android.os.SystemClock; 24 | import android.os.Vibrator; 25 | import android.os.VibrationEffect; 26 | 27 | /** 28 | * Class used to perform vibration once terminal encountered bell character. 29 | * Contains measures against bell character spamming to prevent lags: 30 | */ 31 | @SuppressWarnings("WeakerAccess") 32 | public class Bell { 33 | 34 | private static final long DURATION = 50; 35 | private static final long MIN_PAUSE = 3 * DURATION; 36 | private static final Object LOCK = new Object(); 37 | 38 | private final Handler handler = new Handler(Looper.getMainLooper()); 39 | private final Runnable bellRunnable; 40 | 41 | private static Bell sInstance = null; 42 | 43 | private long mLastBell = 0; 44 | 45 | private Bell(final Vibrator vibrator) { 46 | bellRunnable = () -> { 47 | if (vibrator != null) { 48 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 49 | vibrator.vibrate(VibrationEffect.createOneShot(DURATION, 10)); 50 | } else { 51 | vibrator.vibrate(DURATION); 52 | } 53 | } 54 | }; 55 | } 56 | 57 | public static Bell getInstance(Context context) { 58 | if (sInstance == null) { 59 | synchronized (LOCK) { 60 | if (sInstance == null) { 61 | sInstance = new Bell((Vibrator) context.getApplicationContext() 62 | .getSystemService(Context.VIBRATOR_SERVICE)); 63 | } 64 | } 65 | } 66 | 67 | return sInstance; 68 | } 69 | 70 | public synchronized void doBell() { 71 | long now = SystemClock.uptimeMillis(); 72 | long timeSinceLastBell = now - mLastBell; 73 | 74 | if (timeSinceLastBell > 0) { 75 | if (timeSinceLastBell < MIN_PAUSE) { 76 | // there was a bell recently, scheudle the next one 77 | handler.postDelayed(bellRunnable, MIN_PAUSE - timeSinceLastBell); 78 | mLastBell = mLastBell + MIN_PAUSE; 79 | } else { 80 | // the last bell was long ago, do it now 81 | bellRunnable.run(); 82 | mLastBell = now; 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/Config.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole; 18 | 19 | import android.content.Context; 20 | 21 | /** 22 | * Application build-time configuration entries. 23 | */ 24 | @SuppressWarnings("WeakerAccess") 25 | public class Config { 26 | /** 27 | * Name of CD-ROM image file. 28 | * Must be a name of file located in assets directory. 29 | */ 30 | public static final String CDROM_IMAGE_NAME = "alpine-x86_64.iso"; 31 | 32 | /** 33 | * Name of primary HDD image file. 34 | * Must be a name of file located in assets directory. 35 | */ 36 | public static final String PRIMARY_HDD_IMAGE_NAME = "userdata-01.qcow2"; 37 | 38 | /** 39 | * Name of secondary HDD image file. 40 | * Must be a name of file located in assets directory. 41 | */ 42 | public static final String SECONDARY_HDD_IMAGE_NAME = "userdata-02.qcow2"; 43 | 44 | /** 45 | * Upstream name server used by QEMU DNS resolver (IPv4). 46 | */ 47 | public static final String QEMU_UPSTREAM_DNS_V4 = "1.1.1.1"; 48 | 49 | /** 50 | * Upstream name server used by QEMU DNS resolver (IPv6). 51 | */ 52 | public static final String QEMU_UPSTREAM_DNS_V6 = "2606:4700:4700::1111"; 53 | 54 | /** 55 | * Minimal RAM allocation in MiB which guarantees that guest OS will 56 | * boot and work properly. 57 | */ 58 | public static final int QEMU_MIN_SAFE_RAM = 256; 59 | 60 | /** 61 | * Max RAM allocation in MiB which is considered to be safe. 62 | */ 63 | public static final int QEMU_MAX_SAFE_RAM = 2047; 64 | 65 | /** 66 | * Minimal size of TCG buffer in MiB that would not cause too many 67 | * flushes of generated code cache and significant performance 68 | * degradation. 69 | */ 70 | public static final int QEMU_MIN_TCG_BUF = 64; 71 | 72 | /** 73 | * Maximal size in MiB of TCG buffer to prevent wasting of device 74 | * memory by keeping unnecessary code caches. 75 | */ 76 | public static final int QEMU_MAX_TCG_BUF = 512; 77 | 78 | /** 79 | * A tag used for general logging. 80 | */ 81 | public static final String APP_LOG_TAG = "vmconsole:app"; 82 | 83 | /** 84 | * A tag used for input (ime) logging. 85 | */ 86 | public static final String INPUT_LOG_TAG = "vmconsole:input"; 87 | 88 | /** 89 | * A tag used for installer logging. 90 | */ 91 | public static final String INSTALLER_LOG_TAG = "vmconsole:installer"; 92 | 93 | /** 94 | * A tag used for wakelock logging. 95 | */ 96 | public static final String WAKELOCK_LOG_TAG = "vmconsole:wakelock"; 97 | 98 | /** 99 | * Returns path to runtime environment directory. 100 | */ 101 | public static String getDataDirectory(final Context context) { 102 | return context.getFilesDir().getAbsolutePath(); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/TerminalPreferences.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole; 18 | 19 | import android.content.Context; 20 | import android.content.SharedPreferences; 21 | 22 | import androidx.preference.PreferenceManager; 23 | 24 | public class TerminalPreferences { 25 | 26 | private static final String PREF_SHOW_EXTRA_KEYS = "show_extra_keys"; 27 | private static final String PREF_IGNORE_BELL = "ignore_bell"; 28 | private static final String PREF_DATA_VERSION = "data_version"; 29 | private static final String PREF_DEFAULT_SSH_USER = "default_ssh_user"; 30 | 31 | private boolean mFirstRun; 32 | private boolean mShowExtraKeys; 33 | private boolean mIgnoreBellCharacter; 34 | private int mDataVersion; 35 | private String mDefaultSshUser; 36 | 37 | public TerminalPreferences(Context context) { 38 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); 39 | mShowExtraKeys = prefs.getBoolean(PREF_SHOW_EXTRA_KEYS, true); 40 | mIgnoreBellCharacter = prefs.getBoolean(PREF_IGNORE_BELL, false); 41 | mDataVersion = prefs.getInt(PREF_DATA_VERSION, 0); 42 | mDefaultSshUser = prefs.getString(PREF_DEFAULT_SSH_USER, "root"); 43 | } 44 | 45 | public boolean isExtraKeysEnabled() { 46 | return mShowExtraKeys; 47 | } 48 | 49 | public boolean toggleShowExtraKeys(Context context) { 50 | mShowExtraKeys = !mShowExtraKeys; 51 | PreferenceManager.getDefaultSharedPreferences(context).edit() 52 | .putBoolean(PREF_SHOW_EXTRA_KEYS, mShowExtraKeys).apply(); 53 | return mShowExtraKeys; 54 | } 55 | 56 | public boolean isBellIgnored() { 57 | return mIgnoreBellCharacter; 58 | } 59 | 60 | public void setIgnoreBellCharacter(Context context, boolean newValue) { 61 | mIgnoreBellCharacter = newValue; 62 | PreferenceManager.getDefaultSharedPreferences(context).edit() 63 | .putBoolean(PREF_IGNORE_BELL, newValue).apply(); 64 | } 65 | 66 | public void updateDataVersion(Context context) { 67 | mDataVersion = BuildConfig.VERSION_CODE; 68 | PreferenceManager.getDefaultSharedPreferences(context).edit() 69 | .putInt(PREF_DATA_VERSION, mDataVersion).apply(); 70 | } 71 | 72 | public int getDataVersion() { 73 | return mDataVersion; 74 | } 75 | 76 | public void setDefaultSshUser(Context context, String userName) { 77 | mDefaultSshUser = userName; 78 | PreferenceManager.getDefaultSharedPreferences(context).edit() 79 | .putString(PREF_DEFAULT_SSH_USER, userName).apply(); 80 | } 81 | 82 | public String getDefaultSshUser() { 83 | return mDefaultSshUser; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/termlib/EmulatorDebug.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | import android.util.Log; 20 | 21 | public final class EmulatorDebug { 22 | /** The tag to use with {@link Log}. */ 23 | public static final String LOG_TAG = "vmconsole:terminal"; 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/termlib/JNI.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | /** 20 | * Native methods for creating and managing pseudoterminal subprocesses. 21 | */ 22 | final class JNI { 23 | 24 | static { 25 | System.loadLibrary("VMC"); 26 | } 27 | 28 | /** 29 | * Create a subprocess. Differs from {@link ProcessBuilder} in that a pseudoterminal is used to communicate with the 30 | * subprocess. 31 | *

32 | * Callers are responsible for calling {@link #close(int)} on the returned file descriptor. 33 | * 34 | * @param cmd The command to execute 35 | * @param cwd The current working directory for the executed command 36 | * @param args An array of arguments to the command 37 | * @param envVars An array of strings of the form "VAR=value" to be added to the environment of the process 38 | * @param processId A one-element array to which the process ID of the started process will be written. 39 | * @return the file descriptor resulting from opening /dev/ptmx master device. The sub process will have opened the 40 | * slave device counterpart (/dev/pts/$N) and have it as stdint, stdout and stderr. 41 | */ 42 | public static native int createSubprocess(String[] args, String[] envVars, int[] processId, int rows, int columns); 43 | 44 | /** Set the window size for a given pty, which allows connected programs to learn how large their screen is. */ 45 | public static native void setPtyWindowSize(int fd, int rows, int cols); 46 | 47 | /** 48 | * Causes the calling thread to wait for the process associated with the receiver to finish executing. 49 | * 50 | * @return if >= 0, the exit status of the process. If < 0, the signal causing the process to stop negated. 51 | */ 52 | public static native int waitFor(int processId); 53 | 54 | /** Close a file descriptor through the close(2) system call. */ 55 | public static native void close(int fileDescriptor); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/termlib/TerminalColors.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | /** Current terminal colors (if different from default). */ 20 | public final class TerminalColors { 21 | 22 | /** Static data - a bit ugly but ok for now. */ 23 | public static final TerminalColorScheme COLOR_SCHEME = new TerminalColorScheme(); 24 | 25 | /** 26 | * The current terminal colors, which are normally set from the color theme, but may be set dynamically with the OSC 27 | * 4 control sequence. 28 | */ 29 | public final int[] mCurrentColors = new int[TextStyle.NUM_INDEXED_COLORS]; 30 | 31 | /** Create a new instance with default colors from the theme. */ 32 | public TerminalColors() { 33 | reset(); 34 | } 35 | 36 | /** Reset a particular indexed color with the default color from the color theme. */ 37 | public void reset(int index) { 38 | mCurrentColors[index] = COLOR_SCHEME.mDefaultColors[index]; 39 | } 40 | 41 | /** Reset all indexed colors with the default color from the color theme. */ 42 | public void reset() { 43 | System.arraycopy(COLOR_SCHEME.mDefaultColors, 0, mCurrentColors, 0, TextStyle.NUM_INDEXED_COLORS); 44 | } 45 | 46 | /** 47 | * Parse color according to http://manpages.ubuntu.com/manpages/intrepid/man3/XQueryColor.3.html 48 | *

49 | * Highest bit is set if successful, so return value is 0xFF${R}${G}${B}. Return 0 if failed. 50 | */ 51 | static int parse(String c) { 52 | try { 53 | int skipInitial, skipBetween; 54 | if (c.charAt(0) == '#') { 55 | // #RGB, #RRGGBB, #RRRGGGBBB or #RRRRGGGGBBBB. Most significant bits. 56 | skipInitial = 1; 57 | skipBetween = 0; 58 | } else if (c.startsWith("rgb:")) { 59 | // rgb:// where , , := h | hh | hhh | hhhh. Scaled. 60 | skipInitial = 4; 61 | skipBetween = 1; 62 | } else { 63 | return 0; 64 | } 65 | int charsForColors = c.length() - skipInitial - 2 * skipBetween; 66 | if (charsForColors % 3 != 0) return 0; // Unequal lengths. 67 | int componentLength = charsForColors / 3; 68 | double mult = 255 / (Math.pow(2, componentLength * 4) - 1); 69 | 70 | int currentPosition = skipInitial; 71 | String rString = c.substring(currentPosition, currentPosition + componentLength); 72 | currentPosition += componentLength + skipBetween; 73 | String gString = c.substring(currentPosition, currentPosition + componentLength); 74 | currentPosition += componentLength + skipBetween; 75 | String bString = c.substring(currentPosition, currentPosition + componentLength); 76 | 77 | int r = (int) (Integer.parseInt(rString, 16) * mult); 78 | int g = (int) (Integer.parseInt(gString, 16) * mult); 79 | int b = (int) (Integer.parseInt(bString, 16) * mult); 80 | return 0xFF << 24 | r << 16 | g << 8 | b; 81 | } catch (NumberFormatException | IndexOutOfBoundsException e) { 82 | return 0; 83 | } 84 | } 85 | 86 | /** Try parse a color from a text parameter and into a specified index. */ 87 | public void tryParseColor(int intoIndex, String textParameter) { 88 | int c = parse(textParameter); 89 | if (c != 0) mCurrentColors[intoIndex] = c; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/termlib/TerminalOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | import java.nio.charset.StandardCharsets; 20 | 21 | /** A client which receives callbacks from events triggered by feeding input to a {@link TerminalEmulator}. */ 22 | public abstract class TerminalOutput { 23 | 24 | /** Write a string using the UTF-8 encoding to the terminal client. */ 25 | public final void write(String data) { 26 | byte[] bytes = data.getBytes(StandardCharsets.UTF_8); 27 | write(bytes, 0, bytes.length); 28 | } 29 | 30 | /** Write bytes to the terminal client. */ 31 | public abstract void write(byte[] data, int offset, int count); 32 | 33 | /** Notify the terminal client that the terminal title has changed. */ 34 | public abstract void titleChanged(String oldTitle, String newTitle); 35 | 36 | /** Notify the terminal client about clipboard changes. */ 37 | public abstract void clipboardText(String text); 38 | 39 | /** Notify the terminal client that a bell character (ASCII 7, bell, BEL, \a, ^G)) has been received. */ 40 | public abstract void onBell(); 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/termlib/TextStyle.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | /** 20 | *

21 | * Encodes effects, foreground and background colors into a 64 bit long, which are stored for each cell in a terminal 22 | * row in {@link TerminalRow#mStyle}. 23 | *

24 | *

25 | * The bit layout is: 26 | *

27 | * - 16 flags (11 currently used). 28 | * - 24 for foreground color (only 9 first bits if a color index). 29 | * - 24 for background color (only 9 first bits if a color index). 30 | */ 31 | public final class TextStyle { 32 | 33 | public final static int CHARACTER_ATTRIBUTE_BOLD = 1; 34 | public final static int CHARACTER_ATTRIBUTE_ITALIC = 1 << 1; 35 | public final static int CHARACTER_ATTRIBUTE_UNDERLINE = 1 << 2; 36 | public final static int CHARACTER_ATTRIBUTE_BLINK = 1 << 3; 37 | public final static int CHARACTER_ATTRIBUTE_INVERSE = 1 << 4; 38 | public final static int CHARACTER_ATTRIBUTE_INVISIBLE = 1 << 5; 39 | public final static int CHARACTER_ATTRIBUTE_STRIKETHROUGH = 1 << 6; 40 | /** 41 | * The selective erase control functions (DECSED and DECSEL) can only erase characters defined as erasable. 42 | *

43 | * This bit is set if DECSCA (Select Character Protection Attribute) has been used to define the characters that 44 | * come after it as erasable from the screen. 45 | *

46 | */ 47 | public final static int CHARACTER_ATTRIBUTE_PROTECTED = 1 << 7; 48 | /** Dim colors. Also known as faint or half intensity. */ 49 | public final static int CHARACTER_ATTRIBUTE_DIM = 1 << 8; 50 | /** If true (24-bit) color is used for the cell for foreground. */ 51 | private final static int CHARACTER_ATTRIBUTE_TRUECOLOR_FOREGROUND = 1 << 9; 52 | /** If true (24-bit) color is used for the cell for foreground. */ 53 | private final static int CHARACTER_ATTRIBUTE_TRUECOLOR_BACKGROUND= 1 << 10; 54 | 55 | public final static int COLOR_INDEX_FOREGROUND = 256; 56 | public final static int COLOR_INDEX_BACKGROUND = 257; 57 | public final static int COLOR_INDEX_CURSOR = 258; 58 | 59 | /** The 256 standard color entries and the three special (foreground, background and cursor) ones. */ 60 | public final static int NUM_INDEXED_COLORS = 259; 61 | 62 | /** Normal foreground and background colors and no effects. */ 63 | final static long NORMAL = encode(COLOR_INDEX_FOREGROUND, COLOR_INDEX_BACKGROUND, 0); 64 | 65 | static long encode(int foreColor, int backColor, int effect) { 66 | long result = effect & 0b111111111; 67 | if ((0xff000000 & foreColor) == 0xff000000) { 68 | // 24-bit color. 69 | result |= CHARACTER_ATTRIBUTE_TRUECOLOR_FOREGROUND | ((foreColor & 0x00ffffffL) << 40L); 70 | } else { 71 | // Indexed color. 72 | result |= (foreColor & 0b111111111L) << 40; 73 | } 74 | if ((0xff000000 & backColor) == 0xff000000) { 75 | // 24-bit color. 76 | result |= CHARACTER_ATTRIBUTE_TRUECOLOR_BACKGROUND | ((backColor & 0x00ffffffL) << 16L); 77 | } else { 78 | // Indexed color. 79 | result |= (backColor & 0b111111111L) << 16L; 80 | } 81 | 82 | return result; 83 | } 84 | 85 | public static int decodeForeColor(long style) { 86 | if ((style & CHARACTER_ATTRIBUTE_TRUECOLOR_FOREGROUND) == 0) { 87 | return (int) ((style >>> 40) & 0b111111111L); 88 | } else { 89 | return 0xff000000 | (int) ((style >>> 40) & 0x00ffffffL); 90 | } 91 | 92 | } 93 | 94 | public static int decodeBackColor(long style) { 95 | if ((style & CHARACTER_ATTRIBUTE_TRUECOLOR_BACKGROUND) == 0) { 96 | return (int) ((style >>> 16) & 0b111111111L); 97 | } else { 98 | return 0xff000000 | (int) ((style >>> 16) & 0x00ffffffL); 99 | } 100 | } 101 | 102 | public static int decodeEffect(long style) { 103 | return (int) (style & 0b11111111111); 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/termview/CursorController.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termview; 18 | 19 | import android.view.MotionEvent; 20 | import android.view.ViewTreeObserver; 21 | 22 | /** 23 | * A CursorController instance can be used to control cursors in the text. 24 | * It is not used outside of {@link TerminalView}. 25 | */ 26 | public interface CursorController extends ViewTreeObserver.OnTouchModeChangeListener { 27 | /** 28 | * Show the cursors on screen. Will be drawn by {@link #render()} by a call during onDraw. 29 | * See also {@link #hide()}. 30 | */ 31 | void show(MotionEvent event); 32 | 33 | /** 34 | * Hide the cursors from screen. 35 | * See also {@link #show(MotionEvent event)}. 36 | */ 37 | boolean hide(); 38 | 39 | /** 40 | * Render the cursors. 41 | */ 42 | void render(); 43 | 44 | /** 45 | * Update the cursor positions. 46 | */ 47 | void updatePosition(TextSelectionHandleView handle, int x, int y); 48 | 49 | /** 50 | * This method is called by {@link #onTouchEvent(MotionEvent)} and gives the cursors 51 | * a chance to become active and/or visible. 52 | * 53 | * @param event The touch event 54 | */ 55 | boolean onTouchEvent(MotionEvent event); 56 | 57 | /** 58 | * Called when the view is detached from window. Perform house keeping task, such as 59 | * stopping Runnable thread that would otherwise keep a reference on the context, thus 60 | * preventing the activity to be recycled. 61 | */ 62 | void onDetached(); 63 | 64 | /** 65 | * @return true if the cursors are currently active. 66 | */ 67 | boolean isActive(); 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/sylirre/vmconsole/termview/TerminalViewClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termview; 18 | 19 | import android.view.KeyEvent; 20 | import android.view.MotionEvent; 21 | import android.view.ScaleGestureDetector; 22 | 23 | import sylirre.vmconsole.termlib.TerminalSession; 24 | 25 | /** 26 | * Input and scale listener which may be set on a {@link TerminalView} through 27 | * {@link TerminalView#setOnKeyListener(TerminalViewClient)}. 28 | *

29 | */ 30 | public interface TerminalViewClient { 31 | /** 32 | * Callback function on scale events according to {@link ScaleGestureDetector#getScaleFactor()}. 33 | */ 34 | float onScale(float scale); 35 | 36 | /** 37 | * On a single tap on the terminal if terminal mouse reporting not enabled. 38 | */ 39 | void onSingleTapUp(MotionEvent e); 40 | 41 | boolean onKeyDown(int keyCode, KeyEvent e, TerminalSession session); 42 | 43 | boolean onKeyUp(int keyCode, KeyEvent e); 44 | 45 | boolean readControlKey(); 46 | 47 | boolean readAltKey(); 48 | 49 | boolean readShiftKey(); 50 | 51 | boolean readFnKey(); 52 | 53 | boolean onCodePoint(int codePoint, boolean ctrlDown, TerminalSession session); 54 | 55 | boolean onLongPress(MotionEvent event); 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/jniLibs: -------------------------------------------------------------------------------- 1 | ../../../external/libvmc/jniLibs -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/drawable-xhdpi/banner.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/text_select_handle_left_mtrl_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/drawable-xxhdpi/text_select_handle_left_mtrl_alpha.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/text_select_handle_right_mtrl_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/drawable-xxhdpi/text_select_handle_right_mtrl_alpha.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 14 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_service_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/drawable/ic_service_notification.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/terminal_scroll_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/text_select_handle_left_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/text_select_handle_right_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/installer_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 20 | 21 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | vmConsole 4 | 5 | 6 | Cancel 7 | Exit 8 | OK 9 | 10 | 11 | Initializing… 12 | Initialization failed 13 | Application was unable to set up runtime resources. 14 | Try again 15 | 16 | 17 | Copy 18 | Paste 19 | More… 20 | 21 | 22 | Open SSH (%s) 23 | Open Web (%s) 24 | Autofill password 25 | Select URLs 26 | Reset 27 | Shut down 28 | Ignore bell character 29 | 30 | 31 | Connect as user: 32 | Cannot use the given SSH user name. 33 | Unable to launch SSH client Android application. 34 | Cannot use this function because port forwarding failed. 35 | 36 | 37 | Unable to launch web browser Android application. 38 | Cannot use this function because port forwarding failed. 39 | 40 | 41 | No URLs detected. 42 | URL has been copied to clipboard. 43 | Cannot open this URL! 44 | Click URL to copy or long press to open: 45 | 46 | 47 | Shut down VM 48 | All unsaved data will be lost, do you want to continue? 49 | Yes 50 | 51 | 52 | Acquire wakelock 53 | Release wakelock 54 | Shut down 55 | 56 | 57 | No storage permission granted: you will not be able to mount external storage! 58 | Terminal state has been reset. 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 25 | 26 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/ByteQueueTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | import junit.framework.TestCase; 20 | 21 | public class ByteQueueTest extends TestCase { 22 | 23 | private static void assertArrayEquals(byte[] expected, byte[] actual) { 24 | if (expected.length != actual.length) { 25 | fail("Difference array length"); 26 | } 27 | for (int i = 0; i < expected.length; i++) { 28 | if (expected[i] != actual[i]) { 29 | fail("Inequals at index=" + i + ", expected=" + (int) expected[i] + ", actual=" + (int) actual[i]); 30 | } 31 | } 32 | } 33 | 34 | public void testCompleteWrites() throws Exception { 35 | ByteQueue q = new ByteQueue(10); 36 | assertTrue(q.write(new byte[]{1, 2, 3}, 0, 3)); 37 | 38 | byte[] arr = new byte[10]; 39 | assertEquals(3, q.read(arr, true)); 40 | assertArrayEquals(new byte[]{1, 2, 3}, new byte[]{arr[0], arr[1], arr[2]}); 41 | 42 | assertTrue(q.write(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 0, 10)); 43 | assertEquals(10, q.read(arr, true)); 44 | assertArrayEquals(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, arr); 45 | } 46 | 47 | public void testQueueWraparound() throws Exception { 48 | ByteQueue q = new ByteQueue(10); 49 | 50 | byte[] origArray = new byte[]{1, 2, 3, 4, 5, 6}; 51 | byte[] readArray = new byte[origArray.length]; 52 | for (int i = 0; i < 20; i++) { 53 | q.write(origArray, 0, origArray.length); 54 | assertEquals(origArray.length, q.read(readArray, true)); 55 | assertArrayEquals(origArray, readArray); 56 | } 57 | } 58 | 59 | public void testWriteNotesClosing() throws Exception { 60 | ByteQueue q = new ByteQueue(10); 61 | q.close(); 62 | assertFalse(q.write(new byte[]{1, 2, 3}, 0, 3)); 63 | } 64 | 65 | public void testReadNonBlocking() throws Exception { 66 | ByteQueue q = new ByteQueue(10); 67 | assertEquals(0, q.read(new byte[128], false)); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/ControlSequenceIntroducerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | /** "\033[" is the Control Sequence Introducer char sequence (CSI). */ 20 | public class ControlSequenceIntroducerTest extends TerminalTestCase { 21 | 22 | /** CSI Ps P Scroll down Ps lines (default = 1) (SD). */ 23 | public void testCsiT() { 24 | withTerminalSized(4, 6).enterString("1\r\n2\r\n3\r\nhi\033[2Tyo\r\nA\r\nB").assertLinesAre(" ", " ", "1 ", "2 yo", "A ", 25 | "Bi "); 26 | // Default value (1): 27 | withTerminalSized(4, 6).enterString("1\r\n2\r\n3\r\nhi\033[Tyo\r\nA\r\nB").assertLinesAre(" ", "1 ", "2 ", "3 yo", "Ai ", 28 | "B "); 29 | } 30 | 31 | /** CSI Ps S Scroll up Ps lines (default = 1) (SU). */ 32 | public void testCsiS() { 33 | // The behaviour here is a bit inconsistent between terminals - this is how the OS X Terminal.app does it: 34 | withTerminalSized(3, 4).enterString("1\r\n2\r\n3\r\nhi\033[2Sy").assertLinesAre("3 ", "hi ", " ", " y"); 35 | // Default value (1): 36 | withTerminalSized(3, 4).enterString("1\r\n2\r\n3\r\nhi\033[Sy").assertLinesAre("2 ", "3 ", "hi ", " y"); 37 | } 38 | 39 | /** CSI Ps X Erase Ps Character(s) (default = 1) (ECH). */ 40 | public void testCsiX() { 41 | // See https://code.google.com/p/chromium/issues/detail?id=212712 where test was extraced from. 42 | withTerminalSized(13, 2).enterString("abcdefghijkl\b\b\b\b\b\033[X").assertLinesAre("abcdefg ijkl ", " "); 43 | withTerminalSized(13, 2).enterString("abcdefghijkl\b\b\b\b\b\033[1X").assertLinesAre("abcdefg ijkl ", " "); 44 | withTerminalSized(13, 2).enterString("abcdefghijkl\b\b\b\b\b\033[2X").assertLinesAre("abcdefg jkl ", " "); 45 | withTerminalSized(13, 2).enterString("abcdefghijkl\b\b\b\b\b\033[20X").assertLinesAre("abcdefg ", " "); 46 | } 47 | 48 | /** CSI Pm m Set SGR parameter(s) from semicolon-separated list Pm. */ 49 | public void testCsiSGRParameters() { 50 | // Set more parameters (19) than supported (16). Additional parameters should be silently consumed. 51 | withTerminalSized(3, 2).enterString("\033[0;38;2;255;255;255;48;2;0;0;0;1;2;3;4;5;7;8;9mabc").assertLinesAre("abc", " "); 52 | } 53 | 54 | /** CSI Ps b Repeat the preceding graphic character Ps times (REP). */ 55 | public void testRepeat() { 56 | withTerminalSized(3, 2).enterString("a\033[b").assertLinesAre("aa ", " "); 57 | withTerminalSized(3, 2).enterString("a\033[2b").assertLinesAre("aaa", " "); 58 | // When no char has been output we ignore REP: 59 | withTerminalSized(3, 2).enterString("\033[b").assertLinesAre(" ", " "); 60 | // This shows that REP outputs the last emitted code point and not the one relative to the 61 | // current cursor position: 62 | withTerminalSized(5, 2).enterString("abcde\033[2G\033[2b\n").assertLinesAre("aeede", " "); 63 | } 64 | 65 | /** CSI 3 J Clear scrollback (xterm, libvte; non-standard). */ 66 | public void testCsi3J() { 67 | withTerminalSized(3, 2).enterString("a\r\nb\r\nc\r\nd"); 68 | assertEquals("a\nb\nc\nd", mTerminal.getScreen().getTranscriptText()); 69 | enterString("\033[3J"); 70 | assertEquals("c\nd", mTerminal.getScreen().getTranscriptText()); 71 | 72 | withTerminalSized(3, 2).enterString("Lorem_ipsum"); 73 | assertEquals("Lorem_ipsum", mTerminal.getScreen().getTranscriptText()); 74 | enterString("\033[3J"); 75 | assertEquals("ipsum", mTerminal.getScreen().getTranscriptText()); 76 | 77 | withTerminalSized(3, 2).enterString("w\r\nx\r\ny\r\nz\033[?1049h\033[3J\033[?1049l"); 78 | assertEquals("y\nz", mTerminal.getScreen().getTranscriptText()); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/DecSetTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | /** 20 | *

21 |  * "CSI ? Pm h", DEC Private Mode Set (DECSET)
22 |  * 
23 | *

24 | * and 25 | *

26 | *

27 |  * "CSI ? Pm l", DEC Private Mode Reset (DECRST)
28 |  * 
29 | *

30 | * controls various aspects of the terminal 31 | */ 32 | public class DecSetTest extends TerminalTestCase { 33 | 34 | /** DECSET 25, DECTCEM, controls visibility of the cursor. */ 35 | public void testEnableDisableCursor() { 36 | withTerminalSized(3, 3); 37 | assertTrue("Initially the cursor should be enabled", mTerminal.isShowingCursor()); 38 | enterString("\033[?25l"); // Disable Cursor (DECTCEM). 39 | assertFalse(mTerminal.isShowingCursor()); 40 | enterString("\033[?25h"); // Enable Cursor (DECTCEM). 41 | assertTrue(mTerminal.isShowingCursor()); 42 | 43 | enterString("\033[?25l"); // Disable Cursor (DECTCEM), again. 44 | assertFalse(mTerminal.isShowingCursor()); 45 | mTerminal.reset(false); 46 | assertTrue("Resetting the terminal should enable the cursor", mTerminal.isShowingCursor()); 47 | 48 | enterString("\033[?25l"); 49 | assertFalse(mTerminal.isShowingCursor()); 50 | enterString("\033c"); // RIS resetting should enabled cursor. 51 | assertTrue(mTerminal.isShowingCursor()); 52 | } 53 | 54 | /** DECSET 2004, controls bracketed paste mode. */ 55 | public void testBracketedPasteMode() { 56 | withTerminalSized(3, 3); 57 | 58 | mTerminal.paste("a"); 59 | assertEquals("Pasting 'a' should output 'a' when bracketed paste mode is disabled", "a", mOutput.getOutputAndClear()); 60 | 61 | enterString("\033[?2004h"); // Enable bracketed paste mode. 62 | mTerminal.paste("a"); 63 | assertEquals("Pasting when in bracketed paste mode should be bracketed", "\033[200~a\033[201~", mOutput.getOutputAndClear()); 64 | 65 | enterString("\033[?2004l"); // Disable bracketed paste mode. 66 | mTerminal.paste("a"); 67 | assertEquals("Pasting 'a' should output 'a' when bracketed paste mode is disabled", "a", mOutput.getOutputAndClear()); 68 | 69 | enterString("\033[?2004h"); // Enable bracketed paste mode, again. 70 | mTerminal.paste("a"); 71 | assertEquals("Pasting when in bracketed paste mode again should be bracketed", "\033[200~a\033[201~", mOutput.getOutputAndClear()); 72 | 73 | mTerminal.paste("\033ab\033cd\033"); 74 | assertEquals("Pasting an escape character should not input it", "\033[200~abcd\033[201~", mOutput.getOutputAndClear()); 75 | mTerminal.paste("\u0081ab\u0081cd\u009F"); 76 | assertEquals("Pasting C1 control codes should not input it", "\033[200~abcd\033[201~", mOutput.getOutputAndClear()); 77 | 78 | mTerminal.reset(false); 79 | mTerminal.paste("a"); 80 | assertEquals("Terminal reset(false) should disable bracketed paste mode", "a", mOutput.getOutputAndClear()); 81 | } 82 | 83 | /** DECSET 7, DECAWM, controls wraparound mode. */ 84 | public void testWrapAroundMode() { 85 | // Default with wraparound: 86 | withTerminalSized(3, 3).enterString("abcd").assertLinesAre("abc", "d ", " "); 87 | // With wraparound disabled: 88 | withTerminalSized(3, 3).enterString("\033[?7labcd").assertLinesAre("abd", " ", " "); 89 | enterString("efg").assertLinesAre("abg", " ", " "); 90 | // Re-enabling wraparound: 91 | enterString("\033[?7hhij").assertLinesAre("abh", "ij ", " "); 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/DeviceControlStringTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | /** 20 | * "\033P" is a device control string. 21 | */ 22 | public class DeviceControlStringTest extends TerminalTestCase { 23 | 24 | private static String hexEncode(String s) { 25 | StringBuilder result = new StringBuilder(); 26 | for (int i = 0; i < s.length(); i++) 27 | result.append(String.format("%02X", (int) s.charAt(i))); 28 | return result.toString(); 29 | } 30 | 31 | private void assertCapabilityResponse(String cap, String expectedResponse) { 32 | String input = "\033P+q" + hexEncode(cap) + "\033\\"; 33 | assertEnteringStringGivesResponse(input, "\033P1+r" + hexEncode(cap) + "=" + hexEncode(expectedResponse) + "\033\\"); 34 | } 35 | 36 | public void testReportColorsAndName() { 37 | // Request Termcap/Terminfo String. The string following the "q" is a list of names encoded in 38 | // hexadecimal (2 digits per character) separated by ; which correspond to termcap or terminfo key 39 | // names. 40 | // Two special features are also recognized, which are not key names: Co for termcap colors (or colors 41 | // for terminfo colors), and TN for termcap name (or name for terminfo name). 42 | // xterm responds with DCS 1 + r P t ST for valid requests, adding to P t an = , and the value of the 43 | // corresponding string that xterm would send, or DCS 0 + r P t ST for invalid requests. The strings are 44 | // encoded in hexadecimal (2 digits per character). 45 | withTerminalSized(3, 3).enterString("A"); 46 | assertCapabilityResponse("Co", "256"); 47 | assertCapabilityResponse("colors", "256"); 48 | assertCapabilityResponse("TN", "xterm"); 49 | assertCapabilityResponse("name", "xterm"); 50 | enterString("B").assertLinesAre("AB ", " ", " "); 51 | } 52 | 53 | public void testReportKeys() { 54 | withTerminalSized(3, 3); 55 | assertCapabilityResponse("kB", "\033[Z"); 56 | } 57 | 58 | public void testReallyLongDeviceControlString() { 59 | withTerminalSized(3, 3).enterString("\033P"); 60 | for (int i = 0; i < 10000; i++) { 61 | enterString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); 62 | } 63 | // The terminal should ignore the overlong DCS sequence and continue printing "aaa." and fill at least the first two lines with 64 | // them: 65 | assertLineIs(0, "aaa"); 66 | assertLineIs(1, "aaa"); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/HistoryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | public class HistoryTest extends TerminalTestCase { 20 | 21 | public void testHistory() { 22 | final int rows = 3; 23 | final int cols = 3; 24 | withTerminalSized(cols, rows).enterString("111222333444555666777888999"); 25 | assertCursorAt(2, 2); 26 | assertLinesAre("777", "888", "999"); 27 | assertHistoryStartsWith("666", "555"); 28 | 29 | mTerminal.resize(cols, 2); 30 | assertHistoryStartsWith("777", "666", "555"); 31 | 32 | mTerminal.resize(cols, 3); 33 | assertHistoryStartsWith("666", "555"); 34 | } 35 | 36 | public void testHistoryWithScrollRegion() { 37 | // "CSI P_s ; P_s r" - set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM). 38 | withTerminalSized(3, 4).enterString("111222333444"); 39 | assertLinesAre("111", "222", "333", "444"); 40 | enterString("\033[2;3r"); 41 | // NOTE: "DECSTBM moves the cursor to column 1, line 1 of the page." 42 | assertCursorAt(0, 0); 43 | enterString("\nCDEFGH").assertLinesAre("111", "CDE", "FGH", "444"); 44 | enterString("IJK").assertLinesAre("111", "FGH", "IJK", "444").assertHistoryStartsWith("CDE"); 45 | enterString("LMN").assertLinesAre("111", "IJK", "LMN", "444").assertHistoryStartsWith("FGH", "CDE"); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/ScreenBufferTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | public class ScreenBufferTest extends TerminalTestCase { 20 | 21 | public void testBasics() { 22 | TerminalBuffer screen = new TerminalBuffer(5, 3, 3); 23 | assertEquals("", screen.getTranscriptText()); 24 | screen.setChar(0, 0, 'a', 0); 25 | assertEquals("a", screen.getTranscriptText()); 26 | screen.setChar(0, 0, 'b', 0); 27 | assertEquals("b", screen.getTranscriptText()); 28 | screen.setChar(2, 0, 'c', 0); 29 | assertEquals("b c", screen.getTranscriptText()); 30 | screen.setChar(2, 2, 'f', 0); 31 | assertEquals("b c\n\n f", screen.getTranscriptText()); 32 | screen.blockSet(0, 0, 2, 2, 'X', 0); 33 | } 34 | 35 | public void testBlockSet() { 36 | TerminalBuffer screen = new TerminalBuffer(5, 3, 3); 37 | screen.blockSet(0, 0, 2, 2, 'X', 0); 38 | assertEquals("XX\nXX", screen.getTranscriptText()); 39 | screen.blockSet(1, 1, 2, 2, 'Y', 0); 40 | assertEquals("XX\nXYY\n YY", screen.getTranscriptText()); 41 | } 42 | 43 | public void testGetSelectedText() { 44 | withTerminalSized(5, 3).enterString("ABCDEFGHIJ").assertLinesAre("ABCDE", "FGHIJ", " "); 45 | assertEquals("AB", mTerminal.getSelectedText(0, 0, 1, 0)); 46 | assertEquals("BC", mTerminal.getSelectedText(1, 0, 2, 0)); 47 | assertEquals("CDE", mTerminal.getSelectedText(2, 0, 4, 0)); 48 | assertEquals("FG", mTerminal.getSelectedText(0, 1, 1, 1)); 49 | assertEquals("GH", mTerminal.getSelectedText(1, 1, 2, 1)); 50 | assertEquals("HIJ", mTerminal.getSelectedText(2, 1, 4, 1)); 51 | 52 | assertEquals("ABCDEFG", mTerminal.getSelectedText(0, 0, 1, 1)); 53 | withTerminalSized(5, 3).enterString("ABCDE\r\nFGHIJ").assertLinesAre("ABCDE", "FGHIJ", " "); 54 | assertEquals("ABCDE\nFG", mTerminal.getSelectedText(0, 0, 1, 1)); 55 | } 56 | 57 | public void testGetSelectedTextJoinFullLines() { 58 | withTerminalSized(5, 3).enterString("ABCDE\r\nFG"); 59 | assertEquals("ABCDEFG", mTerminal.getScreen().getSelectedText(0, 0, 1, 1, true, true)); 60 | 61 | withTerminalSized(5, 3).enterString("ABC\r\nFG"); 62 | assertEquals("ABC\nFG", mTerminal.getScreen().getSelectedText(0, 0, 1, 1, true, true)); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/TextStyleTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | import junit.framework.TestCase; 20 | 21 | public class TextStyleTest extends TestCase { 22 | 23 | private static final int[] ALL_EFFECTS = new int[]{0, TextStyle.CHARACTER_ATTRIBUTE_BOLD, TextStyle.CHARACTER_ATTRIBUTE_ITALIC, 24 | TextStyle.CHARACTER_ATTRIBUTE_UNDERLINE, TextStyle.CHARACTER_ATTRIBUTE_BLINK, TextStyle.CHARACTER_ATTRIBUTE_INVERSE, 25 | TextStyle.CHARACTER_ATTRIBUTE_INVISIBLE, TextStyle.CHARACTER_ATTRIBUTE_STRIKETHROUGH, TextStyle.CHARACTER_ATTRIBUTE_PROTECTED, 26 | TextStyle.CHARACTER_ATTRIBUTE_DIM}; 27 | 28 | public void testEncodingSingle() { 29 | for (int fx : ALL_EFFECTS) { 30 | for (int fg = 0; fg < TextStyle.NUM_INDEXED_COLORS; fg++) { 31 | for (int bg = 0; bg < TextStyle.NUM_INDEXED_COLORS; bg++) { 32 | long encoded = TextStyle.encode(fg, bg, fx); 33 | assertEquals(fg, TextStyle.decodeForeColor(encoded)); 34 | assertEquals(bg, TextStyle.decodeBackColor(encoded)); 35 | assertEquals(fx, TextStyle.decodeEffect(encoded)); 36 | } 37 | } 38 | } 39 | } 40 | 41 | public void testEncoding24Bit() { 42 | int[] values = {255, 240, 127, 1, 0}; 43 | for (int red : values) { 44 | for (int green : values) { 45 | for (int blue : values) { 46 | int argb = 0xFF000000 | (red << 16) | (green << 8) | blue; 47 | long encoded = TextStyle.encode(argb, 0, 0); 48 | assertEquals(argb, TextStyle.decodeForeColor(encoded)); 49 | encoded = TextStyle.encode(0, argb, 0); 50 | assertEquals(argb, TextStyle.decodeBackColor(encoded)); 51 | } 52 | } 53 | } 54 | } 55 | 56 | 57 | public void testEncodingCombinations() { 58 | for (int f1 : ALL_EFFECTS) { 59 | for (int f2 : ALL_EFFECTS) { 60 | int combined = f1 | f2; 61 | assertEquals(combined, TextStyle.decodeEffect(TextStyle.encode(0, 0, combined))); 62 | } 63 | } 64 | } 65 | 66 | public void testEncodingStrikeThrough() { 67 | long encoded = TextStyle.encode(TextStyle.COLOR_INDEX_FOREGROUND, TextStyle.COLOR_INDEX_BACKGROUND, 68 | TextStyle.CHARACTER_ATTRIBUTE_STRIKETHROUGH); 69 | assertTrue((TextStyle.decodeEffect(encoded) & TextStyle.CHARACTER_ATTRIBUTE_STRIKETHROUGH) != 0); 70 | } 71 | 72 | public void testEncodingProtected() { 73 | long encoded = TextStyle.encode(TextStyle.COLOR_INDEX_FOREGROUND, TextStyle.COLOR_INDEX_BACKGROUND, 74 | TextStyle.CHARACTER_ATTRIBUTE_STRIKETHROUGH); 75 | assertEquals(0, (TextStyle.decodeEffect(encoded) & TextStyle.CHARACTER_ATTRIBUTE_PROTECTED)); 76 | encoded = TextStyle.encode(TextStyle.COLOR_INDEX_FOREGROUND, TextStyle.COLOR_INDEX_BACKGROUND, 77 | TextStyle.CHARACTER_ATTRIBUTE_STRIKETHROUGH | TextStyle.CHARACTER_ATTRIBUTE_PROTECTED); 78 | assertTrue((TextStyle.decodeEffect(encoded) & TextStyle.CHARACTER_ATTRIBUTE_PROTECTED) != 0); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/src/test/java/sylirre/vmconsole/termlib/WcWidthTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************* 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | ************************************************************************* 16 | */ 17 | package sylirre.vmconsole.termlib; 18 | 19 | import junit.framework.TestCase; 20 | 21 | public class WcWidthTest extends TestCase { 22 | 23 | private static void assertWidthIs(int expectedWidth, int codePoint) { 24 | int wcWidth = WcWidth.width(codePoint); 25 | assertEquals(expectedWidth, wcWidth); 26 | } 27 | 28 | public void testPrintableAscii() { 29 | for (int i = 0x20; i <= 0x7E; i++) { 30 | assertWidthIs(1, i); 31 | } 32 | } 33 | 34 | public void testSomeWidthOne() { 35 | assertWidthIs(1, 'å'); 36 | assertWidthIs(1, 'ä'); 37 | assertWidthIs(1, 'ö'); 38 | assertWidthIs(1, 0x23F2); 39 | } 40 | 41 | public void testSomeWide() { 42 | assertWidthIs(2, 'A'); 43 | assertWidthIs(2, 'B'); 44 | assertWidthIs(2, 'C'); 45 | assertWidthIs(2, '中'); 46 | assertWidthIs(2, '文'); 47 | 48 | assertWidthIs(2, 0x679C); 49 | assertWidthIs(2, 0x679D); 50 | 51 | assertWidthIs(2, 0x2070E); 52 | assertWidthIs(2, 0x20731); 53 | 54 | assertWidthIs(1, 0x1F781); 55 | } 56 | 57 | public void testSomeNonWide() { 58 | assertWidthIs(1, 0x1D11E); 59 | assertWidthIs(1, 0x1D11F); 60 | } 61 | 62 | public void testCombining() { 63 | assertWidthIs(0, 0x0302); 64 | assertWidthIs(0, 0x0308); 65 | assertWidthIs(0, 0xFE0F); 66 | } 67 | 68 | public void testWordJoiner() { 69 | // https://en.wikipedia.org/wiki/Word_joiner 70 | // The word joiner (WJ) is a code point in Unicode used to separate words when using scripts 71 | // that do not use explicit spacing. It is encoded since Unicode version 3.2 72 | // (released in 2002) as U+2060 WORD JOINER (HTML ⁠). 73 | // The word joiner does not produce any space, and prohibits a line break at its position. 74 | assertWidthIs(0, 0x2060); 75 | } 76 | 77 | public void testSofthyphen() { 78 | // http://osdir.com/ml/internationalization.linux/2003-05/msg00006.html: 79 | // "Existing implementation practice in terminals is that the SOFT HYPHEN is 80 | // a spacing graphical character, and the purpose of my wcwidth() was to 81 | // predict the advancement of the cursor position after a string is sent to 82 | // a terminal. Hence, I have no choice but to keep wcwidth(SOFT HYPHEN) = 1. 83 | // VT100-style terminals do not hyphenate." 84 | assertWidthIs(1, 0x00AD); 85 | } 86 | 87 | public void testHangul() { 88 | assertWidthIs(1, 0x11A3); 89 | } 90 | 91 | public void testEmojis() { 92 | assertWidthIs(2, 0x1F428); // KOALA. 93 | assertWidthIs(2, 0x231a); // WATCH. 94 | assertWidthIs(2, 0x1F643); // UPSIDE-DOWN FACE (Unicode 8). 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /app/vmconsole.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/app/vmconsole.jks -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | google() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:7.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | mavenCentral() 16 | } 17 | } 18 | 19 | task clean(type: Delete) { 20 | delete rootProject.buildDir 21 | } 22 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle 2 | /.jekyll-metadata 3 | /.sass-cache 4 | /_site 5 | /vendor 6 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 |

2 |

Page not found

3 |
4 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | # Hello! This is where you manage which Jekyll version is used to run. 4 | # When you want to use a different version, change it below, save the 5 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so: 6 | # 7 | # bundle exec jekyll serve 8 | # 9 | 10 | # This is the default theme for new Jekyll sites. You may change this to anything you like. 11 | gem "minima", git: "https://github.com/jekyll/minima", ref: "296bf6b872b8450529bee1e48d0ca9be200a4be5" 12 | 13 | # If you want to use GitHub Pages, remove the "gem "jekyll"" above and 14 | # uncomment the line below. To upgrade, run `bundle update github-pages`. 15 | gem "github-pages", group: :jekyll_plugins 16 | 17 | # If you have any plugins, put them here! 18 | group :jekyll_plugins do 19 | gem "jekyll-feed", "~> 0.6" 20 | gem "jekyll-commonmark-ghpages", "~> 0.2" 21 | end 22 | 23 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 24 | # and associated library. 25 | install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do 26 | gem "tzinfo", "~> 1.2" 27 | gem "tzinfo-data" 28 | end 29 | 30 | # Performance-booster for watching directories on Windows 31 | gem "wdm", "~> 0.1.0", :install_if => Gem.win_platform? 32 | 33 | # kramdown v2 ships without the gfm parser by default. If you're using 34 | # kramdown v1, comment out this line. 35 | gem "kramdown-parser-gfm" 36 | 37 | gem "webrick", "~> 1.7" 38 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # vmConsole home page 2 | 3 | ## Run locally 4 | 5 | Install dependencies as explained at [Using Jekyll with Pages](https://help.github.com/articles/using-jekyll-with-pages/), 6 | then run 7 | 8 | ``` 9 | bundle exec jekyll serve 10 | ``` 11 | 12 | to start a local server at http://localhost:4000. 13 | 14 | ## Add New Category For Posts 15 | 16 | 1. Add a new page file for the category at `pages/posts/.html` 17 | with the following contents. Replace `` with the actual name 18 | for the category in the file name and [front matter](https://jekyllrb.com/docs/front-matter). 19 | The `category_name` variable is used by [`category.html`](_includes/category.html) 20 | to load posts for the category. Check [`general.html`](pages/posts/general.html) 21 | for the `general` category as a sample. 22 | 23 | ``` 24 | --- 25 | layout: default 26 | title: Posts 27 | permalink: /posts/ 28 | category_name: 29 | --- 30 | 31 | {% include category.html %} 32 | ``` 33 | 34 | 2. Add `[](/posts/)` link to category in 35 | [`posts.md`](pages/posts.md) like [General](/posts/general). The link url 36 | must match the `permalink` defined in category page above. 37 | 38 | ## Add New Post In Category 39 | 40 | Check [jekyll docs](https://jekyllrb.com/docs/posts) and [github docs](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/adding-content-to-your-github-pages-site-using-jekyll#adding-a-new-post-to-your-site) 41 | for details. 42 | 43 | 1. Add the file for the post under the directory for the category at 44 | `_posts//YYYY-MM-DD-POST_TITLE.md`. For example, by 45 | creating the file `_posts/general/1970-01-01-post-title.md`, jekyll 46 | will automatically create a route for the post at `general/1970/01/01/post-title.html`. 47 | Also make sure to set the `category` in the front matter and also 48 | ensure its the same as category directory name under the `_path` 49 | directory, otherwise jekyll will not add the category to 50 | `site.categories` used by [`category.html`](_includes/category.html) 51 | and the posts won't show for the category. 52 | 53 | ``` 54 | --- 55 | layout: post 56 | title: "Post Title" 57 | category: 58 | --- 59 | 60 | Post Content 61 | ``` 62 | 63 | 2. Add any asset files used by the post under the 64 | `assets/posts//YYYY-MM-DD-POST_TITLE` directory, like 65 | `assets/general/1970-01-01-post-title` and link to them with 66 | `[Text Asset](/assets/general/1970-01-01-post-title/asset.txt)` or 67 | `![Image Asset](/assets/general/1970-01-01-post-title/asset.png)`. 68 | Check [jekyll docs](https://jekyllrb.com/docs/posts/#including-images-and-resources) 69 | for more. 70 | 71 | 3. Ensure that the first paragraph of the post is a just a short description 72 | of the post since that text will show in the posts list for the category. 73 | This is done by setting `show_excerpts` to `true` in [`_config.yml`](_config.yml) 74 | and used by [`category.html`](_includes/category.html). Check 75 | [jekyll docs](https://jekyllrb.com/docs/posts/#post-excerpts) for more info. 76 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | # Welcome to Jekyll! 2 | # 3 | # This config file is meant for settings that affect your whole blog, values 4 | # which you are expected to set up once and rarely edit after that. If you find 5 | # yourself editing this file very often, consider using Jekyll's data files 6 | # feature for the data you need to update frequently. 7 | # 8 | # For technical reasons, this file is *NOT* reloaded automatically when you use 9 | # 'bundle exec jekyll serve'. If you change this file, please restart the server process. 10 | 11 | # Site settings 12 | # These are used to personalize your new site. If you look in the HTML files, 13 | # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. 14 | # You can create any custom variable you would like, and they will be accessible 15 | # in the templates via {{ site.myvariable }}. 16 | title: vmConsole 17 | description: >- # this means to ignore newlines until "baseurl:" 18 | Linux virtual machine for Android OS. 19 | baseurl: "/vmConsole" # the subpath of your site, e.g. /blog 20 | url: "https://sylirre.github.io" # the base hostname & protocol for your site, e.g. http://example.com 21 | site_source: "https://github.com/sylirre/vmConsole/tree/main/docs" 22 | github_username: sylirre 23 | 24 | github: [metadata] 25 | 26 | # Build settings 27 | theme: minima 28 | 29 | minima: 30 | skin: dark 31 | 32 | plugins: 33 | - jekyll-feed 34 | - jekyll-sitemap 35 | 36 | markdown: CommonMarkGhPages 37 | commonmark: 38 | options: ["GITHUB_PRE_LANG", "FOOTNOTES"] 39 | extensions: ["strikethrough", "autolink", "table", "tagfilter"] 40 | 41 | defaults: 42 | - 43 | scope: 44 | path: "docs" 45 | values: 46 | layout: "default" 47 | 48 | feed: 49 | categories: 50 | - general 51 | 52 | collections: 53 | posts: 54 | output: true 55 | permalink: /posts/:categories/:year/:month/:day/:title:output_ext 56 | 57 | show_excerpts: true # set to true to show excerpts on posts 58 | 59 | # Exclude from processing. 60 | # The following items will not be processed, by default. Create a custom list 61 | # to override the default setting. 62 | # exclude: 63 | # - Gemfile 64 | # - Gemfile.lock 65 | # - node_modules 66 | # - vendor/bundle/ 67 | # - vendor/cache/ 68 | # - vendor/gems/ 69 | # - vendor/ruby/ 70 | -------------------------------------------------------------------------------- /docs/_includes/category.html: -------------------------------------------------------------------------------- 1 |
2 | {%- if page.category_name -%} 3 | 4 | {% assign category_posts = site.categories[page.category_name] %} 5 |

{{ page.category_name | capitalize }} Posts ({{ category_posts.size | default: "0" }})

6 | 7 | {%- if category_posts.size > 0 -%} 8 |
    9 | {%- for post in category_posts -%} 10 |
  • 11 | {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%} 12 | 13 |

    14 | 15 | {{ post.title | escape }} 16 | 17 |

    18 | {%- if site.show_excerpts -%} 19 | {{ post.excerpt }} 20 | {%- endif -%} 21 |
  • 22 | {%- endfor -%} 23 |
24 | {%- endif -%} 25 | 26 | {%- else -%} 27 |

No Category Name Set

28 | {%- endif -%} 29 | 30 |
31 | 32 | -------------------------------------------------------------------------------- /docs/_includes/disqus_comments.html: -------------------------------------------------------------------------------- 1 | {%- if page.comments != false and jekyll.environment == "production" -%} 2 | 3 |
4 | 19 | 20 | {%- endif -%} 21 | -------------------------------------------------------------------------------- /docs/_includes/footer.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

vmConsole is free and open-source.

5 |
6 |
7 | -------------------------------------------------------------------------------- /docs/_includes/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {%- seo -%} 6 | 7 | 8 | {%- feed_meta -%} 9 | 10 | -------------------------------------------------------------------------------- /docs/_includes/header.html: -------------------------------------------------------------------------------- 1 | 30 | -------------------------------------------------------------------------------- /docs/_includes/icon-github.html: -------------------------------------------------------------------------------- 1 | {% include icon-github.svg %}{{ include.username }} 2 | -------------------------------------------------------------------------------- /docs/_includes/icon-github.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_includes/icon-twitter.html: -------------------------------------------------------------------------------- 1 | {{ include.username }} 2 | -------------------------------------------------------------------------------- /docs/_includes/icon-twitter.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_includes/social.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {%- include head.html -%} 5 | 6 | 7 | 8 | {%- include header.html -%} 9 | 10 |
11 |
12 | {{ content }} 13 |
14 |
15 | 16 | {%- include footer.html -%} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/_layouts/get.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 |
6 |

{{ page.title | escape }}

7 | 21 |
22 | 23 |
24 |

25 | As of now, the vmConsole application is distributed only through Google 26 | Play Store. Click on the badge below to proceed to the installation page. 27 |

28 | 29 |
30 | 31 | Get it on Google Play 32 | 33 |
34 | 35 |

36 | It is planned to enable distribution of the application through GitHub 37 | Releases in future, so people without Google Services will be able to 38 | install it as well. Also this will allow us to provide a version of 39 | vmConsole without certain restrictions. 40 |

41 | 42 |

System Requirements

43 | 44 |

45 | These system requirements are not mandatory. Though on devices where 46 | they are met, you will be able to achieve the max from application. 47 | Remember that vmConsole is a virtual machine holding the full-blown 48 | Linux distribution. Do not be naive, this application IS NOT optimized 49 | for low-end devices. 50 |

51 | 52 |
    53 |
  • 54 |

    55 | Disk: 8 GiB minimum. 56 |

    57 |

    58 | Assuming you will have one 6 GiB partition on persistent disk 59 | and leave some space for Android. Note that vmConsole provides 60 | 2 persistend disks with max size of 32 GiB. You will be able to 61 | use both fully if have more than 64 GiB free on shared storage. 62 |

    63 |
  • 64 |
  • 65 |

    66 | RAM: 6 - 8 GB. 67 |

    68 |

    69 | Having more is good only for overall Android multitasking. 70 | vmConsole automatically determines a safe amount of memory that 71 | it can allocate, but it has a hard limit of 2047 MiB, which 72 | partially is a technical limitation (32bit devices) and partially 73 | a safe threshold that will let Android multitasking function 74 | properly without OOM conditions. 75 |

    76 |
  • 77 |
78 | 79 |

80 | It is suggested to run vmConsole on 64bit devices, as it has been 81 | observed that QEMU has better emulation performance on these. But 82 | that is unclear, especially in cases where device is 64bit with 83 | 32bit only support on Android OS. Possibly that on devices having 84 | good CPU, the performace between 32bit and 64bit variants will be 85 | little to no. 86 |

87 |
88 | -------------------------------------------------------------------------------- /docs/_layouts/home.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 |
6 |

{{ page.title | escape }}

7 | 21 |
22 | 23 |
24 | {%- if page.title -%} 25 |

{{ page.title }}

26 | {%- endif -%} 27 | 28 | {{ content }} 29 | 30 | 31 | 32 |

33 | vmConsole is a Linux virtual machine application for Android OS. It is 34 | built on top of QEMU system emulator and 35 | runs Alpine Linux — a small, yet 36 | powerful Linux distribution. This application lets you to do everything, 37 | like from playing with Bash scripts to performing a penetration test 38 | of remote server. 39 |

40 | 41 |
42 | 43 | Get it on Google Play 44 | 45 |
46 | 47 |

Powerful. 48 | Alpine Linux distribution has over 10000 packages in its repositories 49 | covering the majority of typical tasks. Text editors, compilers, network 50 | administration utilities and others are all there. 51 | 52 |

Secure. 53 | What happens inside VM is remaining to be inside VM. You can't mess up 54 | or brick your device by running something inside vmConsole. Note that 55 | you're given full root control over virtual machine without the need 56 | of rooting or installing customized version of Android. 57 | 58 |

Minimalistic. 59 | vmConsole design is minimal and provides only necessary UI elements 60 | and features in order to provide a stable and consistent software. 61 | It is not overloaded by garland of semi-working functions unlike 62 | certain similar applications. 63 | 64 |

65 | 66 | -------------------------------------------------------------------------------- /docs/_layouts/page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 |
5 | 6 |
7 |

{{ page.title | escape }}

8 |
9 | 10 |
11 | {{ content }} 12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /docs/_layouts/post.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 |
5 | 6 |
7 |

{{ page.title | escape }}

8 | 17 | 64 |
65 | 66 |
67 | 72 | {% include anchor_headings.html html=content beforeHeading=true anchorBody="" %} 73 |
74 | 75 | 76 | {%- if site.disqus.shortname -%} 77 | {%- include disqus_comments.html -%} 78 | {%- endif -%} 79 | 80 | 81 |
82 | -------------------------------------------------------------------------------- /docs/_layouts/redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

Redirecting...

10 | Click here if you are not redirected. 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/_sass/minima/custom-styles.scss: -------------------------------------------------------------------------------- 1 | // Placeholder to allow defining custom styles that override everything else. 2 | // (Use `_sass/minima/custom-variables.scss` to override variable defaults) 3 | -------------------------------------------------------------------------------- /docs/_sass/minima/custom-variables.scss: -------------------------------------------------------------------------------- 1 | // Placeholder to allow overriding predefined variables smoothly. 2 | -------------------------------------------------------------------------------- /docs/_sass/minima/initialize.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Define defaults for each variable. 4 | 5 | $base-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", Roboto, Helvetica, Arial, sans-serif !default; 6 | $code-font-family: "Menlo", "Inconsolata", "Consolas", "Roboto Mono", "Ubuntu Mono", "Liberation Mono", "Courier New", monospace; 7 | $base-font-size: 16px !default; 8 | $base-font-weight: 400 !default; 9 | $small-font-size: $base-font-size * 0.875 !default; 10 | $base-line-height: 1.5 !default; 11 | 12 | $spacing-unit: 30px !default; 13 | 14 | $table-text-align: left !default; 15 | 16 | // Width of the content area 17 | $content-width: 800px !default; 18 | 19 | $on-palm: 600px !default; 20 | $on-laptop: 800px !default; 21 | 22 | $on-medium: $on-palm !default; 23 | $on-large: $on-laptop !default; 24 | 25 | // Use media queries like this: 26 | // @include media-query($on-palm) { 27 | // .wrapper { 28 | // padding-right: $spacing-unit / 2; 29 | // padding-left: $spacing-unit / 2; 30 | // } 31 | // } 32 | // Notice the following mixin uses max-width, in a deprecated, desktop-first 33 | // approach, whereas media queries used elsewhere now use min-width. 34 | @mixin media-query($device) { 35 | @media screen and (max-width: $device) { 36 | @content; 37 | } 38 | } 39 | 40 | @mixin relative-font-size($ratio) { 41 | font-size: #{$ratio}rem; 42 | } 43 | 44 | // Import pre-styling-overrides hook and style-partials. 45 | @import 46 | "minima/custom-variables", // Hook to override predefined variables. 47 | "minima/base", // Defines element resets. 48 | "minima/layout", // Defines structure and style based on CSS selectors. 49 | "minima/custom-styles" // Hook to override existing styles. 50 | ; 51 | -------------------------------------------------------------------------------- /docs/_sass/minima/skins/classic.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | $brand-color: #828282 !default; 4 | $brand-color-light: lighten($brand-color, 40%) !default; 5 | $brand-color-dark: darken($brand-color, 25%) !default; 6 | 7 | $site-title-color: $brand-color-dark !default; 8 | 9 | $text-color: #111111 !default; 10 | $background-color: #fdfdfd !default; 11 | $code-background-color: #eeeeff !default; 12 | 13 | $link-base-color: #2a7ae2 !default; 14 | $link-visited-color: darken($link-base-color, 15%) !default; 15 | $link-hover-color: $text-color !default; 16 | 17 | $border-color-01: $brand-color-light !default; 18 | $border-color-02: lighten($brand-color, 35%) !default; 19 | $border-color-03: $brand-color-dark !default; 20 | 21 | $table-text-color: lighten($text-color, 18%) !default; 22 | $table-zebra-color: lighten($brand-color, 46%) !default; 23 | $table-header-bg-color: lighten($brand-color, 43%) !default; 24 | $table-header-border: lighten($brand-color, 37%) !default; 25 | $table-border-color: $border-color-01 !default; 26 | 27 | 28 | // Syntax highlighting styles should be adjusted appropriately for every "skin" 29 | // ---------------------------------------------------------------------------- 30 | 31 | .highlight { 32 | .c { color: #998; font-style: italic } // Comment 33 | .err { color: #a61717; background-color: #e3d2d2 } // Error 34 | .k { font-weight: bold } // Keyword 35 | .o { font-weight: bold } // Operator 36 | .cm { color: #998; font-style: italic } // Comment.Multiline 37 | .cp { color: #999; font-weight: bold } // Comment.Preproc 38 | .c1 { color: #998; font-style: italic } // Comment.Single 39 | .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special 40 | .gd { color: #000; background-color: #fdd } // Generic.Deleted 41 | .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific 42 | .ge { font-style: italic } // Generic.Emph 43 | .gr { color: #a00 } // Generic.Error 44 | .gh { color: #999 } // Generic.Heading 45 | .gi { color: #000; background-color: #dfd } // Generic.Inserted 46 | .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific 47 | .go { color: #888 } // Generic.Output 48 | .gp { color: #555 } // Generic.Prompt 49 | .gs { font-weight: bold } // Generic.Strong 50 | .gu { color: #aaa } // Generic.Subheading 51 | .gt { color: #a00 } // Generic.Traceback 52 | .kc { font-weight: bold } // Keyword.Constant 53 | .kd { font-weight: bold } // Keyword.Declaration 54 | .kp { font-weight: bold } // Keyword.Pseudo 55 | .kr { font-weight: bold } // Keyword.Reserved 56 | .kt { color: #458; font-weight: bold } // Keyword.Type 57 | .m { color: #099 } // Literal.Number 58 | .s { color: #d14 } // Literal.String 59 | .na { color: #008080 } // Name.Attribute 60 | .nb { color: #0086B3 } // Name.Builtin 61 | .nc { color: #458; font-weight: bold } // Name.Class 62 | .no { color: #008080 } // Name.Constant 63 | .ni { color: #800080 } // Name.Entity 64 | .ne { color: #900; font-weight: bold } // Name.Exception 65 | .nf { color: #900; font-weight: bold } // Name.Function 66 | .nn { color: #555 } // Name.Namespace 67 | .nt { color: #000080 } // Name.Tag 68 | .nv { color: #008080 } // Name.Variable 69 | .ow { font-weight: bold } // Operator.Word 70 | .w { color: #bbb } // Text.Whitespace 71 | .mf { color: #099 } // Literal.Number.Float 72 | .mh { color: #099 } // Literal.Number.Hex 73 | .mi { color: #099 } // Literal.Number.Integer 74 | .mo { color: #099 } // Literal.Number.Oct 75 | .sb { color: #d14 } // Literal.String.Backtick 76 | .sc { color: #d14 } // Literal.String.Char 77 | .sd { color: #d14 } // Literal.String.Doc 78 | .s2 { color: #d14 } // Literal.String.Double 79 | .se { color: #d14 } // Literal.String.Escape 80 | .sh { color: #d14 } // Literal.String.Heredoc 81 | .si { color: #d14 } // Literal.String.Interpol 82 | .sx { color: #d14 } // Literal.String.Other 83 | .sr { color: #009926 } // Literal.String.Regex 84 | .s1 { color: #d14 } // Literal.String.Single 85 | .ss { color: #990073 } // Literal.String.Symbol 86 | .bp { color: #999 } // Name.Builtin.Pseudo 87 | .vc { color: #008080 } // Name.Variable.Class 88 | .vg { color: #008080 } // Name.Variable.Global 89 | .vi { color: #008080 } // Name.Variable.Instance 90 | .il { color: #099 } // Literal.Number.Integer.Long 91 | } 92 | -------------------------------------------------------------------------------- /docs/_sass/minima/skins/dark.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | $brand-color: #999999 !default; 4 | $brand-color-light: lighten($brand-color, 5%) !default; 5 | $brand-color-dark: darken($brand-color, 35%) !default; 6 | 7 | $site-title-color: $brand-color-light !default; 8 | 9 | $text-color: #bbbbbb !default; 10 | $background-color: #181818 !default; 11 | $code-background-color: #212121 !default; 12 | 13 | $link-base-color: #79b8ff !default; 14 | $link-visited-color: $link-base-color !default; 15 | $link-hover-color: $text-color !default; 16 | 17 | $border-color-01: $brand-color-dark !default; 18 | $border-color-02: $brand-color-light !default; 19 | $border-color-03: $brand-color !default; 20 | 21 | $table-text-color: $text-color !default; 22 | $table-zebra-color: lighten($background-color, 4%) !default; 23 | $table-header-bg-color: lighten($background-color, 10%) !default; 24 | $table-header-border: lighten($background-color, 21%) !default; 25 | $table-border-color: $border-color-01 !default; 26 | 27 | 28 | // Syntax highlighting styles should be adjusted appropriately for every "skin" 29 | // List of tokens: https://github.com/rouge-ruby/rouge/wiki/List-of-tokens 30 | // Some colors come from Material Theme Darker: 31 | // https://github.com/material-theme/vsc-material-theme/blob/master/scripts/generator/settings/specific/darker-hc.ts 32 | // https://github.com/material-theme/vsc-material-theme/blob/master/scripts/generator/color-set.ts 33 | // ---------------------------------------------------------------------------- 34 | 35 | .highlight { 36 | .c { color: #545454; font-style: italic } // Comment 37 | .err { color: #f07178; background-color: #e3d2d2 } // Error 38 | .k { color: #89DDFF; font-weight: bold } // Keyword 39 | .o { font-weight: bold } // Operator 40 | .cm { color: #545454; font-style: italic } // Comment.Multiline 41 | .cp { color: #545454; font-weight: bold } // Comment.Preproc 42 | .c1 { color: #545454; font-style: italic } // Comment.Single 43 | .cs { color: #545454; font-weight: bold; font-style: italic } // Comment.Special 44 | .gd { color: #000; background-color: #fdd } // Generic.Deleted 45 | .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific 46 | .ge { font-style: italic } // Generic.Emph 47 | .gr { color: #f07178 } // Generic.Error 48 | .gh { color: #999 } // Generic.Heading 49 | .gi { color: #000; background-color: #dfd } // Generic.Inserted 50 | .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific 51 | .go { color: #888 } // Generic.Output 52 | .gp { color: #555 } // Generic.Prompt 53 | .gs { font-weight: bold } // Generic.Strong 54 | .gu { color: #aaa } // Generic.Subheading 55 | .gt { color: #f07178 } // Generic.Traceback 56 | .kc { font-weight: bold } // Keyword.Constant 57 | .kd { font-weight: bold } // Keyword.Declaration 58 | .kp { font-weight: bold } // Keyword.Pseudo 59 | .kr { font-weight: bold } // Keyword.Reserved 60 | .kt { color: #FFCB6B; font-weight: bold } // Keyword.Type 61 | .m { color: #F78C6C } // Literal.Number 62 | .s { color: #C3E88D } // Literal.String 63 | .na { color: #008080 } // Name.Attribute 64 | .nb { color: #EEFFFF } // Name.Builtin 65 | .nc { color: #FFCB6B; font-weight: bold } // Name.Class 66 | .no { color: #008080 } // Name.Constant 67 | .ni { color: #800080 } // Name.Entity 68 | .ne { color: #900; font-weight: bold } // Name.Exception 69 | .nf { color: #82AAFF; font-weight: bold } // Name.Function 70 | .nn { color: #555 } // Name.Namespace 71 | .nt { color: #FFCB6B } // Name.Tag 72 | .nv { color: #EEFFFF } // Name.Variable 73 | .ow { font-weight: bold } // Operator.Word 74 | .w { color: #EEFFFF } // Text.Whitespace 75 | .mf { color: #F78C6C } // Literal.Number.Float 76 | .mh { color: #F78C6C } // Literal.Number.Hex 77 | .mi { color: #F78C6C } // Literal.Number.Integer 78 | .mo { color: #F78C6C } // Literal.Number.Oct 79 | .sb { color: #C3E88D } // Literal.String.Backtick 80 | .sc { color: #C3E88D } // Literal.String.Char 81 | .sd { color: #C3E88D } // Literal.String.Doc 82 | .s2 { color: #C3E88D } // Literal.String.Double 83 | .se { color: #EEFFFF } // Literal.String.Escape 84 | .sh { color: #C3E88D } // Literal.String.Heredoc 85 | .si { color: #C3E88D } // Literal.String.Interpol 86 | .sx { color: #C3E88D } // Literal.String.Other 87 | .sr { color: #C3E88D } // Literal.String.Regex 88 | .s1 { color: #C3E88D } // Literal.String.Single 89 | .ss { color: #C3E88D } // Literal.String.Symbol 90 | .bp { color: #999 } // Name.Builtin.Pseudo 91 | .vc { color: #FFCB6B } // Name.Variable.Class 92 | .vg { color: #EEFFFF } // Name.Variable.Global 93 | .vi { color: #EEFFFF } // Name.Variable.Instance 94 | .il { color: #F78C6C } // Literal.Number.Integer.Long 95 | } 96 | -------------------------------------------------------------------------------- /docs/_sass/minima/skins/solarized-dark.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | $sol-is-dark: true; 4 | @import "minima/skins/solarized"; 5 | -------------------------------------------------------------------------------- /docs/assets/css/style.scss: -------------------------------------------------------------------------------- 1 | --- 2 | # Only the main Sass file needs front matter (the dashes are enough) 3 | --- 4 | 5 | @import 6 | "minima/skins/{{ site.minima.skin | default: 'classic' }}", 7 | "minima/initialize"; 8 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/favicon.ico -------------------------------------------------------------------------------- /docs/files/demo_boot-logs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/demo_boot-logs.png -------------------------------------------------------------------------------- /docs/files/demo_btop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/demo_btop.png -------------------------------------------------------------------------------- /docs/files/demo_dns-dig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/demo_dns-dig.png -------------------------------------------------------------------------------- /docs/files/demo_docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/demo_docker.png -------------------------------------------------------------------------------- /docs/files/demo_metasploit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/demo_metasploit.png -------------------------------------------------------------------------------- /docs/files/demo_nvim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/demo_nvim.png -------------------------------------------------------------------------------- /docs/files/get-it-on-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/get-it-on-github.png -------------------------------------------------------------------------------- /docs/files/get-it-on-google-play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/docs/files/get-it-on-google-play.png -------------------------------------------------------------------------------- /docs/files/slider.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function() { 2 | 'use strict'; 3 | var delayBetweenSlides = 6000; 4 | 5 | window.setTimeout(function() { 6 | var images = document.querySelectorAll('[data-sliderimages]'); 7 | for (var i = 0; i < images.length; i++) { 8 | (function(img, context) { 9 | var dataSliderImages = img.getAttribute('data-sliderimages').split(','); 10 | dataSliderImages.push(img.src); // Add initial image 11 | img.addEventListener("transitionend", function() { 12 | if (context.visible) { 13 | setTimeout(function() { 14 | img.classList.add('fade-out'); 15 | img.classList.remove('fade-in'); 16 | }, delayBetweenSlides); 17 | } else { 18 | // Change image, which will trigger 'load' event: 19 | img.src = dataSliderImages[context.count].trim(); 20 | context.count = (context.count + 1) % dataSliderImages.length; 21 | } 22 | context.visible = !context.visible; 23 | }, false); 24 | img.addEventListener('load', function() { 25 | // Now that the new image has loaded we fade it in. 26 | context.visible = true; 27 | img.classList.remove('fade-out'); 28 | img.classList.add('fade-in'); 29 | }, false); 30 | img.classList.add('fade-out'); 31 | })(images[i], { count: 0, visible:false}); 32 | } 33 | }, delayBetweenSlides); 34 | }, false); 35 | -------------------------------------------------------------------------------- /docs/google8e6c3fd31cf1f2d8.html: -------------------------------------------------------------------------------- 1 | google-site-verification: google8e6c3fd31cf1f2d8.html -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | # Feel free to add content and custom Front Matter to this file. 3 | # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults 4 | 5 | layout: home 6 | --- 7 | -------------------------------------------------------------------------------- /docs/pages/get.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: get 3 | title: Install vmConsole 4 | permalink: /get 5 | --- 6 | -------------------------------------------------------------------------------- /docs/pages/privacy-policy.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Privacy Policy 4 | permalink: /privacy-policy 5 | --- 6 | 7 | This privacy policy describes what kind of data can be collected and 8 | sent to us or third-parties and why, such as when you: 9 | 10 | - Download and use the vmConsole application. 11 | - Interacting with our online services within the application. 12 | - Interacting with third-party online services within the application. 13 | - Visiting our website. 14 | 15 | Additionally we explain here how privacy-sensitive access permissions 16 | are used by our application. 17 | 18 | ## vmConsole application 19 | 20 | vmConsole does not collect and share any kind of personal data. The 21 | permissions requested within the application are used only to make 22 | it function properly or enable additional features. 23 | 24 | - Internet permission (`android.permission.INTERNET`) 25 | 26 | Used to enable Internet access within the vmConsole virtual machine. 27 | Internet access is used exclusively on behalf of user in order to 28 | download or transfer content from third-party services. For example 29 | the Internet access is necessary to install packages from a remote 30 | repository. 31 | 32 | - Storage permission (`android.permission.WRITE_EXTERNAL_STORAGE`) 33 | 34 | Used to let user access his files outside of the vmConsole virtual 35 | machine. This permission is optional and is disabled by default. 36 | On Android OS version 10 and higher, access scope is limited only 37 | to media files ([scoped storage](https://source.android.com/devices/storage/scoped)). 38 | 39 | ## Our website 40 | 41 | vmConsole official web site is running on [GitHub Pages](https://pages.github.com/) 42 | service. GitHub collects the IP addresses of visitors and stores 43 | them for security purposes. 44 | 45 | You may want to view [GitHub Privacy Policy](https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement). 46 | 47 | ## Third party services 48 | 49 | vmConsole uses package repository server provided by the [Alpine Linux](https://alpinelinux.org/) 50 | project for downloading and installing software packages using 51 | a package manager `apk`. This service as well as the whole Alpine 52 | Linux project are not affiliated with vmConsole in any way. User 53 | IP address could be recorded statistics or security purposes 54 | whenever a package or metadata archive was downloaded. 55 | 56 | vmConsole acts only as environment for installing and running 57 | other software made by third parties. Some programs may collect 58 | extended set of personal data, including but not limited to email 59 | addresses, phone numbers, files, tracked behavior. User must 60 | consult the privacy policy and license agreement of program they 61 | want to run in vmConsole and share their personal data with. 62 | -------------------------------------------------------------------------------- /external/alpine_iso/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:edge 2 | 3 | ARG USER_ID 1000 4 | ARG RSA_KEY_PASSPHRASE pass 5 | 6 | COPY /abuild-keys /abuild-keys 7 | COPY /extras /custom-packages/extras 8 | 9 | RUN apk upgrade && \ 10 | apk add alpine-sdk build-base apk-tools alpine-conf openssl \ 11 | busybox fakeroot syslinux xorriso squashfs-tools sudo && \ 12 | adduser -s /bin/ash -G abuild -D -h /home/build -u ${USER_ID} build && \ 13 | mkdir -p /home/build/.abuild && chown build /home/build/.abuild && \ 14 | openssl aes-256-cbc -d -in /abuild-keys/vmconsole-dev.rsa.enc \ 15 | -out /home/build/.abuild/vmconsole-dev.rsa \ 16 | -k "$RSA_KEY_PASSPHRASE" -pbkdf2 && \ 17 | chown build /home/build/.abuild/vmconsole-dev.rsa && \ 18 | chmod 600 /home/build/.abuild/vmconsole-dev.rsa && \ 19 | cp /abuild-keys/vmconsole-dev.rsa.pub /home/build/.abuild/vmconsole-dev.rsa.pub && \ 20 | chown build /home/build/.abuild/vmconsole-dev.rsa.pub && \ 21 | cp /abuild-keys/vmconsole-dev.rsa.pub /etc/apk/keys/vmconsole-dev.rsa.pub && \ 22 | chown root:root /etc/apk/keys/vmconsole-dev.rsa.pub && \ 23 | chmod 644 /etc/apk/keys/vmconsole-dev.rsa.pub && \ 24 | echo "PACKAGER_PRIVKEY=/home/build/.abuild/vmconsole-dev.rsa" > \ 25 | /home/build/.abuild/abuild.conf && \ 26 | chown build /home/build/.abuild/abuild.conf && \ 27 | chmod 644 /home/build/.abuild/abuild.conf && \ 28 | chown -Rh build:abuild /custom-packages && \ 29 | echo "build ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/build 30 | 31 | USER build 32 | 33 | CMD ["/bin/ash"] 34 | -------------------------------------------------------------------------------- /external/alpine_iso/Makefile: -------------------------------------------------------------------------------- 1 | ALPINE_LINUX_TAG := edge 2 | ALPINE_LINUX_REPO_EDGE := http://dl-cdn.alpinelinux.org/alpine/edge/main 3 | ALPINE_LINUX_REPO_EDGE_COMMUNITY := http://dl-cdn.alpinelinux.org/alpine/edge/community 4 | ALPINE_LINUX_REPO_TESTING := http://dl-cdn.alpinelinux.org/alpine/edge/testing 5 | DOCKER_IMAGE_NAME := alpinelinux-iso-builder 6 | RSA_KEY_PASSPHRASE ?= pass 7 | CURRENT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 8 | OUTPUT_DIR := $(CURRENT_DIR)/iso 9 | 10 | all: build-docker 11 | 12 | setup-docker-image: 13 | @echo "Building Docker image..." 14 | @echo 15 | @docker build -t $(DOCKER_IMAGE_NAME):latest \ 16 | --build-arg USER_ID=$(shell id -u) \ 17 | --build-arg RSA_KEY_PASSPHRASE="$(RSA_KEY_PASSPHRASE)" \ 18 | -f $(CURRENT_DIR)/Dockerfile $(CURRENT_DIR) 19 | 20 | build-docker: setup-docker-image 21 | @echo "Starting build environment using Docker..." 22 | @echo 23 | mkdir -p $(OUTPUT_DIR) 24 | docker run --rm --workdir /workdir -v $(CURRENT_DIR):/workdir \ 25 | -v $(OUTPUT_DIR):/output $(DOCKER_IMAGE_NAME):latest \ 26 | /bin/ash -c "make build-local OUTPUT_DIR=/output" 27 | 28 | build-local: 29 | #@echo "Building extra packages..." 30 | #@echo 31 | #mkdir -p $(CURRENT_DIR)/packages 32 | #cd $(CURRENT_DIR)/extras/sample-package; abuild -r -P $(CURRENT_DIR)/packages 33 | @echo "Building ISO..." 34 | @echo "Output directory:" $(OUTPUT_DIR) 35 | @echo 36 | mkdir -p $(OUTPUT_DIR) 37 | ## add '--repository $(CURRENT_DIR)/packages/extras' for local repository. 38 | sh mkimage.sh \ 39 | --outdir $(OUTPUT_DIR) \ 40 | --tag $(ALPINE_LINUX_TAG) \ 41 | --repository "$(ALPINE_LINUX_REPO_EDGE)" \ 42 | --repository "$(ALPINE_LINUX_REPO_EDGE_COMMUNITY)" \ 43 | --repository "$(ALPINE_LINUX_REPO_TESTING)" 44 | -------------------------------------------------------------------------------- /external/alpine_iso/README.md: -------------------------------------------------------------------------------- 1 | # Alpine Linux ISO build scripts 2 | 3 | Everything that is required to build a custom Alpine Linux ISO image. For now 4 | the image is based on Edge & Testing branches which allow to use the latest 5 | available package versions. Even though it could be a bit unstable and have 6 | certain packaging issues, they should not be a problem in most cases. 7 | 8 | The created ISO image is intended to be used for running a live system without 9 | the need of hard drive. Root file system is placed on RAM (tmpfs). In order 10 | to install system on disk, user must run the standard steps of installation 11 | shown on [Wiki](https://wiki.alpinelinux.org/wiki/Installation). 12 | 13 | **Alpine Linux is developed by third parties and is not affiliated with the 14 | vmConsole application in any way.** 15 | 16 | # How to build ISO image 17 | 18 | Requires `docker` to be installed and running. 19 | 20 | Once you've done with `docker` configuration, do: 21 | 22 | make build-docker 23 | 24 | The make target 'build-docker' will perform ISO building in Docker container 25 | as scripts require operating system to be Alpine Linux and would not work on 26 | others. The generated files are placed into '$(pwd)/iso' by default. 27 | 28 | To specify custom output directory, pass argument 'OUTPUT_DIR=/path' to the 29 | 'make' command. The specified path must be absolute. 30 | -------------------------------------------------------------------------------- /external/alpine_iso/abuild-keys/vmconsole-dev.rsa.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/external/alpine_iso/abuild-keys/vmconsole-dev.rsa.enc -------------------------------------------------------------------------------- /external/alpine_iso/abuild-keys/vmconsole-dev.rsa.pub: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzWAKNAejhyIJMFO/W3TS 3 | DTSOP1xnxfuY/Ji+6EGVAbwPqLaH8hFlUs9UlEN2nCQC1Bg840OyFoR4uojrjs4r 4 | NE6LrUJQxYLmGclp6KsDPnSRgxsbYOriOA3vnjivDKWKsmm4tOdHN4oTfkC9Z0oo 5 | J3j48y9qwhwLBlsUT50LJ7+XQrW3lRQF/q8behuzNfvwLBzMp84gcJ1KYdOdgT5Z 6 | 4Ez2EfnJkgtCBgwkPXuTVEIWY/6r3VwcD0x2bSPR8slQB0Nv3lXtH6Yx0kV7Tkn1 7 | d/DCbmJ9//u9LtrPnbWvKHwvW/69PUB2wd7o2hQYDynnZDHSyNDWo6LpUGt71FGl 8 | eDJQa7cn62sqLirJEjlUmrrcaNgdzygFcqRxt0OPQZs/HprrLQxmjvhcFs0rL3IM 9 | MVfLh6vCX//pXjgiCmpKgJx3m+IsNSSDVut8MM/V3y4rve2i7m29pUM02IabW3GQ 10 | nH5liXBkdrgkRHaEyoqf2CZPyZM3kqiHSaUdibheb6hG0bIkorwldqsTmkr7ObuT 11 | hVfj0gKMCN9/RIDxjeHNVx2f/CUL9R1nihSiQuY24fmCD53z2aUhuyZ0J+F7inQd 12 | p4Z5MDpM+qnl2gw2rDEcVcIFzADhf9tlB1++YKxQbRiUBMrQzBUPfQNqIM27ihy0 13 | /wcugzD0GLKAN3/d+0rb2nkCAwEAAQ== 14 | -----END PUBLIC KEY----- 15 | -------------------------------------------------------------------------------- /external/alpine_iso/extras/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/external/alpine_iso/extras/.placeholder -------------------------------------------------------------------------------- /external/alpine_iso/files/issue: -------------------------------------------------------------------------------- 1 | [!pAlpine Linux, \r, \l 2 | \d, \t 3 | 4 | Login by typing 'root', no password is set by default. 5 | 6 | -------------------------------------------------------------------------------- /external/alpine_iso/packages.txt: -------------------------------------------------------------------------------- 1 | acct 2 | acf-alpine-baselayout 3 | acf-apk-tools 4 | acf-chrony 5 | acf-core 6 | acf-openssh 7 | alpine-base 8 | bash 9 | blkid 10 | busybox 11 | chrony 12 | cryptsetup 13 | curl 14 | dhcpcd 15 | doas 16 | dosfstools 17 | e2fsprogs 18 | e2fsprogs-extra 19 | grub 20 | grub-bios 21 | haveged 22 | kbd-bkeymaps 23 | libc6-compat 24 | linux-firmware-none 25 | linux-virt 26 | lvm2 27 | lynx 28 | mdadm 29 | mini_httpd 30 | nano 31 | nano-syntax 32 | network-extras 33 | openntpd 34 | openssh 35 | openssh-client 36 | openssl 37 | sfdisk 38 | ssmtp 39 | sudo 40 | syslinux 41 | tmux 42 | tzdata 43 | vim 44 | wget 45 | -------------------------------------------------------------------------------- /external/libvmc/README.md: -------------------------------------------------------------------------------- 1 | # Native executables build environment 2 | 3 | A Docker-based build environment for `libVMC.so` (aka `libVMConsole.so`) 4 | \- the QEMU package. It is patched for use as JNI library in order to 5 | avoid the need of `execve()` system call which is restricted by security 6 | hardening on Android 10+. 7 | 8 | # How to build the JNI library 9 | 10 | You need `docker` to be installed and running. 11 | 12 | 1. Create a build environment: 13 | ``` 14 | cd ./scripts/ 15 | docker build -t libvmc-buildenv . 16 | cd .. 17 | ``` 18 | 2. Start the container: 19 | ``` 20 | ./scripts/run-docker.sh 21 | ``` 22 | 3. Build the library for all architectures: 23 | ``` 24 | ./build-package.sh -f -a all qemu-system 25 | ``` 26 | 27 | The output is placed into `./jniLibs`. Note that there are prebuilt 28 | libraries available. 29 | -------------------------------------------------------------------------------- /external/libvmc/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # clean.sh - clean everything. 3 | set -e -u 4 | 5 | rm -Rf /data/* "$HOME/.cache/package_builder" 6 | -------------------------------------------------------------------------------- /external/libvmc/jniLibs/arm64-v8a/libVMC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/external/libvmc/jniLibs/arm64-v8a/libVMC.so -------------------------------------------------------------------------------- /external/libvmc/jniLibs/armeabi-v7a/libVMC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/external/libvmc/jniLibs/armeabi-v7a/libVMC.so -------------------------------------------------------------------------------- /external/libvmc/jniLibs/x86/libVMC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/external/libvmc/jniLibs/x86/libVMC.so -------------------------------------------------------------------------------- /external/libvmc/jniLibs/x86_64/libVMC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/external/libvmc/jniLibs/x86_64/libVMC.so -------------------------------------------------------------------------------- /external/libvmc/packages/glib/0000-configure-no-posix-spawn.patch: -------------------------------------------------------------------------------- 1 | diff -uNr glib-2.58.3/configure.ac glib-2.58.3.mod/configure.ac 2 | --- glib-2.58.3/configure.ac 2019-01-21 15:38:50.000000000 +0200 3 | +++ glib-2.58.3.mod/configure.ac 2019-12-14 19:08:28.123183661 +0200 4 | @@ -478,7 +478,7 @@ 5 | 6 | # Checks for library functions. 7 | AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid) 8 | -AC_CHECK_FUNCS(timegm gmtime_r posix_spawn) 9 | +AC_CHECK_FUNCS(timegm gmtime_r) 10 | AC_FUNC_STRERROR_R() 11 | 12 | AC_CHECK_SIZEOF(char) 13 | @@ -639,7 +639,6 @@ 14 | AC_CHECK_HEADERS([linux/magic.h]) 15 | AC_CHECK_HEADERS([termios.h]) 16 | AC_CHECK_HEADERS([alloca.h]) 17 | -AC_CHECK_HEADERS([spawn.h]) 18 | 19 | # Some versions of MSC lack these 20 | AC_CHECK_HEADERS([dirent.h sys/time.h]) 21 | -------------------------------------------------------------------------------- /external/libvmc/packages/glib/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION="2.58.3" 2 | PACKAGE_SRCURL="https://ftp.gnome.org/pub/gnome/sources/glib/${PACKAGE_VERSION:0:4}/glib-${PACKAGE_VERSION}.tar.xz" 3 | PACKAGE_SHA256="8f43c31767e88a25da72b52a40f3301fefc49a665b56dc10ee7cc9565cbe7481" 4 | PACKAGE_DEPENDS="libandroid-support, libffi, libiconv, zlib" 5 | 6 | # --enable-compile-warnings=no to get rid of format strings causing errors. 7 | PACKAGE_EXTRA_CONFIGURE_ARGS=" 8 | --cache-file=custom_configure.cache 9 | --disable-compile-warnings 10 | --disable-gtk-doc 11 | --disable-gtk-doc-html 12 | --disable-libelf 13 | --disable-libmount 14 | --with-pcre=internal 15 | --with-iconv=external 16 | " 17 | 18 | builder_step_pre_configure() { 19 | NOCONFIGURE=1 ./autogen.sh 20 | 21 | # glib checks for __BIONIC__ instead of __ANDROID__: 22 | CFLAGS="$CFLAGS -D__BIONIC__=1 -fPIC" 23 | LDFLAGS="${LDFLAGS/-static/} -fPIC" 24 | 25 | cd "${PACKAGE_BUILDDIR}" 26 | 27 | # https://developer.gnome.org/glib/stable/glib-cross-compiling.html 28 | echo "glib_cv_long_long_format=ll" >> custom_configure.cache 29 | echo "glib_cv_stack_grows=no" >> custom_configure.cache 30 | echo "glib_cv_uscore=no" >> custom_configure.cache 31 | chmod a-w custom_configure.cache 32 | } 33 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-cpufeatures/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION="ndk-r20" 2 | PACKAGE_SKIP_SRC_EXTRACT="true" 3 | 4 | builder_step_make_install() { 5 | local sources="$PACKAGE_BUILDER_DIR/sources/cpu-features.c" 6 | 7 | "$CC" $CFLAGS $CPPFLAGS \ 8 | -I"$PACKAGE_BUILDER_DIR/sources" \ 9 | -c $sources 10 | "$AR" rcs libandroid-cpufeatures.a *.o 11 | 12 | install -Dm600 "$PACKAGE_BUILDER_DIR/sources/cpu-features.h" \ 13 | "$PACKAGE_INSTALL_PREFIX/include/cpu-features.h" 14 | install -Dm600 libandroid-cpufeatures.a \ 15 | "$PACKAGE_INSTALL_PREFIX/lib/libandroid-cpufeatures.a" 16 | } 17 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-cpufeatures/sources/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 The Android Open Source Project 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION="24" 2 | PACKAGE_SKIP_SRC_EXTRACT="true" 3 | 4 | builder_step_make_install() { 5 | local sources="$PACKAGE_BUILDER_DIR/sources/src/musl-*/*.c" 6 | 7 | "$CC" $CFLAGS -std=c99 -DNULL=0 $CPPFLAGS \ 8 | -I"$PACKAGE_BUILDER_DIR/sources/src/include" \ 9 | -c $sources 10 | "$AR" rcs libandroid-support.a *.o 11 | 12 | install -Dm600 libandroid-support.a "$PACKAGE_INSTALL_PREFIX/lib/libandroid-support.a" 13 | ln -sfr "$PACKAGE_INSTALL_PREFIX/lib/libandroid-support.a" "$PACKAGE_INSTALL_PREFIX/lib/libiconv.a" 14 | } 15 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/README.md: -------------------------------------------------------------------------------- 1 | libandroid-support 2 | ------------------ 3 | A copy of libandroid-support as built from NDK r14. 4 | 5 | The purpose of `libandroid-support` is to add functionality missing 6 | the system libc to ease building packages. 7 | 8 | What is still necessary? 9 | ------------------------ 10 | Some functionality can probably be removed in favour of functionality in bionic: 11 | 12 | - [bionic in Android 5.0](https://android.googlesource.com/platform/bionic.git/+/lollipop-release/libc/bionic/) 13 | - [bionic in Android 6.0](https://android.googlesource.com/platform/bionic.git/+/marshmallow-release/libc/bionic/) 14 | - [bionic in Android 7.0](https://android.googlesource.com/platform/bionic.git/+/nougat-release/libc/bionic/) 15 | 16 | Test cases 17 | ---------- 18 | - Findutils: `touch åäö && find . -name åäö`. 19 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswalnum.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int iswalnum(wint_t wc) 5 | { 6 | return iswdigit(wc) || iswalpha(wc); 7 | } 8 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswalpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static const unsigned char table[] = { 4 | #include "alpha.h" 5 | }; 6 | 7 | int iswalpha(wint_t wc) 8 | { 9 | if (wc<0x20000U) 10 | return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1; 11 | if (wc<0x2fffeU) 12 | return 1; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswblank.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int iswblank(wint_t wc) 6 | { 7 | return isblank(wc); 8 | } 9 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswcntrl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int iswcntrl(wint_t wc) 5 | { 6 | return (unsigned)wc < 32 7 | || (unsigned)(wc-0x7f) < 33 8 | || (unsigned)(wc-0x2028) < 2 9 | || (unsigned)(wc-0xfff9) < 3; 10 | } 11 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswctype.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define WCTYPE_ALNUM 1 6 | #define WCTYPE_ALPHA 2 7 | #define WCTYPE_BLANK 3 8 | #define WCTYPE_CNTRL 4 9 | #define WCTYPE_DIGIT 5 10 | #define WCTYPE_GRAPH 6 11 | #define WCTYPE_LOWER 7 12 | #define WCTYPE_PRINT 8 13 | #define WCTYPE_PUNCT 9 14 | #define WCTYPE_SPACE 10 15 | #define WCTYPE_UPPER 11 16 | #define WCTYPE_XDIGIT 12 17 | 18 | static int custom_iswprint(wint_t wc) 19 | { 20 | if (wc < 0xffU) 21 | return (wc+1 & 0x7f) >= 0x21; 22 | if (wc < 0x2028U || wc-0x202aU < 0xd800-0x202a || wc-0xe000U < 0xfff9-0xe000) 23 | return 1; 24 | if (wc-0xfffcU > 0x10ffff-0xfffc || (wc&0xfffe)==0xfffe) 25 | return 0; 26 | return 1; 27 | } 28 | 29 | int iswctype(wint_t wc, wctype_t type) 30 | { 31 | switch (type) { 32 | case WCTYPE_ALNUM: 33 | return iswalnum(wc); 34 | case WCTYPE_ALPHA: 35 | return iswalpha(wc); 36 | case WCTYPE_BLANK: 37 | return iswblank(wc); 38 | case WCTYPE_CNTRL: 39 | return iswcntrl(wc); 40 | case WCTYPE_DIGIT: 41 | return iswdigit(wc); 42 | case WCTYPE_GRAPH: 43 | return iswgraph(wc); 44 | case WCTYPE_LOWER: 45 | return iswlower(wc); 46 | case WCTYPE_PRINT: 47 | return custom_iswprint(wc); 48 | case WCTYPE_PUNCT: 49 | return iswpunct(wc); 50 | case WCTYPE_SPACE: 51 | return iswspace(wc); 52 | case WCTYPE_UPPER: 53 | return iswupper(wc); 54 | case WCTYPE_XDIGIT: 55 | return iswxdigit(wc); 56 | } 57 | return 0; 58 | } 59 | 60 | wctype_t wctype(const char *s) 61 | { 62 | int i; 63 | const char *p; 64 | /* order must match! */ 65 | static const char names[] = 66 | "alnum\0" "alpha\0" "blank\0" 67 | "cntrl\0" "digit\0" "graph\0" 68 | "lower\0" "print\0" "punct\0" 69 | "space\0" "upper\0" "xdigit"; 70 | for (i=1, p=names; *p; i++, p+=6) 71 | if (*s == *p && !strcmp(s, p)) 72 | return i; 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #undef iswdigit 5 | 6 | int iswdigit(wint_t wc) 7 | { 8 | return (unsigned)wc-'0' < 10; 9 | } 10 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswgraph.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int custom_iswprint(wint_t wc) 4 | { 5 | if (wc < 0xffU) 6 | return (wc+1 & 0x7f) >= 0x21; 7 | if (wc < 0x2028U || wc-0x202aU < 0xd800-0x202a || wc-0xe000U < 0xfff9-0xe000) 8 | return 1; 9 | if (wc-0xfffcU > 0x10ffff-0xfffc || (wc&0xfffe)==0xfffe) 10 | return 0; 11 | return 1; 12 | } 13 | 14 | int iswgraph(wint_t wc) 15 | { 16 | /* ISO C defines this function as: */ 17 | return !iswspace(wc) && custom_iswprint(wc); 18 | } 19 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswlower.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int iswlower(wint_t wc) 4 | { 5 | return towupper(wc) != wc || wc == 0xdf; 6 | } 7 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswpunct.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static const unsigned char table[] = { 4 | #include "punct.h" 5 | }; 6 | 7 | int iswpunct(wint_t wc) 8 | { 9 | if (wc<0x20000U) 10 | return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswspace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* Our definition of whitespace is the Unicode White_Space property, 6 | * minus non-breaking spaces (U+00A0, U+2007, and U+202F) and script- 7 | * specific characters with non-blank glyphs (U+1680 and U+180E). */ 8 | 9 | int iswspace(wint_t wc) 10 | { 11 | static const wchar_t spaces[] = { 12 | ' ', '\t', '\n', '\r', 11, 12, 0x0085, 13 | 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 14 | 0x2006, 0x2008, 0x2009, 0x200a, 15 | 0x2028, 0x2029, 0x205f, 0x3000, 0 16 | }; 17 | return wc && wcschr(spaces, wc); 18 | } 19 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int iswupper(wint_t wc) 4 | { 5 | return towlower(wc) != wc; 6 | } 7 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/iswxdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int iswxdigit(wint_t wc) 5 | { 6 | return (unsigned)(wc-'0') < 10 || (unsigned)((wc|32)-'a') < 6; 7 | } 8 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/wcswidth.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcswidth(const wchar_t *wcs, size_t n) 4 | { 5 | int l=0, k=0; 6 | for (; n-- && *wcs && (k = wcwidth(*wcs)) >= 0; l+=k, wcs++); 7 | return (k < 0) ? k : l; 8 | } 9 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-ctype/wctrans.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | wctrans_t wctrans(const char *class) 5 | { 6 | if (!strcmp(class, "toupper")) return (wctrans_t)1; 7 | if (!strcmp(class, "tolower")) return (wctrans_t)2; 8 | return 0; 9 | } 10 | 11 | wint_t towctrans(wint_t wc, wctrans_t trans) 12 | { 13 | if (trans == (wctrans_t)1) return towupper(wc); 14 | if (trans == (wctrans_t)2) return towlower(wc); 15 | return wc; 16 | } 17 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-locale/intl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char *gettext(const char *msgid) 7 | { 8 | return (char *) msgid; 9 | } 10 | 11 | char *dgettext(const char *domainname, const char *msgid) 12 | { 13 | return (char *) msgid; 14 | } 15 | 16 | char *dcgettext(const char *domainname, const char *msgid, int category) 17 | { 18 | return (char *) msgid; 19 | } 20 | 21 | char *ngettext(const char *msgid1, const char *msgid2, unsigned long int n) 22 | { 23 | return (char *) ((n == 1) ? msgid1 : msgid2); 24 | } 25 | 26 | char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n) 27 | { 28 | return (char *) ((n == 1) ? msgid1 : msgid2); 29 | } 30 | 31 | char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category) 32 | { 33 | return (char *) ((n == 1) ? msgid1 : msgid2); 34 | } 35 | 36 | char *textdomain(const char *domainname) 37 | { 38 | static const char default_str[] = "messages"; 39 | 40 | if (domainname && *domainname && strcmp(domainname, default_str)) { 41 | errno = EINVAL; 42 | return NULL; 43 | } 44 | return (char *) default_str; 45 | } 46 | 47 | char *bindtextdomain(const char *domainname, const char *dirname) 48 | { 49 | static const char dir[] = "/"; 50 | 51 | if (!domainname || !*domainname 52 | || (dirname && ((dirname[0] != '/') || dirname[1])) 53 | ) { 54 | errno = EINVAL; 55 | return NULL; 56 | } 57 | 58 | return (char *) dir; 59 | } 60 | 61 | char *bind_textdomain_codeset(const char *domainname, const char *codeset) 62 | { 63 | if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) { 64 | errno = EINVAL; 65 | } 66 | return NULL; 67 | } 68 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-locale/legacychars.h: -------------------------------------------------------------------------------- 1 | 0,1,160,167,168,169,175,176,178,183,184,198,215,216,230,247,248,162,163,165, 2 | 196,197,198,199,201,214,215,216,220,224,226,228,229,230,231,232,233,234,235, 3 | 236,238,239,242,244,246,248,249,251,252,255,256,257,258,259,260,261,262,263, 4 | 264,265,266,267,268,269,270,271,272,273,274,275,278,279,280,281,282,283,284, 5 | 285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,302,303,304,305, 6 | 308,309,310,311,312,313,314,315,316,317,318,321,322,323,324,325,326,327,328, 7 | 330,331,332,333,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350, 8 | 351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369, 9 | 370,371,372,373,374,375,376,377,378,379,380,381,382,402,416,417,431,432,536, 10 | 537,538,539,710,711,728,729,731,732,733,768,769,771,777,803,890,900,901,902, 11 | 904,905,906,908,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924, 12 | 925,926,927,928,929,931,932,933,934,935,936,937,938,939,940,941,942,943,944, 13 | 945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963, 14 | 964,965,966,967,968,969,970, 15 | 971,972,973,974,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036, 16 | 1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052, 17 | 1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067, 18 | 1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082, 19 | 1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097, 20 | 1098,1099,1100,1101,1102,1103,1105,1106,1107,1108,1109,1110,1111,1112,1113, 21 | 1114,1115,1116,1118,1119,1168,1169,1456,1457,1458,1459,1460,1461,1462,1463, 22 | 1464,1465,1467,1468,1469,1470,1471,1472,1473,1474,1475,1488,1489,1490,1491, 23 | 1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506, 24 | 1507,1508,1509,1510,1511,1512,1513,1514,1520,1521,1522,1523,1524,1548,1563, 25 | 1567,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582, 26 | 1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1600,1601,1602, 27 | 1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617, 28 | 1618,1657,1662,1670,1672,1681,1688,1705,1711,1722,1726,1729,1746,3585,3586, 29 | 3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601, 30 | 3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616, 31 | 3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631, 32 | 3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3647,3648,3649,3650, 33 | 3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665, 34 | 3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,7682,7683,7690,7691,7710, 35 | 7711,7744,7745,7766,7767,7776,7777,7786,7787,7808,7809,7810,7811,7812,7813, 36 | 7922,7923,8204,8205,8206,8207,8211,8212,8213,8215,8216,8217,8218,8220,8221, 37 | 8222,8224,8225,8226,8230,8240,8249,8250,8362,8363,8364,8367,8359,8470,8482, 38 | 8729,8730,8776,8804,8805,8992,8993,9472,9474,9484,9488,9492,9496,9500,9508, 39 | 9516,9524,9532,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563, 40 | 9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578, 41 | 9579,9580,9600,9604,9608,9612,9616,9617,9618,9619,9632, 42 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-multibyte/internal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was written by Rich Felker in 2010; no copyright is claimed. 3 | * This code is in the public domain. Attribution is appreciated but 4 | * unnecessary. 5 | */ 6 | 7 | #include "internal.h" 8 | 9 | #define C(x) ( x<2 ? -1 : ( R(0x80,0xc0) | x ) ) 10 | #define D(x) C((x+16)) 11 | #define E(x) ( ( x==0 ? R(0xa0,0xc0) : \ 12 | x==0xd ? R(0x80,0xa0) : \ 13 | R(0x80,0xc0) ) \ 14 | | ( R(0x80,0xc0) >> 6 ) \ 15 | | x ) 16 | #define F(x) ( ( x>=5 ? 0 : \ 17 | x==0 ? R(0x90,0xc0) : \ 18 | x==4 ? R(0x80,0xa0) : \ 19 | R(0x80,0xc0) ) \ 20 | | ( R(0x80,0xc0) >> 6 ) \ 21 | | ( R(0x80,0xc0) >> 12 ) \ 22 | | x ) 23 | 24 | const uint32_t bittab[] = { 25 | C(0x2),C(0x3),C(0x4),C(0x5),C(0x6),C(0x7), 26 | C(0x8),C(0x9),C(0xa),C(0xb),C(0xc),C(0xd),C(0xe),C(0xf), 27 | D(0x0),D(0x1),D(0x2),D(0x3),D(0x4),D(0x5),D(0x6),D(0x7), 28 | D(0x8),D(0x9),D(0xa),D(0xb),D(0xc),D(0xd),D(0xe),D(0xf), 29 | E(0x0),E(0x1),E(0x2),E(0x3),E(0x4),E(0x5),E(0x6),E(0x7), 30 | E(0x8),E(0x9),E(0xa),E(0xb),E(0xc),E(0xd),E(0xe),E(0xf), 31 | F(0x0),F(0x1),F(0x2),F(0x3),F(0x4) 32 | }; 33 | 34 | #ifdef BROKEN_VISIBILITY 35 | __asm__(".hidden __fsmu8"); 36 | #endif 37 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-multibyte/internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was written by Rich Felker in 2010; no copyright is claimed. 3 | * This code is in the public domain. Attribution is appreciated but 4 | * unnecessary. 5 | */ 6 | 7 | #define bittab __fsmu8 8 | 9 | #include 10 | #include "libc.h" 11 | 12 | extern const uint32_t bittab[] ATTR_LIBC_VISIBILITY; 13 | 14 | /* Upper 6 state bits are a negative integer offset to bound-check next byte */ 15 | /* equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f */ 16 | #define OOB(c,b) (((((b)>>3)-0x10)|(((b)>>3)+((int32_t)(c)>>26))) & ~7) 17 | 18 | /* Interval [a,b). Either a must be 80 or b must be c0, lower 3 bits clear. */ 19 | #define R(a,b) ((uint32_t)((a==0x80 ? 0x40-b : -a) << 23)) 20 | #define FAILSTATE R(0x80,0x80) 21 | 22 | #define SA 0xc2u 23 | #define SB 0xf4u 24 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-multibyte/libc.h: -------------------------------------------------------------------------------- 1 | // Replacemenet for musl's libc 2 | 3 | #ifndef MUSL_LIBC_H 4 | #define MUSL_LIBC_H 5 | 6 | #define ATTR_LIBC_VISIBILITY __attribute__((visibility("hidden"))) 7 | 8 | #endif // MUSL_LIBC_H 9 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-multibyte/mblen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was written by Rich Felker in 2010; no copyright is claimed. 3 | * This code is in the public domain. Attribution is appreciated but 4 | * unnecessary. 5 | */ 6 | 7 | #include 8 | 9 | int mblen(const char *s, size_t n) 10 | { 11 | return mbtowc(0, s, n); 12 | } 13 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-multibyte/mbsnrtowcs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was written by Rich Felker in 2010; no copyright is claimed. 3 | * This code is in the public domain. Attribution is appreciated but 4 | * unnecessary. 5 | */ 6 | 7 | #include 8 | 9 | size_t mbsnrtowcs(wchar_t *restrict wcs, const char **restrict src, size_t n, size_t wn, mbstate_t *restrict st) 10 | { 11 | size_t l, cnt=0, n2; 12 | wchar_t *ws, wbuf[256]; 13 | const char *s = *src; 14 | 15 | if (!wcs) ws = wbuf, wn = sizeof wbuf / sizeof *wbuf; 16 | else ws = wcs; 17 | 18 | /* making sure output buffer size is at most n/4 will ensure 19 | * that mbsrtowcs never reads more than n input bytes. thus 20 | * we can use mbsrtowcs as long as it's practical.. */ 21 | 22 | while ( s && wn && ( (n2=n/4)>=wn || n2>32 ) ) { 23 | if (n2>=wn) n2=wn; 24 | n -= n2; 25 | l = mbsrtowcs(ws, &s, n2, st); 26 | if (!(l+1)) { 27 | cnt = l; 28 | wn = 0; 29 | break; 30 | } 31 | if (ws != wbuf) { 32 | ws += l; 33 | wn -= l; 34 | } 35 | cnt += l; 36 | } 37 | if (s) while (wn && n) { 38 | l = mbrtowc(ws, s, n, st); 39 | if (l+2<=2) { 40 | if (!(l+1)) { 41 | cnt = l; 42 | break; 43 | } 44 | if (!l) { 45 | s = 0; 46 | break; 47 | } 48 | /* have to roll back partial character */ 49 | *(unsigned *)st = 0; 50 | break; 51 | } 52 | s += l; n -= l; 53 | /* safe - this loop runs fewer than sizeof(wbuf)/8 times */ 54 | ws++; wn--; 55 | cnt++; 56 | } 57 | if (wcs) *src = s; 58 | return cnt; 59 | } 60 | -------------------------------------------------------------------------------- /external/libvmc/packages/libandroid-support/sources/src/musl-multibyte/mbsrtowcs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was written by Rich Felker in 2010; no copyright is claimed. 3 | * This code is in the public domain. Attribution is appreciated but 4 | * unnecessary. 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include "internal.h" 11 | 12 | size_t mbsrtowcs(wchar_t *restrict ws, const char **restrict src, size_t wn, mbstate_t *restrict st) 13 | { 14 | const unsigned char *s = (const void *)*src; 15 | size_t wn0 = wn; 16 | unsigned c = 0; 17 | 18 | if (st && (c = *(unsigned *)st)) { 19 | if (ws) { 20 | *(unsigned *)st = 0; 21 | goto resume; 22 | } else { 23 | goto resume0; 24 | } 25 | } 26 | 27 | if (!ws) for (;;) { 28 | if (*s-1u < 0x7f && (uintptr_t)s%4 == 0) { 29 | while (!(( *(uint32_t*)s | *(uint32_t*)s-0x01010101) & 0x80808080)) { 30 | s += 4; 31 | wn -= 4; 32 | } 33 | } 34 | if (*s-1u < 0x7f) { 35 | s++; 36 | wn--; 37 | continue; 38 | } 39 | if (*s-SA > SB-SA) break; 40 | c = bittab[*s++-SA]; 41 | resume0: 42 | if (OOB(c,*s)) { s--; break; } 43 | s++; 44 | if (c&(1U<<25)) { 45 | if (*s-0x80u >= 0x40) { s-=2; break; } 46 | s++; 47 | if (c&(1U<<19)) { 48 | if (*s-0x80u >= 0x40) { s-=3; break; } 49 | s++; 50 | } 51 | } 52 | wn--; 53 | c = 0; 54 | } else for (;;) { 55 | if (!wn) { 56 | *src = (const void *)s; 57 | return wn0; 58 | } 59 | if (*s-1u < 0x7f && (uintptr_t)s%4 == 0) { 60 | while (wn>=5 && !(( *(uint32_t*)s | *(uint32_t*)s-0x01010101) & 0x80808080)) { 61 | *ws++ = *s++; 62 | *ws++ = *s++; 63 | *ws++ = *s++; 64 | *ws++ = *s++; 65 | wn -= 4; 66 | } 67 | } 68 | if (*s-1u < 0x7f) { 69 | *ws++ = *s++; 70 | wn--; 71 | continue; 72 | } 73 | if (*s-SA > SB-SA) break; 74 | c = bittab[*s++-SA]; 75 | resume: 76 | if (OOB(c,*s)) { s--; break; } 77 | c = (c<<6) | *s++-0x80; 78 | if (c&(1U<<31)) { 79 | if (*s-0x80u >= 0x40) { s-=2; break; } 80 | c = (c<<6) | *s++-0x80; 81 | if (c&(1U<<31)) { 82 | if (*s-0x80u >= 0x40) { s-=3; break; } 83 | c = (c<<6) | *s++-0x80; 84 | } 85 | } 86 | *ws++ = c; 87 | wn--; 88 | c = 0; 89 | } 90 | 91 | if (!c && !*s) { 92 | if (ws) { 93 | *ws = 0; 94 | *src = 0; 95 | } 96 | return wn0-wn; 97 | } 98 | errno = EILSEQ; 99 | if (ws) *src = (const void *)s; 100 | return -1; 101 | } 102 | -------------------------------------------------------------------------------- /external/libvmc/packages/libffi/0001-fix-hardcoded-paths.patch: -------------------------------------------------------------------------------- 1 | diff -uNr libffi-3.2.1/src/closures.c libffi-3.2.1.mod/src/closures.c 2 | --- libffi-3.2.1/src/closures.c 2014-11-08 14:47:24.000000000 +0200 3 | +++ libffi-3.2.1.mod/src/closures.c 2019-12-14 20:27:56.006489582 +0200 4 | @@ -391,10 +391,10 @@ 5 | int repeat; 6 | } open_temp_exec_file_opts[] = { 7 | { open_temp_exec_file_env, "TMPDIR", 0 }, 8 | - { open_temp_exec_file_dir, "/tmp", 0 }, 9 | - { open_temp_exec_file_dir, "/var/tmp", 0 }, 10 | - { open_temp_exec_file_dir, "/dev/shm", 0 }, 11 | + { open_temp_exec_file_env, "APP_RUNTIME_DIR", 0 }, 12 | { open_temp_exec_file_env, "HOME", 0 }, 13 | + { open_temp_exec_file_dir, "/data/local/tmp", 0 }, 14 | + { open_temp_exec_file_dir, "/dev/shm", 0 }, 15 | #ifdef HAVE_MNTENT 16 | { open_temp_exec_file_mnt, "/etc/mtab", 1 }, 17 | { open_temp_exec_file_mnt, "/proc/mounts", 1 }, 18 | -------------------------------------------------------------------------------- /external/libvmc/packages/libffi/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION="3.3" 2 | PACKAGE_SRCURL="ftp://sourceware.org/pub/libffi/libffi-${PACKAGE_VERSION}.tar.gz" 3 | PACKAGE_SHA256="72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056" 4 | PACKAGE_EXTRA_CONFIGURE_ARGS="--disable-multi-os-directory" 5 | 6 | builder_step_pre_configure() { 7 | if [ "$PACKAGE_TARGET_ARCH" = "arm" ]; then 8 | CFLAGS+=" -fno-integrated-as" 9 | fi 10 | autoconf 11 | } 12 | 13 | builder_step_post_configure() { 14 | # Work around since mmap can't be written and marked 15 | # executable in android anymore from userspace. 16 | echo "#define FFI_MMAP_EXEC_WRIT 1" >> fficonfig.h 17 | } 18 | -------------------------------------------------------------------------------- /external/libvmc/packages/libiconv/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION=1.16 2 | PACKAGE_SRCURL=https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$PACKAGE_VERSION.tar.gz 3 | PACKAGE_SHA256=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04 4 | PACKAGE_EXTRA_CONFIGURE_ARGS="--enable-extra-encodings" 5 | -------------------------------------------------------------------------------- /external/libvmc/packages/pixman/0000-fix-pkgconfig-defs.patch: -------------------------------------------------------------------------------- 1 | diff -uNr pixman-0.40.0/pixman-1.pc.in pixman-0.40.0.mod/pixman-1.pc.in 2 | --- pixman-0.40.0/pixman-1.pc.in 2019-10-27 19:00:11.000000000 +0200 3 | +++ pixman-0.40.0.mod/pixman-1.pc.in 2020-12-09 19:10:37.842617519 +0200 4 | @@ -7,5 +7,5 @@ 5 | Description: The pixman library (version 1) 6 | Version: @PACKAGE_VERSION@ 7 | Cflags: -I${includedir}/pixman-1 8 | -Libs: -L${libdir} -lpixman-1 9 | +Libs: -L${libdir} -lpixman-1 -landroid-cpufeatures 10 | 11 | -------------------------------------------------------------------------------- /external/libvmc/packages/pixman/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION="0.40.0" 2 | PACKAGE_SRCURL="https://cairographics.org/releases/pixman-${PACKAGE_VERSION}.tar.gz" 3 | PACKAGE_SHA256="6d200dec3740d9ec4ec8d1180e25779c00bc749f94278c8b9021f5534db223fc" 4 | PACKAGE_DEPENDS="libandroid-cpufeatures" 5 | 6 | PACKAGE_EXTRA_CONFIGURE_ARGS=" 7 | --disable-loongson-mmi 8 | --disable-vmx 9 | --disable-arm-iwmmxt 10 | --disable-arm-iwmmxt2 11 | " 12 | 13 | builder_step_pre_configure() { 14 | export LIBS="-landroid-cpufeatures" 15 | 16 | if [ "$PACKAGE_TARGET_ARCH" = "arm" ]; then 17 | CFLAGS+=" -fno-integrated-as" 18 | PACKAGE_EXTRA_CONFIGURE_ARGS+=" --enable-arm-simd" 19 | PACKAGE_EXTRA_CONFIGURE_ARGS+=" --enable-arm-neon" 20 | elif [ "$PACKAGE_TARGET_ARCH" = "i686" ] || [ "$PACKAGE_TARGET_ARCH" = "x86_64" ]; then 21 | PACKAGE_EXTRA_CONFIGURE_ARGS+=" --enable-mmx" 22 | PACKAGE_EXTRA_CONFIGURE_ARGS+=" --enable-sse2" 23 | PACKAGE_EXTRA_CONFIGURE_ARGS+=" --enable-ssse3" 24 | fi 25 | } 26 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0000-android-config-support.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-6.1.0/meson.build qemu-6.1.0.mod/meson.build 2 | --- qemu-6.1.0/meson.build 2021-08-24 20:35:41.000000000 +0300 3 | +++ qemu-6.1.0.mod/meson.build 2021-08-25 16:17:56.185294702 +0300 4 | @@ -1508,7 +1508,7 @@ 5 | } 6 | endif 7 | 8 | -have_ivshmem = config_host_data.get('CONFIG_EVENTFD') 9 | +have_ivshmem = false 10 | host_kconfig = \ 11 | ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \ 12 | ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \ 13 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0002-fix-soundcard.h-location.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-4.2.0/audio/ossaudio.c qemu-4.2.0.mod/audio/ossaudio.c 2 | --- qemu-4.2.0/audio/ossaudio.c 2019-12-12 20:20:47.000000000 +0200 3 | +++ qemu-4.2.0.mod/audio/ossaudio.c 2019-12-15 00:04:31.280813450 +0200 4 | @@ -24,7 +24,7 @@ 5 | 6 | #include "qemu/osdep.h" 7 | #include 8 | -#include 9 | +#include 10 | #include "qemu/main-loop.h" 11 | #include "qemu/module.h" 12 | #include "qemu/host-utils.h" 13 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0003-fix-time_nsec-defs.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-4.2.0/fsdev/9p-marshal.h qemu-4.2.0.mod/fsdev/9p-marshal.h 2 | --- qemu-4.2.0/fsdev/9p-marshal.h 2019-12-12 20:20:47.000000000 +0200 3 | +++ qemu-4.2.0.mod/fsdev/9p-marshal.h 2019-12-15 00:09:59.586176320 +0200 4 | @@ -48,6 +48,18 @@ 5 | int64_t mtime_nsec; 6 | } V9fsIattr; 7 | 8 | +#ifdef st_atime_nsec 9 | +# undef st_atime_nsec 10 | +#endif 11 | + 12 | +#ifdef st_mtime_nsec 13 | +# undef st_mtime_nsec 14 | +#endif 15 | + 16 | +#ifdef st_ctime_nsec 17 | +# undef st_ctime_nsec 18 | +#endif 19 | + 20 | typedef struct V9fsStatDotl { 21 | uint64_t st_result_mask; 22 | V9fsQID qid; 23 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0004-add-missing-telldir-seekdir.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-4.2.0/hw/9pfs/9p-local.c qemu-4.2.0.mod/hw/9pfs/9p-local.c 2 | --- qemu-4.2.0/hw/9pfs/9p-local.c 2019-12-12 20:20:47.000000000 +0200 3 | +++ qemu-4.2.0.mod/hw/9pfs/9p-local.c 2019-12-15 00:12:11.073725293 +0200 4 | @@ -535,9 +535,23 @@ 5 | rewinddir(fs->dir.stream); 6 | } 7 | 8 | +struct DIR { 9 | + int fd_; 10 | +}; 11 | + 12 | +static long android_telldir(struct DIR *dirp) 13 | +{ 14 | + return (long) lseek(dirp->fd_, 0, SEEK_CUR); 15 | +} 16 | + 17 | +static void android_seekdir(DIR *dirp, long loc) 18 | +{ 19 | + (void) lseek(dirp->fd_, loc, SEEK_SET); 20 | +} 21 | + 22 | static off_t local_telldir(FsContext *ctx, V9fsFidOpenState *fs) 23 | { 24 | - return telldir(fs->dir.stream); 25 | + return android_telldir(fs->dir.stream); 26 | } 27 | 28 | static bool local_is_mapped_file_metadata(FsContext *fs_ctx, const char *name) 29 | @@ -571,7 +585,7 @@ 30 | 31 | static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) 32 | { 33 | - seekdir(fs->dir.stream, off); 34 | + android_seekdir(fs->dir.stream, off); 35 | } 36 | 37 | static ssize_t local_preadv(FsContext *ctx, V9fsFidOpenState *fs, 38 | diff -uNr qemu-4.2.0/hw/9pfs/9p-proxy.c qemu-4.2.0.mod/hw/9pfs/9p-proxy.c 39 | --- qemu-4.2.0/hw/9pfs/9p-proxy.c 2019-12-12 20:20:47.000000000 +0200 40 | +++ qemu-4.2.0.mod/hw/9pfs/9p-proxy.c 2019-12-15 00:12:11.074725297 +0200 41 | @@ -675,9 +675,23 @@ 42 | rewinddir(fs->dir.stream); 43 | } 44 | 45 | +struct DIR { 46 | + int fd_; 47 | +}; 48 | + 49 | +static long android_telldir(struct DIR *dirp) 50 | +{ 51 | + return (long) lseek(dirp->fd_, 0, SEEK_CUR); 52 | +} 53 | + 54 | +static void android_seekdir(DIR *dirp, long loc) 55 | +{ 56 | + (void) lseek(dirp->fd_, loc, SEEK_SET); 57 | +} 58 | + 59 | static off_t proxy_telldir(FsContext *ctx, V9fsFidOpenState *fs) 60 | { 61 | - return telldir(fs->dir.stream); 62 | + return android_telldir(fs->dir.stream); 63 | } 64 | 65 | static struct dirent *proxy_readdir(FsContext *ctx, V9fsFidOpenState *fs) 66 | @@ -687,7 +701,7 @@ 67 | 68 | static void proxy_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) 69 | { 70 | - seekdir(fs->dir.stream, off); 71 | + android_seekdir(fs->dir.stream, off); 72 | } 73 | 74 | static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs, 75 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0005-add-missing-sigorset.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-4.2.0/linux-user/signal.c qemu-4.2.0.mod/linux-user/signal.c 2 | --- qemu-4.2.0/linux-user/signal.c 2019-12-12 20:20:48.000000000 +0200 3 | +++ qemu-4.2.0.mod/linux-user/signal.c 2019-12-15 00:15:27.954549467 +0200 4 | @@ -182,6 +182,27 @@ 5 | return atomic_xchg(&ts->signal_pending, 1); 6 | } 7 | 8 | +#ifdef _NSIG_WORDS 9 | +static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b) 10 | +{ 11 | + int i; 12 | + if (!dest || !a || !b) 13 | + return -1; 14 | + for (i = 0; i < _NSIG_WORDS; i++) 15 | + dest->sig[i] = a->sig[i] | b->sig[i]; 16 | + return 0; 17 | +} 18 | +#else 19 | +static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b) 20 | +{ 21 | + int i; 22 | + if (!dest || !a || !b) 23 | + return -1; 24 | + *dest = *a | *b; 25 | + return 0; 26 | +} 27 | +#endif 28 | + 29 | /* Wrapper for sigprocmask function 30 | * Emulates a sigprocmask in a safe way for the guest. Note that set and oldset 31 | * are host signal set, not guest ones. Returns -TARGET_ERESTARTSYS if 32 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0006-fix-sem.h-location.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-4.2.0/linux-user/strace.c qemu-4.2.0.mod/linux-user/strace.c 2 | --- qemu-4.2.0/linux-user/strace.c 2019-12-12 20:20:48.000000000 +0200 3 | +++ qemu-4.2.0.mod/linux-user/strace.c 2019-12-15 00:18:22.178280369 +0200 4 | @@ -1,7 +1,7 @@ 5 | #include "qemu/osdep.h" 6 | #include 7 | #include 8 | -#include 9 | +#include 10 | #include 11 | #include 12 | #include 13 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0008-fix-struct-member-conflicts.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-4.2.0/linux-user/aarch64/signal.c qemu-4.2.0.mod/linux-user/aarch64/signal.c 2 | --- qemu-4.2.0/linux-user/aarch64/signal.c 2019-12-12 20:20:48.000000000 +0200 3 | +++ qemu-4.2.0.mod/linux-user/aarch64/signal.c 2019-12-15 00:25:43.651300812 +0200 4 | @@ -38,7 +38,7 @@ 5 | target_stack_t tuc_stack; 6 | target_sigset_t tuc_sigmask; 7 | /* glibc uses a 1024-bit sigset_t */ 8 | - char __unused[1024 / 8 - sizeof(target_sigset_t)]; 9 | + char __qemu_unused[1024 / 8 - sizeof(target_sigset_t)]; 10 | /* last for future expansion */ 11 | struct target_sigcontext tuc_mcontext; 12 | }; 13 | diff -uNr qemu-4.2.0/linux-user/arm/signal.c qemu-4.2.0.mod/linux-user/arm/signal.c 14 | --- qemu-4.2.0/linux-user/arm/signal.c 2019-12-12 20:20:48.000000000 +0200 15 | +++ qemu-4.2.0.mod/linux-user/arm/signal.c 2019-12-15 00:25:43.651300812 +0200 16 | @@ -59,7 +59,7 @@ 17 | target_stack_t tuc_stack; 18 | struct target_sigcontext tuc_mcontext; 19 | target_sigset_t tuc_sigmask; /* mask last for extensibility */ 20 | - char __unused[128 - sizeof(target_sigset_t)]; 21 | + char __qemu_unused[128 - sizeof(target_sigset_t)]; 22 | abi_ulong tuc_regspace[128] __attribute__((__aligned__(8))); 23 | }; 24 | 25 | diff -uNr qemu-4.2.0/linux-user/syscall_defs.h qemu-4.2.0.mod/linux-user/syscall_defs.h 26 | --- qemu-4.2.0/linux-user/syscall_defs.h 2019-12-12 20:20:48.000000000 +0200 27 | +++ qemu-4.2.0.mod/linux-user/syscall_defs.h 2019-12-15 00:25:43.652300818 +0200 28 | @@ -1794,7 +1794,7 @@ 29 | abi_ulong target_st_mtime_nsec; 30 | abi_ulong target_st_ctime; 31 | abi_ulong target_st_ctime_nsec; 32 | - abi_long __unused[3]; 33 | + abi_long __qemu_unused[3]; 34 | }; 35 | 36 | #elif defined(TARGET_SH4) 37 | @@ -1881,7 +1881,7 @@ 38 | abi_ulong target_st_ctime; 39 | abi_ulong target_st_ctime_nsec; 40 | 41 | - abi_long __unused[3]; 42 | + abi_long __qemu_unused[3]; 43 | }; 44 | #elif defined(TARGET_S390X) 45 | struct target_stat { 46 | @@ -1902,7 +1902,7 @@ 47 | abi_ulong target_st_ctime_nsec; 48 | abi_ulong st_blksize; 49 | abi_long st_blocks; 50 | - abi_ulong __unused[3]; 51 | + abi_ulong __qemu_unused[3]; 52 | }; 53 | #elif defined(TARGET_AARCH64) 54 | #define TARGET_STAT_HAVE_NSEC 55 | @@ -1925,7 +1925,7 @@ 56 | abi_ulong target_st_mtime_nsec; 57 | abi_long target_st_ctime; 58 | abi_ulong target_st_ctime_nsec; 59 | - unsigned int __unused[2]; 60 | + unsigned int __qemu_unused[2]; 61 | }; 62 | #elif defined(TARGET_XTENSA) 63 | #define TARGET_STAT_HAVE_NSEC 64 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0010-disable-glob.h-include.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-4.2.0/util/drm.c qemu-4.2.0.mod/util/drm.c 2 | --- qemu-4.2.0/util/drm.c 2019-12-12 20:20:48.000000000 +0200 3 | +++ qemu-4.2.0.mod/util/drm.c 2019-12-15 02:18:23.537494928 +0200 4 | @@ -17,7 +17,6 @@ 5 | #include "qemu/osdep.h" 6 | #include "qemu/drm.h" 7 | 8 | -#include 9 | #include 10 | 11 | int qemu_drm_rendernode_open(const char *rendernode) 12 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0011-misc-build-fixes.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-5.2.0/include/qapi/util.h qemu-5.2.0.mod/include/qapi/util.h 2 | --- qemu-5.2.0/include/qapi/util.h 2020-12-08 18:59:44.000000000 +0200 3 | +++ qemu-5.2.0.mod/include/qapi/util.h 2020-12-09 17:15:41.400859913 +0200 4 | @@ -11,6 +11,10 @@ 5 | #ifndef QAPI_UTIL_H 6 | #define QAPI_UTIL_H 7 | 8 | +#include 9 | + 10 | +typedef struct Error Error; 11 | + 12 | typedef struct QEnumLookup { 13 | const char *const *array; 14 | int size; 15 | diff -uNr qemu-5.2.0/meson.build qemu-5.2.0.mod/meson.build 16 | --- qemu-5.2.0/meson.build 2020-12-08 18:59:44.000000000 +0200 17 | +++ qemu-5.2.0.mod/meson.build 2020-12-09 17:18:04.165911853 +0200 18 | @@ -94,11 +94,11 @@ 19 | 20 | # Specify linker-script with add_project_link_arguments so that it is not placed 21 | # within a linker --start-group/--end-group pair 22 | -if 'CONFIG_FUZZ' in config_host 23 | - add_project_link_arguments(['-Wl,-T,', 24 | - (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')], 25 | - native: false, language: ['c', 'cpp', 'objc']) 26 | -endif 27 | +#if 'CONFIG_FUZZ' in config_host 28 | +# add_project_link_arguments(['-Wl,-T,', 29 | +# (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')], 30 | +# native: false, language: ['c', 'cpp', 'objc']) 31 | +#endif 32 | 33 | add_project_arguments(config_host['QEMU_CFLAGS'].split(), 34 | native: false, language: ['c', 'objc']) 35 | @@ -1575,8 +1575,8 @@ 36 | specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) 37 | 38 | # needed for fuzzing binaries 39 | -subdir('tests/qtest/libqos') 40 | -subdir('tests/qtest/fuzz') 41 | +#subdir('tests/qtest/libqos') 42 | +#subdir('tests/qtest/fuzz') 43 | 44 | ######################## 45 | # Library dependencies # 46 | diff -uNr qemu-5.2.0/tests/meson.build qemu-5.2.0.mod/tests/meson.build 47 | --- qemu-5.2.0/tests/meson.build 2020-12-08 18:59:44.000000000 +0200 48 | +++ qemu-5.2.0.mod/tests/meson.build 2020-12-09 17:24:07.616614694 +0200 49 | @@ -286,5 +286,4 @@ 50 | endif 51 | 52 | subdir('qapi-schema') 53 | -subdir('qtest') 54 | subdir('migration') 55 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0012-add-missing-arch_prctl.patch: -------------------------------------------------------------------------------- 1 | --- qemu-4.2.0/tcg/i386/tcg-target.c.inc 2 | +++ qemu-4.2.0.mod/tcg/i386/tcg-target.c.inc 3 | @@ -1968,7 +1968,12 @@ 4 | # if defined(__x86_64__) && defined(__linux__) 5 | # include 6 | # include 7 | -int arch_prctl(int code, unsigned long addr); 8 | +# include 9 | +static int arch_prctl(int code, unsigned long addr) 10 | +{ 11 | + return syscall(__NR_arch_prctl, code, addr); 12 | +} 13 | + 14 | static inline int setup_guest_base_seg(void) 15 | { 16 | if (arch_prctl(ARCH_SET_GS, guest_base) == 0) { 17 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0014-app_dns-from-envvar.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-6.1.0/slirp/src/slirp.c qemu-6.1.0.mod/slirp/src/slirp.c 2 | --- qemu-6.1.0/slirp/src/slirp.c 2021-10-23 20:19:38.700663146 +0300 3 | +++ qemu-6.1.0.mod/slirp/src/slirp.c 2021-10-23 20:59:41.510786510 +0300 4 | @@ -256,7 +256,6 @@ 5 | { 6 | char buff[512]; 7 | char buff2[257]; 8 | - FILE *f; 9 | int found = 0; 10 | union { 11 | struct in_addr dns_addr; 12 | @@ -265,16 +264,16 @@ 13 | unsigned if_index; 14 | 15 | assert(sizeof(tmp_addr) >= addrlen); 16 | - char *prefixed_resolvconf_path = android_dynamic_path_prefix(RESOLV_CONF_PATH); 17 | - f = fopen(prefixed_resolvconf_path, "r"); 18 | - if (!f) { 19 | - free(prefixed_resolvconf_path); 20 | - return -1; 21 | - } 22 | - free(prefixed_resolvconf_path); 23 | + 24 | + const char *env_dns4 = getenv("CONFIG_QEMU_DNS"); 25 | + if (!env_dns4) env_dns4 = "1.1.1.1"; 26 | + const char *env_dns6 = getenv("CONFIG_QEMU_DNS6"); 27 | + if (!env_dns6) env_dns6 = "2606:4700:4700::1111"; 28 | + snprintf(buff, 512, "nameserver %s\nnameserver %s\n", env_dns4, env_dns6); 29 | 30 | DEBUG_MISC("IP address of your DNS(s):"); 31 | - while (fgets(buff, 512, f) != NULL) { 32 | + char *resolvconf_token = strtok(buff, "\n"); 33 | + while (resolvconf_token) { 34 | if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) { 35 | char *c = strchr(buff2, '%'); 36 | if (c) { 37 | @@ -285,6 +284,7 @@ 38 | } 39 | 40 | if (!inet_pton(af, buff2, &tmp_addr)) { 41 | + resolvconf_token = strtok(NULL, "\n"); 42 | continue; 43 | } 44 | /* If it's the first one, set it to dns_addr */ 45 | @@ -309,8 +309,8 @@ 46 | DEBUG_MISC(" %s", res); 47 | } 48 | } 49 | + resolvconf_token = strtok(NULL, "\n"); 50 | } 51 | - fclose(f); 52 | if (!found) 53 | return -1; 54 | return 0; 55 | @@ -318,6 +318,7 @@ 56 | 57 | int get_dns_addr(struct in_addr *pdns_addr) 58 | { 59 | +#if 0 60 | static struct stat dns_addr_stat; 61 | 62 | if (dns_addr.s_addr != 0) { 63 | @@ -328,12 +329,14 @@ 64 | return ret; 65 | } 66 | } 67 | +#endif 68 | return get_dns_addr_resolv_conf(AF_INET, pdns_addr, &dns_addr, 69 | sizeof(dns_addr), NULL, &dns_addr_time); 70 | } 71 | 72 | int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id) 73 | { 74 | +#if 0 75 | static struct stat dns6_addr_stat; 76 | 77 | if (!in6_zero(&dns6_addr)) { 78 | @@ -344,6 +347,7 @@ 79 | return ret; 80 | } 81 | } 82 | +#endif 83 | return get_dns_addr_resolv_conf(AF_INET6, pdns6_addr, &dns6_addr, 84 | sizeof(dns6_addr), scope_id, 85 | &dns6_addr_time); 86 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0015-app_no-libcap-attr-deps.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-6.1.0/meson.build qemu-6.1.0.mod/meson.build 2 | --- qemu-6.1.0/meson.build 2021-08-25 18:10:11.326652683 +0300 3 | +++ qemu-6.1.0.mod/meson.build 2021-08-25 18:11:06.867091838 +0300 4 | @@ -1201,12 +1201,9 @@ 5 | # config-host.h # 6 | ################# 7 | 8 | -have_virtfs = (targetos == 'linux' and 9 | - have_system and 10 | - libattr.found() and 11 | - libcap_ng.found()) 12 | +have_virtfs = true 13 | 14 | -have_virtfs_proxy_helper = have_virtfs and have_tools 15 | +have_virtfs_proxy_helper = false 16 | 17 | if get_option('virtfs').enabled() 18 | if not have_virtfs 19 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0017-9pfs-dont-chmod-mapfile.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-5.2.0/hw/9pfs/9p-local.c qemu-5.2.0.mod/hw/9pfs/9p-local.c 2 | --- qemu-5.2.0/hw/9pfs/9p-local.c 2020-12-08 18:59:44.000000000 +0200 3 | +++ qemu-5.2.0.mod/hw/9pfs/9p-local.c 2021-08-07 17:01:43.567841976 +0300 4 | @@ -299,8 +299,6 @@ 5 | 6 | map_fd = fileno(fp); 7 | assert(map_fd != -1); 8 | - ret = fchmod(map_fd, 0600); 9 | - assert(ret == 0); 10 | 11 | if (credp->fc_uid != -1) { 12 | uid = credp->fc_uid; 13 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0018-iconv.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-6.1.0/meson.build qemu-6.1.0.mod/meson.build 2 | --- qemu-6.1.0/meson.build 2021-08-25 19:52:27.673921612 +0300 3 | +++ qemu-6.1.0.mod/meson.build 2021-08-25 20:09:20.496591469 +0300 4 | @@ -310,7 +310,7 @@ 5 | add_project_arguments(config_host['GLIB_CFLAGS'].split(), 6 | native: false, language: ['c', 'cpp', 'objc']) 7 | glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(), 8 | - link_args: config_host['GLIB_LIBS'].split()) 9 | + link_args: config_host['GLIB_LIBS'].split() + ['-liconv']) 10 | # override glib dep with the configure results (for subprojects) 11 | meson.override_dependency('glib-2.0', glib) 12 | 13 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/0019-disable-signalfd.patch: -------------------------------------------------------------------------------- 1 | diff -uNr qemu-6.1.0/meson.build qemu-6.1.0.mod/meson.build 2 | --- qemu-6.1.0/meson.build 2021-08-25 21:20:39.873631512 +0300 3 | +++ qemu-6.1.0.mod/meson.build 2021-08-25 21:21:35.135670419 +0300 4 | @@ -1411,11 +1411,6 @@ 5 | #include 6 | #include 7 | int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }''')) 8 | -config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + ''' 9 | - #include 10 | - #include 11 | - #include 12 | - int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }''')) 13 | config_host_data.set('CONFIG_SPLICE', cc.links(gnu_source_prefix + ''' 14 | #include 15 | #include 16 | -------------------------------------------------------------------------------- /external/libvmc/packages/qemu-system/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION="6.1.0" 2 | PACKAGE_SRCURL="https://download.qemu.org/qemu-${PACKAGE_VERSION}.tar.xz" 3 | PACKAGE_SHA256="eebc089db3414bbeedf1e464beda0a7515aad30f73261abc246c9b27503a3c96" 4 | PACKAGE_DEPENDS="glib, libiconv, pixman, zlib" 5 | PACKAGE_BUILD_IN_SRC="true" 6 | 7 | builder_step_configure() { 8 | CFLAGS+=" $CPPFLAGS" 9 | CXXFLAGS+=" $CPPFLAGS" 10 | 11 | if [ "$PACKAGE_TARGET_ARCH" = "i686" ]; then 12 | LDFLAGS+=" -latomic" 13 | fi 14 | 15 | # Note: using --disable-stack-protector since stack protector 16 | # flags already passed by build scripts but we do not want to 17 | # override them with what QEMU configure provides. 18 | ./configure \ 19 | --prefix="$PACKAGE_INSTALL_PREFIX" \ 20 | --cross-prefix="${PACKAGE_TARGET_PLATFORM}-" \ 21 | --host-cc="gcc" \ 22 | --cc="$CC" \ 23 | --cxx="$CXX" \ 24 | --objcc="$CC" \ 25 | --disable-stack-protector \ 26 | --smbd="/system/bin/smbd" \ 27 | --enable-coroutine-pool \ 28 | --enable-trace-backends=nop \ 29 | --disable-guest-agent \ 30 | --disable-gnutls \ 31 | --disable-nettle \ 32 | --disable-gcrypt \ 33 | --disable-sdl \ 34 | --disable-sdl-image \ 35 | --disable-gtk \ 36 | --disable-vte \ 37 | --disable-curses \ 38 | --disable-iconv \ 39 | --disable-vnc \ 40 | --disable-vnc-sasl \ 41 | --disable-vnc-jpeg \ 42 | --disable-vnc-png \ 43 | --disable-xen \ 44 | --disable-xen-pci-passthrough \ 45 | --enable-virtfs \ 46 | --disable-curl \ 47 | --disable-fdt \ 48 | --disable-kvm \ 49 | --disable-hax \ 50 | --disable-hvf \ 51 | --disable-whpx \ 52 | --disable-libnfs \ 53 | --disable-libusb \ 54 | --disable-lzo \ 55 | --disable-snappy \ 56 | --disable-bzip2 \ 57 | --disable-lzfse \ 58 | --disable-seccomp \ 59 | --disable-libssh \ 60 | --disable-libxml2 \ 61 | --disable-bochs \ 62 | --disable-cloop \ 63 | --disable-dmg \ 64 | --disable-parallels \ 65 | --disable-qed \ 66 | --disable-vhost-user \ 67 | --disable-vhost-user-blk-server \ 68 | --disable-tools \ 69 | --target-list=x86_64-softmmu 70 | } 71 | 72 | builder_step_post_make_install() { 73 | local bindir 74 | 75 | case "$PACKAGE_TARGET_ARCH" in 76 | aarch64) bindir="arm64-v8a";; 77 | arm) bindir="armeabi-v7a";; 78 | i686) bindir="x86";; 79 | x86_64) bindir="x86_64";; 80 | *) echo "Invalid architecture '$PACKAGE_TARGET_ARCH'" && return 1;; 81 | esac 82 | 83 | install -Dm600 "$PACKAGE_INSTALL_PREFIX"/lib/libqemu-system-x86_64.so \ 84 | "${BUILDER_SCRIPTDIR}/jniLibs/${bindir}/libVMC.so" 85 | "$STRIP" -s "${BUILDER_SCRIPTDIR}/jniLibs/${bindir}/libVMC.so" 86 | } 87 | -------------------------------------------------------------------------------- /external/libvmc/packages/zlib/build.sh: -------------------------------------------------------------------------------- 1 | PACKAGE_VERSION="1.2.12" 2 | PACKAGE_SRCURL="https://www.zlib.net/zlib-$PACKAGE_VERSION.tar.xz" 3 | PACKAGE_SHA256="7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18" 4 | 5 | builder_step_configure() { 6 | CFLAGS+=" $CPPFLAGS -fPIC" 7 | LDFLAGS+=" -fPIC" 8 | "$PACKAGE_SRCDIR"/configure \ 9 | --prefix="$PACKAGE_INSTALL_PREFIX" --static 10 | } 11 | -------------------------------------------------------------------------------- /external/libvmc/scripts/Dockerfile: -------------------------------------------------------------------------------- 1 | # Build with: 2 | # docker build -t libvmc-buildenv . 3 | FROM ubuntu:20.04 4 | 5 | # Fix locale to avoid warnings: 6 | ENV LANG C.UTF-8 7 | 8 | # Install necessary packages. 9 | ENV DEBIAN_FRONTEND noninteractive 10 | RUN apt update && apt upgrade -yq && \ 11 | apt install -yq --no-install-recommends \ 12 | automake autopoint bison ca-certificates curl flex g++ \ 13 | git gettext gperf libglib2.0-dev libtool-bin m4 make \ 14 | ninja-build pkg-config patch python3.8 sudo tar texinfo \ 15 | unzip xmlto zip 16 | 17 | # Setup user. 18 | RUN adduser --disabled-password --shell /bin/bash --gecos "" builder && \ 19 | echo "builder ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/builder && \ 20 | chmod 0440 /etc/sudoers.d/builder && \ 21 | mkdir -p /data && chown builder:builder /data 22 | 23 | # Install NDK toolchain. 24 | RUN curl --fail --retry 3 -o ndk.zip https://dl.google.com/android/repository/android-ndk-r20-Linux-x86_64.zip && \ 25 | unzip -q ndk.zip && rm -f ndk.zip 26 | COPY ./toolchain /tmp/toolchain 27 | RUN /tmp/toolchain/create-standalone-toolchain.sh android-ndk-r20 /home/builder/ndk-llvm-x86_64 && \ 28 | chown -Rh builder:builder /home/builder/ndk-llvm-x86_64 && \ 29 | rm -rf android-ndk-r20 30 | 31 | # Cleanup. 32 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* 33 | 34 | # Finish. 35 | USER builder 36 | RUN mkdir /home/builder/libvmc 37 | WORKDIR /home/builder/libvmc 38 | -------------------------------------------------------------------------------- /external/libvmc/scripts/run-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e -u 3 | 4 | REPOROOT=$(dirname "$(readlink -f "${0}")")/../ 5 | 6 | BUILDENV_USER="builder" 7 | BUILDENV_HOME="/home/builder" 8 | : "${BUILDENV_IMAGE_NAME:="libvmc-buildenv"}" 9 | : "${BUILDENV_CONTAINER_NAME:="libvmc-buildenv"}" 10 | : "${BUILDENV_RUN_WITH_SUDO:=false}" 11 | 12 | if [ "${BUILDENV_RUN_WITH_SUDO}" = "true" ]; then 13 | SUDO="sudo" 14 | else 15 | SUDO= 16 | fi 17 | 18 | if [ "${GITHUB_EVENT_PATH-x}" != "x" ]; then 19 | # On CI/CD tty may not be available. 20 | DOCKER_TTY="" 21 | else 22 | DOCKER_TTY="--tty" 23 | fi 24 | 25 | echo "Running container '${BUILDENV_CONTAINER_NAME}' from image '${BUILDENV_IMAGE_NAME}'..." 26 | 27 | $SUDO docker start "${BUILDENV_CONTAINER_NAME}" > /dev/null 2> /dev/null || { 28 | echo "Creating new container..." 29 | 30 | $SUDO docker run --detach --tty \ 31 | --name "${BUILDENV_CONTAINER_NAME}" \ 32 | --volume "${REPOROOT}:${BUILDENV_HOME}/libvmc" \ 33 | "${BUILDENV_IMAGE_NAME}" 34 | 35 | if [ "$(id -u)" -ne 1000 ] && [ "$(id -u)" -ne 0 ]; then 36 | echo "Changed builder uid/gid... (this may take a while)" 37 | $SUDO docker exec ${DOCKER_TTY} "${BUILDENV_CONTAINER_NAME}" \ 38 | sudo chown -Rh "$(id -u):$(id -g)" /data "${BUILDENV_HOME}" 39 | $SUDO docker exec ${DOCKER_TTY} "${BUILDENV_CONTAINER_NAME}" \ 40 | sudo usermod -u "$(id -u)" "${BUILDENV_USER}" 41 | $SUDO docker exec ${DOCKER_TTY} "${BUILDENV_CONTAINER_NAME}" \ 42 | sudo groupmod -g "$(id -g)" "${BUILDENV_USER}" 43 | fi 44 | } 45 | 46 | if [ "$#" -eq "0" ]; then 47 | $SUDO docker exec --interactive ${DOCKER_TTY} \ 48 | --user "${BUILDENV_USER}" \ 49 | "${BUILDENV_CONTAINER_NAME}" /bin/bash 50 | else 51 | $SUDO docker exec --interactive ${DOCKER_TTY} \ 52 | --user "${BUILDENV_USER}" \ 53 | "${BUILDENV_CONTAINER_NAME}" "${@}" 54 | fi 55 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/create-standalone-toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -u 4 | 5 | if [ $# -ne 2 ]; then 6 | echo "Usage: create-standalone-toolchain.sh [android ndk dir] [toolchain dir]" 7 | echo "Generate toolchain from the Android NDK and save it to specified directory." 8 | exit 1 9 | fi 10 | 11 | ANDROID_NDK_DIR=$1 12 | STANDALONE_TOOLCHAIN_DIR=$2 13 | STANDALONE_TOOLCHAIN_DIR_STAGING="${2}.tmp" 14 | SCRIPT_DIR=$(dirname "$(realpath "$0")") 15 | 16 | rm -rf "$STANDALONE_TOOLCHAIN_DIR_STAGING" 17 | 18 | cp -r "$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64" \ 19 | "$STANDALONE_TOOLCHAIN_DIR_STAGING" 20 | 21 | # Remove android-support header wrapping not needed on android-21: 22 | rm -Rf "$STANDALONE_TOOLCHAIN_DIR_STAGING/sysroot/usr/local" 23 | 24 | # Use gold by default to work around https://github.com/android-ndk/ndk/issues/148 25 | ln -sfr "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/aarch64-linux-android-ld.gold" \ 26 | "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/aarch64-linux-android-ld" 27 | ln -sfr "$STANDALONE_TOOLCHAIN_DIR_STAGING/aarch64-linux-android/bin/ld.gold" \ 28 | "$STANDALONE_TOOLCHAIN_DIR_STAGING/aarch64-linux-android/bin/ld" 29 | 30 | # Linker wrapper script to add '--exclude-libs libgcc.a', see 31 | # https://github.com/android-ndk/ndk/issues/379 32 | # https://android-review.googlesource.com/#/c/389852/ 33 | for linker in ld ld.bfd ld.gold; do 34 | wrap_linker="$STANDALONE_TOOLCHAIN_DIR_STAGING/arm-linux-androideabi/bin/$linker" 35 | real_linker="$STANDALONE_TOOLCHAIN_DIR_STAGING/arm-linux-androideabi/bin/$linker.real" 36 | cp "$wrap_linker" "$real_linker" 37 | echo '#!/bin/bash' > "$wrap_linker" 38 | echo -n '$(dirname $0)/' >> "$wrap_linker" 39 | echo -n $linker.real >> "$wrap_linker" 40 | echo ' --exclude-libs libunwind.a --exclude-libs libgcc_real.a "$@"' >> "$wrap_linker" 41 | done 42 | unset linker wrap_linker real_linker 43 | 44 | for api in {16..29}; do 45 | for host_plat in aarch64-linux-android armv7a-linux-androideabi i686-linux-android x86_64-linux-android; do 46 | if [ -e "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-clang" ]; then 47 | # Setup c/c++ preprocessor. 48 | cp "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-clang" \ 49 | "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-cpp" 50 | sed -i 's/clang/clang -E/' \ 51 | "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-cpp" 52 | 53 | # GCC link required by CMake. 54 | ln -sfr "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-clang" \ 55 | "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-gcc" 56 | fi 57 | 58 | if [ -e "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-clang++" ]; then 59 | # GCC link required by CMake. 60 | ln -sfr "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-clang++" \ 61 | "$STANDALONE_TOOLCHAIN_DIR_STAGING/bin/${host_plat}${api}-g++" 62 | fi 63 | done 64 | done 65 | unset api host_plat 66 | 67 | (cd "$STANDALONE_TOOLCHAIN_DIR_STAGING/sysroot" 68 | for f in "$SCRIPT_DIR"/ndk-patches/*.patch; do 69 | patch --silent -p1 -i $f 70 | done 71 | ) 72 | 73 | # langinfo.h: Inline implementation of nl_langinfo(). 74 | # iconv.h: Header for iconv, implemented in libandroid-support. 75 | cp "$SCRIPT_DIR"/ndk-headers/{libintl.h,langinfo.h,iconv.h} "$STANDALONE_TOOLCHAIN_DIR_STAGING/sysroot/usr/include/" 76 | 77 | # Remove because it is provided by libcap. 78 | # Remove from the NDK in favour of that from the libandroid-shmem. 79 | # Remove as it doesn't work for non-root. 80 | # Remove as we currently provide it from libandroid-glob. 81 | # Remove as it's only for future (later than android-27). 82 | # Remove and as we build our own zlib 83 | rm -f "$STANDALONE_TOOLCHAIN_DIR_STAGING"/sysroot/usr/include/sys/{capability.h,shm.h,sem.h} \ 84 | "$STANDALONE_TOOLCHAIN_DIR_STAGING"/sysroot/usr/include/{glob.h,spawn.h,zlib.h,zconf.h} 85 | 86 | # We want static libc++. 87 | for HOST_PLAT in aarch64-linux-android arm-linux-androideabi i686-linux-android x86_64-linux-android; do 88 | if [ "$HOST_PLAT" = "arm-linux-androideabi" ]; then 89 | echo "INPUT(-lc++_static -lc++abi -lunwind)" \ 90 | > "$STANDALONE_TOOLCHAIN_DIR_STAGING/sysroot/usr/lib/$HOST_PLAT/libc++_shared.so" 91 | else 92 | echo "INPUT(-lc++_static -lc++abi)" \ 93 | > "$STANDALONE_TOOLCHAIN_DIR_STAGING/sysroot/usr/lib/$HOST_PLAT/libc++_shared.so" 94 | fi 95 | done 96 | 97 | # Ensure that we use our libz.{so,a} instead of NDK's. 98 | find "$STANDALONE_TOOLCHAIN_DIR_STAGING/sysroot/usr/lib" -type f -iname "libz.*" -delete 99 | 100 | grep -lrw "$STANDALONE_TOOLCHAIN_DIR_STAGING/sysroot/usr/include/c++/v1" -e '' | xargs -n 1 sed -i 's//\"version\"/g' 101 | 102 | mv "$STANDALONE_TOOLCHAIN_DIR_STAGING" "$STANDALONE_TOOLCHAIN_DIR" 103 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-headers/iconv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in 12 | * the documentation and/or other materials provided with the 13 | * distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | */ 28 | #ifndef _ICONV_H 29 | #define _ICONV_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #include 36 | 37 | typedef void* iconv_t; 38 | 39 | iconv_t iconv_open(const char*, const char*); 40 | size_t iconv(iconv_t, char**, size_t*, char**, size_t*); 41 | int iconv_close(iconv_t); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-headers/libintl.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBINTL_H 2 | #define _LIBINTL_H 3 | 4 | #include 5 | #include 6 | 7 | static __inline__ char* gettext(const char* msgid) 8 | { return (char*) msgid; } 9 | 10 | static __inline__ char* dgettext(const char* domainname, const char* msgid) 11 | { return (char*) msgid; } 12 | 13 | static __inline__ char* dcgettext(const char* domainname, const char* msgid, int category) 14 | { return (char*) msgid; } 15 | 16 | static __inline__ char* ngettext(const char* msgid1, const char* msgid2, unsigned long int n) 17 | { return (char *) ((n == 1) ? msgid1 : msgid2); } 18 | 19 | static __inline__ char* dngettext(const char* domainname, const char* msgid1, const char* msgid2, unsigned long int n) 20 | { return (char *) ((n == 1) ? msgid1 : msgid2); } 21 | 22 | static __inline__ char* dcngettext(const char* domainname, const char* msgid1, const char* msgid2, unsigned long int n, int category) 23 | { return (char *) ((n == 1) ? msgid1 : msgid2); } 24 | 25 | static __inline__ char* textdomain(const char* domainname) 26 | { 27 | static const char default_str[] = "messages"; 28 | if (domainname && *domainname && strcmp(domainname, default_str)) { 29 | errno = EINVAL; 30 | return NULL; 31 | } 32 | return (char*) default_str; 33 | } 34 | 35 | static __inline__ char* bindtextdomain(const char* domainname, const char* dirname) 36 | { 37 | static const char dir[] = "/"; 38 | if (!domainname || !*domainname || (dirname && ((dirname[0] != '/') || dirname[1]))) { 39 | errno = EINVAL; 40 | return NULL; 41 | } 42 | return (char*) dir; 43 | } 44 | 45 | static __inline__ char* bind_textdomain_codeset(const char* domainname, const char* codeset) 46 | { 47 | if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) { 48 | errno = EINVAL; 49 | } 50 | return NULL; 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-patches/android_api-level.h.patch: -------------------------------------------------------------------------------- 1 | diff -uNr ./usr.old/include/android/api-level.h ./usr/include/android/api-level.h 2 | --- ./usr.old/include/android/api-level.h 2019-05-22 12:49:28.000000000 +0300 3 | +++ ./usr/include/android/api-level.h 2019-12-15 13:18:06.754440355 +0200 4 | @@ -47,12 +47,8 @@ 5 | #endif 6 | 7 | #ifndef __ANDROID_API__ 8 | -/** 9 | - * `__ANDROID_API__` is the API level being targeted. For the OS, 10 | - * this is `__ANDROID_API_FUTURE__`. For the NDK, this is set by the 11 | - * compiler/build system based on the API level you claimed to target. 12 | - */ 13 | -#define __ANDROID_API__ __ANDROID_API_FUTURE__ 14 | +/** Default Android API level to target. */ 15 | +#define __ANDROID_API__ 24 16 | #endif 17 | 18 | /** Names the Gingerbread API level (9), for comparisons against __ANDROID_API__. */ 19 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-patches/asm-generic_termbits.h.patch: -------------------------------------------------------------------------------- 1 | diff -uNr ./usr.old/include/asm-generic/termbits.h ./usr/include/asm-generic/termbits.h 2 | --- ./usr.old/include/asm-generic/termbits.h 2019-10-17 15:35:02.000000000 +0300 3 | +++ ./usr/include/asm-generic/termbits.h 2019-12-13 19:00:25.447498748 +0200 4 | @@ -190,5 +190,6 @@ 5 | #define TCIOFLUSH 2 6 | #define TCSANOW 0 7 | #define TCSADRAIN 1 8 | -#define TCSAFLUSH 2 9 | +/* TCSAFLUSH is patched to be TCSANOW to work around Android SELinux rule */ 10 | +#define TCSAFLUSH 0 11 | #endif 12 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-patches/linux_fcntl.h.patch: -------------------------------------------------------------------------------- 1 | diff -uNr ./usr.old/include/linux/fcntl.h ./usr/include/linux/fcntl.h 2 | --- ./usr.old/include/linux/fcntl.h 2019-10-17 15:35:02.000000000 +0300 3 | +++ ./usr/include/linux/fcntl.h 2019-12-13 19:24:38.948217810 +0200 4 | @@ -50,6 +50,12 @@ 5 | #define DN_ATTRIB 0x00000020 6 | #define DN_MULTISHOT 0x80000000 7 | #define AT_FDCWD - 100 8 | +/* This flag is not supported on Android 6.0+, and should not be 9 | + needed since there are not setuid binaries. Define AT_EACCESS 10 | + to 0 to avoid packages defining their own AT_EACCESS (which 11 | + e.g. coreutil does) since that will only result in errors. See: 12 | + https://android.googlesource.com/platform/bionic/+/3577825%5E!/ */ 13 | +#define AT_EACCESS 0 14 | #define AT_SYMLINK_NOFOLLOW 0x100 15 | #define AT_REMOVEDIR 0x200 16 | #define AT_SYMLINK_FOLLOW 0x400 17 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-patches/stdio.h.patch: -------------------------------------------------------------------------------- 1 | diff -uNr ./usr.old/include/stdio.h ./usr/include/stdio.h 2 | --- ./usr.old/include/stdio.h 2019-05-22 12:49:28.000000000 +0300 3 | +++ ./usr/include/stdio.h 2019-12-15 18:38:06.678291313 +0200 4 | @@ -44,6 +44,9 @@ 5 | #include 6 | #include 7 | 8 | +#include /* For strcpy(3) used by ctermid() */ 9 | +#include /* For O_RDWR and other O_* constants */ 10 | + 11 | #include 12 | 13 | #if __ANDROID_API__ < __ANDROID_API_N__ 14 | @@ -165,7 +168,6 @@ 15 | __printflike(2, 0) __warnattr_strict("vsprintf is often misused; please use vsnprintf"); 16 | char* tmpnam(char* __s) 17 | __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead"); 18 | -#define P_tmpdir "/tmp/" /* deprecated */ 19 | char* tempnam(const char* __dir, const char* __prefix) 20 | __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead"); 21 | 22 | @@ -241,12 +243,6 @@ 23 | FILE* freopen64(const char* __path, const char* __mode, FILE* __fp) __INTRODUCED_IN(24); 24 | #endif /* __ANDROID_API__ >= 24 */ 25 | 26 | -FILE* tmpfile(void); 27 | - 28 | -#if __ANDROID_API__ >= 24 29 | -FILE* tmpfile64(void) __INTRODUCED_IN(24); 30 | -#endif /* __ANDROID_API__ >= 24 */ 31 | - 32 | 33 | int snprintf(char* __buf, size_t __size, const char* __fmt, ...) __printflike(3, 4); 34 | int vfscanf(FILE* __fp, const char* __fmt, va_list __args) __scanflike(2, 0); 35 | @@ -256,9 +252,14 @@ 36 | 37 | #define L_ctermid 1024 /* size for ctermid() */ 38 | 39 | -#if __ANDROID_API__ >= 26 40 | -char* ctermid(char* __buf) __INTRODUCED_IN(26); 41 | -#endif /* __ANDROID_API__ >= 26 */ 42 | +static __inline__ char* ctermid(char* s) { 43 | + if (!s) return (char*) "/dev/tty"; 44 | + strcpy(s, "/dev/tty"); 45 | + return s; 46 | +} 47 | + 48 | +/* Needed by gnulibs freading(). */ 49 | +#define __sferror(p) (((p)->_flags & __SERR) != 0) 50 | 51 | 52 | FILE* fdopen(int __fd, const char* __mode); 53 | @@ -324,6 +325,87 @@ 54 | 55 | #endif 56 | 57 | +char* getenv(const char* __name); 58 | +void free(void* p); 59 | +__noreturn void abort(void); 60 | + 61 | +// Prepend application runtime directory path to given string. 62 | +// Returned pointer should be passed to free(). 63 | +static __inline__ char *android_dynamic_path_prefix(const char *basic_path) { 64 | + char *env_prefix = getenv("APP_RUNTIME_DIR"); 65 | + char *prefixed_path; 66 | + 67 | + if (!env_prefix) { 68 | +#define __XSTRINGIFY(x) #x 69 | +#define __STRINGIFY(x) __XSTRINGIFY(x) 70 | +#ifndef APPLICATION_RUNTIME_PREFIX 71 | +#error "Please, define the APPLICATION_RUNTIME_PREFIX" 72 | +#else 73 | + env_prefix = __STRINGIFY(APPLICATION_RUNTIME_PREFIX); 74 | +#endif 75 | +#undef __XSTRINGIFY 76 | +#undef __STRINGIFY 77 | + fprintf(stderr, "%s", "Warning: program is built with 'Dynamic path prefix' feature but the environment variable 'APP_RUNTIME_DIR' is not set.\n"); 78 | + fprintf(stderr, "Using the %s as fallback.\n", env_prefix); 79 | + } 80 | + 81 | + if (asprintf(&prefixed_path, "%s%s", env_prefix, basic_path) == -1) { 82 | + fprintf(stderr, "Error: failed to create prefixed path for '%s'.\n", basic_path); 83 | + abort(); 84 | + } 85 | + 86 | + return prefixed_path; 87 | +} 88 | + 89 | +int open(const char*, int, ...); 90 | +pid_t getpid(); 91 | +int unlink(const char*); 92 | +uint32_t arc4random(void); 93 | + 94 | +static __inline__ FILE* tmpfile() { 95 | + char *tmpdir = getenv("TMPDIR"); 96 | + 97 | + if (!tmpdir) { 98 | + tmpdir = android_dynamic_path_prefix("/tmp"); 99 | + } else { 100 | + // Since tmpdir can be an allocated string (see above), it is 101 | + // needed to strdup() it if obtained from environment variable. 102 | + tmpdir = strdup(tmpdir); 103 | + 104 | + if (!tmpdir) { 105 | + return NULL; 106 | + } 107 | + } 108 | + 109 | + for (int i = 0; i < 100; i++) { 110 | + char *path; 111 | + 112 | + if (asprintf(&path, "%s/tmpfile.%d-%u", tmpdir, getpid(), arc4random()) == -1) { 113 | + free(tmpdir); 114 | + return NULL; 115 | + } 116 | + 117 | + int fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600); 118 | + 119 | + if (fd >= 0) { 120 | + FILE *result = fdopen(fd, "w+"); 121 | + unlink(path); 122 | + free(path); 123 | + free(tmpdir); 124 | + return result; 125 | + } 126 | + 127 | + free(path); 128 | + } 129 | + 130 | + free(tmpdir); 131 | + return NULL; 132 | +} 133 | + 134 | +#if __ANDROID_API__ >= 24 135 | +#define tmpfile64 tmpfile 136 | +#endif /* __ANDROID_API__ >= 24 */ 137 | + 138 | #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS) 139 | #include 140 | #endif 141 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-patches/stdlib.h.patch: -------------------------------------------------------------------------------- 1 | diff -uNr ./usr.old/include/stdlib.h ./usr/include/stdlib.h 2 | --- ./usr.old/include/stdlib.h 2019-10-17 15:35:02.000000000 +0300 3 | +++ ./usr/include/stdlib.h 2019-12-13 19:25:03.748348682 +0200 4 | @@ -33,6 +33,7 @@ 5 | #include 6 | #include 7 | #include 8 | +#include 9 | #include 10 | #include 11 | 12 | @@ -224,8 +225,7 @@ 13 | size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n); 14 | 15 | #if __ANDROID_API__ >= __ANDROID_API_L__ 16 | -size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21); 17 | -#define MB_CUR_MAX __ctype_get_mb_cur_max() 18 | +#define MB_CUR_MAX 4 19 | #else 20 | /* 21 | * Pre-L we didn't have any locale support and so we were always the POSIX 22 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-patches/sys_wait.h.patch: -------------------------------------------------------------------------------- 1 | diff -uNr ./usr.old/include/sys/wait.h ./usr/include/sys/wait.h 2 | --- ./usr.old/include/sys/wait.h 2019-10-17 15:35:02.000000000 +0300 3 | +++ ./usr/include/sys/wait.h 2019-12-13 23:07:38.793539421 +0200 4 | @@ -46,6 +46,9 @@ 5 | // Implemented as a static inline before 18. 6 | #endif 7 | 8 | +/* Add wait3() declaration used by busybox. Available in libc for 32-bit only. */ 9 | +static pid_t wait3(int* status, int options, struct rusage* rusage) { return wait4(-1, status, options, rusage); } 10 | + 11 | /* Posix states that idtype_t should be an enumeration type, but 12 | * the kernel headers define P_ALL, P_PID and P_PGID as constant macros 13 | * instead. 14 | -------------------------------------------------------------------------------- /external/libvmc/scripts/toolchain/ndk-patches/unistd.h.patch: -------------------------------------------------------------------------------- 1 | diff -uNr ./usr.old/include/unistd.h ./usr/include/unistd.h 2 | --- ./usr.old/include/unistd.h 2019-10-17 15:35:02.000000000 +0300 3 | +++ ./usr/include/unistd.h 2019-12-13 23:08:13.953732782 +0200 4 | @@ -383,4 +383,72 @@ 5 | #undef _UNISTD_H_ 6 | #endif 7 | 8 | +#if !defined GETPASS_H && !defined getpass && !defined HAVE_GETPASS && !defined HAS_GETPASS && !defined NO_INLINE_GETPASS 9 | +#define GETPASS_H 1 10 | +#define HAVE_GETPASS 1 11 | +#define HAS_GETPASS 1 12 | +#define PASSWORDLEN 512 13 | + 14 | +static __inline__ char* getpass(const char* prompt) { 15 | + // termios struct as in asm-generic/termbits.h 16 | + struct _termios { 17 | + unsigned int c_iflag; /* input mode flags */ 18 | + unsigned int c_oflag; /* output mode flags */ 19 | + unsigned int c_cflag; /* control mode flags */ 20 | + unsigned int c_lflag; /* local mode flags */ 21 | + unsigned char c_line; /* line discipline */ 22 | + unsigned char c_cc[19/* NCCS */]; /* control characters */ 23 | + }; 24 | + 25 | + struct _termios term_old, term_new; 26 | + static char password[513] = { 0 }; /* 512 1-byte charactes and '0' */ 27 | + int len = 0, tty_changed = 0; 28 | + 29 | + // print prompt 30 | + while (*prompt) { 31 | + write(1, prompt, 1); 32 | + prompt++; 33 | + } 34 | + 35 | + // try to disable echoing on terminal 36 | + if (ioctl(0, 0x5401 /* TCGETS */, &term_old) == 0) { 37 | + term_new = term_old; 38 | + term_new.c_lflag &= ~0000010;/* ~ECHO */ 39 | + 40 | + if (ioctl(0, 0x5402+0 /* TCSETS+TCSANOW */, &term_new) == 0) { 41 | + tty_changed = 1; 42 | + } else { 43 | + tty_changed = 0; 44 | + } 45 | + } 46 | + 47 | + // read password 48 | + char chr; 49 | + while (read(0, &chr, sizeof(char)) > 0) { 50 | + if (chr == '\r' || chr == '\n' || chr == 0) { 51 | + break; 52 | + } 53 | + 54 | + if (len == sizeof(password)-1) { 55 | + // we should consume all entered characters even 56 | + // if maximal input length reached 57 | + continue; 58 | + } else { 59 | + password[len++] = chr; 60 | + } 61 | + } 62 | + password[len] = 0; 63 | + 64 | + // restore terminal to previous state if needed 65 | + if (tty_changed) { 66 | + ioctl(0, 0x5402+0 /* TCSETS+TCSANOW */, &term_old); 67 | + } 68 | + 69 | + // force new line 70 | + write(1, "\n", 1); 71 | + 72 | + return password; 73 | +} 74 | +#endif 75 | + 76 | __END_DECLS 77 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | ## Project-wide Gradle settings. 2 | # 3 | # For more details on how to configure your build environment visit 4 | # http://www.gradle.org/docs/current/userguide/build_environment.html 5 | # 6 | # Specifies the JVM arguments used for the daemon process. 7 | # The setting is particularly useful for tweaking memory settings. 8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 10 | # 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | org.gradle.jvmargs=-Xmx4096M 16 | android.useAndroidX=true 17 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/images/banner.png -------------------------------------------------------------------------------- /images/google-play-badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/images/google-play-badge.png -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/images/logo.png -------------------------------------------------------------------------------- /images/logo_source.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /images/screenshots.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbirss/vmConsole/bda585d91ec5edcee1e0cf55cc584b8607d6f162/images/screenshots.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------