mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-30 18:38:32 +00:00
t/oxr_android: Add Android-specific subdirectory
This commit is contained in:
parent
d6564e3798
commit
2cafdfa5cc
settings.gradle
src/xrt/targets/openxr_android
|
@ -5,3 +5,4 @@ rootProject.name = 'monado'
|
||||||
|
|
||||||
include ':src:xrt:auxiliary:android'
|
include ':src:xrt:auxiliary:android'
|
||||||
include ':src:xrt:ipc_android'
|
include ':src:xrt:ipc_android'
|
||||||
|
include ':src:xrt:targets:openxr_android'
|
||||||
|
|
66
src/xrt/targets/openxr_android/build.gradle
Normal file
66
src/xrt/targets/openxr_android/build.gradle
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
// Copyright 2020, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion project.sharedTargetSdk
|
||||||
|
buildToolsVersion '30.0.2'
|
||||||
|
|
||||||
|
ndkVersion "${ndk_version}"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId 'org.freedesktop.monado.openxr_runtime'
|
||||||
|
minSdkVersion project.sharedMinSdk
|
||||||
|
targetSdkVersion project.sharedTargetSdk
|
||||||
|
versionCode 1
|
||||||
|
versionName '1.0'
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
arguments "-DEIGEN3_INCLUDE_DIR=${project.eigenIncludeDir}", "-DANDROID_PLATFORM=26", "-DANDROID_STL=c++_shared", "-DANDROID_ARM_NEON=TRUE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path "../../../../CMakeLists.txt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flavorDimensions 'deployment'
|
||||||
|
productFlavors {
|
||||||
|
inProcess {
|
||||||
|
dimension 'deployment'
|
||||||
|
applicationIdSuffix '.in_process'
|
||||||
|
externalNativeBuild.cmake.arguments += "-DXRT_FEATURE_SERVICE=OFF"
|
||||||
|
externalNativeBuild.cmake.targets "openxr_monado"
|
||||||
|
}
|
||||||
|
outOfProcess {
|
||||||
|
dimension 'deployment'
|
||||||
|
applicationIdSuffix '.out_of_process'
|
||||||
|
externalNativeBuild.cmake.arguments += "-DXRT_FEATURE_SERVICE=ON"
|
||||||
|
externalNativeBuild.cmake.targets "openxr_monado", "monado-service"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
outOfProcessImplementation project(':src:xrt:ipc_android')
|
||||||
|
implementation project(':src:xrt:auxiliary:android')
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||||
|
}
|
46
src/xrt/targets/openxr_android/src/main/AndroidManifest.xml
Normal file
46
src/xrt/targets/openxr_android/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="org.freedesktop.monado.openxr_runtime">
|
||||||
|
<!--
|
||||||
|
Copyright 2020, Collabora, Ltd.
|
||||||
|
SPDX-License-Identifier: BSL-1.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- We may try to use OpenGL|ES 3.0 -->
|
||||||
|
<uses-feature android:glEsVersion="0x00030002" android:required="true" />
|
||||||
|
<!-- This is for Android's VR mode. -->
|
||||||
|
<uses-feature android:name="android.software.vr.mode" android:required="false"/>
|
||||||
|
<!-- Available on only Daydream-ready devices. -->
|
||||||
|
<uses-feature android:name="android.hardware.vr.high_performance" android:required="false"/>
|
||||||
|
|
||||||
|
<!-- Can handle both 3-DOF and 6-DOF head tracking. -->
|
||||||
|
<uses-feature android:name="android.hardware.vr.headtracking" android:required="false" android:version="1"/>
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/ic_monado_logo"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
<activity android:name=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- Provide the VrListenerService with the OpenXR metadata. -->
|
||||||
|
<service
|
||||||
|
android:name=".OpenXRListener"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:permission="android.permission.BIND_VR_LISTENER_SERVICE">
|
||||||
|
<meta-data
|
||||||
|
android:name="org.khronos.openxr.OpenXRRuntime"
|
||||||
|
android:value="libopenxr_monado.so" />
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.vr.VrListenerService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2020, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
/*!
|
||||||
|
* @file
|
||||||
|
* @brief Simple main activity for Android.
|
||||||
|
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.freedesktop.monado.openxr_runtime;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright 2020, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
/*!
|
||||||
|
* @file
|
||||||
|
* @brief Implementation of VrListenerService.
|
||||||
|
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.freedesktop.monado.openxr_runtime
|
||||||
|
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.service.vr.VrListenerService
|
||||||
|
import android.util.Log
|
||||||
|
import android.widget.Toast
|
||||||
|
|
||||||
|
class OpenXRListener : VrListenerService() {
|
||||||
|
// Would like to override
|
||||||
|
// void onCurrentVrActivityChanged(
|
||||||
|
// ComponentName component, boolean running2dInVr, int pid)
|
||||||
|
// as recommended, but not possible?
|
||||||
|
override fun onCurrentVrActivityChanged(component: ComponentName?) {
|
||||||
|
if (component == null) {
|
||||||
|
Toast.makeText(this, "Now in VR for 2D", Toast.LENGTH_SHORT).show()
|
||||||
|
Log.i("OpenXRListener", "Got VR mode for 2D")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "Now in VR for $component", Toast.LENGTH_SHORT).show()
|
||||||
|
Log.i("OpenXRListener", "Got VR mode for component: $component")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="48dp"
|
||||||
|
android:viewportWidth="12.7"
|
||||||
|
android:viewportHeight="12.7">
|
||||||
|
<!--
|
||||||
|
Copyright 2020, Collabora, Ltd.
|
||||||
|
SPDX-License-Identifier: BSL-1.0
|
||||||
|
-->
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="m1.8665,2.6141c-0.2572,0.2626 0,1.8501 0,3.2379 0,1.3878 -0.2469,3.9584 0,4.1628 0.2469,0.2042 1.8107,0.2281 2.0545,0 0.243,-0.2283 0.1316,-2.4988 -0.0404,-2.6223 -0.1712,-0.1233 -0.841,0.0306 -0.9293,-0.1272 -0.0889,-0.1578 0.3158,-2.0393 0.6067,-2.2152 0.2911,-0.1758 1.7612,0.1825 1.9909,0.546 0.2304,0.3629 0.1264,1.4424 -0.0517,2.2146 -0.1787,0.772 0.4399,2.2563 0.853,2.3238l0,-5.9583c-0.5321,-0.2296 -1.5226,-0.6613 -2.3029,-1.0691 -0.7803,-0.407 -1.9235,-0.7556 -2.1809,-0.493zM10.8338,2.6141c0.2566,0.2626 0,1.8501 0,3.2379 0,1.3878 0.2469,3.9584 0,4.1628 -0.2469,0.2042 -1.8112,0.2281 -2.0545,0 -0.2438,-0.2283 -0.1316,-2.4988 0.0404,-2.6223 0.1714,-0.1233 0.841,0.0306 0.9293,-0.1272 0.0883,-0.1578 -0.3158,-2.0393 -0.6067,-2.2152 -0.2911,-0.1758 -1.7612,0.1825 -1.9916,0.546 -0.2296,0.3629 -0.1256,1.4424 0.0525,2.2146 0.1779,0.772 -0.4407,2.2563 -0.8529,2.3238l0,-5.9583c0.5311,-0.2296 1.5224,-0.6613 2.3027,-1.0691 0.7795,-0.407 1.9235,-0.7556 2.1809,-0.493z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m1.8665,2.6141c-0.2572,0.2626 0,1.8501 0,3.2379 0,1.3878 -0.2469,3.9584 0,4.1628 0.2469,0.2042 1.8107,0.2281 2.0545,0 0.243,-0.2283 0.1316,-2.4988 -0.0404,-2.6223 -0.1712,-0.1233 -0.841,0.0306 -0.9293,-0.1272 -0.0889,-0.1578 0.3158,-2.0393 0.6067,-2.2152 0.2911,-0.1758 1.7612,0.1825 1.9909,0.546 0.2304,0.3629 0.1264,1.4424 -0.0517,2.2146 -0.1787,0.772 0.4399,2.2563 0.853,2.3238l0,-5.9583c-0.5321,-0.2296 -1.5226,-0.6613 -2.3029,-1.0691 -0.7803,-0.407 -1.9235,-0.7556 -2.1809,-0.493zM10.8338,2.6141c0.2566,0.2626 0,1.8501 0,3.2379 0,1.3878 0.2469,3.9584 0,4.1628 -0.2469,0.2042 -1.8112,0.2281 -2.0545,0 -0.2438,-0.2283 -0.1316,-2.4988 0.0404,-2.6223 0.1714,-0.1233 0.841,0.0306 0.9293,-0.1272 0.0883,-0.1578 -0.3158,-2.0393 -0.6067,-2.2152 -0.2911,-0.1758 -1.7612,0.1825 -1.9916,0.546 -0.2296,0.3629 -0.1256,1.4424 0.0525,2.2146 0.1779,0.772 -0.4407,2.2563 -0.8529,2.3238l0,-5.9583c0.5311,-0.2296 1.5224,-0.6613 2.3027,-1.0691 0.7795,-0.407 1.9235,-0.7556 2.1809,-0.493z"
|
||||||
|
android:strokeWidth="1.84195"
|
||||||
|
android:strokeColor="#00000000">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:startY="9.63902"
|
||||||
|
android:startX="5.83651"
|
||||||
|
android:endY="2.7786648"
|
||||||
|
android:endX="6.9264116"
|
||||||
|
android:type="linear"
|
||||||
|
android:tileMode="clamp">
|
||||||
|
<item android:offset="0" android:color="#FF2196F3"/>
|
||||||
|
<item android:offset="1" android:color="#FF3F51B5"/>
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
</group>
|
||||||
|
</vector>
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2020, Collabora, Ltd.
|
||||||
|
SPDX-License-Identifier: BSL-1.0
|
||||||
|
-->
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="@android:dimen/thumbnail_width"
|
||||||
|
android:layout_height="@android:dimen/thumbnail_height"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:contentDescription="Monado logo"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_monado_logo" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/constraintLayout"
|
||||||
|
android:layout_width="409dp"
|
||||||
|
android:layout_height="143dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/imageView">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:text="@string/owered_by_monado"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollView2"
|
||||||
|
android:layout_width="409dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/notice" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2020, Collabora, Ltd.
|
||||||
|
SPDX-License-Identifier: BSL-1.0
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<color name="colorPrimary">#6200EE</color>
|
||||||
|
<color name="colorPrimaryDark">#3700B3</color>
|
||||||
|
<color name="colorAccent">#03DAC5</color>
|
||||||
|
</resources>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<resources>
|
||||||
|
<!--
|
||||||
|
Copyright 2020, Collabora, Ltd.
|
||||||
|
SPDX-License-Identifier: BSL-1.0
|
||||||
|
-->
|
||||||
|
<string name="app_name">FD.O Monado</string>
|
||||||
|
<string name="owered_by_monado">An XR Runtime, powered by Monado</string>
|
||||||
|
<string name="notice">NOTICE text goes here</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<resources>
|
||||||
|
<!--
|
||||||
|
Copyright 2020, Collabora, Ltd.
|
||||||
|
SPDX-License-Identifier: BSL-1.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
Loading…
Reference in a new issue