From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 7 Oct 2017 22:54:42 +0300 Subject: [PATCH] add special runtime permission for other sensors Ported from 12: 9d5a62ed573bc3c7be8b19445b372fed13533d0e --- core/api/current.txt | 2 ++ .../internal/pm/pkg/parsing/ParsingPackageUtils.java | 2 ++ core/res/AndroidManifest.xml | 12 ++++++++++++ core/res/res/values/strings.xml | 12 ++++++++++++ .../pm/permission/PermissionManagerServiceImpl.java | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/core/api/current.txt b/core/api/current.txt index ab1becbad01f..2f251c8a7755 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -220,6 +220,7 @@ package android { field public static final String NFC = "android.permission.NFC"; field public static final String NFC_PREFERRED_PAYMENT_INFO = "android.permission.NFC_PREFERRED_PAYMENT_INFO"; field public static final String NFC_TRANSACTION_EVENT = "android.permission.NFC_TRANSACTION_EVENT"; + field public static final String OTHER_SENSORS = "android.permission.OTHER_SENSORS"; field public static final String OVERRIDE_WIFI_CONFIG = "android.permission.OVERRIDE_WIFI_CONFIG"; field public static final String PACKAGE_USAGE_STATS = "android.permission.PACKAGE_USAGE_STATS"; field @Deprecated public static final String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY"; @@ -333,6 +334,7 @@ package android { field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES"; field public static final String NETWORK = "android.permission-group.NETWORK"; field public static final String NOTIFICATIONS = "android.permission-group.NOTIFICATIONS"; + field public static final String OTHER_SENSORS = "android.permission-group.OTHER_SENSORS"; field public static final String PHONE = "android.permission-group.PHONE"; field public static final String READ_MEDIA_AURAL = "android.permission-group.READ_MEDIA_AURAL"; field public static final String READ_MEDIA_VISUAL = "android.permission-group.READ_MEDIA_VISUAL"; diff --git a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java index dbe4fba5dfdb..f71bbec1a8ad 100644 --- a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java +++ b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java @@ -2321,6 +2321,8 @@ public class ParsingPackageUtils { setSupportsSizeChanges(pkg); pkg.setHasDomainUrls(hasDomainURLs(pkg)); + + pkg.addUsesPermission(new ParsedUsesPermissionImpl(android.Manifest.permission.OTHER_SENSORS, 0)); } /** diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 6536d86432b4..84a53173be9f 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1815,6 +1815,18 @@ android:protectionLevel="dangerous|instant" /> + + + + diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 5fe90e5510f5..fe69b195ea4c 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -946,6 +946,11 @@ show notifications + + Sensors + + access sensor data about orientation, movement, etc. + Network @@ -1361,6 +1366,13 @@ Allows the app to access body sensor data, such as heart rate, temperature, and blood oxygen percentage, while the app is in the background. + + access sensors (like the compass) + + + Allows the app to access data from sensors + monitoring orientation, movement, vibration (including low frequency sound) and environmental data + Read calendar events and details diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java index ad63a2d19779..9d91fbc0be74 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java @@ -2477,7 +2477,7 @@ public class PermissionManagerServiceImpl implements PermissionManagerServiceInt } public static boolean isSpecialRuntimePermission(final String permission) { - return Manifest.permission.INTERNET.equals(permission); + return Manifest.permission.INTERNET.equals(permission) || Manifest.permission.OTHER_SENSORS.equals(permission); } /**