From 10448862c15eaca34d42c8ebceb6171d9cd7c305 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 15 Dec 2014 16:38:49 +0100 Subject: [PATCH] Added new restrictions for PhoneInterfaceManager Refs #1757 --- CHANGELOG.md | 1 + res/values/functions.xml | 5 +++ src/biz/bokhorst/xprivacy/Meta.java | 14 ++++-- .../bokhorst/xprivacy/XTelephonyManager.java | 44 +++++++++++++++++-- 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bcb63faf..d1477ba1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Changelog * Added restrictions *Srv_addGpsMeasurementsListener* and *Srv_addGpsNavigationMessageListener* ([issue](/../../issues/1757)) * Added restrictions *getCarrierConfigValues* and *sendMultimediaMessage* ([issue](/../../issues/1757)) * Added restrictions *Srv_getImei*, *Srv_getIsimIst* and *Srv_getIsimPcscf* ([issue](/../../issues/1757)) +* Added restrictions *Srv_enableLocationUpdatesForSubscriber*, *Srv_getCdmaMdn*, *Srv_getCdmaMin*, *getLine1AlphaTagForDisplay* and *Srv_getLine1NumberForDisplay* ([issue](/../../issues/1757)) [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/res/values/functions.xml b/res/values/functions.xml index ef819d19f..774515c85 100644 --- a/res/values/functions.xml +++ b/res/values/functions.xml @@ -167,6 +167,7 @@ Google documentation]]> Google documentation]]> phone state listener]]> + phone state listener]]> Google documentation]]> Google documentation]]> Google documentation]]> @@ -317,6 +318,10 @@ Google documentation]]> + + + + Google documentation]]> Google documentation]]> diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java index 26c735cfb..9b8b76636 100644 --- a/src/biz/bokhorst/xprivacy/Meta.java +++ b/src/biz/bokhorst/xprivacy/Meta.java @@ -231,6 +231,7 @@ public static List get() { mListHook.add(new Hook("location", "getNeighboringCellInfo", "ACCESS_COARSE_UPDATES", 3, null, null).notAOSP(19)); mListHook.add(new Hook("location", "Srv_enableLocationUpdates", "CONTROL_LOCATION_UPDATES", 10, "2.99", "enableLocationUpdates").AOSP(19)); + mListHook.add(new Hook("location", "Srv_enableLocationUpdatesForSubscriber", "CONTROL_LOCATION_UPDATES", 21, "3.5.6", null).AOSP(21)); mListHook.add(new Hook("location", "Srv_getAllCellInfo", "ACCESS_COARSE_UPDATES", 17, "2.99", "getAllCellInfo").AOSP(19)); mListHook.add(new Hook("location", "Srv_getCellLocation", "ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION", 1, "2.99", "getCellLocation").AOSP(19)); mListHook.add(new Hook("location", "Srv_getNeighboringCellInfo", "ACCESS_COARSE_UPDATES", 3, "2.99", "getNeighboringCellInfo").AOSP(19)); @@ -368,9 +369,15 @@ public static List get() { mListHook.add(new Hook("phone", "Srv_getVoiceMailAlphaTag", "READ_PHONE_STATE", 10, "2.99", "getVoiceMailAlphaTag").AOSP(19)); mListHook.add(new Hook("phone", "Srv_getVoiceMailNumber", "READ_PHONE_STATE", 10, "2.99", "getVoiceMailNumber").AOSP(19)); mListHook.add(new Hook("phone", "Srv_getCompleteVoiceMailNumber", "READ_PHONE_STATE", 10, "2.99", null).AOSP(19)); - mListHook.add(new Hook("phone", "Srv_getImei", "READ_PHONE_STATE", 21, "3.5.6", null)); - mListHook.add(new Hook("phone", "Srv_getIsimIst", "READ_PRIVILEGED_PHONE_STATE", 21, "3.5.6", null)); - mListHook.add(new Hook("phone", "Srv_getIsimPcscf", "READ_PRIVILEGED_PHONE_STATE", 21, "3.5.6", null)); + + mListHook.add(new Hook("phone", "Srv_getImei", "READ_PHONE_STATE", 21, "3.5.6", null).AOSP(21)); + mListHook.add(new Hook("phone", "Srv_getIsimIst", "READ_PRIVILEGED_PHONE_STATE", 21, "3.5.6", null).AOSP(21)); + mListHook.add(new Hook("phone", "Srv_getIsimPcscf", "READ_PRIVILEGED_PHONE_STATE", 21, "3.5.6", null).AOSP(21)); + + mListHook.add(new Hook("phone", "Srv_getCdmaMdn", "MODIFY_PHONE_STATE", 21, "3.5.6", null).AOSP(21)); + mListHook.add(new Hook("phone", "Srv_getCdmaMin", "MODIFY_PHONE_STATE", 21, "3.5.6", null).AOSP(21)); + mListHook.add(new Hook("phone", "Srv_getLine1AlphaTagForDisplay", "READ_PHONE_STATE", 21, "3.5.6", null).AOSP(21)); + mListHook.add(new Hook("phone", "Srv_getLine1NumberForDisplay", "READ_PHONE_STATE", 21, "3.5.6", null).AOSP(21)); mListHook.add(new Hook("phone", "listen", "READ_PHONE_STATE", 10, null, null).notAOSP(19)); mListHook.add(new Hook("phone", "Srv_listen", "READ_PHONE_STATE", 10, null, null).AOSP(19)); @@ -608,6 +615,7 @@ public static List get() { // TelephonyManager mListHook.add(new Hook(null, "disableLocationUpdates", "", 10, null, null).notAOSP(19)); mListHook.add(new Hook(null, "Srv_disableLocationUpdates", "", 19, null, null).AOSP(19)); + mListHook.add(new Hook(null, "Srv_disableLocationUpdatesForSubscriber", "", 21, null, null).AOSP(21)); // UtilHook mListHook.add(new Hook(null, "isXposedEnabled", "", 15, null, null)); diff --git a/src/biz/bokhorst/xprivacy/XTelephonyManager.java b/src/biz/bokhorst/xprivacy/XTelephonyManager.java index 5633cf57c..c6d6efe0d 100644 --- a/src/biz/bokhorst/xprivacy/XTelephonyManager.java +++ b/src/biz/bokhorst/xprivacy/XTelephonyManager.java @@ -101,10 +101,17 @@ public String getClassName() { // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/com/android/server/TelephonyRegistry.java // public void enableLocationUpdates() + // public void enableLocationUpdatesForSubscriber(long subId) // public void disableLocationUpdates() - // public java.util.List getAllCellInfo() + // public void disableLocationUpdatesForSubscriber(long subId) + // public List getAllCellInfo() // public android.os.Bundle getCellLocation() - // public java.util.List getNeighboringCellInfo() + // public String getCdmaMdn(long subId) + // public String getCdmaMin(long subId) + // public String getLine1AlphaTagForDisplay(long subId) + // public String getLine1NumberForDisplay(long subId) + // public List getNeighboringCellInfo() + // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/com/android/internal/telephony/ITelephony.java // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/5.0.0_r1/com/android/phone/PhoneInterfaceManager.java // @formatter:on @@ -135,7 +142,11 @@ private enum Methods { Srv_listen, Srv_enableLocationUpdates, Srv_disableLocationUpdates, - Srv_getAllCellInfo, Srv_getCellLocation, Srv_getNeighboringCellInfo + Srv_getAllCellInfo, Srv_getCellLocation, Srv_getNeighboringCellInfo, + + Srv_enableLocationUpdatesForSubscriber, Srv_disableLocationUpdatesForSubscriber, + Srv_getCdmaMdn, Srv_getCdmaMin, + Srv_getLine1AlphaTagForDisplay, Srv_getLine1NumberForDisplay }; // @formatter:on @@ -211,6 +222,14 @@ public static List getPhoneInstances() { listHook.add(new XTelephonyManager(Methods.Srv_getAllCellInfo, PrivacyManager.cLocation, Srv.Phone)); listHook.add(new XTelephonyManager(Methods.Srv_getCellLocation, PrivacyManager.cLocation, Srv.Phone)); listHook.add(new XTelephonyManager(Methods.Srv_getNeighboringCellInfo, PrivacyManager.cLocation, Srv.Phone)); + + listHook.add(new XTelephonyManager(Methods.Srv_enableLocationUpdatesForSubscriber, + PrivacyManager.cLocation, Srv.Phone)); + listHook.add(new XTelephonyManager(Methods.Srv_disableLocationUpdatesForSubscriber, null, Srv.Phone)); + listHook.add(new XTelephonyManager(Methods.Srv_getCdmaMdn, PrivacyManager.cPhone, Srv.Phone)); + listHook.add(new XTelephonyManager(Methods.Srv_getCdmaMin, PrivacyManager.cPhone, Srv.Phone)); + listHook.add(new XTelephonyManager(Methods.Srv_getLine1AlphaTagForDisplay, PrivacyManager.cPhone, Srv.Phone)); + listHook.add(new XTelephonyManager(Methods.Srv_getLine1NumberForDisplay, PrivacyManager.cPhone, Srv.Phone)); } return listHook; } @@ -228,8 +247,14 @@ protected void before(XParam param) throws Throwable { param.setResult(null); break; + case Srv_disableLocationUpdatesForSubscriber: + if (isRestricted(param, PrivacyManager.cLocation, "Srv_enableLocationUpdatesForSubscriber")) + param.setResult(null); + break; + case enableLocationUpdates: case Srv_enableLocationUpdates: + case Srv_enableLocationUpdatesForSubscriber: if (isRestricted(param)) param.setResult(null); break; @@ -318,6 +343,10 @@ protected void before(XParam param) throws Throwable { case Srv_getImei: case Srv_getIsimIst: case Srv_getIsimPcscf: + case Srv_getCdmaMdn: + case Srv_getCdmaMin: + case Srv_getLine1AlphaTagForDisplay: + case Srv_getLine1NumberForDisplay: break; } } @@ -331,6 +360,8 @@ protected void after(XParam param) throws Throwable { case enableLocationUpdates: case Srv_disableLocationUpdates: case Srv_enableLocationUpdates: + case Srv_disableLocationUpdatesForSubscriber: + case Srv_enableLocationUpdatesForSubscriber: break; case getAllCellInfo: @@ -410,14 +441,19 @@ protected void after(XParam param) throws Throwable { case Srv_getCompleteVoiceMailNumber: case Srv_getVoiceMailNumber: case Srv_getVoiceMailAlphaTag: + case Srv_getLine1AlphaTagForDisplay: + case Srv_getLine1NumberForDisplay: String srvPhoneNumber = (String) param.getResult(); if (srvPhoneNumber != null) if (isRestrictedValue(param, srvPhoneNumber)) - param.setResult(PrivacyManager.getDefacedProp(uid, mMethod.name().replace("Srv_", ""))); + param.setResult(PrivacyManager.getDefacedProp(uid, + mMethod.name().replace("Srv_", "").replace("ForDisplay", ""))); break; case Srv_getIsimIst: case Srv_getIsimPcscf: + case Srv_getCdmaMdn: + case Srv_getCdmaMin: if (param.getResult() != null) if (isRestricted(param)) param.setResult(null);