|
@@ -768,6 +768,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
|
return OK;
|
|
return OK;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ bool _has_storage_permission(const Vector<String> &p_permissions) {
|
|
|
|
+ return p_permissions.find("android.permission.READ_EXTERNAL_STORAGE") != -1 || p_permissions.find("android.permission.WRITE_EXTERNAL_STORAGE") != -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
void _get_permissions(const Ref<EditorExportPreset> &p_preset, bool p_give_internet, Vector<String> &r_permissions) {
|
|
void _get_permissions(const Ref<EditorExportPreset> &p_preset, bool p_give_internet, Vector<String> &r_permissions) {
|
|
const char **aperms = android_perms;
|
|
const char **aperms = android_perms;
|
|
while (*aperms) {
|
|
while (*aperms) {
|
|
@@ -819,7 +823,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
|
|
|
|
|
manifest_text += _get_xr_features_tag(p_preset);
|
|
manifest_text += _get_xr_features_tag(p_preset);
|
|
manifest_text += _get_instrumentation_tag(p_preset);
|
|
manifest_text += _get_instrumentation_tag(p_preset);
|
|
- manifest_text += _get_application_tag(p_preset);
|
|
|
|
|
|
+ manifest_text += _get_application_tag(p_preset, _has_storage_permission(perms));
|
|
manifest_text += "</manifest>\n";
|
|
manifest_text += "</manifest>\n";
|
|
String manifest_path = vformat("res://android/build/src/%s/AndroidManifest.xml", (p_debug ? "debug" : "release"));
|
|
String manifest_path = vformat("res://android/build/src/%s/AndroidManifest.xml", (p_debug ? "debug" : "release"));
|
|
|
|
|
|
@@ -873,6 +877,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
|
Vector<String> perms;
|
|
Vector<String> perms;
|
|
// Write permissions into the perms variable.
|
|
// Write permissions into the perms variable.
|
|
_get_permissions(p_preset, p_give_internet, perms);
|
|
_get_permissions(p_preset, p_give_internet, perms);
|
|
|
|
+ bool has_storage_permission = _has_storage_permission(perms);
|
|
|
|
|
|
while (ofs < (uint32_t)p_manifest.size()) {
|
|
while (ofs < (uint32_t)p_manifest.size()) {
|
|
|
|
|
|
@@ -968,6 +973,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
|
string_table.write[attr_value] = version_name;
|
|
string_table.write[attr_value] = version_name;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (tname == "application" && attrname == "requestLegacyExternalStorage") {
|
|
|
|
+
|
|
|
|
+ encode_uint32(has_storage_permission ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (tname == "instrumentation" && attrname == "targetPackage") {
|
|
if (tname == "instrumentation" && attrname == "targetPackage") {
|
|
string_table.write[attr_value] = get_package_name(package_name);
|
|
string_table.write[attr_value] = get_package_name(package_name);
|
|
}
|
|
}
|