Skip to content

Commit

Permalink
Revert "Update Android SDK Target to v32 (Android 12); request MANAGE…
Browse files Browse the repository at this point in the history
…_EXTERNAL_STORAGE (icosa-foundation#563)"

This reverts commit 1433142.
  • Loading branch information
helifax committed Jun 3, 2024
1 parent 02818fc commit 28db49c
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 117 deletions.
Binary file not shown.
5 changes: 1 addition & 4 deletions Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="false"
tools:replace="android:allowBackup"
Expand All @@ -16,9 +15,7 @@
<category android:name="com.oculus.intent.category.VR"/>
</intent-filter>
</activity>
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
</application>
<uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.oculus.permission.USE_SCENE" />
</manifest>
21 changes: 0 additions & 21 deletions Assets/Scenes/Loading.unity
Original file line number Diff line number Diff line change
Expand Up @@ -206,27 +206,6 @@ MonoBehaviour:
m_VrCamera: {fileID: 1815664868}
m_MaximumLoadingTime: 60
m_SceneLoadRatio: 0.75
m_LoadingText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 287897575133184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_RequestAndroidFolderPermissions:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 170004956477833216
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
--- !u!4 &326031496
Transform:
m_ObjectHideFlags: 0
Expand Down
68 changes: 0 additions & 68 deletions Assets/Scripts/LoadingScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Localization;

#if UNITY_ANDROID
using UnityEngine.Android;
#endif

namespace TiltBrush
{
Expand All @@ -32,17 +27,11 @@ public class LoadingScene : MonoBehaviour
// Amount of the progress bar taken up by the scene load
[SerializeField] private float m_SceneLoadRatio;

[SerializeField] private LocalizedString m_LoadingText;
[SerializeField] private LocalizedString m_RequestAndroidFolderPermissions;

// We have a slightly faked loading position that will always increase
// The fake loading rate is the minimum amount it will increase in one second, the reciprocal of
// m_MaximumLoadingTime
private float m_FakeLoadingRate;
private float m_CurrentLoadingPosition;
#if UNITY_ANDROID
private bool m_FolderPermissionOverride = false;
#endif

private IEnumerator Start()
{
Expand All @@ -69,23 +58,6 @@ private IEnumerator Start()

DontDestroyOnLoad(gameObject);

#if UNITY_ANDROID
if (Application.platform == RuntimePlatform.Android)
{
if (!UserHasManageExternalStoragePermission())
{
m_Overlay.MessageStatus = m_RequestAndroidFolderPermissions.GetLocalizedString();
AskForManageStoragePermission();
while (!UserHasManageExternalStoragePermission())
{
yield return new WaitForEndOfFrame();
}

m_Overlay.MessageStatus = m_LoadingText.GetLocalizedString();
}
}
#endif

AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("Main");
while (!asyncLoad.isDone)
{
Expand Down Expand Up @@ -119,45 +91,5 @@ private void UpdateProgress(float start, float scale, float progress)
m_CurrentLoadingPosition = Mathf.Max(m_CurrentLoadingPosition, position);
m_Overlay.Progress = m_CurrentLoadingPosition;
}

#if UNITY_ANDROID
private bool UserHasManageExternalStoragePermission()
{
bool isExternalStorageManager = false;
try
{
AndroidJavaClass environmentClass = new AndroidJavaClass("android.os.Environment");
isExternalStorageManager = environmentClass.CallStatic<bool>("isExternalStorageManager");
}
catch (AndroidJavaException e)
{
Debug.LogError("Java Exception caught and ignored: " + e.Message);
Debug.LogError("Assuming this means this device doesn't support isExternalStorageManager.");
}
return m_FolderPermissionOverride || isExternalStorageManager;
}

private void AskForManageStoragePermission()
{
try
{
using var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
using AndroidJavaObject currentActivityObject = unityClass.GetStatic<AndroidJavaObject>("currentActivity");
string packageName = currentActivityObject.Call<string>("getPackageName");
using var uriClass = new AndroidJavaClass("android.net.Uri");
using AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("fromParts", "package", packageName, null);
using var intentObject = new AndroidJavaObject("android.content.Intent", "android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION", uriObject);
intentObject.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
currentActivityObject.Call("startActivity", intentObject);
}
catch (AndroidJavaException e)
{
// TODO: only skip this if it's of type act=android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
m_FolderPermissionOverride = true;
Debug.LogError("Java Exception caught and ignored: " + e.Message);
Debug.LogError("Assuming this means we don't need android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION (e.g., Android SDK < 30)");
}
}
#endif
}
} // namespace TiltBrush
10 changes: 1 addition & 9 deletions Assets/Settings/Localization/Strings/Strings Shared Data.asset
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 287897575133184
m_Key: LOADING_SCENE_OVERLAY_LOADING
m_Key: LOADING_SCENE_OVERLAY_MESSAGE
m_Metadata:
m_Items: []
- m_Id: 7892854560759808
Expand Down Expand Up @@ -3271,14 +3271,6 @@ MonoBehaviour:
m_Key: POPUP_RECORD_UNSUPPORTED_TEXT
m_Metadata:
m_Items: []
- m_Id: 170004956477833216
m_Key: LOADING_SCENE_OVERLAY_ANDROIDPERMISSIONS
m_Metadata:
m_Items: []
- m_Id: 172767995928834048
m_Key: CONTROLLER_HINT_THUMBPAD_BRUSHSIZE
m_Metadata:
m_Items: []
m_Metadata:
m_Items: []
m_KeyGenerator:
Expand Down
16 changes: 3 additions & 13 deletions Assets/Settings/Localization/Strings/Strings_en.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3101,7 +3101,7 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 106429517453328384
m_Localized: Background Images
m_Localized: "Background Images"
m_Metadata:
m_Items: []
- m_Id: 95221400803737600
Expand Down Expand Up @@ -3457,21 +3457,11 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 151490030713540608
m_Localized: 'You can create a video of your sketch by opening it on a Mac or
PC. Search for "Exporting video" on our docs website: https://docs.openbrush.app
m_Localized: 'You can create a video of your sketch by opening it on a Mac or PC.
Search for "Exporting video" on our docs website: https://docs.openbrush.app
for a step by step guide.'
m_Metadata:
m_Items: []
- m_Id: 170004956477833216
m_Localized: Please give Open Brush file access to save your creations!
m_Metadata:
m_Items: []
- m_Id: 172767995928834048
m_Localized: 'Swipe To Adjust
Brush Size'
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
1 change: 0 additions & 1 deletion Assets/XR/Settings/OpenXR Editor Settings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ MonoBehaviour:
- featureSets: []
- featureSets:
- com.qualcomm.snapdragon.spaces
- com.qualcomm.snapdragon.spaces.experimental
m_vulkanAdditionalGraphicsQueue: 0
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ PlayerSettings:
overrideDefaultApplicationIdentifier: 1
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 29
AndroidTargetSdkVersion: 32
AndroidTargetSdkVersion: 31
AndroidPreferredInstallLocation: 0
aotOptions:
stripEngineCode: 1
Expand Down

0 comments on commit 28db49c

Please sign in to comment.