Fix the logic to enable focus awareness

This commit is contained in:
Fredia Huya-Kouadio 2020-06-27 16:40:22 -07:00
parent dafadfe6db
commit 623a1ae5b3
2 changed files with 6 additions and 4 deletions

View File

@ -881,6 +881,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String tname = string_table[name]; String tname = string_table[name];
uint32_t attrcount = decode_uint32(&p_manifest[iofs + 20]); uint32_t attrcount = decode_uint32(&p_manifest[iofs + 20]);
iofs += 28; iofs += 28;
bool is_focus_aware_metadata = false;
for (uint32_t i = 0; i < attrcount; i++) { for (uint32_t i = 0; i < attrcount; i++) {
uint32_t attr_nspace = decode_uint32(&p_manifest[iofs]); uint32_t attr_nspace = decode_uint32(&p_manifest[iofs]);
@ -958,9 +959,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
} }
} }
if (tname == "meta-data" && attrname == "value" && value == "oculus_focus_aware_value") { if (tname == "meta-data" && attrname == "value" && is_focus_aware_metadata) {
// Update the focus awareness meta-data value // Update the focus awareness meta-data value
string_table.write[attr_value] = xr_mode_index == /* XRMode.OVR */ 1 && focus_awareness ? "true" : "false"; encode_uint32(xr_mode_index == /* XRMode.OVR */ 1 && focus_awareness ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
} }
if (tname == "meta-data" && attrname == "value" && value == "plugins_value" && !plugins_names.empty()) { if (tname == "meta-data" && attrname == "value" && value == "plugins_value" && !plugins_names.empty()) {
@ -968,6 +969,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
string_table.write[attr_value] = plugins_names; string_table.write[attr_value] = plugins_names;
} }
is_focus_aware_metadata = tname == "meta-data" && attrname == "name" && value == "com.oculus.vr.focusaware";
iofs += 20; iofs += 20;
} }

View File

@ -52,8 +52,8 @@
android:resizeableActivity="false" android:resizeableActivity="false"
tools:ignore="UnusedAttribute" > tools:ignore="UnusedAttribute" >
<!-- Focus awareness metadata populated at export time if the user enables it in the 'Xr Features' section. --> <!-- Focus awareness metadata is updated at export time if the user enables it in the 'Xr Features' section. -->
<meta-data android:name="com.oculus.vr.focusaware" android:value="oculus_focus_aware_value" /> <meta-data android:name="com.oculus.vr.focusaware" android:value="false" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />