From 79db4835681f5d0149620ec8e0990411cb882241 Mon Sep 17 00:00:00 2001 From: Aditya Wasan Date: Tue, 12 Oct 2021 03:59:03 -0700 Subject: [PATCH] Add `ACCESS_MEDIA_LOCATION` permission (#32282) Summary: This PR adds `ACCESS_MEDIA_LOCATION` permission to the PermissionsAndroid library. It fixes https://github.com/facebook/react-native/issues/31953. It's a `dangerous` permission added in API level 29. https://developer.android.com/reference/android/Manifest.permission#ACCESS_MEDIA_LOCATION ## Changelog [Android] [Added] - Add ACCESS_MEDIA_LOCATION permission to PermisionsAndroid library. Pull Request resolved: https://github.com/facebook/react-native/pull/32282 Test Plan: ``` PermissionsAndroid.ACCESS_MEDIA_LOCATION === 'android.permission.ACCESS_MEDIA_LOCATION' ``` Reviewed By: yungsters Differential Revision: D31235523 Pulled By: cortinico fbshipit-source-id: 45fa86b1cdf8bc76453e9df6198c1f7ed923db7c --- Libraries/PermissionsAndroid/NativePermissionsAndroid.js | 3 ++- Libraries/PermissionsAndroid/PermissionsAndroid.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js index 358882c8ec4820..7c3a6c58ac7616 100644 --- a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js @@ -44,7 +44,8 @@ export type PermissionType = | 'android.permission.WRITE_EXTERNAL_STORAGE' | 'android.permission.BLUETOOTH_CONNECT' | 'android.permission.BLUETOOTH_SCAN' - | 'android.permission.BLUETOOTH_ADVERTISE'; + | 'android.permission.BLUETOOTH_ADVERTISE' + | 'android.permission.ACCESS_MEDIA_LOCATION'; */ export interface Spec extends TurboModule { diff --git a/Libraries/PermissionsAndroid/PermissionsAndroid.js b/Libraries/PermissionsAndroid/PermissionsAndroid.js index 1006cd3192451d..0a24840c56e18d 100644 --- a/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -62,6 +62,7 @@ const PERMISSIONS = Object.freeze({ BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT', BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN', BLUETOOTH_ADVERTISE: 'android.permission.BLUETOOTH_ADVERTISE', + ACCESS_MEDIA_LOCATION: 'android.permission.ACCESS_MEDIA_LOCATION', }); /** @@ -75,6 +76,7 @@ class PermissionsAndroid { ACCESS_BACKGROUND_LOCATION: string, ACCESS_COARSE_LOCATION: string, ACCESS_FINE_LOCATION: string, + ACCESS_MEDIA_LOCATION: string, ADD_VOICEMAIL: string, BLUETOOTH_ADVERTISE: string, BLUETOOTH_CONNECT: string,