mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
c92c084ca1
Signed-off-by: Tad <tad@spotco.us>
114 lines
7.4 KiB
Diff
114 lines
7.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Micay <danielmicay@gmail.com>
|
|
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 ++
|
|
core/res/AndroidManifest.xml | 12 ++++++++++++
|
|
core/res/res/values/strings.xml | 12 ++++++++++++
|
|
.../pm/permission/PermissionManagerServiceImpl.java | 2 +-
|
|
.../server/pm/pkg/parsing/ParsingPackageUtils.java | 2 ++
|
|
5 files changed, 29 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/core/api/current.txt b/core/api/current.txt
|
|
index f229b6e25126..773d77422d9f 100644
|
|
--- a/core/api/current.txt
|
|
+++ b/core/api/current.txt
|
|
@@ -122,6 +122,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";
|
|
@@ -227,6 +228,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/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
|
|
index 0372e915b4ab..3f52b57a0dd3 100644
|
|
--- a/core/res/AndroidManifest.xml
|
|
+++ b/core/res/AndroidManifest.xml
|
|
@@ -1732,6 +1732,18 @@
|
|
android:protectionLevel="dangerous|instant" />
|
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
|
|
+ <permission-group android:name="android.permission-group.OTHER_SENSORS"
|
|
+ android:icon="@drawable/perm_group_location"
|
|
+ android:label="@string/permgrouplab_otherSensors"
|
|
+ android:description="@string/permgroupdesc_otherSensors"
|
|
+ android:priority="1000" />
|
|
+
|
|
+ <permission android:name="android.permission.OTHER_SENSORS"
|
|
+ android:permissionGroup="android.permission-group.UNDEFINED"
|
|
+ android:label="@string/permlab_otherSensors"
|
|
+ android:description="@string/permdesc_otherSensors"
|
|
+ android:protectionLevel="dangerous" />
|
|
+
|
|
<!-- ====================================================================== -->
|
|
<!-- REMOVED PERMISSIONS -->
|
|
<!-- ====================================================================== -->
|
|
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
|
|
index cfcc305988bc..2ea89de7d5cb 100644
|
|
--- a/core/res/res/values/strings.xml
|
|
+++ b/core/res/res/values/strings.xml
|
|
@@ -931,6 +931,11 @@
|
|
<!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE]-->
|
|
<string name="permgroupdesc_notifications">show notifications</string>
|
|
|
|
+ <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
|
|
+ <string name="permgrouplab_otherSensors">Sensors</string>
|
|
+ <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
|
|
+ <string name="permgroupdesc_otherSensors">access sensor data about orientation, movement, etc.</string>
|
|
+
|
|
<!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
|
|
<string name="permgrouplab_network">Network</string>
|
|
<!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
|
|
@@ -1261,6 +1266,13 @@
|
|
<!-- Description of the background body sensors permission, listed so the user can decide whether to allow the application to access data from body sensors in the background. [CHAR LIMIT=NONE] -->
|
|
<string name="permdesc_bodySensors_background" product="default">Allows the app to access body sensor data, such as heart rate, temperature, and blood oxygen percentage, while the app is in the background.</string>
|
|
|
|
+ <!-- Title of the sensors permission, listed so the user can decide whether to allow the application to access sensor data. [CHAR LIMIT=80] -->
|
|
+ <string name="permlab_otherSensors">access sensors (like the compass)
|
|
+ </string>
|
|
+ <!-- Description of the sensors permission, listed so the user can decide whether to allow the application to access data from sensors. [CHAR LIMIT=NONE] -->
|
|
+ <string name="permdesc_otherSensors" product="default">Allows the app to access data from sensors
|
|
+ monitoring orientation, movement, vibration (including low frequency sound) and environmental data</string>
|
|
+
|
|
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
|
<string name="permlab_readCalendar">Read calendar events and details</string>
|
|
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
|
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 714bf540468c..17d35cee6e53 100644
|
|
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java
|
|
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java
|
|
@@ -2524,7 +2524,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);
|
|
}
|
|
|
|
/**
|
|
diff --git a/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java b/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java
|
|
index 7ce7f7ebf6cc..2c1eed855404 100644
|
|
--- a/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java
|
|
+++ b/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java
|
|
@@ -2213,6 +2213,8 @@ public class ParsingPackageUtils {
|
|
|
|
pkg.setHasDomainUrls(hasDomainURLs(pkg));
|
|
|
|
+ pkg.addUsesPermission(new ParsedUsesPermissionImpl(android.Manifest.permission.OTHER_SENSORS, 0));
|
|
+
|
|
return input.success(pkg);
|
|
}
|
|
|