diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9e513cf6e..3bda3045e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -64,6 +64,7 @@
+
= Build.VERSION_CODES.TIRAMISU) {
+ permission1=Manifest.permission.READ_MEDIA_IMAGES;
+ permission2=Manifest.permission.READ_MEDIA_VIDEO;
+ }
+
//选择图片
- int isPermission1 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
- int isPermission2 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
+ int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
startActivity(intoIndex);
} else {
//申请权限
- ActivityCompat.requestPermissions(mContext, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ ActivityCompat.requestPermissions(mContext, new String[]{permission1,
+ permission2}, PERMISSION_REQUEST_CODE);
}
}
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java
index e77055df2..4a7cffde4 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java
@@ -4,6 +4,7 @@ import android.Manifest;
import android.app.ActionBar;
import android.app.Dialog;
import android.graphics.Color;
+import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
@@ -161,11 +162,20 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
@Override
public void onClick(View v) {
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_DEFAULT) {
- LiveAudienceActivity.mProcessResultUtil.requestPermissions(new String[]{
- Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE,
- Manifest.permission.RECORD_AUDIO
- }, new Runnable() {
+ String[] permissions;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ permissions=new String[]{
+ Manifest.permission.READ_MEDIA_IMAGES,
+ Manifest.permission.RECORD_AUDIO
+ };
+ }else{
+ permissions=new String[]{
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ Manifest.permission.RECORD_AUDIO
+ };
+ }
+ LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
diff --git a/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java b/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java
index 017cf7742..319fd943e 100644
--- a/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java
@@ -3,6 +3,7 @@ package com.yunbao.live.dialog;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
@@ -162,15 +163,21 @@ public class PDLIiveChatConversationFragment extends AbsDialogFragment implement
//intoIndex 1=调用相机,2=照片选取,3=视频选取
public void jumpPic(int intoIndex) {
+ String permission1=Manifest.permission.READ_EXTERNAL_STORAGE;
+ String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ permission1=Manifest.permission.READ_MEDIA_IMAGES;
+ permission2=Manifest.permission.READ_MEDIA_IMAGES;
+ }
//选择图片
- int isPermission1 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
- int isPermission2 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
+ int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
startActivity(intoIndex);
} else {
//申请权限
- ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ ActivityCompat.requestPermissions(getActivity(), new String[]{permission1,
+ permission2}, PERMISSION_REQUEST_CODE);
}
}
diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java
index dba97e787..983bc7b5a 100644
--- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java
+++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java
@@ -5,6 +5,7 @@ import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -587,12 +588,22 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
if (processResultUtil == null) {
return;
}
- processResultUtil.requestPermissions(new String[]{
- Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE,
- Manifest.permission.CAMERA,
- Manifest.permission.RECORD_AUDIO
- }, new Runnable() {
+ String[] permissions;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ permissions=new String[]{
+ Manifest.permission.READ_MEDIA_IMAGES,
+ Manifest.permission.CAMERA,
+ Manifest.permission.RECORD_AUDIO,
+ };
+ }else{
+ permissions=new String[]{
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ Manifest.permission.CAMERA,
+ Manifest.permission.RECORD_AUDIO
+ };
+ }
+ processResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
SocketLinkMicUtil.audienceApplyLinkMic(mSocketClient);
diff --git a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java
index 182f7518c..4a0f83171 100644
--- a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java
@@ -11,6 +11,7 @@ import android.content.pm.PackageManager;
import android.graphics.drawable.BitmapDrawable;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
+import android.os.Build;
import android.os.Handler;
import android.os.Parcelable;
import android.text.Editable;
@@ -682,14 +683,20 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli
//intoIndex 1=调用相机,2=照片选取,3=视频选取
public void choosePic(int intoIndex) {
//选择图片
- int isPermission1 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
- int isPermission2 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ String permission1=Manifest.permission.READ_EXTERNAL_STORAGE;
+ String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ permission1=Manifest.permission.READ_MEDIA_IMAGES;
+ permission2=Manifest.permission.READ_MEDIA_VIDEO;
+ }
+ int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
+ int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
startActivity(intoIndex);
} else {
//申请权限
- ActivityCompat.requestPermissions(nowActivity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ ActivityCompat.requestPermissions(nowActivity, new String[]{permission1,
+ permission2}, PERMISSION_REQUEST_CODE);
}
}
diff --git a/main/src/main/java/com/yunbao/main/activity/ThreeDistributActivity.java b/main/src/main/java/com/yunbao/main/activity/ThreeDistributActivity.java
index e55b94ae6..22c76faf1 100644
--- a/main/src/main/java/com/yunbao/main/activity/ThreeDistributActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/ThreeDistributActivity.java
@@ -309,10 +309,18 @@ public class ThreeDistributActivity extends AbsActivity implements View.OnClickL
* 生成分享图片
*/
private void saveBitmapFile() {
- mProcessResultUtil.requestPermissions(new String[]{
- Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE,
- }, new Runnable() {
+ String[] permissions;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ permissions=new String[]{
+ Manifest.permission.READ_MEDIA_IMAGES
+ };
+ }else{
+ permissions=new String[]{
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ };
+ }
+ mProcessResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
if (mContainer == null) {
diff --git a/video/src/main/java/com/yunbao/video/activity/AbsVideoPlayActivity.java b/video/src/main/java/com/yunbao/video/activity/AbsVideoPlayActivity.java
index ed8457dc3..170864c72 100644
--- a/video/src/main/java/com/yunbao/video/activity/AbsVideoPlayActivity.java
+++ b/video/src/main/java/com/yunbao/video/activity/AbsVideoPlayActivity.java
@@ -6,6 +6,7 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.media.MediaMetadataRetriever;
+import android.os.Build;
import android.text.TextUtils;
import android.view.WindowManager;
@@ -143,10 +144,18 @@ public abstract class AbsVideoPlayActivity extends AbsVideoCommentActivity {
if (mProcessResultUtil == null || videoBean == null || TextUtils.isEmpty(videoBean.getHref())) {
return;
}
- mProcessResultUtil.requestPermissions(new String[]{
- Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE,
- }, new Runnable() {
+ String[] permissions;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ permissions=new String[]{
+ Manifest.permission.READ_MEDIA_IMAGES
+ };
+ }else{
+ permissions=new String[]{
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE
+ };
+ }
+ mProcessResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
mDownloadVideoDialog = DialogUitl.loadingDialog(mContext);