Add partial support for Android scoped storage.

This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
This commit is contained in:
ne0fhyk
2021-07-10 18:39:31 -07:00
parent 54d14a912a
commit c88d1608ab
21 changed files with 99 additions and 263 deletions

View File

@ -1081,10 +1081,6 @@ String _OS::get_user_data_dir() const {
return OS::get_singleton()->get_user_data_dir();
};
String _OS::get_external_data_dir() const {
return OS::get_singleton()->get_external_data_dir();
}
Error _OS::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
return OS::get_singleton()->native_video_play(p_path, p_volume, p_audio_track, p_subtitle_track);
};
@ -1160,8 +1156,8 @@ bool _OS::is_keep_screen_on() const {
return OS::get_singleton()->is_keep_screen_on();
}
String _OS::get_system_dir(SystemDir p_dir) const {
return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir));
String _OS::get_system_dir(SystemDir p_dir, bool p_shared_storage) const {
return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir), p_shared_storage);
}
String _OS::get_scancode_string(uint32_t p_code) const {
@ -1370,8 +1366,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_dynamic_memory_usage"), &_OS::get_dynamic_memory_usage);
ClassDB::bind_method(D_METHOD("get_user_data_dir"), &_OS::get_user_data_dir);
ClassDB::bind_method(D_METHOD("get_external_data_dir"), &_OS::get_external_data_dir);
ClassDB::bind_method(D_METHOD("get_system_dir", "dir"), &_OS::get_system_dir);
ClassDB::bind_method(D_METHOD("get_system_dir", "dir", "shared_storage"), &_OS::get_system_dir, DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_config_dir"), &_OS::get_config_dir);
ClassDB::bind_method(D_METHOD("get_data_dir"), &_OS::get_data_dir);
ClassDB::bind_method(D_METHOD("get_cache_dir"), &_OS::get_cache_dir);

View File

@ -347,10 +347,9 @@ public:
SCREEN_ORIENTATION_SENSOR,
};
String get_system_dir(SystemDir p_dir) const;
String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const;
String get_user_data_dir() const;
String get_external_data_dir() const;
String get_config_dir() const;
String get_data_dir() const;
String get_cache_dir() const;