关于分区存储,官方文档的一段:
Access files using direct file paths and native libraries
To help your app work more smoothly with third-party media libraries, Android 11 allows you to use APIs other than the MediaStore API to access media files from shared storage. You can instead choose to access media files directly using either of the following APIs:
The File API.
Native libraries, such as fopen().
If your app doesn’t have any storage permissions, you can access media files that are attributed to your app using direct file paths. If your app has the READ_EXTERNAL_STORAGE permission, it can access all media files using direct file paths, regardless of whether the files are attributed to your app.
If you access media files directly, it’s recommended that you opt out of scoped storage by setting requestLegacyExternalStorage to true in your app’s manifest file. That way, your app behaves as expected on devices that run Android 10.
意思是为了应用能使用第三方的媒体库,Android 11 允许使用分区存储api之外的api访问文件,如Java File相关类,或者c的fopen,如果你有了读取外部文件的权限的话,就可以通过上面的方式访问所有公共媒体文件
另外:
分区存储有一些小优化,对于一些特别文件访问不需要申请存储权限了,比如应用自己下载的
在 Android 11 上,应用无法再访问外部存储设备中的任何其他应用的专用于特定应用的目录中的文件。
使用Palette获取图片的色调等信息
比如现在的根据图片改变ViewPager与Fragement搭配使用时Item的颜色,或者通知栏颜色就可以使用这种方式,让通知栏色调和背景图片颜色一致。
Palette可以提取的颜色如下:
● Vibrant (有活力的)
● Vibrant dark(有活力的 暗色)
● Vibrant light(有活力的 亮色)
● Muted (柔和的)
● Muted dark(柔和的 暗色)
● Muted light(柔和的 亮色)