mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-16 23:30:48 +01:00
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:
parent
f7ff3e8b3a
commit
f68d15cba3
2 changed files with 0 additions and 11 deletions
|
@ -171,11 +171,6 @@ public class WebRtcAudioRecord {
|
||||||
|
|
||||||
private int initRecording(int sampleRate, int channels) {
|
private int initRecording(int sampleRate, int channels) {
|
||||||
Logging.d(TAG, "initRecording(sampleRate=" + sampleRate + ", channels=" + 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) {
|
if (audioRecord != null) {
|
||||||
reportWebRtcAudioRecordInitError("InitRecording called twice without StopRecording.");
|
reportWebRtcAudioRecordInitError("InitRecording called twice without StopRecording.");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -207,10 +207,4 @@ public final class WebRtcAudioUtils {
|
||||||
+ "Model: " + Build.MODEL + ", "
|
+ "Model: " + Build.MODEL + ", "
|
||||||
+ "Product: " + Build.PRODUCT);
|
+ "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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue