Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ dependencies {
androidTestImplementation("androidx.test:runner:1.6.2")
}

val verifyGfxstreamRuntimeAssets by
val verifyGraphicsRuntimeAssets by
tasks.registering {
val runtimeRoot = file("src/main/assets/runtime/arm64-v8a")
inputs.dir(runtimeRoot.resolve("gfxstream-host"))
inputs.dir(runtimeRoot.resolve("gfxstream-guest"))
inputs.dir(runtimeRoot.resolve("virgl-host"))
inputs.dir(runtimeRoot.resolve("virgl-angle-vulkan"))

doLast {
fun ByteArray.containsSequence(needle: ByteArray): Boolean {
Expand All @@ -184,7 +186,13 @@ val verifyGfxstreamRuntimeAssets by
return false
}

val bundleNames = listOf("gfxstream-host", "gfxstream-guest")
val bundleNames =
listOf(
"gfxstream-host",
"gfxstream-guest",
"virgl-host",
"virgl-angle-vulkan",
)
val manifests =
bundleNames.associateWith { bundleName ->
val bundle = runtimeRoot.resolve(bundleName)
Expand Down Expand Up @@ -238,5 +246,5 @@ val verifyGfxstreamRuntimeAssets by
}

tasks.matching { it.name == "preBuild" }.configureEach {
dependsOn(verifyGfxstreamRuntimeAssets)
dependsOn(verifyGraphicsRuntimeAssets)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
format=1
runtime=2.1.24923-f09a19ce-2
abi=arm64-v8a
source_package=angle-android
source_backend=vulkan
termux_packages_commit=4c3e1c0c700f7515d89ecbb9f636d5289f6cd48e
source_deb_sha256=3e421cecefc8cb5ca9c57ffe1eb38f77dc315d88d99f1018ef0fdd2add6ca330
lib/libEGL_angle.so.sha256=902da0dabfdc87ed572b7c597e9007066f871e9674ba2ff7c1c73c51d6066a99
lib/libGLESv1_CM_angle.so.sha256=8495dcb6af2d5743283c783a58e744ed160d868e1baf6322aa7ee71b006cbe65
lib/libGLESv2_angle.so.sha256=e99093dd5de9e05d40a4d427dcbd3803e5781e579e9d65543db71c0a3fa1ffba
lib/libfeature_support_angle.so.sha256=afa4ffcda88fca52007ed8a40bfd9bfd27db34f465c753b1d4c4e0540ca7b252
share/doc/copyright.sha256=bf4da21bd20bcfb5b60b7ecc67fa864a79be049e21d6178076887f178dd6c71a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2018 The ANGLE Project Authors.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
// Ltd., nor the names of their contributors may be used to endorse
// or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
format=1
runtime=1.3.0-1-venus2
abi=arm64-v8a
source_package=virglrenderer-android
termux_packages_commit=fcf4b74c4e94203b5c93963443cfadb2f0145c11
source_deb_sha256=8dadfc5589b3081ccb581bda0832c9cbbbbe014438067e2a93f37ae25adac73e
bin/virgl_test_server_android.sha256=c4fa02e432f2edbf974c8bf85922b6d1f7418be633bce443e5b1893c312273aa
libexec/virgl_render_server.sha256=86973655b0e239126762da11b97e62a0c4e7855e07793c8089de80d6c584a32f
lib/libepoxy.so.sha256=7b50fe1ef66cfea354f398523169bdb4ac8ec3b2715ac77073540bd5a1b3075f
lib/libvirglrenderer.so.sha256=9b77357fdf9e2820d853c587aaf4488b6d07ff74e42f8ec0af37511ba40ab167
share/doc/COPYING-gl4es.sha256=69a3049c77abd88658f6ad7cf6a5b6ceb5cf03b80e60f7c4657d90322cfab7bd
share/doc/COPYING-libepoxy.sha256=8d5144666f9c4df9bbd69b8900086d5979259152a1060421cdcc0fb9061a1c12
share/doc/COPYING-virglrenderer.sha256=3b32caf16e2402c2aff2b716858713f3e1feded85c25e71bf829816ee5009402
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2016-2018 Sebastien Chevalier
Copyright (c) 2013-2016 Ryan Hileman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
The libepoxy project code is covered by the MIT license:

/*
* Copyright © 2013-2014 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

The generated code is derived from Khronos's xml files, which appear
under the following license:

/*
* Copyright (c) 2013 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
virglrenderer is under MIT license and derived from mesa in many parts.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

18 changes: 18 additions & 0 deletions app/src/main/java/org/randomcoder/udroid/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ import org.randomcoder.udroid.runtime.DesktopEnvironment
import org.randomcoder.udroid.runtime.DesktopEnvironmentScanner
import org.randomcoder.udroid.runtime.DesktopSessionPhase
import org.randomcoder.udroid.runtime.InstalledRootfs
import org.randomcoder.udroid.runtime.ProotEnvironmentProfileStore
import org.randomcoder.udroid.runtime.ProotMountProfile
import org.randomcoder.udroid.runtime.ProotMountProfileValidator
import org.randomcoder.udroid.runtime.ProotMountResolver
import org.randomcoder.udroid.runtime.RuntimePhase
import org.randomcoder.udroid.runtime.RuntimeSnapshot
import org.randomcoder.udroid.runtime.RuntimeSupervisorService
import org.randomcoder.udroid.runtime.VirglServerMode
import org.randomcoder.udroid.ui.UdroidApp
import org.randomcoder.udroid.ui.UdroidCanvas
import org.randomcoder.udroid.ui.UdroidDarkCanvas
Expand Down Expand Up @@ -266,6 +269,7 @@ class MainActivity : ComponentActivity() {
onCompositingChanged = { updateCompositing(it) },
onTouchScaleChanged = { updateTouchScale(it) },
onGraphicsProfileChanged = { updateGraphicsProfile(it) },
onVirglServerModeChanged = { updateVirglServerMode(it) },
onAudioOutputChanged = { updateAudioOutput(it) },
onMicrophoneChanged = { updateMicrophone(it) },
onStartDesktop = { startSelectedDesktop() },
Expand Down Expand Up @@ -839,13 +843,19 @@ class MainActivity : ComponentActivity() {
runCatching { audioConfigurationStore.remove(rootfsName) }
.exceptionOrNull()
?.let { cleanupWarnings += it.message ?: "audio settings" }
runCatching { ProotMountResolver.removeRuntime(this@MainActivity, rootfsName) }
.exceptionOrNull()
?.let { cleanupWarnings += it.message ?: "runtime files" }
runCatching {
LinuxApplicationShortcutPublisher(this@MainActivity)
.disableForRootfs(rootfsName)
}.exceptionOrNull()
?.let { cleanupWarnings += it.message ?: "launcher shortcuts" }

if (resetWork == null) {
runCatching { ProotEnvironmentProfileStore(this@MainActivity).remove(rootfsName) }
.exceptionOrNull()
?.let { cleanupWarnings += it.message ?: "environment profile" }
runCatching { app.mountProfiles.remove(rootfsName) }
.exceptionOrNull()
?.let { cleanupWarnings += it.message ?: "mount profile" }
Expand Down Expand Up @@ -1021,6 +1031,14 @@ class MainActivity : ComponentActivity() {
)
}

private fun updateVirglServerMode(mode: VirglServerMode) {
val rootfsName = selectedSystemRootfsName ?: return
saveDesktopConfiguration(
rootfsName,
desktopConfiguration.copy(virglServerMode = mode),
)
}

private fun loadAudioConfiguration(rootfsName: String) {
runCatching { audioConfigurationStore.load(rootfsName) }
.onSuccess {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import android.os.Build
import android.os.StatFs
import org.randomcoder.udroid.runtime.AndroidExecutableCommand
import org.randomcoder.udroid.runtime.ANDROID_PROOT_BIND_MOUNTS
import org.randomcoder.udroid.runtime.ProotMountProfile
import org.randomcoder.udroid.runtime.ProotMountResolver
import org.randomcoder.udroid.runtime.ProotPathContract
import org.randomcoder.udroid.runtime.ResolvedProotMount
import org.randomcoder.udroid.runtime.addAndroidProotBindMounts
import org.randomcoder.udroid.runtime.addProotBindMounts
import org.tukaani.xz.XZInputStream
import java.io.BufferedReader
import java.io.File
Expand Down Expand Up @@ -307,12 +311,6 @@ class AndroidRootfsConfigurator : RootfsConfigurator {
"Could not prepare /$it"
}
}
File(rootfs, "proc").apply {
check(setReadable(true, true) && setWritable(true, true) && setExecutable(true, true)) {
"Could not prepare rootfs /proc compatibility directory"
}
}

replaceFile(
File(rootfs, "etc/hosts"),
"""
Expand All @@ -325,15 +323,6 @@ class AndroidRootfsConfigurator : RootfsConfigurator {
File(rootfs, "etc/resolv.conf"),
"nameserver 1.1.1.1\nnameserver 8.8.8.8\n",
)
replaceFile(
File(rootfs, "proc/.version"),
"Linux version 5.4.0-udroid-faked (udroid@android)\n",
)
replaceFile(File(rootfs, "proc/.uptime"), "0.00 0.00\n")
replaceFile(File(rootfs, "proc/.loadavg"), "0.00 0.00 0.00 1/1 1\n")
replaceFile(File(rootfs, "proc/.stat"), "cpu 1 0 1 1 0 0 0 0 0 0\n")
replaceFile(File(rootfs, "proc/.vmstat"), "nr_free_pages 0\n")

replaceFile(
File(rootfs, "etc/profile.d/udroid.sh"),
"""
Expand Down Expand Up @@ -420,6 +409,12 @@ class ProotRootfsHealthCheck(
*buildArguments(
rootfsPath = ProotPathContract.rootfsPath(context, rootfs),
shellPath = "/${shell.relativeTo(rootfs).path}",
mounts =
ProotMountResolver.resolve(
context = context,
rootfs = rootfs,
profile = ProotMountProfile(),
),
),
),
).apply {
Expand All @@ -438,12 +433,15 @@ class ProotRootfsHealthCheck(
}.start()
val output = process.inputStream.bufferedReader().use { it.readText().trim() }
val exitCode = process.waitFor()
check(exitCode == 0) {
if (output.isBlank()) {
"Rootfs health check failed with exit code $exitCode"
} else {
"Rootfs health check failed: ${output.lineSequence().last()}"
}
if (exitCode != 0) {
runCatching { ProotMountResolver.removeRuntime(context, rootfs.name) }
error(
if (output.isBlank()) {
"Rootfs health check failed with exit code $exitCode"
} else {
"Rootfs health check failed: ${output.lineSequence().last()}"
},
)
}
}

Expand All @@ -454,13 +452,14 @@ class ProotRootfsHealthCheck(
internal fun buildArguments(
rootfsPath: String,
shellPath: String,
mounts: List<ResolvedProotMount> = ProotMountResolver.defaults(),
): Array<String> =
buildList {
add("--link2symlink")
add("--kill-on-exit")
add("--root-id")
add("--rootfs=$rootfsPath")
addAndroidProotBindMounts()
addProotBindMounts(mounts)
add("--cwd=/")
add("/usr/bin/env")
add("-i")
Expand Down
Loading