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

Commit

Permalink
Added restrictions getCarrierConfigValues and sendMultimediaMessage
Browse files Browse the repository at this point in the history
Refs #1757
  • Loading branch information
M66B committed Dec 15, 2014
1 parent 9a23de9 commit 540ca93
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Changelog
* Added restrictions *InetAddress.getAllByNameOnNet* and *InetAddress.getByNameOnNet* ([issue](/../../issues/1757))
* Added restriction *Srv_getCurrentSyncsAsUser* ([issue](/../../issues/1757))
* Added restrictions *Srv_addGpsMeasurementsListener* and *Srv_addGpsNavigationMessageListener* ([issue](/../../issues/1757))
* Added restrictions *getCarrierConfigValues* and *sendMultimediaMessage* ([issue](/../../issues/1757))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
2 changes: 2 additions & 0 deletions res/values/functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

<!-- calling -->
<string name="calling_sendDataMessage" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/gsm/SmsManager.html#sendDataMessage(java.lang.String,%20java.lang.String,%20short,%20byte[],%20android.app.PendingIntent,%20android.app.PendingIntent)">Google documentation</a>]]></string>
<string name="calling_sendMultimediaMessage" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/SmsManager.html#sendMultimediaMessage(android.content.Context,%20android.net.Uri, java.lang.String,%20android.os.Bundle,%20android.app.PendingIntent)">Google documentation</a>]]></string>
<string name="calling_sendMultipartTextMessage" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/gsm/SmsManager.html#sendMultipartTextMessage(java.lang.String,%20java.lang.String,%20java.util.ArrayList&lt;java.lang.String&gt;,%20java.util.ArrayList&lt;android.app.PendingIntent&gt;,%20java.util.ArrayList&lt;android.app.PendingIntent&gt;)">Google documentation</a>]]></string>
<string name="calling_sendTextMessage" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/gsm/SmsManager.html#sendTextMessage(java.lang.String,%20java.lang.String,%20java.lang.String,%20android.app.PendingIntent,%20android.app.PendingIntent)">Google documentation</a>]]></string>
<string name="calling_Srv_sendData" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/gsm/SmsManager.html#sendDataMessage(java.lang.String,%20java.lang.String,%20short,%20byte[],%20android.app.PendingIntent,%20android.app.PendingIntent)">Google documentation</a>]]></string>
Expand Down Expand Up @@ -213,6 +214,7 @@

