Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Added new restrictions for PhoneInterfaceManager
Browse files Browse the repository at this point in the history
Refs #1757
  • Loading branch information
M66B committed Dec 15, 2014
1 parent 9b2bfc3 commit 1044886
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions res/values/functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
<string name="location_getCellLocation" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getCellLocation()">Google documentation</a>]]></string>
<string name="location_getNeighboringCellInfo" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getNeighboringCellInfo()">Google documentation</a>]]></string>
<string name="location_Srv_enableLocationUpdates" translatable="false"><![CDATA[Will restrict location updates through the <a href="https://developer.android.com/reference/android/telephony/PhoneStateListener.html">phone state listener</a>]]></string>
<string name="location_Srv_enableLocationUpdatesForSubscriber" translatable="false"><![CDATA[Will restrict location updates through the <a href="https://developer.android.com/reference/android/telephony/PhoneStateListener.html">phone state listener</a>]]></string>
<string name="location_Srv_getAllCellInfo" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getAllCellInfo()">Google documentation</a>]]></string>
<string name="location_Srv_getCellLocation" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getCellLocation()">Google documentation</a>]]></string>
<string name="location_Srv_getNeighboringCellInfo" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getNeighboringCellInfo()">Google documentation</a>]]></string>
Expand Down Expand Up @@ -317,6 +318,10 @@
<string name="phone_Srv_getImei" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getDeviceId()">Google documentation</a>]]></string>
<string name="phone_Srv_getIsimIst" translatable="false"><![CDATA[Will restrict access to the IMS Service Table (IST) that was loaded from the ISIM]]></string>
<string name="phone_Srv_getIsimPcscf" translatable="false"><![CDATA[Will restrict access to the IMS Proxy Call Session Control Function(PCSCF) that were loaded from the ISIM]]></string>
<string name="phone_Srv_getCdmaMdn" translatable="false"><![CDATA[Will restrict access to the CDMA MDN]]></string>
<string name="phone_Srv_getCdmaMin" translatable="false"><![CDATA[Will restrict access to the CDMA MIN]]></string>
<string name="phone_Srv_getLine1AlphaTagForDisplay" translatable="false"><![CDATA[Will restrict access to hidden function to get the alpha identifier for line 1]]></string>
<string name="phone_Srv_getLine1NumberForDisplay" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getLine1Number()">Google documentation</a>]]></string>

<!-- sensors -->
<string name="sensors_getDefaultSensor" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/hardware/SensorManager.html#getDefaultSensor(int)">Google documentation</a>]]></string>
Expand Down
14 changes: 11 additions & 3 deletions src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public static List<Hook> 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));
Expand Down Expand Up @@ -368,9 +369,15 @@ public static List<Hook> 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));
Expand Down Expand Up @@ -608,6 +615,7 @@ public static List<Hook> 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));
Expand Down
44 changes: 40 additions & 4 deletions src/biz/bokhorst/xprivacy/XTelephonyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<android.telephony.CellInfo> getAllCellInfo()
// public void disableLocationUpdatesForSubscriber(long subId)
// public List<android.telephony.CellInfo> getAllCellInfo()
// public android.os.Bundle getCellLocation()
// public java.util.List<android.telephony.NeighboringCellInfo> getNeighboringCellInfo()
// public String getCdmaMdn(long subId)
// public String getCdmaMin(long subId)
// public String getLine1AlphaTagForDisplay(long subId)
// public String getLine1NumberForDisplay(long subId)
// public List<android.telephony.NeighboringCellInfo> 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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -211,6 +222,14 @@ public static List<XHook> 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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1044886

Please sign in to comment.