From 9e8d6b224b8b89d93b8041a68e35d530f5821959 Mon Sep 17 00:00:00 2001 From: tornaco Date: Fri, 24 Feb 2023 12:54:53 +0800 Subject: [PATCH] [service] add SENSOR ops --- .../android/thanos/core/secure/ops/AppOpsManager.java | 7 +++++-- .../android/thanos/core/secure/ops/OpsTemplate.java | 4 +++- android/internal/Thanox-Internal | 2 +- .../src/main/res/drawable/module_ops_ic_sensor.xml | 9 +++++++++ .../src/main/res/layout/module_ops_item_ops.xml | 11 +++++++---- .../src/main/res/values-zh-rCN/appops_states.xml | 2 ++ .../src/main/res/values-zh-rTW/appops_states.xml | 2 ++ .../module_ops/src/main/res/values/appops_states.xml | 3 +++ 8 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 android/modules/module_ops/src/main/res/drawable/module_ops_ic_sensor.xml diff --git a/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/AppOpsManager.java b/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/AppOpsManager.java index 817b717e9..0194cd15d 100644 --- a/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/AppOpsManager.java +++ b/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/AppOpsManager.java @@ -555,9 +555,10 @@ public class AppOpsManager { public static final int OP_GET_INSTALLED_PACKAGES = _OP_THANOX_BASE + 2; public static final int OP_QUERY_INTENT_ACTIVITIES = _OP_THANOX_BASE + 3; public static final int OP_ANY_LOCATION = _OP_THANOX_BASE + 4; + public static final int OP_SENSOR = _OP_THANOX_BASE + 5; public static final int _OP_ANDROID_LAST = OP_NO_ISOLATED_STORAGE; - public static final int _OP_THANOX_LAST = OP_ANY_LOCATION; + public static final int _OP_THANOX_LAST = OP_SENSOR; /** * Access to coarse location information. @@ -959,7 +960,7 @@ public class AppOpsManager { /** * @hide */ - public static final int _NUM_OP = 105; + public static final int _NUM_OP = 106; /** * This optionally maps a permission to an operation. If there is no permission associated with @@ -1075,6 +1076,7 @@ public class AppOpsManager { null, null, null, + null, }; private static final String[] S_OP_TO_STRING = new String[]{ @@ -1183,6 +1185,7 @@ public class AppOpsManager { "", "", "", + "", "" }; diff --git a/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/OpsTemplate.java b/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/OpsTemplate.java index c41ba96b4..ee0727e2b 100644 --- a/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/OpsTemplate.java +++ b/android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/secure/ops/OpsTemplate.java @@ -110,7 +110,9 @@ public static OpsTemplate templateOfOp(int op) { AppOpsManager.OP_CHANGE_BRIGHTNESS, AppOpsManager.OP_GET_INSTALLED_PACKAGES, AppOpsManager.OP_GET_PACKAGE_INFO, - AppOpsManager.OP_QUERY_INTENT_ACTIVITIES} + AppOpsManager.OP_QUERY_INTENT_ACTIVITIES, + AppOpsManager.OP_SENSOR, + } ); // this template should contain all ops which are not part of any other template in diff --git a/android/internal/Thanox-Internal b/android/internal/Thanox-Internal index 93f6342da..c82e95467 160000 --- a/android/internal/Thanox-Internal +++ b/android/internal/Thanox-Internal @@ -1 +1 @@ -Subproject commit 93f6342da2636b732b4b50578875e082be93f1b1 +Subproject commit c82e95467cb095ebfa76c0cca1f79b8d7d27b776 diff --git a/android/modules/module_ops/src/main/res/drawable/module_ops_ic_sensor.xml b/android/modules/module_ops/src/main/res/drawable/module_ops_ic_sensor.xml new file mode 100644 index 000000000..7ce990e59 --- /dev/null +++ b/android/modules/module_ops/src/main/res/drawable/module_ops_ic_sensor.xml @@ -0,0 +1,9 @@ + + + diff --git a/android/modules/module_ops/src/main/res/layout/module_ops_item_ops.xml b/android/modules/module_ops/src/main/res/layout/module_ops_item_ops.xml index 7c08e0a38..b8281731d 100644 --- a/android/modules/module_ops/src/main/res/layout/module_ops_item_ops.xml +++ b/android/modules/module_ops/src/main/res/layout/module_ops_item_ops.xml @@ -1,5 +1,6 @@ @@ -38,14 +39,16 @@ android:clickable="true" android:focusable="true" android:foreground="?selectableItemBackground" - android:minHeight="@dimen/common_list_item_height" - android:soundEffectsEnabled="false"> + android:soundEffectsEnabled="false" + app:contentPaddingBottom="4dp" + app:contentPaddingTop="4dp" + tools:cardBackgroundColor="@android:color/holo_blue_bright"> + android:minHeight="@dimen/list_item_height_small"> + tools:text="This is summary This is summary This is summary This is summary This is summary This is summary This is summary" /> diff --git a/android/modules/module_ops/src/main/res/values-zh-rCN/appops_states.xml b/android/modules/module_ops/src/main/res/values-zh-rCN/appops_states.xml index e549363fd..e69911807 100755 --- a/android/modules/module_ops/src/main/res/values-zh-rCN/appops_states.xml +++ b/android/modules/module_ops/src/main/res/values-zh-rCN/appops_states.xml @@ -129,6 +129,7 @@ 获取已安装应用 Query intent(LAUNCHER, 经常用于查询应用列表) activities 获取您的位置信息 + 接收传感器数据,禁止后应用的摇一摇等依赖传感器的功能将会失效;拒绝该权限需要xposed中勾选该目标应用的作用域 @@ -240,5 +241,6 @@ 获取已安装应用列表 查询意图活动 定位 + 接收传感器数据 diff --git a/android/modules/module_ops/src/main/res/values-zh-rTW/appops_states.xml b/android/modules/module_ops/src/main/res/values-zh-rTW/appops_states.xml index 302389513..69971a509 100755 --- a/android/modules/module_ops/src/main/res/values-zh-rTW/appops_states.xml +++ b/android/modules/module_ops/src/main/res/values-zh-rTW/appops_states.xml @@ -129,6 +129,7 @@ 獲取已安裝應用 Query intent(LAUNCHER, 經常用於查詢應用列表) activities 获取您的位置信息 + 接收傳感器數據,禁止後應用的搖一搖等依賴傳感器的功能將會失效;拒絕該權限需要xposed中勾選該目標應用的作用域 @@ -240,5 +241,6 @@ 獲取已安裝應用列表 查詢意圖活動 定位 + 接收傳感器數據 diff --git a/android/modules/module_ops/src/main/res/values/appops_states.xml b/android/modules/module_ops/src/main/res/values/appops_states.xml index e2725e830..de6d04c02 100755 --- a/android/modules/module_ops/src/main/res/values/appops_states.xml +++ b/android/modules/module_ops/src/main/res/values/appops_states.xml @@ -128,6 +128,7 @@ Get installed apps Query intent(LAUNCHER, usually used to query installed apps) activities Access device location + Receive sensor event, remember select target app in scoped Xposed framework @@ -239,6 +240,7 @@ Get installed apps Query intent activities Location + Receive sensor event @@ -349,6 +351,7 @@ @drawable/module_ops_ic_apps_fill @drawable/module_ops_ic_apps_fill @drawable/module_ops_ic_map_pin_fill + @drawable/module_ops_ic_sensor