<!-- messages -->
<string name="messages_getAllMessagesFromIcc" translatable="false"><![CDATA[Will restrict access to messages stored on the SIM card]]></string>
<string name="messages_getCarrierConfigValues" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/SmsManager.html#getCarrierConfigValues()">Google documentation</a>]]></string>
<string name="messages_Srv_getAllMessagesFromIccEf" translatable="false"><![CDATA[Will restrict access to messages stored on the SIM card]]></string>
<string name="messages_SmsProvider" translatable="false"><![CDATA[Will restrict access to SMS messages]]></string>
<string name="messages_MmsProvider" translatable="false"><![CDATA[Will restrict access to MMS messages]]></string>
Expand Down
2 changes: 2 additions & 0 deletions src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static List<Hook> get() {
mListHook.add(new Hook("calendar", "CalendarProvider2", "READ_CALENDAR,WRITE_CALENDAR", 1, null, null));

mListHook.add(new Hook("calling", "sendDataMessage", "SEND_SMS", 4, null, null).notAOSP(19).whitelist(cTypeAddress).doNotify());
mListHook.add(new Hook("calling", "sendMultimediaMessage", "SEND_SMS", 21, "3.5.6", null).doNotify());
mListHook.add(new Hook("calling", "sendMultipartTextMessage", "SEND_SMS", 4, null, null).notAOSP(19).whitelist(cTypeAddress).doNotify());
mListHook.add(new Hook("calling", "sendTextMessage", "SEND_SMS", 4, null, null).notAOSP(19).whitelist(cTypeAddress).doNotify());

Expand Down Expand Up @@ -282,6 +283,7 @@ public static List<Hook> get() {
mListHook.add(new Hook("media", "Camera2.setRepeatingBurst", "CAMERA", 20, null, null).unsafe().doNotify());

mListHook.add(new Hook("messages", "getAllMessagesFromIcc", "RECEIVE_SMS", 10, null, null).notAOSP(19));
mListHook.add(new Hook("messages", "getCarrierConfigValues", "", 21, "3.5.6", null));
mListHook.add(new Hook("messages", "Srv_getAllMessagesFromIccEf", "RECEIVE_SMS", 19, "2.99", "getAllMessagesFromIcc").AOSP(19));

mListHook.add(new Hook("messages", "SmsProvider", "READ_SMS,WRITE_SMS", 1, null, null));
Expand Down
19 changes: 18 additions & 1 deletion src/biz/bokhorst/xprivacy/XSmsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.telephony.SmsMessage;

public class XSmsManager extends XHook {
Expand All @@ -23,8 +24,10 @@ public String getClassName() {
// @formatter:off

// public static ArrayList<SmsMessage> getAllMessagesFromIcc()
// public Bundle getCarrierConfigValues()
// public void sendDataMessage(String destinationAddress, String scAddress, short destinationPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent)
// public void sendMultipartTextMessage(String destinationAddress, String scAddress, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents)
// public void sendMultimediaMessage(Context context, Uri contentUri, String locationUrl, Bundle configOverrides, PendingIntent sentIntent)
// public void sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
// frameworks/base/telephony/java/android/telephony/SmsManager.java
// http://developer.android.com/reference/android/telephony/SmsManager.html
Expand All @@ -39,15 +42,17 @@ public String getClassName() {

// @formatter:off
private enum Methods {
getAllMessagesFromIcc, sendDataMessage, sendMultipartTextMessage, sendTextMessage,
getAllMessagesFromIcc, getCarrierConfigValues, sendDataMessage, sendMultipartTextMessage, sendMultimediaMessage, sendTextMessage,
Srv_getAllMessagesFromIccEf, Srv_sendData, Srv_sendMultipartText, Srv_sendText
};
// @formatter:on

public static List<XHook> getInstances() {
List<XHook> listHook = new ArrayList<XHook>();
listHook.add(new XSmsManager(Methods.getAllMessagesFromIcc, PrivacyManager.cMessages));
listHook.add(new XSmsManager(Methods.getCarrierConfigValues, PrivacyManager.cMessages));
listHook.add(new XSmsManager(Methods.sendDataMessage, PrivacyManager.cCalling));
listHook.add(new XSmsManager(Methods.sendMultimediaMessage, PrivacyManager.cCalling));
listHook.add(new XSmsManager(Methods.sendMultipartTextMessage, PrivacyManager.cCalling));
listHook.add(new XSmsManager(Methods.sendTextMessage, PrivacyManager.cCalling));

Expand All @@ -62,6 +67,7 @@ public static List<XHook> getInstances() {
protected void before(XParam param) throws Throwable {
switch (mMethod) {
case getAllMessagesFromIcc:
case getCarrierConfigValues:
// Do nothing
break;

Expand All @@ -73,6 +79,11 @@ protected void before(XParam param) throws Throwable {
param.setResult(null);
break;

case sendMultimediaMessage:
if (isRestricted(param))
param.setResult(null);
break;

case Srv_getAllMessagesFromIccEf:
// Do nothing
break;
Expand All @@ -96,7 +107,13 @@ protected void after(XParam param) throws Throwable {
param.setResult(new ArrayList<SmsMessage>());
break;

case getCarrierConfigValues:
if (param.getResult() != null && isRestricted(param))
param.setResult(new Bundle());
break;

case sendDataMessage:
case sendMultimediaMessage:
case sendMultipartTextMessage:
case sendTextMessage:
// Do nothing
Expand Down

0 comments on commit 540ca93

Please sign in to comment.