Skip to content

Commit

Permalink
remove useless permission
Browse files Browse the repository at this point in the history
  • Loading branch information
xianing committed Apr 20, 2021
1 parent 82b02e4 commit 2b8bcb2
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class ConstantApp {
public static final int BASE_VALUE_PERMISSION = 0X0001;
public static final int PERMISSION_REQ_ID_RECORD_AUDIO = BASE_VALUE_PERMISSION + 1;
public static final int PERMISSION_REQ_ID_CAMERA = BASE_VALUE_PERMISSION + 2;
public static final int PERMISSION_REQ_ID_WRITE_EXTERNAL_STORAGE = BASE_VALUE_PERMISSION + 3;

public static final int MAX_PEER_COUNT = 4;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public void run() {

private boolean checkSelfPermissions() {
return checkSelfPermission(Manifest.permission.RECORD_AUDIO, ConstantApp.PERMISSION_REQ_ID_RECORD_AUDIO) &&
checkSelfPermission(Manifest.permission.CAMERA, ConstantApp.PERMISSION_REQ_ID_CAMERA) &&
checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, ConstantApp.PERMISSION_REQ_ID_WRITE_EXTERNAL_STORAGE);
checkSelfPermission(Manifest.permission.CAMERA, ConstantApp.PERMISSION_REQ_ID_CAMERA)
}

@Override
Expand Down Expand Up @@ -164,21 +163,12 @@ public void onRequestPermissionsResult(int requestCode,
case ConstantApp.PERMISSION_REQ_ID_CAMERA: {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, ConstantApp.PERMISSION_REQ_ID_WRITE_EXTERNAL_STORAGE);
permissionGranted();
} else {
finish();
}
break;
}
case ConstantApp.PERMISSION_REQ_ID_WRITE_EXTERNAL_STORAGE: {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
} else {
finish();
}
break;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public class VideoChatViewActivity extends AppCompatActivity {
// logs to external sdcard.
private static final String[] REQUESTED_PERMISSIONS = {
Manifest.permission.RECORD_AUDIO,
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE
Manifest.permission.CAMERA
};

private RtcEngine mRtcEngine;
Expand Down Expand Up @@ -214,7 +213,7 @@ public void onRequestPermissionsResult(int requestCode,
grantResults[1] != PackageManager.PERMISSION_GRANTED ||
grantResults[2] != PackageManager.PERMISSION_GRANTED) {

This comment has been minimized.

Copy link
@kishansinghpanwar

kishansinghpanwar Jun 17, 2021

The condition check for the 3rd position/item (grantResults[2] != PackageManager.PERMISSION_GRANTED) should be removed from here because now there are only 2 permissions that can be granted or denied. (0 and 1)

showLongToast("Need permissions " + Manifest.permission.RECORD_AUDIO +
"/" + Manifest.permission.CAMERA + "/" + Manifest.permission.WRITE_EXTERNAL_STORAGE);
"/" + Manifest.permission.CAMERA);
finish();
return;
}
Expand Down

0 comments on commit 2b8bcb2

Please sign in to comment.