Skip to content

Commit ee56364

Browse files
GalaxyWearable: Disable required telephony permission
1 parent e073308 commit ee56364

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

GalaxyWearable/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ Enables running Samsung's GalaxyWearable app and companions on modded Samsung de
44

55
This is an Xposed variant of [`Linux4/GalaxyWearable`](https://github.com/Linux4/GalaxyWearable).
66

7-
Additionally disables the forced app update prompt when opening the app.
7+
Additional features:
8+
* Disable the forced app update prompt when opening the app
9+
* Disable the required phone permission
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
com.programminghoch10.GalaxyWearable.DisableForcedUpdateHook
22
com.programminghoch10.GalaxyWearable.DisableManufacturerCheckHook
3+
com.programminghoch10.GalaxyWearable.DisableTelephonyPermissionHook
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.programminghoch10.GalaxyWearable;
2+
3+
import java.util.ArrayList;
4+
5+
import de.robv.android.xposed.IXposedHookLoadPackage;
6+
import de.robv.android.xposed.XposedHelpers;
7+
import de.robv.android.xposed.callbacks.XC_LoadPackage;
8+
9+
public class DisableTelephonyPermissionHook implements IXposedHookLoadPackage {
10+
/*
11+
The app says the phone permission is used to "synchronize contacts".
12+
I think this is wrong, since contacts aren't requested,
13+
instead I think read-only access to the phone number and the phone state are used
14+
to automatically enable transparency mode while the user is in a call.
15+
Either way, this should be an optional permission.
16+
*/
17+
18+
@SuppressWarnings("unchecked")
19+
@Override
20+
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
21+
if (!lpparam.packageName.equals("com.samsung.android.app.watchmanager")) return;
22+
Class<?> PermissionsUtilsClass =
23+
XposedHelpers.findClass("com.samsung.android.app.watchmanager.setupwizard.permission.PermissionUtils", lpparam.classLoader);
24+
ArrayList<String> INITIAL_PERMISSION = (ArrayList<String>) XposedHelpers.getStaticObjectField(PermissionsUtilsClass, "INITIAL_PERMISSION");
25+
INITIAL_PERMISSION.remove("android.permission.READ_PHONE_STATE");
26+
INITIAL_PERMISSION.remove("android.permission.READ_PHONE_NUMBERS");
27+
}
28+
}

0 commit comments

Comments
 (0)