Removes check of RECORD_AUDIO in native audio layer on Android.

This type of check should instead be performed by the application/client.
If the app does not have mic permissions, construction of the AudioRecord
object will fail and the user will receive an error callback anyhow.

Bug: b/69434512
Change-Id: If1d7eff488f7c693697e048a567c17ed0c51f040
Reviewed-on: https://webrtc-review.googlesource.com/25261
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20839}
This commit is contained in:
henrika 2017-11-22 16:54:33 +01:00 committed by Commit Bot
parent f7ff3e8b3a
commit f68d15cba3
2 changed files with 0 additions and 11 deletions

View file

@ -171,11 +171,6 @@ public class WebRtcAudioRecord {
private int initRecording(int sampleRate, int channels) {
Logging.d(TAG, "initRecording(sampleRate=" + sampleRate + ", channels=" + channels + ")");
if (!WebRtcAudioUtils.hasPermission(
ContextUtils.getApplicationContext(), android.Manifest.permission.RECORD_AUDIO)) {
reportWebRtcAudioRecordInitError("RECORD_AUDIO permission is missing");
return -1;
}
if (audioRecord != null) {
reportWebRtcAudioRecordInitError("InitRecording called twice without StopRecording.");
return -1;

View file

@ -207,10 +207,4 @@ public final class WebRtcAudioUtils {
+ "Model: " + Build.MODEL + ", "
+ "Product: " + Build.PRODUCT);
}
// Checks if the process has as specified permission or not.
public static boolean hasPermission(Context context, String permission) {
return context.checkPermission(permission, Process.myPid(), Process.myUid())
== PackageManager.PERMISSION_GRANTED;
}
}