diff options
author | Spartan322 <Megacake1234@gmail.com> | 2024-11-06 01:07:22 -0500 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2024-11-06 01:12:36 -0500 |
commit | b8b8a7127e3040582c5937fd2dff4c99e94a3b57 (patch) | |
tree | 849c2d29b6fb90100f31de20340d5f0ef4238edf /platform/android/java/lib | |
parent | d14f2a31558686f00c4f351ea659918576711a7a (diff) | |
parent | 87318a2fb7fffeb72adca934e31915be077c3d1f (diff) | |
download | redot-engine-b8b8a7127e3040582c5937fd2dff4c99e94a3b57.tar.gz |
Merge commit godotengine/godot@87318a2fb7fffeb72adca934e31915be077c3d1f
Diffstat (limited to 'platform/android/java/lib')
3 files changed, 19 insertions, 25 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt index 9e430c481e..0a424a7c6a 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt @@ -927,6 +927,12 @@ class Godot(private val context: Context) { } } + @Keep + private fun getAccentColor(): Int { + val value = TypedValue() + context.theme.resolveAttribute(android.R.attr.colorAccent, value, true) + return value.data + } /** * Destroys the Godot Engine and kill the process it's running in. diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java index 44102c5d9c..d42f8140a2 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java @@ -298,28 +298,6 @@ public class GodotIO { } } - /** - This function is used by DisplayServer::screen_get_internal_current_rotation (C++) - and is used to implement a performance optimization in devices that do not offer - a HW rotator. - @return - Rotation in degrees, in multiples of 90° - */ - public int getInternalCurrentScreenRotation() { - int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); - - switch (rotation) { - case Surface.ROTATION_90: - return 90; - case Surface.ROTATION_180: - return 180; - case Surface.ROTATION_270: - return 270; - default: - return 0; - } - } - public void setEdit(GodotEditText _edit) { edit = _edit; } diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java index 966b323bf6..d016b6cad0 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java @@ -51,7 +51,6 @@ import androidx.core.content.ContextCompat; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -68,6 +67,7 @@ public final class PermissionsUtil { public static final int REQUEST_ALL_PERMISSION_REQ_CODE = 1001; public static final int REQUEST_SINGLE_PERMISSION_REQ_CODE = 1002; public static final int REQUEST_MANAGE_EXTERNAL_STORAGE_REQ_CODE = 2002; + public static final int REQUEST_INSTALL_PACKAGES_REQ_CODE = 3002; private PermissionsUtil() { } @@ -107,6 +107,16 @@ public final class PermissionsUtil { activity.startActivityForResult(intent, REQUEST_MANAGE_EXTERNAL_STORAGE_REQ_CODE); } } + } else if (permission.equals(Manifest.permission.REQUEST_INSTALL_PACKAGES)) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !activity.getPackageManager().canRequestPackageInstalls()) { + try { + Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES); + intent.setData(Uri.parse(String.format("package:%s", activity.getPackageName()))); + activity.startActivityForResult(intent, REQUEST_INSTALL_PACKAGES_REQ_CODE); + } catch (Exception e) { + Log.e(TAG, "Unable to request permission " + Manifest.permission.REQUEST_INSTALL_PACKAGES); + } + } } else { PermissionInfo permissionInfo = getPermissionInfo(activity, permission); int protectionLevel = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? permissionInfo.getProtection() : permissionInfo.protectionLevel; @@ -217,7 +227,7 @@ public final class PermissionsUtil { try { manifestPermissions = getManifestPermissions(activity); } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); + Log.e(TAG, "Unable to retrieve manifest permissions", e); return false; } @@ -244,7 +254,7 @@ public final class PermissionsUtil { try { manifestPermissions = getManifestPermissions(context); } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); + Log.e(TAG, "Unable to retrieve manifest permissions", e); return new String[0]; } if (manifestPermissions.isEmpty()) { |