Skip to content

Commit

Permalink
feat: add missing Android dangerous permissions (#32445)
Browse files Browse the repository at this point in the history
Summary:
This PR adds all missing `dangerous` permissions in Android. I recently updated these for Android 12 and found many more missing dating all the way back to API 26. After this PR, it will be in sync with ALL dangerous permissions as of the recently released Android 12.

https://developer.android.com/reference/android/Manifest.permission.html#ACCEPT_HANDOVER - 28
https://developer.android.com/reference/android/Manifest.permission.html#ACTIVITY_RECOGNITION - 29
https://developer.android.com/reference/android/Manifest.permission.html#ANSWER_PHONE_CALLS - 26
https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_NUMBERS - 26
https://developer.android.com/reference/android/Manifest.permission.html#UWB_RANGING - 31

## Changelog

[Android] [Changed] - Add ACCEPT_HANDOVER, ACTIVITY_RECOGNITION, ANSWER_PHONE_CALLS, READ_PHONE_NUMBERS & UWB_RANGING to PermissionsAndroid

Pull Request resolved: #32445

Test Plan:
```
PermissionsAndroid.ACCEPT_HANDOVER === 'android.permission.ACCEPT_HANDOVER'
PermissionsAndroid.ACTIVITY_RECOGNITION === 'android.permission.ACTIVITY_RECOGNITION'
PermissionsAndroid.ANSWER_PHONE_CALLS === 'android.permission.ANSWER_PHONE_CALLS'
PermissionsAndroid.READ_PHONE_NUMBERS === 'android.permission.READ_PHONE_NUMBERS'
PermissionsAndroid.UWB_RANGING === 'android.permission.UWB_RANGING'
```

Reviewed By: yungsters

Differential Revision: D31793802

Pulled By: sshic

fbshipit-source-id: 4a2e5086e92ccd223e74db451c4ccd87485ffb63
  • Loading branch information
iBotPeaches authored and facebook-github-bot committed Oct 22, 2021
1 parent b03e824 commit 4b25a0a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Libraries/PermissionsAndroid/NativePermissionsAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export type PermissionType =
| 'android.permission.BLUETOOTH_CONNECT'
| 'android.permission.BLUETOOTH_SCAN'
| 'android.permission.BLUETOOTH_ADVERTISE'
| 'android.permission.ACCESS_MEDIA_LOCATION';
| 'android.permission.ACCESS_MEDIA_LOCATION'
| 'android.permission.ACCEPT_HANDOVER'
| 'android.permission.ACTIVITY_RECOGNITION'
| 'android.permission.ANSWER_PHONE_CALLS'
| 'android.permission.READ_PHONE_NUMBERS'
| 'android.permission.UWB_RANGING';
*/

export interface Spec extends TurboModule {
Expand Down
10 changes: 10 additions & 0 deletions Libraries/PermissionsAndroid/PermissionsAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ const PERMISSIONS = Object.freeze({
BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN',
BLUETOOTH_ADVERTISE: 'android.permission.BLUETOOTH_ADVERTISE',
ACCESS_MEDIA_LOCATION: 'android.permission.ACCESS_MEDIA_LOCATION',
ACCEPT_HANDOVER: 'android.permission.ACCEPT_HANDOVER',
ACTIVITY_RECOGNITION: 'android.permission.ACTIVITY_RECOGNITION',
ANSWER_PHONE_CALLS: 'android.permission.ANSWER_PHONE_CALLS',
READ_PHONE_NUMBERS: 'android.permission.READ_PHONE_NUMBERS',
UWB_RANGING: 'android.permission.UWB_RANGING',
});

/**
Expand All @@ -73,11 +78,14 @@ const PERMISSIONS = Object.freeze({

class PermissionsAndroid {
PERMISSIONS: {|
ACCEPT_HANDOVER: string,
ACCESS_BACKGROUND_LOCATION: string,
ACCESS_COARSE_LOCATION: string,
ACCESS_FINE_LOCATION: string,
ACCESS_MEDIA_LOCATION: string,
ACTIVITY_RECOGNITION: string,
ADD_VOICEMAIL: string,
ANSWER_PHONE_CALLS: string,
BLUETOOTH_ADVERTISE: string,
BLUETOOTH_CONNECT: string,
BLUETOOTH_SCAN: string,
Expand All @@ -90,6 +98,7 @@ class PermissionsAndroid {
READ_CALL_LOG: string,
READ_CONTACTS: string,
READ_EXTERNAL_STORAGE: string,
READ_PHONE_NUMBERS: string,
READ_PHONE_STATE: string,
READ_SMS: string,
RECEIVE_MMS: string,
Expand All @@ -98,6 +107,7 @@ class PermissionsAndroid {
RECORD_AUDIO: string,
SEND_SMS: string,
USE_SIP: string,
UWB_RANGING: string,
WRITE_CALENDAR: string,
WRITE_CALL_LOG: string,
WRITE_CONTACTS: string,
Expand Down

0 comments on commit 4b25a0a

Please sign in to comment.