From 01a7e4f3a9e28dfb8d84e06e74960c594a690123 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 15 Feb 2015 09:09:04 +0100 Subject: [PATCH] Only hook what needs to be hooked Refs #1757 --- .../bokhorst/xprivacy/XAccountManager.java | 14 +++--- .../bokhorst/xprivacy/XActivityManager.java | 15 +++--- .../bokhorst/xprivacy/XClipboardManager.java | 11 +++-- .../xprivacy/XConnectivityManager.java | 2 +- .../bokhorst/xprivacy/XLocationManager.java | 16 ++++--- .../bokhorst/xprivacy/XPackageManager.java | 32 +++++++------ src/biz/bokhorst/xprivacy/XPrivacy.java | 46 +++++++++--------- src/biz/bokhorst/xprivacy/XSensorManager.java | 2 +- .../bokhorst/xprivacy/XTelephonyManager.java | 48 ++++++++++--------- src/biz/bokhorst/xprivacy/XWifiManager.java | 15 +++--- src/biz/bokhorst/xprivacy/XWindowManager.java | 2 +- 11 files changed, 108 insertions(+), 95 deletions(-) diff --git a/src/biz/bokhorst/xprivacy/XAccountManager.java b/src/biz/bokhorst/xprivacy/XAccountManager.java index 62ba84344..96250be7a 100644 --- a/src/biz/bokhorst/xprivacy/XAccountManager.java +++ b/src/biz/bokhorst/xprivacy/XAccountManager.java @@ -90,17 +90,19 @@ private enum Methods { }; // @formatter:on - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) className = cClassName; - listHook.add(new XAccountManager(Methods.Srv_getAccounts, PrivacyManager.cAccounts)); - listHook.add(new XAccountManager(Methods.Srv_getAccountsAsUser, PrivacyManager.cAccounts)); - listHook.add(new XAccountManager(Methods.Srv_getAccountsByFeatures, PrivacyManager.cAccounts)); - listHook.add(new XAccountManager(Methods.Srv_getAccountsForPackage, PrivacyManager.cAccounts)); - listHook.add(new XAccountManager(Methods.Srv_getSharedAccountsAsUser, PrivacyManager.cAccounts)); + if (server) { + listHook.add(new XAccountManager(Methods.Srv_getAccounts, PrivacyManager.cAccounts)); + listHook.add(new XAccountManager(Methods.Srv_getAccountsAsUser, PrivacyManager.cAccounts)); + listHook.add(new XAccountManager(Methods.Srv_getAccountsByFeatures, PrivacyManager.cAccounts)); + listHook.add(new XAccountManager(Methods.Srv_getAccountsForPackage, PrivacyManager.cAccounts)); + listHook.add(new XAccountManager(Methods.Srv_getSharedAccountsAsUser, PrivacyManager.cAccounts)); + } listHook.add(new XAccountManager(Methods.addOnAccountsUpdatedListener, PrivacyManager.cAccounts, className)); listHook.add(new XAccountManager(Methods.blockingGetAuthToken, PrivacyManager.cAccounts, className)); diff --git a/src/biz/bokhorst/xprivacy/XActivityManager.java b/src/biz/bokhorst/xprivacy/XActivityManager.java index acd31c593..56e05103b 100644 --- a/src/biz/bokhorst/xprivacy/XActivityManager.java +++ b/src/biz/bokhorst/xprivacy/XActivityManager.java @@ -67,19 +67,20 @@ private enum Methods { }; // @formatter:on - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) className = cClassName; for (Methods act : Methods.values()) - if (act.name().startsWith("Srv_")) - if (act.name().startsWith("Srv_start")) - listHook.add(new XActivityManager(act, null, null)); - else - listHook.add(new XActivityManager(act, PrivacyManager.cSystem, null)); - else + if (act.name().startsWith("Srv_")) { + if (server) + if (act.name().startsWith("Srv_start")) + listHook.add(new XActivityManager(act, null, null)); + else + listHook.add(new XActivityManager(act, PrivacyManager.cSystem, null)); + } else listHook.add(new XActivityManager(act, PrivacyManager.cSystem, className)); } return listHook; diff --git a/src/biz/bokhorst/xprivacy/XClipboardManager.java b/src/biz/bokhorst/xprivacy/XClipboardManager.java index b95755fd4..d1f82cd72 100644 --- a/src/biz/bokhorst/xprivacy/XClipboardManager.java +++ b/src/biz/bokhorst/xprivacy/XClipboardManager.java @@ -62,7 +62,7 @@ private enum Methods { }; // @formatter:on - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) @@ -70,10 +70,11 @@ public static List getInstances(String className) { for (Methods clip : Methods.values()) if (clip.name().startsWith("Srv_")) { - if (clip == Methods.Srv_removePrimaryClipChangedListener) - listHook.add(new XClipboardManager(clip, null)); - else - listHook.add(new XClipboardManager(clip, PrivacyManager.cClipboard)); + if (server) + if (clip == Methods.Srv_removePrimaryClipChangedListener) + listHook.add(new XClipboardManager(clip, null)); + else + listHook.add(new XClipboardManager(clip, PrivacyManager.cClipboard)); } else { if (clip == Methods.removePrimaryClipChangedListener) listHook.add(new XClipboardManager(clip, null, className)); diff --git a/src/biz/bokhorst/xprivacy/XConnectivityManager.java b/src/biz/bokhorst/xprivacy/XConnectivityManager.java index c33fc3f31..e4f5cfd28 100644 --- a/src/biz/bokhorst/xprivacy/XConnectivityManager.java +++ b/src/biz/bokhorst/xprivacy/XConnectivityManager.java @@ -30,7 +30,7 @@ private enum Methods { getActiveNetworkInfo, getAllNetworkInfo, getNetworkInfo }; - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) diff --git a/src/biz/bokhorst/xprivacy/XLocationManager.java b/src/biz/bokhorst/xprivacy/XLocationManager.java index 510ae732f..8e7a0d1ff 100644 --- a/src/biz/bokhorst/xprivacy/XLocationManager.java +++ b/src/biz/bokhorst/xprivacy/XLocationManager.java @@ -105,7 +105,7 @@ private enum Methods { }; // @formatter:on - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) @@ -114,12 +114,14 @@ public static List getInstances(String className) { for (Methods loc : Methods.values()) if (loc == Methods.removeUpdates) listHook.add(new XLocationManager(loc, null, className)); - else if (loc.name().startsWith("Srv_remove")) - listHook.add(new XLocationManager(loc, null, "com.android.server.LocationManagerService")); - else if (loc.name().startsWith("Srv_")) - listHook.add(new XLocationManager(loc, PrivacyManager.cLocation, - "com.android.server.LocationManagerService")); - else + else if (loc.name().startsWith("Srv_remove")) { + if (server) + listHook.add(new XLocationManager(loc, null, "com.android.server.LocationManagerService")); + } else if (loc.name().startsWith("Srv_")) { + if (server) + listHook.add(new XLocationManager(loc, PrivacyManager.cLocation, + "com.android.server.LocationManagerService")); + } else listHook.add(new XLocationManager(loc, PrivacyManager.cLocation, className)); } return listHook; diff --git a/src/biz/bokhorst/xprivacy/XPackageManager.java b/src/biz/bokhorst/xprivacy/XPackageManager.java index 177bc281c..bee8db111 100644 --- a/src/biz/bokhorst/xprivacy/XPackageManager.java +++ b/src/biz/bokhorst/xprivacy/XPackageManager.java @@ -101,26 +101,28 @@ private enum Methods { }; // @formatter:on - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) className = cClassName; - listHook.add(new XPackageManager(Methods.Srv_getPackageInfo, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_getApplicationInfo, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_getInstalledApplications, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_getInstalledPackages, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_getPackagesForUid, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_getPackagesHoldingPermissions, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_getPersistentApplications, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_getPreferredPackages, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_queryContentProviders, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_queryIntentActivities, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_queryIntentActivityOptions, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_queryIntentContentProviders, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_queryIntentReceivers, PrivacyManager.cSystem)); - listHook.add(new XPackageManager(Methods.Srv_queryIntentServices, PrivacyManager.cSystem)); + if (server) { + listHook.add(new XPackageManager(Methods.Srv_getPackageInfo, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getApplicationInfo, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getInstalledApplications, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getInstalledPackages, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getPackagesForUid, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getPackagesHoldingPermissions, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getPersistentApplications, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getPreferredPackages, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_queryContentProviders, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_queryIntentActivities, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_queryIntentActivityOptions, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_queryIntentContentProviders, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_queryIntentReceivers, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_queryIntentServices, PrivacyManager.cSystem)); + } listHook.add(new XPackageManager(Methods.getInstalledApplications, PrivacyManager.cSystem, className)); listHook.add(new XPackageManager(Methods.getInstalledPackages, PrivacyManager.cSystem, className)); diff --git a/src/biz/bokhorst/xprivacy/XPrivacy.java b/src/biz/bokhorst/xprivacy/XPrivacy.java index 68216b258..7a0e44b03 100644 --- a/src/biz/bokhorst/xprivacy/XPrivacy.java +++ b/src/biz/bokhorst/xprivacy/XPrivacy.java @@ -76,7 +76,7 @@ public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable { if (Util.hasLBE()) return; - handleLoadPackage(lpparam.packageName, lpparam.classLoader, mSecret); + handleLoadPackage(lpparam.packageName, lpparam.classLoader, lpparam.isFirstApplication, mSecret); } // Common @@ -122,11 +122,11 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } } - private static void handleLoadPackage(String packageName, final ClassLoader classLoader, String secret) { + private static void handleLoadPackage(String packageName, final ClassLoader classLoader, boolean main, String secret) { // Util.log(null, Log.INFO, "Load package=" + packageName + " uid=" + // Process.myUid()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && "android".equals(packageName)) + if (main && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && "android".equals(packageName)) try { Class cSystemServer = Class.forName("com.android.server.am.ActivityManagerService", false, classLoader); @@ -227,10 +227,10 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { private static void hookAll(final ClassLoader classLoader) { // Account manager - hookAll(XAccountManager.getInstances(null), classLoader, mSecret); + hookAll(XAccountManager.getInstances(null, true), classLoader, mSecret); // Activity manager - hookAll(XActivityManager.getInstances(null), classLoader, mSecret); + hookAll(XActivityManager.getInstances(null, true), classLoader, mSecret); // Activity manager service hookAll(XActivityManagerService.getInstances(), classLoader, mSecret); @@ -260,10 +260,10 @@ private static void hookAll(final ClassLoader classLoader) { hookAll(XCameraDevice2.getInstances(), classLoader, mSecret); // Clipboard manager - hookAll(XClipboardManager.getInstances(null), classLoader, mSecret); + hookAll(XClipboardManager.getInstances(null, true), classLoader, mSecret); // Connectivity manager - hookAll(XConnectivityManager.getInstances(null), classLoader, mSecret); + hookAll(XConnectivityManager.getInstances(null, true), classLoader, mSecret); // Content resolver hookAll(XContentResolver.getInstances(null), classLoader, mSecret); @@ -293,7 +293,7 @@ private static void hookAll(final ClassLoader classLoader) { hookAll(XLinkProperties.getInstances(), classLoader, mSecret); // Location manager - hookAll(XLocationManager.getInstances(null), classLoader, mSecret); + hookAll(XLocationManager.getInstances(null, true), classLoader, mSecret); // Media recorder hookAll(XMediaRecorder.getInstances(), classLoader, mSecret); @@ -308,7 +308,7 @@ private static void hookAll(final ClassLoader classLoader) { hookAll(XNfcAdapter.getInstances(), classLoader, mSecret); // Package manager service - hookAll(XPackageManager.getInstances(null), classLoader, mSecret); + hookAll(XPackageManager.getInstances(null, true), classLoader, mSecret); // Process hookAll(XProcess.getInstances(), classLoader, mSecret); @@ -323,7 +323,7 @@ private static void hookAll(final ClassLoader classLoader) { hookAll(XRuntime.getInstances(), classLoader, mSecret); // Sensor manager - hookAll(XSensorManager.getInstances(null), classLoader, mSecret); + hookAll(XSensorManager.getInstances(null, true), classLoader, mSecret); // Settings secure hookAll(XSettingsSecure.getInstances(), classLoader, mSecret); @@ -338,7 +338,7 @@ private static void hookAll(final ClassLoader classLoader) { hookAll(XSystemProperties.getInstances(), classLoader, mSecret); // Telephone service - hookAll(XTelephonyManager.getInstances(null), classLoader, mSecret); + hookAll(XTelephonyManager.getInstances(null, true), classLoader, mSecret); // Usage statistics manager hookAll(XUsageStatsManager.getInstances(), classLoader, mSecret); @@ -350,10 +350,10 @@ private static void hookAll(final ClassLoader classLoader) { hookAll(XWebView.getInstances(), classLoader, mSecret); // Window service - hookAll(XWindowManager.getInstances(null), classLoader, mSecret); + hookAll(XWindowManager.getInstances(null, true), classLoader, mSecret); // Wi-Fi service - hookAll(XWifiManager.getInstances(null), classLoader, mSecret); + hookAll(XWifiManager.getInstances(null, true), classLoader, mSecret); // Intent receive hookAll(XActivityThread.getInstances(), classLoader, mSecret); @@ -367,25 +367,25 @@ public static void handleGetSystemService(String name, String className, String PrivacyManager.setTransient(className, Boolean.toString(true)); if (name.equals(Context.ACCOUNT_SERVICE)) - hookAll(XAccountManager.getInstances(className), null, secret); + hookAll(XAccountManager.getInstances(className, false), null, secret); else if (name.equals(Context.ACTIVITY_SERVICE)) - hookAll(XActivityManager.getInstances(className), null, secret); + hookAll(XActivityManager.getInstances(className, false), null, secret); else if (name.equals(Context.CLIPBOARD_SERVICE)) - hookAll(XClipboardManager.getInstances(className), null, secret); + hookAll(XClipboardManager.getInstances(className, false), null, secret); else if (name.equals(Context.CONNECTIVITY_SERVICE)) - hookAll(XConnectivityManager.getInstances(className), null, secret); + hookAll(XConnectivityManager.getInstances(className, false), null, secret); else if (name.equals(Context.LOCATION_SERVICE)) - hookAll(XLocationManager.getInstances(className), null, secret); + hookAll(XLocationManager.getInstances(className, false), null, secret); else if (name.equals("PackageManager")) - hookAll(XPackageManager.getInstances(className), null, secret); + hookAll(XPackageManager.getInstances(className, false), null, secret); else if (name.equals(Context.SENSOR_SERVICE)) - hookAll(XSensorManager.getInstances(className), null, secret); + hookAll(XSensorManager.getInstances(className, false), null, secret); else if (name.equals(Context.TELEPHONY_SERVICE)) - hookAll(XTelephonyManager.getInstances(className), null, secret); + hookAll(XTelephonyManager.getInstances(className, false), null, secret); else if (name.equals(Context.WINDOW_SERVICE)) - hookAll(XWindowManager.getInstances(className), null, secret); + hookAll(XWindowManager.getInstances(className, false), null, secret); else if (name.equals(Context.WIFI_SERVICE)) - hookAll(XWifiManager.getInstances(className), null, secret); + hookAll(XWifiManager.getInstances(className, false), null, secret); } } diff --git a/src/biz/bokhorst/xprivacy/XSensorManager.java b/src/biz/bokhorst/xprivacy/XSensorManager.java index d5e716f1d..f3eab1fc8 100644 --- a/src/biz/bokhorst/xprivacy/XSensorManager.java +++ b/src/biz/bokhorst/xprivacy/XSensorManager.java @@ -42,7 +42,7 @@ private enum Methods { getDefaultSensor, getSensorList, registerListener }; - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) diff --git a/src/biz/bokhorst/xprivacy/XTelephonyManager.java b/src/biz/bokhorst/xprivacy/XTelephonyManager.java index c6d6efe0d..9107b0339 100644 --- a/src/biz/bokhorst/xprivacy/XTelephonyManager.java +++ b/src/biz/bokhorst/xprivacy/XTelephonyManager.java @@ -150,7 +150,7 @@ private enum Methods { }; // @formatter:on - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) @@ -188,28 +188,30 @@ public static List getInstances(String className) { listHook.add(new XTelephonyManager(Methods.getSimOperator, PrivacyManager.cPhone, className)); listHook.add(new XTelephonyManager(Methods.getSimOperatorName, PrivacyManager.cPhone, className)); - // PhoneSubInfo - listHook.add(new XTelephonyManager(Methods.Srv_getDeviceId, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getGroupIdLevel1, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getIccSerialNumber, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getIsimDomain, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getIsimImpi, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getIsimImpu, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getLine1AlphaTag, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getLine1Number, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getMsisdn, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getSubscriberId, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getCompleteVoiceMailNumber, PrivacyManager.cPhone, - Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getVoiceMailAlphaTag, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getVoiceMailNumber, PrivacyManager.cPhone, Srv.SubInfo)); - - listHook.add(new XTelephonyManager(Methods.Srv_getImei, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getIsimIst, PrivacyManager.cPhone, Srv.SubInfo)); - listHook.add(new XTelephonyManager(Methods.Srv_getIsimPcscf, PrivacyManager.cPhone, Srv.SubInfo)); - - listHook.add(new XTelephonyManager(Methods.Srv_listen, PrivacyManager.cLocation, Srv.Registry)); - listHook.add(new XTelephonyManager(Methods.Srv_listen, PrivacyManager.cPhone, Srv.Registry)); + if (server) { + // PhoneSubInfo + listHook.add(new XTelephonyManager(Methods.Srv_getDeviceId, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getGroupIdLevel1, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getIccSerialNumber, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getIsimDomain, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getIsimImpi, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getIsimImpu, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getLine1AlphaTag, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getLine1Number, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getMsisdn, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getSubscriberId, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getCompleteVoiceMailNumber, PrivacyManager.cPhone, + Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getVoiceMailAlphaTag, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getVoiceMailNumber, PrivacyManager.cPhone, Srv.SubInfo)); + + listHook.add(new XTelephonyManager(Methods.Srv_getImei, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getIsimIst, PrivacyManager.cPhone, Srv.SubInfo)); + listHook.add(new XTelephonyManager(Methods.Srv_getIsimPcscf, PrivacyManager.cPhone, Srv.SubInfo)); + + listHook.add(new XTelephonyManager(Methods.Srv_listen, PrivacyManager.cLocation, Srv.Registry)); + listHook.add(new XTelephonyManager(Methods.Srv_listen, PrivacyManager.cPhone, Srv.Registry)); + } } return listHook; } diff --git a/src/biz/bokhorst/xprivacy/XWifiManager.java b/src/biz/bokhorst/xprivacy/XWifiManager.java index 27011822e..e71e3ff84 100644 --- a/src/biz/bokhorst/xprivacy/XWifiManager.java +++ b/src/biz/bokhorst/xprivacy/XWifiManager.java @@ -58,7 +58,7 @@ private enum Methods { }; // @formatter:on - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null) @@ -71,17 +71,20 @@ public static List getInstances(String className) { srvClassName = "com.android.server.wifi.WifiService"; for (Methods wifi : Methods.values()) - if (wifi.name().startsWith("Srv_")) - listHook.add(new XWifiManager(wifi, PrivacyManager.cNetwork, srvClassName)); - else + if (wifi.name().startsWith("Srv_")) { + if (server) + listHook.add(new XWifiManager(wifi, PrivacyManager.cNetwork, srvClassName)); + } else listHook.add(new XWifiManager(wifi, PrivacyManager.cNetwork, className)); listHook.add(new XWifiManager(Methods.getScanResults, PrivacyManager.cLocation, className)); - listHook.add(new XWifiManager(Methods.Srv_getScanResults, PrivacyManager.cLocation, srvClassName)); + if (server) + listHook.add(new XWifiManager(Methods.Srv_getScanResults, PrivacyManager.cLocation, srvClassName)); // This is to fake "offline", no permission required listHook.add(new XWifiManager(Methods.getConnectionInfo, PrivacyManager.cInternet, className)); - listHook.add(new XWifiManager(Methods.Srv_getConnectionInfo, PrivacyManager.cInternet, srvClassName)); + if (server) + listHook.add(new XWifiManager(Methods.Srv_getConnectionInfo, PrivacyManager.cInternet, srvClassName)); } return listHook; diff --git a/src/biz/bokhorst/xprivacy/XWindowManager.java b/src/biz/bokhorst/xprivacy/XWindowManager.java index e7029f11a..4ccbdf20d 100644 --- a/src/biz/bokhorst/xprivacy/XWindowManager.java +++ b/src/biz/bokhorst/xprivacy/XWindowManager.java @@ -39,7 +39,7 @@ private enum Methods { addView, removeView, updateViewLayout }; - public static List getInstances(String className) { + public static List getInstances(String className, boolean server) { List listHook = new ArrayList(); if (!cClassName.equals(className)) { if (className == null)