Create "manifest_override" feature - #23
Conversation
…e a custom AndroidManifest.xml file to be copied rather than generated.
|
Can you give an example? It's best to use generators to support those use cases, which is consistent with Rust's best practices of using unified manifest files. |
|
Yep, I specifically ran into a few issues that I can remember (and several more that I can't)
ManifestsCreated by Cargo-APK2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mgcarpet.vr"
android:versionCode="16777472" android:versionName="0.1.0">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29"/>
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1"/>
<uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="false"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:debuggable="false" android:label="Magic Carpet VR" android:extractNativeLibs="true">
<android:allowNativeHeapPointerTagging/>
<android:requestLegacyExternalStorage>true</android:requestLegacyExternalStorage>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest2|questpro|quest3|quest3s"/>
<activity
android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
android:name="android.app.NativeActivity"
android:screenOrientation="landscape" android:exported="true" android:resizeableActivity="false">
<meta-data android:name="android.app.lib_name" android:value="mgc_app"/>
<meta-data android:name="com.oculus.intent.category.VR" android:value="vr_only"/>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest2|questpro|quest3|quest3s"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="com.oculus.intent.category.VR"/>
</intent-filter>
</activity>
<activity
android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
android:name="rust.jniminhelper.PermActivity"
android:screenOrientation="landscape" android:resizeableActivity="false"/>
</application>
</manifest>Created by me: <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mgcarpet.vr"
android:versionCode="1"
android:versionName="0.1.0">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29"/>
<!-- VR headtracking required; Quest 3 always provides it -->
<uses-feature
android:name="android.hardware.vr.headtracking"
android:required="true"
android:version="1"/>
<!-- Boundaryless application -->
<uses-feature
android:name="com.oculus.feature.BOUNDARYLESS_APP"
android:required="true"/>
<!-- Passthrough is optional — useful for future mixed-reality overlays -->
<uses-feature
android:name="com.oculus.feature.PASSTHROUGH"
android:required="false"/>
<!-- /sdcard/mgcarpet/baked/ game data — legacy full access under targetSdkVersion 29 (see above) -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="Magic Carpet VR"
android:requestLegacyExternalStorage="true"
android:hasCode="true">
<!--
NativeActivity: the OS calls into the .so produced by mgc-app.
lib_name must match the Cargo package name (hyphens → underscores).
-->
<activity
android:name="android.app.NativeActivity"
android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
android:exported="true"
android:resizeableActivity="false"
android:screenOrientation="landscape">
<meta-data
android:name="android.app.lib_name"
android:value="mgc_app"/>
<!-- Main launcher + VR category: Quest OS launches this as a VR app -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="com.oculus.intent.category.VR"/>
</intent-filter>
<!-- Tell the Meta runtime this is a VR-only application -->
<meta-data
android:name="com.oculus.intent.category.VR"
android:value="vr_only"/>
</activity>
<activity
android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
android:name="rust.jniminhelper.PermActivity" android:screenOrientation="landscape"
android:resizeableActivity="false"/>
</application>
</manifest>
In addition, if you look at: There are a massive number of both top level nodes and key:values that aren't currently supported... So having an escape hatch, seems like a reasonable feature request... |
|
I can merge this PR to temporarily solve this scenario problem, but I need you to add instructions for adding this feature in the README. |
This allows an escape hatch to declare a custom AndroidManifest.xml file to be copied rather than have it be generated.
In my specific case their are several items that the current generator doesn't support , and this now makes this tool (at least in the Android Manifest) easily forward compatible immediately as if the generator doesn't work you can override it with your own.