When I update from Android 10 to 11, I get "open failed: EACCES (Permission denied)". The procedure is as follows
1.Save files from targetSDK28 app to internal storage(This is a proprietary file.)
/storage/emulated/0/MyAppName/202109259092928414.hoge
2.Update your device from Android 10 to 11
3.Load the file created in step 1 from the app that has been updated to targetSDK30.
FileInputStream in = new FileInputStream(new File("/storage/emulated/0/MyAppName/202109259092928414.hoge"))
file.exists()=true file.canRead()=false
4.An error occurred.
09-16 12:16:40.582 27825 27825 W System.err: java.io.FileNotFoundException: /storage/emulated/0/MyAppName/202109259092928414.hoge: open failed: EACCES (Permission denied) 09-16 12:16:40.583 27825 27825 W System.err: at libcore.io.IoBridge.open(IoBridge.java:492) 09-16 12:16:40.583 27825 27825 W System.err: at java.io.FileInputStream.(FileInputStream.java:160)
I have added and allowed storage permission in Manifest file and also on runtime for reading a file. However there is no Internal Storage Permission request available.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
and also for Android 10 I was using this attribute also
android:requestLegacyExternalStorage="true"
This does not occur on devices that have not been updated with the OS.