Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 102.47 KB | None | 0 0
  1. diff --git a/src/java/android/provider/Telephony.java b/src/java/android/provider/Telephony.java
  2. index df328b7..bc9d415 100755
  3. --- a/src/java/android/provider/Telephony.java
  4. +++ b/src/java/android/provider/Telephony.java
  5. @@ -35,10 +35,8 @@ import android.util.Patterns;
  6. import com.android.internal.telephony.PhoneConstants;
  7. import com.android.internal.telephony.SmsApplication;
  8.  
  9. -import java.util.ArrayList;
  10. -import java.util.Arrays;
  11. +
  12. import java.util.HashSet;
  13. -import java.util.List;
  14. import java.util.Set;
  15. import java.util.regex.Matcher;
  16. import java.util.regex.Pattern;
  17. @@ -843,51 +841,6 @@ public final class Telephony {
  18. public static final int RESULT_SMS_DUPLICATED = 5;
  19.  
  20. /**
  21. - * Used internally: The sender of the SMS was blacklisted
  22. - * for not being listed in the contact list
  23. - * @hide
  24. - */
  25. - public static final int RESULT_SMS_BLACKLISTED_UNKNOWN = 6;
  26. -
  27. - /**
  28. - * Used internally: The sender of the SMS was blacklisted
  29. - * for being listed in the blacklist
  30. - * @hide
  31. - */
  32. - public static final int RESULT_SMS_BLACKLISTED_LIST = 7;
  33. -
  34. - /**
  35. - * Used internally: The sender of the SMS was blacklisted
  36. - * for matching a blacklist regex entry
  37. - * @hide
  38. - */
  39. - public static final int RESULT_SMS_BLACKLISTED_REGEX = 8;
  40. -
  41. - /**
  42. - * Used internally:
  43. - * Broadcast Action: A new protected text-based SMS message has been received
  44. - * by the device. This intent will be delivered to all registered
  45. - * receivers who possess {@link android.Manifest.permission#RECEIVE_PROTECTED_SMS}.
  46. - * These apps SHOULD NOT write the message or notify the user.
  47. - * The intent will have the following extra values:
  48. - * </p>
  49. - *
  50. - * <ul>
  51. - * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
  52. - * that make up the message.</li>
  53. - * </ul>
  54. - *
  55. - * <p>The extra values can be extracted using
  56. - * {@link #getMessagesFromIntent(Intent)}.</p>
  57. - *
  58. - * <p>If a BroadcastReceiver encounters an error while processing
  59. - * this intent it should set the result code appropriately.</p>
  60. - * @hide
  61. - */
  62. - public static final String PROTECTED_SMS_RECEIVED_ACTION =
  63. - "android.provider.Telephony.ACTION_PROTECTED_SMS_RECEIVED";
  64. -
  65. - /**
  66. * Activity action: Ask the user to change the default
  67. * SMS application. This will show a dialog that asks the
  68. * user whether they want to replace the current default
  69. @@ -1253,61 +1206,6 @@ public final class Telephony {
  70. }
  71. return msgs;
  72. }
  73. -
  74. - /**
  75. - * Read the normalized addresses out of PDUs
  76. - * @param pdus bytes for PDUs
  77. - * @param format the format of the message
  78. - * @return a list of Addresses for the PDUs
  79. - * @hide
  80. - */
  81. - public static List<String> getNormalizedAddressesFromPdus(byte[][] pdus,
  82. - String format) {
  83. - int pduCount = pdus.length;
  84. - SmsMessage[] msgs = new SmsMessage[pduCount];
  85. - List<String> addresses = new ArrayList<String>();
  86. -
  87. - for (int i = 0; i < pduCount; i++) {
  88. - byte[] pdu = (byte[]) pdus[i];
  89. - msgs[i] = SmsMessage.createFromPdu(pdu, format);
  90. - // If the originating address is null on our message
  91. - // then the format for SmsMessage createFromPdu is likely
  92. - // incorrect. SmsMessage createFromPdu(the new method)
  93. - // takes in a format parameter that it gets from the Tracker
  94. - // however, on some of our legacy devices using a legacy ril,
  95. - // since that format is derived by getting voice tech,
  96. - // we can get a bad format and no valid members.
  97. - // Thus we introduce a hack that utilizes the deprecated
  98. - // SmsMessage.createFromPdu if we get a null originating address.
  99. - if (msgs[i].getOriginatingAddress() == null) {
  100. - msgs[i] = SmsMessage.createFromPdu(pdu);
  101. - }
  102. - String originatingAddress = msgs[i].getOriginatingAddress();
  103. - if (!TextUtils.isEmpty(originatingAddress)) {
  104. - String normalized = normalizeDigitsOnly(originatingAddress);
  105. - addresses.add(normalized);
  106. - }
  107. - }
  108. - return addresses;
  109. - }
  110. -
  111. - private static String normalizeDigitsOnly(String number) {
  112. - return normalizeDigits(number, false /* strip non-digits */).toString();
  113. - }
  114. -
  115. - private static StringBuilder normalizeDigits(String number, boolean keepNonDigits) {
  116. - StringBuilder normalizedDigits = new StringBuilder(number.length());
  117. - for (char c : number.toCharArray()) {
  118. - int digit = Character.digit(c, 10);
  119. - if (digit != -1) {
  120. - normalizedDigits.append(digit);
  121. - } else if (keepNonDigits) {
  122. - normalizedDigits.append(c);
  123. - }
  124. - }
  125. - return normalizedDigits;
  126. - }
  127. -
  128. }
  129. }
  130.  
  131. @@ -3180,76 +3078,4 @@ public final class Telephony {
  132. CMAS_CERTAINTY
  133. };
  134. }
  135. -
  136. - /**
  137. - * Contains phone numbers that are blacklisted
  138. - * for phone and/or message purposes.
  139. - * @hide
  140. - */
  141. - public static final class Blacklist implements BaseColumns {
  142. - /**
  143. - * The content:// style URL for this table
  144. - */
  145. - public static final Uri CONTENT_URI =
  146. -
  147. - Uri.parse("content://blacklist");
  148. -
  149. - /**
  150. - * The content:// style URL for filtering this table by number.
  151. - * When using this, make sure the number is correctly encoded
  152. - * when appended to the Uri.
  153. - */
  154. - public static final Uri CONTENT_FILTER_BYNUMBER_URI =
  155. - Uri.parse("content://blacklist/bynumber");
  156. -
  157. - /**
  158. - * The content:// style URL for filtering this table on phone numbers
  159. - */
  160. - public static final Uri CONTENT_PHONE_URI =
  161. - Uri.parse("content://blacklist/phone");
  162. -
  163. - /**
  164. - * The content:// style URL for filtering this table on message numbers
  165. - */
  166. - public static final Uri CONTENT_MESSAGE_URI =
  167. - Uri.parse("content://blacklist/message");
  168. -
  169. -
  170. - /**
  171. - * Query parameter used to match numbers by regular-expression like
  172. - * matching. Supported are the '*' and the '.' operators.
  173. - * <p>
  174. - * TYPE: boolean
  175. - */
  176. - public static final String REGEX_KEY = "regex";
  177. -
  178. - /**
  179. - * The default sort order for this table
  180. - */
  181. - public static final String DEFAULT_SORT_ORDER = "number ASC";
  182. -
  183. - /**
  184. - * The phone number as the user entered it.
  185. - * <P>Type: TEXT</P>
  186. - */
  187. - public static final String NUMBER = "number";
  188. -
  189. - /**
  190. - * Whether the number contains a regular expression pattern
  191. - * <P>Type: BOOLEAN (read only)</P>
  192. - */
  193. - public static final String IS_REGEX = "is_regex";
  194. -
  195. - /**
  196. - * Blacklisting mode for phone calls
  197. - * <P>Type: INTEGER (int)</P>
  198. - */
  199. - public static final String PHONE_MODE = "phone";
  200. -
  201. - /**
  202. - * Blacklisting mode for messages
  203. - * <P>Type: INTEGER (int)</P>
  204. - */
  205. - public static final String MESSAGE_MODE = "message";
  206. - }
  207. }
  208. diff --git a/src/java/android/telephony/SmsMessage.java b/src/java/android/telephony/SmsMessage.java
  209. index 11a7371..dd80fbb 100644
  210. --- a/src/java/android/telephony/SmsMessage.java
  211. +++ b/src/java/android/telephony/SmsMessage.java
  212. @@ -94,12 +94,6 @@ public class SmsMessage {
  213. */
  214. public static final String FORMAT_3GPP2 = "3gpp2";
  215.  
  216. - /**
  217. - * Indicates a synthetic SMS message.
  218. - * @hide
  219. - */
  220. - public static final String FORMAT_SYNTHETIC = "synthetic";
  221. -
  222. /** Contains actual SmsMessage. Only public for debugging and for framework layer.
  223. *
  224. * @hide
  225. @@ -175,9 +169,6 @@ public class SmsMessage {
  226. int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
  227. String format = (PHONE_TYPE_CDMA == activePhone) ?
  228. SmsConstants.FORMAT_3GPP2 : SmsConstants.FORMAT_3GPP;
  229. - if (com.android.internal.telephony.SyntheticSmsMessage.isSyntheticPdu(pdu)) {
  230. - format = FORMAT_SYNTHETIC;
  231. - }
  232. message = createFromPdu(pdu, format);
  233.  
  234. if (null == message || null == message.mWrappedSmsMessage) {
  235. @@ -206,8 +197,6 @@ public class SmsMessage {
  236. wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromPdu(pdu);
  237. } else if (SmsConstants.FORMAT_3GPP.equals(format)) {
  238. wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromPdu(pdu);
  239. - } else if (FORMAT_SYNTHETIC.equals(format)) {
  240. - wrappedMessage = com.android.internal.telephony.SyntheticSmsMessage.createFromPdu(pdu);
  241. } else {
  242. Rlog.e(LOG_TAG, "createFromPdu(): unsupported message format " + format);
  243. return null;
  244. @@ -568,7 +557,7 @@ public class SmsMessage {
  245. * form or null if unavailable
  246. */
  247. public String getOriginatingAddress() {
  248. - return mWrappedSmsMessage != null ? mWrappedSmsMessage.getOriginatingAddress() : null;
  249. + return mWrappedSmsMessage.getOriginatingAddress();
  250. }
  251.  
  252. /**
  253. diff --git a/src/java/android/telephony/gsm/SmsMessage.java b/src/java/android/telephony/gsm/SmsMessage.java
  254. index f42eb2f..8d5dac7 100644
  255. --- a/src/java/android/telephony/gsm/SmsMessage.java
  256. +++ b/src/java/android/telephony/gsm/SmsMessage.java
  257. @@ -158,14 +158,6 @@ public class SmsMessage {
  258. wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromPdu(pdu);
  259. }
  260.  
  261. - // Hangouts, and some other bad citizens, are using this deprecated API call.
  262. - // Make sure that WhisperPush and Voice+ integration properly work,
  263. - // as this may be a synthetic message.
  264. - if (wrappedMessage == null) {
  265. - // returns null if it is not synthetic. (likely malformed)
  266. - wrappedMessage = com.android.internal.telephony.SyntheticSmsMessage.createFromPdu(pdu);
  267. - }
  268. -
  269. return new SmsMessage(wrappedMessage);
  270. }
  271.  
  272. diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
  273. index 26fd296..7432662 100644
  274. --- a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
  275. +++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
  276. @@ -24,9 +24,8 @@ import android.content.Context;
  277. import android.database.Cursor;
  278. import android.database.sqlite.SQLiteException;
  279. import android.net.Uri;
  280. -import android.os.Binder;
  281. -import android.os.RemoteException;
  282. import android.os.AsyncResult;
  283. +import android.os.Binder;
  284. import android.os.Handler;
  285. import android.os.Message;
  286. import android.os.UserManager;
  287. @@ -34,7 +33,6 @@ import android.provider.Telephony;
  288. import android.telephony.Rlog;
  289. import android.telephony.SmsManager;
  290. import android.telephony.SmsMessage;
  291. -import android.telephony.TelephonyManager;
  292. import android.util.Log;
  293.  
  294. import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
  295. @@ -42,6 +40,7 @@ import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
  296. import com.android.internal.telephony.uicc.IccConstants;
  297. import com.android.internal.telephony.uicc.IccFileHandler;
  298. import com.android.internal.telephony.uicc.UiccController;
  299. +import com.android.internal.telephony.SmsNumberUtils;
  300. import com.android.internal.telephony.uicc.IccRecords;
  301. import com.android.internal.util.HexDump;
  302.  
  303. @@ -61,7 +60,7 @@ import android.telephony.TelephonyManager;
  304. */
  305. public class IccSmsInterfaceManager {
  306. static final String LOG_TAG = "IccSmsInterfaceManager";
  307. - static final boolean DBG = false;
  308. + static final boolean DBG = true;
  309.  
  310. protected final Object mLock = new Object();
  311. protected boolean mSuccess;
  312. @@ -306,9 +305,6 @@ public class IccSmsInterfaceManager {
  313. return mSuccess;
  314. }
  315.  
  316. - public void synthesizeMessages(String originatingAddress, String scAddress, List<String> messages, long timestampMillis) throws RemoteException {
  317. - }
  318. -
  319. /**
  320. * Retrieves all messages currently stored on Icc.
  321. *
  322. @@ -321,6 +317,10 @@ public class IccSmsInterfaceManager {
  323. mContext.enforceCallingOrSelfPermission(
  324. Manifest.permission.RECEIVE_SMS,
  325. "Reading messages from Icc");
  326. + if (mAppOps.noteOp(AppOpsManager.OP_READ_ICC_SMS, Binder.getCallingUid(),
  327. + callingPackage) != AppOpsManager.MODE_ALLOWED) {
  328. + return new ArrayList<SmsRawData>();
  329. + }
  330. synchronized(mLock) {
  331.  
  332. IccFileHandler fh = mPhone.getIccFileHandler();
  333. @@ -462,32 +462,16 @@ public class IccSmsInterfaceManager {
  334.  
  335. public void sendText(String callingPackage, String destAddr, String scAddr,
  336. String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
  337. - int callingUid = Binder.getCallingUid();
  338. -
  339. - String[] callingParts = callingPackage.split("\\\\");
  340. - if (callingUid == android.os.Process.PHONE_UID &&
  341. - callingParts.length > 1) {
  342. - callingUid = Integer.parseInt(callingParts[1]);
  343. - }
  344. -
  345. - // Reset the calling package, remove the trailing uid so
  346. - // shouldWriteMessageForPackage can match correctly
  347. - // if our message has been synthesized by an
  348. - // external package
  349. - callingPackage = callingParts[0];
  350. -
  351. - if (Binder.getCallingPid() != android.os.Process.myPid()) {
  352. - mPhone.getContext().enforceCallingPermission(
  353. - Manifest.permission.SEND_SMS,
  354. - "Sending SMS message");
  355. - }
  356. + mPhone.getContext().enforceCallingPermission(
  357. + Manifest.permission.SEND_SMS,
  358. + "Sending SMS message");
  359. if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
  360. log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr +
  361. " text='"+ text + "' sentIntent=" +
  362. sentIntent + " deliveryIntent=" + deliveryIntent);
  363. }
  364. - if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, callingUid,
  365. - callingParts[0]) != AppOpsManager.MODE_ALLOWED) {
  366. + if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
  367. + callingPackage) != AppOpsManager.MODE_ALLOWED) {
  368. return;
  369. }
  370. destAddr = filterDestAddress(destAddr);
  371. @@ -607,25 +591,9 @@ public class IccSmsInterfaceManager {
  372. public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
  373. List<String> parts, List<PendingIntent> sentIntents,
  374. List<PendingIntent> deliveryIntents) {
  375. - int callingUid = Binder.getCallingUid();
  376. -
  377. - String[] callingParts = callingPackage.split("\\\\");
  378. - if (callingUid == android.os.Process.PHONE_UID &&
  379. - callingParts.length > 1) {
  380. - callingUid = Integer.parseInt(callingParts[1]);
  381. - }
  382. -
  383. - // Reset the calling package, remove the trailing uid so
  384. - // shouldWriteMessageForPackage can match correctly
  385. - // if our message has been synthesized by an
  386. - // external package
  387. - callingPackage = callingParts[0];
  388. -
  389. - if (Binder.getCallingPid() != android.os.Process.myPid()) {
  390. - mPhone.getContext().enforceCallingPermission(
  391. - Manifest.permission.SEND_SMS,
  392. - "Sending SMS message");
  393. - }
  394. + mPhone.getContext().enforceCallingPermission(
  395. + Manifest.permission.SEND_SMS,
  396. + "Sending SMS message");
  397. if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
  398. int i = 0;
  399. for (String part : parts) {
  400. @@ -633,8 +601,8 @@ public class IccSmsInterfaceManager {
  401. ", part[" + (i++) + "]=" + part);
  402. }
  403. }
  404. - if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, callingUid,
  405. - callingParts[0]) != AppOpsManager.MODE_ALLOWED) {
  406. + if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
  407. + callingPackage) != AppOpsManager.MODE_ALLOWED) {
  408. return;
  409. }
  410.  
  411. @@ -831,6 +799,7 @@ public class IccSmsInterfaceManager {
  412. throw new IllegalArgumentException("Not a supportted RAN Type");
  413. }
  414. }
  415. +
  416. synchronized public boolean enableGsmBroadcastRange(int startMessageId, int endMessageId) {
  417. if (DBG) log("enableGsmBroadcastRange");
  418.  
  419. @@ -1350,28 +1319,4 @@ public class IccSmsInterfaceManager {
  420. }
  421. return mSmscSuccess;
  422. }
  423. -
  424. - /** @hide **/
  425. - public boolean isShortSMSCode(String destAddr) {
  426. - TelephonyManager telephonyManager;
  427. - int smsCategory = SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE;
  428. -
  429. - telephonyManager =(TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
  430. -
  431. - String countryIso = telephonyManager.getSimCountryIso();
  432. - if (countryIso == null || countryIso.length() != 2) {
  433. - countryIso = telephonyManager.getNetworkCountryIso();
  434. - }
  435. -
  436. - smsCategory = SmsUsageMonitor.mergeShortCodeCategories(smsCategory,
  437. - mPhone.mSmsUsageMonitor.checkDestination(destAddr, countryIso));
  438. -
  439. - if (smsCategory == SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE
  440. - || smsCategory == SmsUsageMonitor.CATEGORY_FREE_SHORT_CODE
  441. - || smsCategory == SmsUsageMonitor.CATEGORY_STANDARD_SHORT_CODE) {
  442. - return false; // not a premium short code
  443. - }
  444. -
  445. - return true;
  446. - }
  447. }
  448. diff --git a/src/java/com/android/internal/telephony/InboundSmsHandler.java b/src/java/com/android/internal/telephony/InboundSmsHandler.java
  449. index f0b8788..653c06f 100644
  450. --- a/src/java/com/android/internal/telephony/InboundSmsHandler.java
  451. +++ b/src/java/com/android/internal/telephony/InboundSmsHandler.java
  452. @@ -49,7 +49,6 @@ import android.os.SystemProperties;
  453. import android.os.UserHandle;
  454. import android.os.UserManager;
  455. import android.preference.PreferenceManager;
  456. -import android.provider.Settings;
  457. import android.provider.Telephony;
  458. import android.provider.Telephony.Sms.Intents;
  459. import android.service.carrier.CarrierMessagingService;
  460. @@ -66,20 +65,14 @@ import android.text.TextUtils;
  461.  
  462. import com.android.internal.telephony.uicc.UiccCard;
  463. import com.android.internal.telephony.uicc.UiccController;
  464. -import android.text.TextUtils;
  465. -import com.android.internal.telephony.util.BlacklistUtils;
  466. -import com.android.internal.telephony.PhoneBase;
  467. import com.android.internal.util.HexDump;
  468. import com.android.internal.util.State;
  469. import com.android.internal.util.StateMachine;
  470.  
  471. import java.io.ByteArrayOutputStream;
  472. -import java.util.ArrayList;
  473. import java.util.Arrays;
  474. import java.util.ArrayList;
  475. -import java.util.Collections;
  476. import java.util.List;
  477. -import java.util.Map;
  478.  
  479. /**
  480. * This class broadcasts incoming SMS messages to interested apps after storing them in
  481. @@ -482,40 +475,20 @@ public abstract class InboundSmsHandler extends StateMachine {
  482. return;
  483. }
  484.  
  485. - int result, blacklistMatchType = -1;
  486. - SmsMessage sms = null;
  487. -
  488. + int result;
  489. try {
  490. - sms = (SmsMessage) ar.result;
  491. + SmsMessage sms = (SmsMessage) ar.result;
  492. result = dispatchMessage(sms.mWrappedSmsMessage);
  493. } catch (RuntimeException ex) {
  494. loge("Exception dispatching message", ex);
  495. result = Intents.RESULT_SMS_GENERIC_ERROR;
  496. }
  497.  
  498. - // Translate (internal) blacklist check results to
  499. - // RESULT_SMS_HANDLED + match type
  500. - switch (result) {
  501. - case Intents.RESULT_SMS_BLACKLISTED_UNKNOWN:
  502. - blacklistMatchType = BlacklistUtils.MATCH_UNKNOWN;
  503. - result = Intents.RESULT_SMS_HANDLED;
  504. - break;
  505. - case Intents.RESULT_SMS_BLACKLISTED_LIST:
  506. - blacklistMatchType = BlacklistUtils.MATCH_LIST;
  507. - result = Intents.RESULT_SMS_HANDLED;
  508. - break;
  509. - case Intents.RESULT_SMS_BLACKLISTED_REGEX:
  510. - blacklistMatchType = BlacklistUtils.MATCH_REGEX;
  511. - result = Intents.RESULT_SMS_HANDLED;
  512. - break;
  513. - }
  514. -
  515. -
  516. // RESULT_OK means that the SMS will be acknowledged by special handling,
  517. // e.g. for SMS-PP data download. Any other result, we should ack here.
  518. if (result != Activity.RESULT_OK) {
  519. boolean handled = (result == Intents.RESULT_SMS_HANDLED);
  520. - notifyAndAcknowledgeLastIncomingSms(handled, result, blacklistMatchType, sms, null);
  521. + notifyAndAcknowledgeLastIncomingSms(handled, result, null);
  522. }
  523. }
  524.  
  525. @@ -609,26 +582,14 @@ public abstract class InboundSmsHandler extends StateMachine {
  526. * and send an acknowledge message to the network.
  527. * @param success indicates that last message was successfully received.
  528. * @param result result code indicating any error
  529. - * @param blacklistMatchType blacklist type if the message was blacklisted,
  530. - * -1 if it wasn't blacklisted
  531. - * @param sms incoming SMS
  532. * @param response callback message sent when operation completes.
  533. */
  534. void notifyAndAcknowledgeLastIncomingSms(boolean success,
  535. - int result, int blacklistMatchType, SmsMessage sms, Message response) {
  536. - if (!success || blacklistMatchType >= 0) {
  537. + int result, Message response) {
  538. + if (!success) {
  539. // broadcast SMS_REJECTED_ACTION intent
  540. Intent intent = new Intent(Intents.SMS_REJECTED_ACTION);
  541. intent.putExtra("result", result);
  542. - intent.putExtra("blacklisted", blacklistMatchType >= 0);
  543. - if (blacklistMatchType >= 0) {
  544. - intent.putExtra("blacklistMatchType", blacklistMatchType);
  545. - }
  546. - if (sms != null) {
  547. - intent.putExtra("sender", sms.getOriginatingAddress());
  548. - intent.putExtra("timestamp", sms.getTimestampMillis());
  549. - }
  550. - if (DBG) log("notifyAndAcknowledgeLastIncomingSms(): reject intent= " + intent);
  551. mContext.sendBroadcast(intent, android.Manifest.permission.RECEIVE_SMS);
  552. }
  553. acknowledgeLastIncomingSms(success, result, response);
  554. @@ -650,11 +611,6 @@ public abstract class InboundSmsHandler extends StateMachine {
  555. * @return {@link Intents#RESULT_SMS_HANDLED} if the message was accepted, or an error status
  556. */
  557. protected int dispatchNormalMessage(SmsMessageBase sms) {
  558. - int blacklistResult = checkIfBlacklisted(sms);
  559. - if (blacklistResult != Intents.RESULT_SMS_HANDLED) {
  560. - return blacklistResult;
  561. - }
  562. -
  563. SmsHeader smsHeader = sms.getUserDataHeader();
  564. InboundSmsTracker tracker;
  565.  
  566. @@ -684,22 +640,6 @@ public abstract class InboundSmsHandler extends StateMachine {
  567. return addTrackerToRawTableAndSendMessage(tracker);
  568. }
  569.  
  570. - private int checkIfBlacklisted(SmsMessageBase sms) {
  571. - int result = BlacklistUtils.isListed(mContext,
  572. - sms.getOriginatingAddress(), BlacklistUtils.BLOCK_MESSAGES);
  573. -
  574. - switch (result) {
  575. - case BlacklistUtils.MATCH_UNKNOWN:
  576. - return Intents.RESULT_SMS_BLACKLISTED_UNKNOWN;
  577. - case BlacklistUtils.MATCH_LIST:
  578. - return Intents.RESULT_SMS_BLACKLISTED_LIST;
  579. - case BlacklistUtils.MATCH_REGEX:
  580. - return Intents.RESULT_SMS_BLACKLISTED_REGEX;
  581. - }
  582. -
  583. - return Intents.RESULT_SMS_HANDLED;
  584. - }
  585. -
  586. /**
  587. * Helper to add the tracker to the raw table and then send a message to broadcast it, if
  588. * successful. Returns the SMS intent status to return to the SMSC.
  589. @@ -816,21 +756,6 @@ public abstract class InboundSmsHandler extends StateMachine {
  590. return (result == Activity.RESULT_OK);
  591. }
  592.  
  593. - List<String> regAddresses = Settings.Secure.getDelimitedStringAsList(mContext.getContentResolver(),
  594. - Settings.Secure.PROTECTED_SMS_ADDRESSES , "|");
  595. -
  596. - List<String> allAddresses = Intents
  597. - .getNormalizedAddressesFromPdus(pdus, tracker.getFormat());
  598. -
  599. - if (!Collections.disjoint(regAddresses, allAddresses)) {
  600. - Intent intent = new Intent(Intents.PROTECTED_SMS_RECEIVED_ACTION);
  601. - intent.putExtra("pdus", pdus);
  602. - intent.putExtra("format", tracker.getFormat());
  603. - dispatchIntent(intent, android.Manifest.permission.RECEIVE_PROTECTED_SMS,
  604. - AppOpsManager.OP_RECEIVE_SMS, resultReceiver, UserHandle.OWNER);
  605. - return true;
  606. - }
  607. -
  608. List<String> carrierPackages = null;
  609. UiccCard card = UiccController.getInstance().getUiccCard(mPhone.getPhoneId());
  610. if (card != null) {
  611. diff --git a/src/java/com/android/internal/telephony/PhoneProxy.java b/src/java/com/android/internal/telephony/PhoneProxy.java
  612. index e7781be..59248f1 100644
  613. --- a/src/java/com/android/internal/telephony/PhoneProxy.java
  614. +++ b/src/java/com/android/internal/telephony/PhoneProxy.java
  615. @@ -96,8 +96,7 @@ public class PhoneProxy extends Handler implements Phone {
  616. mPhoneId = phone.getPhoneId();
  617. mIccSmsInterfaceManager =
  618. new IccSmsInterfaceManager((PhoneBase)this.mActivePhone);
  619. - mIccCardProxy = new IccCardProxy(mActivePhone.getContext(),
  620. - mCommandsInterface, mActivePhone.getPhoneId());
  621. + mIccCardProxy = new IccCardProxy(mActivePhone.getContext(), mCommandsInterface, mActivePhone.getPhoneId());
  622.  
  623. if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
  624. // For the purpose of IccCardProxy we only care about the technology family
  625. diff --git a/src/java/com/android/internal/telephony/ProxyController.java b/src/java/com/android/internal/telephony/ProxyController.java
  626. index ca9d35c..b25b983 100644
  627. --- a/src/java/com/android/internal/telephony/ProxyController.java
  628. +++ b/src/java/com/android/internal/telephony/ProxyController.java
  629. @@ -101,7 +101,7 @@ public class ProxyController {
  630. mDctController = DctController.makeDctController((PhoneProxy[])phoneProxy, t.getLooper());
  631. mUiccPhoneBookController = new UiccPhoneBookController(mProxyPhones);
  632. mPhoneSubInfoController = new PhoneSubInfoController(mProxyPhones);
  633. - mUiccSmsController = new UiccSmsController(mProxyPhones, context);
  634. + mUiccSmsController = new UiccSmsController(mProxyPhones);
  635.  
  636. logd("Constructor - Exit");
  637. }
  638. diff --git a/src/java/com/android/internal/telephony/SMSDispatcher.java b/src/java/com/android/internal/telephony/SMSDispatcher.java
  639. index 0eff576..08cb115 100644
  640. --- a/src/java/com/android/internal/telephony/SMSDispatcher.java
  641. +++ b/src/java/com/android/internal/telephony/SMSDispatcher.java
  642. @@ -35,7 +35,6 @@ import android.os.AsyncResult;
  643. import android.os.Binder;
  644. import android.os.Handler;
  645. import android.os.Message;
  646. -import android.os.Process;
  647. import android.os.RemoteException;
  648. import android.os.SystemProperties;
  649. import android.provider.Settings;
  650. @@ -68,9 +67,7 @@ import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
  651. import com.android.internal.telephony.uicc.UiccCard;
  652. import com.android.internal.telephony.uicc.UiccController;
  653.  
  654. -import java.util.Arrays;
  655. import java.util.ArrayList;
  656. -import java.util.Collections;
  657. import java.util.HashMap;
  658. import java.util.List;
  659. import java.util.Random;
  660. @@ -173,7 +170,6 @@ public abstract class SMSDispatcher extends Handler {
  661. /* Flags indicating whether the current device allows sms service */
  662. protected boolean mSmsCapable = true;
  663. protected boolean mSmsSendDisabled;
  664. - private boolean mSmsPseudoMultipart;
  665.  
  666. protected static int getNextConcatenatedRef() {
  667. sConcatenatedRef += 1;
  668. @@ -202,7 +198,6 @@ public abstract class SMSDispatcher extends Handler {
  669. com.android.internal.R.bool.config_sms_capable);
  670. mSmsSendDisabled = !SystemProperties.getBoolean(
  671. TelephonyProperties.PROPERTY_SMS_SEND, mSmsCapable);
  672. - mSmsPseudoMultipart = SystemProperties.getBoolean("telephony.sms.pseudo_multipart", false);
  673. Rlog.d(TAG, "SMSDispatcher: ctor mSmsCapable=" + mSmsCapable + " format=" + getFormat()
  674. + " mSmsSendDisabled=" + mSmsSendDisabled);
  675. }
  676. @@ -335,16 +330,6 @@ public abstract class SMSDispatcher extends Handler {
  677. }
  678. }
  679.  
  680. - private static boolean isSystemUid(Context context, String pkgName) {
  681. - final PackageManager packageManager = context.getPackageManager();
  682. - try {
  683. - return packageManager.getPackageInfo(pkgName, 0)
  684. - .applicationInfo.uid == Process.SYSTEM_UID;
  685. - } catch (PackageManager.NameNotFoundException e) {
  686. - return false;
  687. - }
  688. - }
  689. -
  690. /**
  691. * Use the carrier messaging service to send a data or text SMS.
  692. */
  693. @@ -862,17 +847,7 @@ public abstract class SMSDispatcher extends Handler {
  694. ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
  695. ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg,
  696. int priority, boolean isExpectMore, int validityPeriod) {
  697. -
  698. - if (mSmsPseudoMultipart) {
  699. - // Send as individual messages as the combination of device and
  700. - // carrier behavior may not process concatenated messages correctly.
  701. - sendPseudoMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents,
  702. - messageUri, callingPkg, priority, isExpectMore, validityPeriod);
  703. - return;
  704. - }
  705. -
  706. final String fullMessageText = getMultipartMessageText(parts);
  707. -
  708. int refNumber = getNextConcatenatedRef() & 0x00FF;
  709. int msgCount = parts.size();
  710. int encoding = SmsConstants.ENCODING_UNKNOWN;
  711. @@ -956,72 +931,6 @@ public abstract class SMSDispatcher extends Handler {
  712. }
  713.  
  714. /**
  715. - * Send a multi-part text based SMS as individual messages
  716. - * (i.e., without User Data Headers).
  717. - *
  718. - * @param destAddr the address to send the message to
  719. - * @param scAddr is the service center address or null to use
  720. - * the current default SMSC
  721. - * @param parts an <code>ArrayList</code> of strings that, in order,
  722. - * comprise the original message
  723. - * @param sentIntents if not null, an <code>ArrayList</code> of
  724. - * <code>PendingIntent</code>s (one for each message part) that is
  725. - * broadcast when the corresponding message part has been sent.
  726. - * The result code will be <code>Activity.RESULT_OK<code> for success,
  727. - * or one of these errors:
  728. - * <code>RESULT_ERROR_GENERIC_FAILURE</code>
  729. - * <code>RESULT_ERROR_RADIO_OFF</code>
  730. - * <code>RESULT_ERROR_NULL_PDU</code>
  731. - * <code>RESULT_ERROR_NO_SERVICE</code>.
  732. - * The per-application based SMS control checks sentIntent. If sentIntent
  733. - * is NULL the caller will be checked against all unknown applications,
  734. - * which cause smaller number of SMS to be sent in checking period.
  735. - * @param deliveryIntents if not null, an <code>ArrayList</code> of
  736. - * <code>PendingIntent</code>s (one for each message part) that is
  737. - * broadcast when the corresponding message part has been delivered
  738. - * to the recipient. The raw pdu of the status report is in the
  739. - * extended data ("pdu").
  740. - * @param messageUri optional URI of the message if it is already stored in the system
  741. - * @param callingPkg the calling package name
  742. - * @param priority Priority level of the message
  743. - * Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
  744. - * ---------------------------------
  745. - * PRIORITY | Level of Priority
  746. - * ---------------------------------
  747. - * '00' | Normal
  748. - * '01' | Interactive
  749. - * '10' | Urgent
  750. - * '11' | Emergency
  751. - * ----------------------------------
  752. - * Any Other values included Negative considered as Invalid Priority Indicator of the message.
  753. - * @param isExpectMore is a boolean to indicate the sending message is multi segmented or not.
  754. - * @param validityPeriod Validity Period of the message in mins.
  755. - * Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
  756. - * Validity Period(Minimum) -> 5 mins
  757. - * Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
  758. - * Any Other values included Negative considered as Invalid Validity Period of the message.
  759. - */
  760. - private void sendPseudoMultipartText(String destAddr, String scAddr,
  761. - ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
  762. - ArrayList<PendingIntent> deliveryIntents,
  763. - Uri messageUri, String callingPkg,
  764. - int priority, boolean isExpectMore, int validityPeriod) {
  765. - int msgCount = parts.size();
  766. - for (int i = 0; i < msgCount; i++) {
  767. - PendingIntent sentIntent = null;
  768. - if (sentIntents != null && sentIntents.size() > i) {
  769. - sentIntent = sentIntents.get(i);
  770. - }
  771. - PendingIntent deliveryIntent = null;
  772. - if (deliveryIntents != null && deliveryIntents.size() > i) {
  773. - deliveryIntent = deliveryIntents.get(i);
  774. - }
  775. - sendText(destAddr, scAddr, parts.get(i), sentIntent, deliveryIntent,
  776. - messageUri, callingPkg, priority, isExpectMore, validityPeriod);
  777. - }
  778. - }
  779. -
  780. - /**
  781. * Create a new SubmitPdu and return the SMS tracker.
  782. */
  783. protected abstract SmsTracker getNewSubmitPduTracker(String destinationAddress, String scAddress,
  784. @@ -1067,21 +976,10 @@ public abstract class SMSDispatcher extends Handler {
  785. tracker.onFailed(mContext, RESULT_ERROR_NULL_PDU, 0/*errorCode*/);
  786. return;
  787. }
  788. -
  789. - PendingIntent sentIntent = tracker.mSentIntent;
  790. +
  791. // Get calling app package name via UID from Binder call
  792. PackageManager pm = mContext.getPackageManager();
  793. - int callingUid = Binder.getCallingUid();
  794. - // Special case: We're being proxied by the telephony stack itself,
  795. - // so use the intent generator's UID if one exists
  796. - String[] packageNames;
  797. -
  798. - if (callingUid == android.os.Process.PHONE_UID && sentIntent != null &&
  799. - sentIntent.getCreatorPackage() != null) {
  800. - packageNames = new String[] { sentIntent.getCreatorPackage() };
  801. - } else {
  802. - packageNames = pm.getPackagesForUid(callingUid);
  803. - }
  804. + String[] packageNames = pm.getPackagesForUid(Binder.getCallingUid());
  805.  
  806. if (packageNames == null || packageNames.length == 0) {
  807. // Refuse to send SMS if we can't get the calling package name.
  808. @@ -1123,15 +1021,6 @@ public abstract class SMSDispatcher extends Handler {
  809. * @return true if the destination is approved; false if user confirmation event was sent
  810. */
  811. boolean checkDestination(SmsTracker tracker) {
  812. - List<String> ignorePackages = Arrays.asList(
  813. - mContext.getResources().getStringArray(R.array.config_ignored_sms_packages));
  814. -
  815. - String packageName = resolvePackageName(tracker);
  816. -
  817. - if (ignorePackages.contains(packageName)) {
  818. - return true;
  819. - }
  820. -
  821. if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION_PERMISSION)
  822. == PackageManager.PERMISSION_GRANTED) {
  823. return true; // app is pre-approved to send to short codes
  824. @@ -1230,25 +1119,6 @@ public abstract class SMSDispatcher extends Handler {
  825. }
  826.  
  827. /**
  828. - * Returns the package name from the original creator of the sms, even
  829. - * if the package is mapped with others in a specific UID (like System UID)
  830. - *
  831. - * @param tracker
  832. - * @return the package name that created the original sms
  833. - */
  834. - private String resolvePackageName(SmsTracker tracker) {
  835. - PendingIntent sentIntent = tracker.mSentIntent;
  836. - String packageName = tracker.mAppInfo.applicationInfo.packageName;
  837. - // System UID maps to multiple packages. Try to narrow it
  838. - // down to an actual sender if possible
  839. - if (isSystemUid(mContext, packageName) && sentIntent != null &&
  840. - sentIntent.getCreatorPackage() != null) {
  841. - packageName = sentIntent.getCreatorPackage();
  842. - }
  843. - return packageName;
  844. - }
  845. -
  846. - /**
  847. * Post an alert when SMS needs confirmation due to excessive usage.
  848. * @param tracker an SmsTracker for the current message.
  849. */
  850. @@ -1691,17 +1561,7 @@ public abstract class SMSDispatcher extends Handler {
  851. boolean isExpectMore, String fullMessageText, boolean isText, int validityPeriod) {
  852. // Get calling app package name via UID from Binder call
  853. PackageManager pm = mContext.getPackageManager();
  854. - int callingUid = Binder.getCallingUid();
  855. - // Special case: We're being proxied by the telephony stack itself,
  856. - // so use the intent generator's UID if one exists
  857. - String[] packageNames;
  858. -
  859. - if (callingUid == android.os.Process.PHONE_UID && sentIntent != null &&
  860. - sentIntent.getCreatorPackage() != null) {
  861. - packageNames = new String[] { sentIntent.getCreatorPackage() };
  862. - } else {
  863. - packageNames = pm.getPackagesForUid(callingUid);
  864. - }
  865. + String[] packageNames = pm.getPackagesForUid(Binder.getCallingUid());
  866.  
  867. // Get package info via packagemanager
  868. PackageInfo appInfo = null;
  869. diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
  870. index ec13605..c957633 100644
  871. --- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
  872. +++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
  873. @@ -17,9 +17,7 @@
  874. package com.android.internal.telephony;
  875.  
  876. import android.app.PendingIntent;
  877. -import android.content.BroadcastReceiver;
  878. import android.content.Context;
  879. -import android.content.Intent;
  880. import android.content.IntentFilter;
  881. import android.content.SharedPreferences;
  882. import android.os.AsyncResult;
  883. @@ -29,7 +27,6 @@ import android.os.Registrant;
  884. import android.os.RegistrantList;
  885. import android.os.SystemClock;
  886. import android.os.SystemProperties;
  887. -import android.os.UserHandle;
  888. import android.preference.PreferenceManager;
  889. import android.telephony.CellInfo;
  890. import android.telephony.ServiceState;
  891. @@ -38,11 +35,11 @@ import android.telephony.SubscriptionManager;
  892. import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
  893. import android.telephony.TelephonyManager;
  894. import android.text.TextUtils;
  895. -import android.util.NativeTextHelper;
  896. import android.util.Pair;
  897. import android.util.TimeUtils;
  898. import android.net.ConnectivityManager;
  899. import android.net.NetworkInfo;
  900. +import android.content.Context;
  901.  
  902. import java.io.FileDescriptor;
  903. import java.io.PrintWriter;
  904. @@ -84,13 +81,6 @@ public abstract class ServiceStateTracker extends Handler {
  905. // so we don't want the reference to change.
  906. protected final CellInfo mCellInfo;
  907.  
  908. - // PLMN/SPN data we last broadcasted
  909. - private int mCurSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
  910. - private String mCurPlmn;
  911. - private boolean mCurShowPlmn = false;
  912. - private String mCurSpn;
  913. - private boolean mCurShowSpn = false;
  914. -
  915. protected SignalStrength mSignalStrength = new SignalStrength();
  916.  
  917. // TODO - this should not be public, right now used externally GsmConnetion.
  918. @@ -251,6 +241,7 @@ public abstract class ServiceStateTracker extends Handler {
  919. if (DBG) log("SubscriptionListener.onSubscriptionInfoChanged");
  920. // Set the network type, in case the radio does not restore it.
  921. int subId = mPhoneBase.getSubId();
  922. + int previousSubId = mPhoneBase.getSubId();
  923. if (previousSubId != subId) {
  924. previousSubId = subId;
  925. if (SubscriptionManager.isValidSubscriptionId(subId)) {
  926. @@ -279,18 +270,10 @@ public abstract class ServiceStateTracker extends Handler {
  927. editor.commit();
  928. }
  929. }
  930. - updateSpnDisplay();
  931. }
  932. }
  933. };
  934.  
  935. - private BroadcastReceiver mReceiver = new BroadcastReceiver() {
  936. - @Override
  937. - public void onReceive(Context context, Intent intent) {
  938. - updateSpnDisplay();
  939. - }
  940. - };
  941. -
  942. protected ServiceStateTracker(PhoneBase phoneBase, CommandsInterface ci, CellInfo cellInfo) {
  943. mPhoneBase = phoneBase;
  944. mCellInfo = cellInfo;
  945. @@ -306,9 +289,6 @@ public abstract class ServiceStateTracker extends Handler {
  946. mSubscriptionManager
  947. .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
  948.  
  949. - mPhoneBase.getContext().registerReceiver(mReceiver,
  950. - new IntentFilter(Intent.ACTION_LOCALE_CHANGED));
  951. -
  952. mPhoneBase.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
  953. ServiceState.rilRadioTechnologyToString(ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN));
  954. mCi.registerForImsNetworkStateChanged(this, EVENT_IMS_STATE_CHANGED, null);
  955. @@ -327,7 +307,6 @@ public abstract class ServiceStateTracker extends Handler {
  956. mCi.unregisterForCellInfoList(this);
  957. mSubscriptionManager
  958. .removeOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
  959. - mPhoneBase.getContext().unregisterReceiver(mReceiver);
  960. }
  961.  
  962. public boolean getDesiredPowerState() {
  963. @@ -963,11 +942,6 @@ public abstract class ServiceStateTracker extends Handler {
  964. pw.println(" mDontPollSignalStrength=" + mDontPollSignalStrength);
  965. pw.println(" mPendingRadioPowerOffAfterDataOff=" + mPendingRadioPowerOffAfterDataOff);
  966. pw.println(" mPendingRadioPowerOffAfterDataOffTag=" + mPendingRadioPowerOffAfterDataOffTag);
  967. - pw.println(" mCurSubId=" + mCurSubId);
  968. - pw.println(" mCurSpn=" + mCurSpn);
  969. - pw.println(" mCurShowSpn=" + mCurShowSpn);
  970. - pw.println(" mCurPlmn=" + mCurPlmn);
  971. - pw.println(" mCurShowPlmn=" + mCurShowPlmn);
  972. pw.flush();
  973. }
  974.  
  975. @@ -1121,58 +1095,10 @@ public abstract class ServiceStateTracker extends Handler {
  976. protected abstract void setRoamingType(ServiceState currentServiceState);
  977.  
  978. protected String getHomeOperatorNumeric() {
  979. - final Context context = mPhoneBase.getContext();
  980. - final TelephonyManager tm =
  981. - (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
  982. - return tm.getSimOperatorNumericForPhone(mPhoneBase.getPhoneId());
  983. + return SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
  984. }
  985.  
  986. protected int getPhoneId() {
  987. return mPhoneBase.getPhoneId();
  988. }
  989. -
  990. - private String adaptCarrierNameToLocale(Context context, String name) {
  991. - return NativeTextHelper.getLocalString(context, name,
  992. - com.android.internal.R.array.origin_carrier_names,
  993. - com.android.internal.R.array.locale_carrier_names);
  994. - }
  995. -
  996. - protected void sendSpnStringsBroadcastIfNeeded(String plmn, boolean showPlmn,
  997. - String spn, boolean showSpn) {
  998. - final Context context = mPhoneBase.getContext();
  999. - final int phoneId = mPhoneBase.getPhoneId();
  1000. - final int subId = mPhoneBase.getSubId();
  1001. -
  1002. - if (context.getResources().getBoolean(
  1003. - com.android.internal.R.bool.config_monitor_locale_change)) {
  1004. - plmn = adaptCarrierNameToLocale(context, plmn);
  1005. - spn = adaptCarrierNameToLocale(context, spn);
  1006. - }
  1007. -
  1008. - if (subId != mCurSubId
  1009. - || showPlmn != mCurShowPlmn
  1010. - || showSpn != mCurShowSpn
  1011. - || !TextUtils.equals(spn, mCurSpn)
  1012. - || !TextUtils.equals(plmn, mCurPlmn)) {
  1013. - if (DBG) {
  1014. - log(String.format("sendSpnStringsBroadcast:" +
  1015. - " showPlmn='%b' plmn='%s' showSpn='%b' spn='%s' for sub %d",
  1016. - showPlmn, plmn, showSpn, spn, subId));
  1017. - }
  1018. - Intent intent = new Intent(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION);
  1019. - intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
  1020. - intent.putExtra(TelephonyIntents.EXTRA_SHOW_SPN, showSpn);
  1021. - intent.putExtra(TelephonyIntents.EXTRA_SPN, spn);
  1022. - intent.putExtra(TelephonyIntents.EXTRA_SHOW_PLMN, showPlmn);
  1023. - intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn);
  1024. - SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId, subId);
  1025. - mPhoneBase.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
  1026. - }
  1027. -
  1028. - mCurShowSpn = showSpn;
  1029. - mCurShowPlmn = showPlmn;
  1030. - mCurSpn = spn;
  1031. - mCurPlmn = plmn;
  1032. - mCurSubId = subId;
  1033. - }
  1034. }
  1035. diff --git a/src/java/com/android/internal/telephony/SmsApplication.java b/src/java/com/android/internal/telephony/SmsApplication.java
  1036. index 315b377..56ff988 100644
  1037. --- a/src/java/com/android/internal/telephony/SmsApplication.java
  1038. +++ b/src/java/com/android/internal/telephony/SmsApplication.java
  1039. @@ -42,10 +42,8 @@ import android.telephony.SmsManager;
  1040. import android.telephony.TelephonyManager;
  1041. import android.util.Log;
  1042.  
  1043. -import com.android.internal.R;
  1044. import com.android.internal.content.PackageMonitor;
  1045.  
  1046. -import java.util.Arrays;
  1047. import java.util.Collection;
  1048. import java.util.HashMap;
  1049. import java.util.List;
  1050. @@ -749,13 +747,6 @@ public final class SmsApplication {
  1051. defaultSmsPackage = component.getPackageName();
  1052. }
  1053.  
  1054. - List<String> ignorePackages = Arrays.asList(
  1055. - context.getResources().getStringArray(R.array.config_ignored_sms_packages));
  1056. -
  1057. - if (ignorePackages.contains(packageName)) {
  1058. - return false;
  1059. - }
  1060. -
  1061. if ((defaultSmsPackage == null || !defaultSmsPackage.equals(packageName)) &&
  1062. !packageName.equals(BLUETOOTH_PACKAGE_NAME)) {
  1063. // To write the message for someone other than the default SMS and BT app
  1064. diff --git a/src/java/com/android/internal/telephony/SmsUsageMonitor.java b/src/java/com/android/internal/telephony/SmsUsageMonitor.java
  1065. index 7182e05..aa9f4e5 100644
  1066. --- a/src/java/com/android/internal/telephony/SmsUsageMonitor.java
  1067. +++ b/src/java/com/android/internal/telephony/SmsUsageMonitor.java
  1068. @@ -22,7 +22,6 @@ import android.content.Context;
  1069. import android.content.pm.ApplicationInfo;
  1070. import android.content.res.XmlResourceParser;
  1071. import android.database.ContentObserver;
  1072. -import android.net.Uri;
  1073. import android.os.Binder;
  1074. import android.os.Handler;
  1075. import android.os.Process;
  1076. @@ -108,8 +107,8 @@ public class SmsUsageMonitor {
  1077. /** Premium SMS permission when the owner has allowed the app to send premium SMS. */
  1078. public static final int PREMIUM_SMS_PERMISSION_ALWAYS_ALLOW = 3;
  1079.  
  1080. - private int mCheckPeriod;
  1081. - private int mMaxAllowed;
  1082. + private final int mCheckPeriod;
  1083. + private final int mMaxAllowed;
  1084.  
  1085. private final HashMap<String, ArrayList<Long>> mSmsStamp =
  1086. new HashMap<String, ArrayList<Long>>();
  1087. @@ -129,9 +128,6 @@ public class SmsUsageMonitor {
  1088. /** Handler for responding to content observer updates. */
  1089. private final SettingsObserverHandler mSettingsObserverHandler;
  1090.  
  1091. - /** Handler for responding to content observer updates sms limits. */
  1092. - private final SmsLimitObserverHandler mSmsLimitObserverHandler;
  1093. -
  1094. /** File holding the patterns */
  1095. private final File mPatternFile = new File(SHORT_CODE_PATH);
  1096.  
  1097. @@ -254,56 +250,20 @@ public class SmsUsageMonitor {
  1098. }
  1099.  
  1100. /**
  1101. - * Observe the global setting for sms limits
  1102. - */
  1103. - private class SmsLimitObserver extends ContentObserver {
  1104. - private final Context mContext;
  1105. -
  1106. - SmsLimitObserver(Handler handler, Context context) {
  1107. - super(handler);
  1108. - mContext = context;
  1109. - onChange(false);
  1110. - }
  1111. -
  1112. - @Override
  1113. - public void onChange(boolean selfChange) {
  1114. - onChange(selfChange, null);
  1115. - }
  1116. -
  1117. - @Override
  1118. - public void onChange(boolean selfChange, Uri uri) {
  1119. - ContentResolver resolver = mContext.getContentResolver();
  1120. - mMaxAllowed = Settings.Global.getInt(resolver,
  1121. - Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT,
  1122. - DEFAULT_SMS_MAX_COUNT);
  1123. -
  1124. - mCheckPeriod = Settings.Global.getInt(resolver,
  1125. - Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS,
  1126. - DEFAULT_SMS_CHECK_PERIOD);
  1127. - }
  1128. - }
  1129. -
  1130. - private class SmsLimitObserverHandler extends Handler {
  1131. - SmsLimitObserverHandler(Context context) {
  1132. - ContentResolver resolver = context.getContentResolver();
  1133. -
  1134. - ContentObserver globalObserver = new SmsLimitObserver(this, context);
  1135. -
  1136. - resolver.registerContentObserver(Settings.Global.getUriFor(
  1137. - Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT), false, globalObserver);
  1138. - resolver.registerContentObserver(Settings.Global.getUriFor(
  1139. - Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS), false, globalObserver);
  1140. - }
  1141. - }
  1142. -
  1143. - /**
  1144. * Create SMS usage monitor.
  1145. * @param context the context to use to load resources and get TelephonyManager service
  1146. */
  1147. public SmsUsageMonitor(Context context) {
  1148. mContext = context;
  1149. + ContentResolver resolver = context.getContentResolver();
  1150. +
  1151. + mMaxAllowed = Settings.Global.getInt(resolver,
  1152. + Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT,
  1153. + DEFAULT_SMS_MAX_COUNT);
  1154.  
  1155. - mSmsLimitObserverHandler = new SmsLimitObserverHandler(mContext);
  1156. + mCheckPeriod = Settings.Global.getInt(resolver,
  1157. + Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS,
  1158. + DEFAULT_SMS_CHECK_PERIOD);
  1159.  
  1160. mSettingsObserverHandler = new SettingsObserverHandler(mContext, mCheckEnabled);
  1161.  
  1162. diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
  1163. index 8b00dc6..2ca3b04 100755
  1164. --- a/src/java/com/android/internal/telephony/SubscriptionController.java
  1165. +++ b/src/java/com/android/internal/telephony/SubscriptionController.java
  1166. @@ -171,11 +171,20 @@ public class SubscriptionController extends ISub.Stub {
  1167. int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
  1168. SubscriptionManager.INVALID_SUBSCRIPTION_ID);
  1169. if (intent.getAction().equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) {
  1170. - setPlmnSpn(subId,
  1171. - intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false),
  1172. - intent.getStringExtra(TelephonyIntents.EXTRA_PLMN),
  1173. - intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false),
  1174. - intent.getStringExtra(TelephonyIntents.EXTRA_SPN));
  1175. + if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false)) {
  1176. + String carrierText = intent.getStringExtra(TelephonyIntents.EXTRA_PLMN);
  1177. + if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) {
  1178. + // Need to show both plmn and spn.
  1179. + String separator = mContext.getString(
  1180. + com.android.internal.R.string.kg_text_message_separator).toString();
  1181. + carrierText = new StringBuilder().append(carrierText).append(separator)
  1182. + .append(intent.getStringExtra(TelephonyIntents.EXTRA_SPN))
  1183. + .toString();
  1184. + }
  1185. + setCarrierText(carrierText, subId);
  1186. + } else if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) {
  1187. + setCarrierText(intent.getStringExtra(TelephonyIntents.EXTRA_PLMN), subId);
  1188. + }
  1189. }
  1190. }
  1191. };
  1192. @@ -851,11 +860,13 @@ public class SubscriptionController extends ISub.Stub {
  1193. * @param spn spn to be included in carrier text
  1194. * @return true if carrier text is set, false otherwise
  1195. */
  1196. - public boolean setPlmnSpn(int subId, boolean showPlmn, String plmn,
  1197. + public boolean setPlmnSpn(int slotId, boolean showPlmn, String plmn,
  1198. boolean showSpn, String spn) {
  1199. + int[] subIds = getSubId(slotId);
  1200. if (mContext.getPackageManager().resolveContentProvider(
  1201. SubscriptionManager.CONTENT_URI.getAuthority(), 0) == null ||
  1202. - !SubscriptionManager.isValidSubscriptionId(subId)) {
  1203. + subIds == null ||
  1204. + !SubscriptionManager.isValidSubscriptionId(subIds[0])) {
  1205. // No place to store this info. Notify registrants of the change anyway as they
  1206. // might retrieve the SPN/PLMN text from the SST sticky broadcast.
  1207. // TODO: This can be removed once SubscriptionController is not running on devices
  1208. @@ -864,37 +875,22 @@ public class SubscriptionController extends ISub.Stub {
  1209. notifySubscriptionInfoChanged();
  1210. return false;
  1211. }
  1212. -
  1213. - if (plmn != null && showPlmn && spn != null && showSpn) {
  1214. - if (mContext.getResources().getBoolean(
  1215. - com.android.internal.R.bool.config_spn_display_control)) {
  1216. - logd("[setPlmnSpn] Do not display SPN string when PLMN and SPN both need to show"
  1217. - + "and PLMN string is not null");
  1218. - showSpn = false;
  1219. - }
  1220. - }
  1221. -
  1222. - final String carrierText;
  1223. + String carrierText = "";
  1224. if (showPlmn) {
  1225. + carrierText = plmn;
  1226. if (showSpn) {
  1227. // Need to show both plmn and spn.
  1228. String separator = mContext.getString(
  1229. com.android.internal.R.string.kg_text_message_separator).toString();
  1230. - carrierText = new StringBuilder()
  1231. - .append(plmn)
  1232. - .append(separator)
  1233. - .append(spn)
  1234. + carrierText = new StringBuilder().append(carrierText).append(separator).append(spn)
  1235. .toString();
  1236. - } else {
  1237. - carrierText = plmn;
  1238. }
  1239. } else if (showSpn) {
  1240. carrierText = spn;
  1241. - } else {
  1242. - carrierText = "";
  1243. }
  1244. -
  1245. - setCarrierText(carrierText, subId);
  1246. + for (int i = 0; i < subIds.length; i++) {
  1247. + setCarrierText(carrierText, subIds[i]);
  1248. + }
  1249. return true;
  1250. }
  1251.  
  1252. diff --git a/src/java/com/android/internal/telephony/SyntheticSmsMessage.java b/src/java/com/android/internal/telephony/SyntheticSmsMessage.java
  1253. deleted file mode 100644
  1254. index 0953470..0000000
  1255. --- a/src/java/com/android/internal/telephony/SyntheticSmsMessage.java
  1256. +++ /dev/null
  1257. @@ -1,125 +0,0 @@
  1258. -/*
  1259. - * Copyright (C) 2014 The CyanogenMod Project
  1260. - *
  1261. - * Licensed under the Apache License, Version 2.0 (the "License");
  1262. - * you may not use this file except in compliance with the License.
  1263. - * You may obtain a copy of the License at
  1264. - *
  1265. - * http://www.apache.org/licenses/LICENSE-2.0
  1266. - *
  1267. - * Unless required by applicable law or agreed to in writing, software
  1268. - * distributed under the License is distributed on an "AS IS" BASIS,
  1269. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1270. - * See the License for the specific language governing permissions and
  1271. - * limitations under the License.
  1272. - */
  1273. -
  1274. -package com.android.internal.telephony;
  1275. -
  1276. -import org.json.JSONObject;
  1277. -
  1278. -import com.android.internal.telephony.SmsConstants.MessageClass;
  1279. -
  1280. -public class SyntheticSmsMessage extends SmsMessageBase {
  1281. - public static class SyntheticAddress extends SmsAddress {
  1282. - }
  1283. -
  1284. - public static boolean isSyntheticPdu(byte[] pdu) {
  1285. - try {
  1286. - JSONObject json = new JSONObject(new String(pdu));
  1287. - return json.optBoolean("synthetic", false);
  1288. - }
  1289. - catch (Exception e) {
  1290. - }
  1291. - return false;
  1292. - }
  1293. -
  1294. - public static SyntheticSmsMessage createFromPdu(byte[] pdu) {
  1295. - try {
  1296. - // TODO: use Parcelable or Bundle or something that serializes?
  1297. - JSONObject json = new JSONObject(new String(pdu));
  1298. - SyntheticSmsMessage message = new SyntheticSmsMessage(
  1299. - json.getString("originatingAddress"),
  1300. - json.optString("scAddress", null),
  1301. - json.getString("messageBody"),
  1302. - json.getLong("timestampMillis"));
  1303. - return message;
  1304. - }
  1305. - catch (Exception e) {
  1306. - e.printStackTrace();
  1307. - }
  1308. - return null;
  1309. - }
  1310. -
  1311. - public SyntheticSmsMessage(String originatingAddress, String scAddress, String messageBody, long timestampMillis) {
  1312. - this.mOriginatingAddress = new SyntheticAddress();
  1313. - this.mOriginatingAddress.address = originatingAddress;
  1314. -
  1315. - this.mMessageBody = messageBody;
  1316. - this.mScTimeMillis = timestampMillis;
  1317. - this.mScAddress = scAddress;
  1318. -
  1319. - try {
  1320. - JSONObject json = new JSONObject();
  1321. - json.put("originatingAddress", originatingAddress);
  1322. - json.put("scAddress", scAddress);
  1323. - json.put("messageBody", messageBody);
  1324. - json.put("timestampMillis", timestampMillis);
  1325. - json.put("synthetic", true);
  1326. - this.mPdu = json.toString().getBytes();
  1327. - }
  1328. - catch (Exception e) {
  1329. - e.printStackTrace();
  1330. - }
  1331. - }
  1332. -
  1333. - @Override
  1334. - public MessageClass getMessageClass() {
  1335. - return SmsConstants.MessageClass.UNKNOWN;
  1336. - }
  1337. -
  1338. - @Override
  1339. - public int getProtocolIdentifier() {
  1340. - return 0;
  1341. - }
  1342. -
  1343. - @Override
  1344. - public boolean isReplace() {
  1345. - return false;
  1346. - }
  1347. -
  1348. - @Override
  1349. - public boolean isCphsMwiMessage() {
  1350. - return false;
  1351. - }
  1352. -
  1353. - @Override
  1354. - public boolean isMWIClearMessage() {
  1355. - return false;
  1356. - }
  1357. -
  1358. - @Override
  1359. - public boolean isMWISetMessage() {
  1360. - return false;
  1361. - }
  1362. -
  1363. - @Override
  1364. - public boolean isMwiDontStore() {
  1365. - return false;
  1366. - }
  1367. -
  1368. - @Override
  1369. - public int getStatus() {
  1370. - return 0;
  1371. - }
  1372. -
  1373. - @Override
  1374. - public boolean isStatusReportMessage() {
  1375. - return false;
  1376. - }
  1377. -
  1378. - @Override
  1379. - public boolean isReplyPathPresent() {
  1380. - return false;
  1381. - }
  1382. -}
  1383. \ No newline at end of file
  1384. diff --git a/src/java/com/android/internal/telephony/UiccSmsController.java b/src/java/com/android/internal/telephony/UiccSmsController.java
  1385. index e65155b..4262179 100644
  1386. --- a/src/java/com/android/internal/telephony/UiccSmsController.java
  1387. +++ b/src/java/com/android/internal/telephony/UiccSmsController.java
  1388. @@ -2,7 +2,6 @@
  1389. * Copyright (C) 2008 The Android Open Source Project
  1390. * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
  1391. * Not a Contribution.
  1392. - * Copyright (c) 2015 The CyanogenMod Project
  1393. *
  1394. * Licensed under the Apache License, Version 2.0 (the "License");
  1395. * you may not use this file except in compliance with the License.
  1396. @@ -19,188 +18,35 @@
  1397.  
  1398. package com.android.internal.telephony;
  1399.  
  1400. -import android.Manifest;
  1401. -import android.app.Activity;
  1402. import android.app.ActivityThread;
  1403. -import android.app.AppOpsManager;
  1404. import android.app.PendingIntent;
  1405. -import android.content.BroadcastReceiver;
  1406. -import android.content.ComponentName;
  1407. import android.content.Context;
  1408. -import android.content.Intent;
  1409. import android.net.Uri;
  1410. import android.os.Binder;
  1411. -import android.os.Handler;
  1412. -import android.os.PowerManager;
  1413. import android.os.RemoteException;
  1414. import android.os.ServiceManager;
  1415. -import android.os.UserHandle;
  1416. -import android.provider.Telephony.Sms.Intents;
  1417. import android.telephony.Rlog;
  1418. -import android.telephony.SmsMessage;
  1419. import android.telephony.SubscriptionInfo;
  1420. -import android.util.Log;
  1421. import android.telephony.SubscriptionManager;
  1422. import android.telephony.TelephonyManager;
  1423.  
  1424. import java.util.List;
  1425. -import java.util.ArrayList;
  1426.  
  1427. /**
  1428. * UiccSmsController to provide an inter-process communication to
  1429. * access Sms in Icc.
  1430. */
  1431. public class UiccSmsController extends ISms.Stub {
  1432. -
  1433. static final String LOG_TAG = "RIL_UiccSmsController";
  1434.  
  1435. protected Phone[] mPhone;
  1436.  
  1437. - protected UiccSmsController(Phone[] phone, Context context){
  1438. + protected UiccSmsController(Phone[] phone){
  1439. mPhone = phone;
  1440. - mContext = context;
  1441. +
  1442. if (ServiceManager.getService("isms") == null) {
  1443. ServiceManager.addService("isms", this);
  1444. }
  1445. -
  1446. - createWakelock();
  1447. - }
  1448. -
  1449. - private void createWakelock() {
  1450. - PowerManager pm = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
  1451. - mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "IccSmsInterfaceManager");
  1452. - mWakeLock.setReferenceCounted(true);
  1453. - }
  1454. -
  1455. - private BroadcastReceiver mReceiver = new BroadcastReceiver() {
  1456. - public void onReceive(Context context, Intent intent) {
  1457. - // check if the message was aborted
  1458. - if (getResultCode() != Activity.RESULT_OK) {
  1459. - return;
  1460. - }
  1461. - String destAddr = getResultData();
  1462. - String scAddr = intent.getStringExtra("scAddr");
  1463. - int subId = intent.getIntExtra("subId", getDefaultSmsSubId());
  1464. - String callingPackage = intent.getStringExtra("callingPackage");
  1465. - ArrayList<String> parts = intent.getStringArrayListExtra("parts");
  1466. - ArrayList<PendingIntent> sentIntents = intent.getParcelableArrayListExtra("sentIntents");
  1467. - ArrayList<PendingIntent> deliveryIntents = intent.getParcelableArrayListExtra("deliveryIntents");
  1468. -
  1469. - if (intent.getIntExtra("callingUid", 0) != 0) {
  1470. - callingPackage = callingPackage + "\\" + intent.getIntExtra("callingUid", 0);
  1471. - }
  1472. -
  1473. - if (intent.getBooleanExtra("multipart", false)) {
  1474. - if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
  1475. - log("ProxiedMultiPartSms destAddr: " + destAddr +
  1476. - "\n scAddr= " + scAddr +
  1477. - "\n subId= " + subId +
  1478. - "\n callingPackage= " + callingPackage +
  1479. - "\n partsSize= " + parts.size());
  1480. - }
  1481. - getIccSmsInterfaceManager(subId)
  1482. - .sendMultipartText(callingPackage, destAddr, scAddr, parts,
  1483. - sentIntents, deliveryIntents);
  1484. - return;
  1485. - }
  1486. -
  1487. - PendingIntent sentIntent = null;
  1488. - if (sentIntents != null && sentIntents.size() > 0) {
  1489. - sentIntent = sentIntents.get(0);
  1490. - }
  1491. - PendingIntent deliveryIntent = null;
  1492. - if (deliveryIntents != null && deliveryIntents.size() > 0) {
  1493. - deliveryIntent = deliveryIntents.get(0);
  1494. - }
  1495. - String text = null;
  1496. - if (parts != null && parts.size() > 0) {
  1497. - text = parts.get(0);
  1498. - }
  1499. - if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
  1500. - log("ProxiedSms destAddr: " + destAddr +
  1501. - "\n scAddr=" + scAddr +
  1502. - "\n subId= " + subId +
  1503. - "\n callingPackage=" + callingPackage);
  1504. - }
  1505. - getIccSmsInterfaceManager(subId).sendText(callingPackage, destAddr,
  1506. - scAddr, text, sentIntent, deliveryIntent);
  1507. - }
  1508. - };
  1509. -
  1510. - private Context mContext;
  1511. - private PowerManager.WakeLock mWakeLock;
  1512. - private static final int WAKE_LOCK_TIMEOUT = 5000;
  1513. - private final Handler mHandler = new Handler();
  1514. - private void dispatchPdus(byte[][] pdus) {
  1515. - Intent intent = new Intent(Intents.SMS_DELIVER_ACTION);
  1516. - // Direct the intent to only the default SMS app. If we can't find a default SMS app
  1517. - // then send it to all broadcast receivers.
  1518. - ComponentName componentName = SmsApplication.getDefaultSmsApplication(mContext, true);
  1519. - if (componentName == null)
  1520. - return;
  1521. -
  1522. - if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
  1523. - log("dispatchPdu pdus: " + pdus +
  1524. - "\n componentName=" + componentName +
  1525. - "\n format=" + SmsMessage.FORMAT_SYNTHETIC);
  1526. - }
  1527. -
  1528. - // Deliver SMS message only to this receiver
  1529. - intent.setComponent(componentName);
  1530. - intent.putExtra("pdus", pdus);
  1531. - intent.putExtra("format", SmsMessage.FORMAT_SYNTHETIC);
  1532. - dispatch(intent, Manifest.permission.RECEIVE_SMS);
  1533. -
  1534. - intent.setAction(Intents.SMS_RECEIVED_ACTION);
  1535. - intent.setComponent(null);
  1536. - dispatch(intent, Manifest.permission.RECEIVE_SMS);
  1537. - }
  1538. -
  1539. - private void dispatch(Intent intent, String permission) {
  1540. - // Hold a wake lock for WAKE_LOCK_TIMEOUT seconds, enough to give any
  1541. - // receivers time to take their own wake locks.
  1542. - mWakeLock.acquire(WAKE_LOCK_TIMEOUT);
  1543. - intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT);
  1544. - mContext.sendOrderedBroadcast(intent, permission, AppOpsManager.OP_RECEIVE_SMS, null,
  1545. - mHandler, Activity.RESULT_OK, null, null);
  1546. - }
  1547. -
  1548. - private void broadcastOutgoingSms(
  1549. - int subId, String callingPackage, String destAddr, String scAddr, boolean multipart,
  1550. - ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
  1551. - ArrayList<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
  1552. - int validityPeriod) {
  1553. - Intent broadcast = new Intent(Intent.ACTION_NEW_OUTGOING_SMS);
  1554. - broadcast.putExtra("destAddr", destAddr);
  1555. - broadcast.putExtra("scAddr", scAddr);
  1556. - broadcast.putExtra("subId", subId);
  1557. - broadcast.putExtra("multipart", multipart);
  1558. - broadcast.putExtra("callingPackage", callingPackage);
  1559. - broadcast.putExtra("callingUid", android.os.Binder.getCallingUid());
  1560. - broadcast.putStringArrayListExtra("parts", parts);
  1561. - broadcast.putParcelableArrayListExtra("sentIntents", sentIntents);
  1562. - broadcast.putParcelableArrayListExtra("deliveryIntents", deliveryIntents);
  1563. - broadcast.putExtra("priority", priority);
  1564. - broadcast.putExtra("isExpectMore", isExpectMore);
  1565. - broadcast.putExtra("validityPeriod", validityPeriod);
  1566. -
  1567. - if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
  1568. - log("Broadcasting sms destAddr: " + destAddr +
  1569. - "\n scAddr= " + scAddr +
  1570. - "\n subId= " + subId +
  1571. - "\n multipart= " + multipart +
  1572. - "\n callingPackager= " + callingPackage +
  1573. - "\n callingUid= " + android.os.Binder.getCallingUid() +
  1574. - "\n parts= " + parts.size() +
  1575. - "\n sentIntents= " + sentIntents.size() +
  1576. - "\n deliveryIntents= " + deliveryIntents.size() +
  1577. - "\n priority= " + priority +
  1578. - "\n isExpectMore= " + isExpectMore +
  1579. - "\n validityPeriod= " + validityPeriod);
  1580. - }
  1581. - mContext.sendOrderedBroadcastAsUser(broadcast, UserHandle.OWNER,
  1582. - android.Manifest.permission.INTERCEPT_SMS,
  1583. - mReceiver, null, Activity.RESULT_OK, destAddr, null);
  1584. }
  1585.  
  1586. public boolean
  1587. @@ -305,33 +151,29 @@ public class UiccSmsController extends ISms.Stub {
  1588.  
  1589. public void sendTextForSubscriber(int subId, String callingPackage, String destAddr,
  1590. String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
  1591. - sendTextWithOptionsUsingSubscriber(subId, callingPackage, destAddr, scAddr, text,
  1592. - sentIntent, deliveryIntent, -1, false, -1);
  1593. + IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
  1594. + if (iccSmsIntMgr != null) {
  1595. + iccSmsIntMgr.sendText(callingPackage, destAddr, scAddr, text, sentIntent,
  1596. + deliveryIntent);
  1597. + } else {
  1598. + Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" +
  1599. + " Subscription: " + subId);
  1600. + }
  1601. }
  1602.  
  1603. public void sendTextWithOptionsUsingSubscriber(int subId, String callingPackage,
  1604. - String destAddr, String scAddr, String text, PendingIntent sentIntent,
  1605. - PendingIntent deliveryIntent, int priority, boolean isExpectMore,
  1606. + String destAddr, String scAddr, String parts, PendingIntent sentIntents,
  1607. + PendingIntent deliveryIntents, int priority, boolean isExpectMore,
  1608. int validityPeriod) {
  1609. - mContext.enforceCallingPermission(
  1610. - android.Manifest.permission.SEND_SMS,
  1611. - "Sending SMS message");
  1612. IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
  1613. - if (iccSmsIntMgr.isShortSMSCode(destAddr)) {
  1614. - iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, text,
  1615. - sentIntent, deliveryIntent, priority, isExpectMore, validityPeriod);
  1616. - return;
  1617. + if (iccSmsIntMgr != null ) {
  1618. + iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents,
  1619. + deliveryIntents, priority, isExpectMore, validityPeriod);
  1620. + } else {
  1621. + Rlog.e(LOG_TAG,"sendTextWithOptions iccSmsIntMgr is null for" +
  1622. + " Subscription: " + subId);
  1623. }
  1624. - ArrayList<String> parts = new ArrayList<String>();
  1625. - parts.add(text);
  1626. - ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
  1627. - sentIntents.add(sentIntent);
  1628. - ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>();
  1629. - deliveryIntents.add(deliveryIntent);
  1630. - broadcastOutgoingSms(subId, callingPackage, destAddr, scAddr, false, parts, sentIntents,
  1631. - deliveryIntents, priority, isExpectMore, validityPeriod);
  1632. }
  1633. -
  1634. public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
  1635. List<String> parts, List<PendingIntent> sentIntents,
  1636. List<PendingIntent> deliveryIntents) throws android.os.RemoteException {
  1637. @@ -343,28 +185,28 @@ public class UiccSmsController extends ISms.Stub {
  1638. String scAddr, List<String> parts, List<PendingIntent> sentIntents,
  1639. List<PendingIntent> deliveryIntents)
  1640. throws android.os.RemoteException {
  1641. - sendMultipartTextWithOptionsUsingSubscriber(subId, callingPackage, destAddr,
  1642. - scAddr, parts, sentIntents, deliveryIntents, -1, false, -1);
  1643. + IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
  1644. + if (iccSmsIntMgr != null ) {
  1645. + iccSmsIntMgr.sendMultipartText(callingPackage, destAddr, scAddr, parts, sentIntents,
  1646. + deliveryIntents);
  1647. + } else {
  1648. + Rlog.e(LOG_TAG,"sendMultipartText iccSmsIntMgr is null for" +
  1649. + " Subscription: " + subId);
  1650. + }
  1651. }
  1652.  
  1653. public void sendMultipartTextWithOptionsUsingSubscriber(int subId, String callingPackage,
  1654. String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents,
  1655. List<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
  1656. int validityPeriod) {
  1657. - mContext.enforceCallingPermission(
  1658. - android.Manifest.permission.SEND_SMS,
  1659. - "Sending SMS message");
  1660. IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
  1661. - if (iccSmsIntMgr.isShortSMSCode(destAddr)) {
  1662. - iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, destAddr,
  1663. - scAddr, parts, sentIntents, deliveryIntents, -1, false, -1);
  1664. - return;
  1665. + if (iccSmsIntMgr != null ) {
  1666. + iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts,
  1667. + sentIntents, deliveryIntents, priority, isExpectMore, validityPeriod);
  1668. + } else {
  1669. + Rlog.e(LOG_TAG,"sendMultipartTextWithOptions iccSmsIntMgr is null for" +
  1670. + " Subscription: " + subId);
  1671. }
  1672. - broadcastOutgoingSms(subId, callingPackage, destAddr, scAddr, true,
  1673. - parts != null ? new ArrayList<String>(parts) : null,
  1674. - sentIntents != null ? new ArrayList<PendingIntent>(sentIntents) : null,
  1675. - deliveryIntents != null ? new ArrayList<PendingIntent>(deliveryIntents) : null,
  1676. - -1, false, -1);
  1677. }
  1678.  
  1679. public boolean enableCellBroadcast(int messageIdentifier, int ranType)
  1680. @@ -530,20 +372,6 @@ public class UiccSmsController extends ISms.Stub {
  1681. getIccSmsInterfaceManager(subId).injectSmsPdu(pdu, format, receivedIntent);
  1682. }
  1683.  
  1684. - @Override
  1685. - public void synthesizeMessages(String originatingAddress,
  1686. - String scAddress, List<String> messages, long timestampMillis) throws RemoteException {
  1687. - mContext.enforceCallingPermission(
  1688. - android.Manifest.permission.BROADCAST_SMS, "");
  1689. - byte[][] pdus = new byte[messages.size()][];
  1690. - for (int i = 0; i < messages.size(); i++) {
  1691. - SyntheticSmsMessage message = new SyntheticSmsMessage(originatingAddress,
  1692. - scAddress, messages.get(i), timestampMillis);
  1693. - pdus[i] = message.getPdu();
  1694. - }
  1695. - dispatchPdus(pdus);
  1696. - }
  1697. -
  1698. /**
  1699. * get sms interface manager object based on subscription.
  1700. **/
  1701. @@ -650,8 +478,4 @@ public class UiccSmsController extends ISms.Stub {
  1702. return false;
  1703. }
  1704. }
  1705. -
  1706. - protected void log(String msg) {
  1707. - Log.d(LOG_TAG, "[UiccSmsController] " + msg);
  1708. - }
  1709. }
  1710. diff --git a/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java b/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
  1711. index 38487cc..ea943d8 100644
  1712. --- a/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
  1713. +++ b/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
  1714. @@ -233,31 +233,10 @@ public class CDMALTEPhone extends CDMAPhone {
  1715. return false;
  1716. }
  1717.  
  1718. - // return IMSI from CSIM as subscriber ID if available, otherwise reads from USIM
  1719. + // return IMSI from USIM as subscriber ID.
  1720. @Override
  1721. public String getSubscriberId() {
  1722. - IccRecords r = (mIccRecords != null) ? mIccRecords.get() : null;
  1723. - if (r != null) {
  1724. - String imsi = r.getIMSI();
  1725. - if (!TextUtils.isEmpty(imsi)) {
  1726. - log("IMSI = " + imsi);
  1727. - return imsi;
  1728. - }
  1729. - }
  1730. -
  1731. - log("IMSI undefined");
  1732. - return "";
  1733. - }
  1734. -
  1735. -
  1736. - // fix CTS test expecting IMEI to be used as device ID when in LteOnCdma mode
  1737. - @Override
  1738. - public String getDeviceId() {
  1739. - if (TelephonyManager.getLteOnCdmaModeStatic() == PhoneConstants.LTE_ON_CDMA_TRUE) {
  1740. - return mImei;
  1741. - } else {
  1742. - return super.getDeviceId();
  1743. - }
  1744. + return (mSimRecords != null) ? mSimRecords.getIMSI() : "";
  1745. }
  1746.  
  1747. // return GID1 from USIM
  1748. diff --git a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
  1749. index 422bb6f..5a683c1 100644
  1750. --- a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
  1751. +++ b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
  1752. @@ -1956,7 +1956,7 @@ public class CDMAPhone extends PhoneBase {
  1753. if (status) {
  1754. IccRecords iccRecords = mIccRecords.get();
  1755. if (iccRecords != null) {
  1756. - setSystemProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA,
  1757. + SystemProperties.set(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA,
  1758. iccRecords.getServiceProviderName());
  1759. }
  1760. if (mSST != null) {
  1761. diff --git a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
  1762. index 01d19bf..dcc5a01 100644
  1763. --- a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
  1764. +++ b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
  1765. @@ -40,6 +40,7 @@ import android.telephony.Rlog;
  1766. import android.telephony.ServiceState;
  1767. import android.telephony.SignalStrength;
  1768. import android.telephony.TelephonyManager;
  1769. +import android.telephony.SubscriptionManager;
  1770. import android.telephony.cdma.CdmaCellLocation;
  1771. import android.text.TextUtils;
  1772. import android.util.EventLog;
  1773. @@ -129,6 +130,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
  1774. private PowerManager.WakeLock mWakeLock;
  1775. private static final String WAKELOCK_TAG = "ServiceStateTracker";
  1776.  
  1777. + /** Contains the name of the registered network in CDMA (either ONS or ERI text). */
  1778. + protected String mCurPlmn = null;
  1779. +
  1780. protected String mMdn;
  1781. protected int mHomeSystemId[] = null;
  1782. protected int mHomeNetworkId[] = null;
  1783. @@ -599,7 +603,27 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
  1784. "of service, set plmn='" + plmn + "'");
  1785. }
  1786.  
  1787. - sendSpnStringsBroadcastIfNeeded(plmn, plmn != null, "", false);
  1788. + if (!TextUtils.equals(plmn, mCurPlmn)) {
  1789. + // Allow A blank plmn, "" to set showPlmn to true. Previously, we
  1790. + // would set showPlmn to true only if plmn was not empty, i.e. was not
  1791. + // null and not blank. But this would cause us to incorrectly display
  1792. + // "No Service". Now showPlmn is set to true for any non null string.
  1793. + boolean showPlmn = plmn != null;
  1794. + if (DBG) {
  1795. + log(String.format("updateSpnDisplay: changed sending intent" +
  1796. + " showPlmn='%b' plmn='%s'", showPlmn, plmn));
  1797. + }
  1798. + Intent intent = new Intent(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION);
  1799. + intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
  1800. + intent.putExtra(TelephonyIntents.EXTRA_SHOW_SPN, false);
  1801. + intent.putExtra(TelephonyIntents.EXTRA_SPN, "");
  1802. + intent.putExtra(TelephonyIntents.EXTRA_SHOW_PLMN, showPlmn);
  1803. + intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn);
  1804. + SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
  1805. + mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
  1806. + }
  1807. +
  1808. + mCurPlmn = plmn;
  1809. }
  1810.  
  1811. /**
  1812. @@ -2086,6 +2110,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
  1813. pw.println(" mSavedTime=" + mSavedTime);
  1814. pw.println(" mSavedAtTime=" + mSavedAtTime);
  1815. pw.println(" mWakeLock=" + mWakeLock);
  1816. + pw.println(" mCurPlmn=" + mCurPlmn);
  1817. pw.println(" mMdn=" + mMdn);
  1818. pw.println(" mHomeSystemId=" + mHomeSystemId);
  1819. pw.println(" mHomeNetworkId=" + mHomeNetworkId);
  1820. diff --git a/src/java/com/android/internal/telephony/gsm/GSMPhone.java b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
  1821. index 422f0f0..a41556a 100644
  1822. --- a/src/java/com/android/internal/telephony/gsm/GSMPhone.java
  1823. +++ b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
  1824. @@ -2052,7 +2052,7 @@ public class GSMPhone extends PhoneBase {
  1825. if (status) {
  1826. IccRecords iccRecords = mIccRecords.get();
  1827. if (iccRecords != null) {
  1828. - setSystemProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA,
  1829. + SystemProperties.set(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA,
  1830. iccRecords.getServiceProviderName());
  1831. }
  1832. if (mSST != null) {
  1833. diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
  1834. index 2b6d7c4..1f1aa0b 100644
  1835. --- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
  1836. +++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
  1837. @@ -48,9 +48,8 @@ import android.telephony.CellLocation;
  1838. import android.telephony.Rlog;
  1839. import android.telephony.ServiceState;
  1840. import android.telephony.SignalStrength;
  1841. -import android.telephony.SubscriptionManager;
  1842. -import android.telephony.TelephonyManager;
  1843. import android.telephony.gsm.GsmCellLocation;
  1844. +import android.telephony.TelephonyManager;
  1845. import android.text.TextUtils;
  1846. import android.util.EventLog;
  1847. import android.util.TimeUtils;
  1848. @@ -66,6 +65,7 @@ import com.android.internal.telephony.PhoneFactory;
  1849. import com.android.internal.telephony.RILConstants;
  1850. import com.android.internal.telephony.RestrictedState;
  1851. import com.android.internal.telephony.ServiceStateTracker;
  1852. +import android.telephony.SubscriptionManager;
  1853. import com.android.internal.telephony.TelephonyIntents;
  1854. import com.android.internal.telephony.TelephonyProperties;
  1855. import com.android.internal.telephony.dataconnection.DcTrackerBase;
  1856. @@ -157,6 +157,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
  1857. private PowerManager.WakeLock mWakeLock;
  1858. private static final String WAKELOCK_TAG = "ServiceStateTracker";
  1859.  
  1860. + /** Keep track of SPN display rules, so we only broadcast intent if something changes. */
  1861. + private String mCurSpn = null;
  1862. + private String mCurPlmn = null;
  1863. + private boolean mCurShowPlmn = false;
  1864. + private boolean mCurShowSpn = false;
  1865. +
  1866. /** Notification type. */
  1867. static final int PS_ENABLED = 1001; // Access Control blocks data service
  1868. static final int PS_DISABLED = 1002; // Access Control enables data service
  1869. @@ -637,7 +643,30 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
  1870. showSpn = false;
  1871. }
  1872.  
  1873. - sendSpnStringsBroadcastIfNeeded(plmn, showPlmn, spn, showSpn);
  1874. + // Update SPN_STRINGS_UPDATED_ACTION IFF any value changes
  1875. + if (showPlmn != mCurShowPlmn
  1876. + || showSpn != mCurShowSpn
  1877. + || !TextUtils.equals(spn, mCurSpn)
  1878. + || !TextUtils.equals(plmn, mCurPlmn)) {
  1879. + if (DBG) {
  1880. + log(String.format("updateSpnDisplay: changed" +
  1881. + " sending intent rule=" + rule +
  1882. + " showPlmn='%b' plmn='%s' showSpn='%b' spn='%s'",
  1883. + showPlmn, plmn, showSpn, spn));
  1884. + }
  1885. + Intent intent = new Intent(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION);
  1886. + intent.putExtra(TelephonyIntents.EXTRA_SHOW_SPN, showSpn);
  1887. + intent.putExtra(TelephonyIntents.EXTRA_SPN, spn);
  1888. + intent.putExtra(TelephonyIntents.EXTRA_SHOW_PLMN, showPlmn);
  1889. + intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn);
  1890. + SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
  1891. + mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
  1892. + }
  1893. +
  1894. + mCurShowSpn = showSpn;
  1895. + mCurShowPlmn = showPlmn;
  1896. + mCurSpn = spn;
  1897. + mCurPlmn = plmn;
  1898. }
  1899.  
  1900. /**
  1901. @@ -2138,6 +2167,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
  1902. pw.println(" mReportedGprsNoReg=" + mReportedGprsNoReg);
  1903. pw.println(" mNotification=" + mNotification);
  1904. pw.println(" mWakeLock=" + mWakeLock);
  1905. + pw.println(" mCurSpn=" + mCurSpn);
  1906. + pw.println(" mCurShowSpn=" + mCurShowSpn);
  1907. + pw.println(" mCurPlmn=" + mCurPlmn);
  1908. + pw.println(" mCurShowPlmn=" + mCurShowPlmn);
  1909. pw.flush();
  1910. }
  1911.  
  1912. diff --git a/src/java/com/android/internal/telephony/uicc/IccRecords.java b/src/java/com/android/internal/telephony/uicc/IccRecords.java
  1913. index 86bdca9..50aedf6 100644
  1914. --- a/src/java/com/android/internal/telephony/uicc/IccRecords.java
  1915. +++ b/src/java/com/android/internal/telephony/uicc/IccRecords.java
  1916. @@ -41,8 +41,6 @@ import java.io.PrintWriter;
  1917. import java.nio.ByteBuffer;
  1918. import java.util.concurrent.atomic.AtomicBoolean;
  1919.  
  1920. -import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
  1921. -
  1922. /**
  1923. * {@hide}
  1924. */
  1925. @@ -66,8 +64,6 @@ public abstract class IccRecords extends Handler implements IccConstants {
  1926.  
  1927. protected AdnRecordCache mAdnCache;
  1928.  
  1929. - private SpnOverride mSpnOverride;
  1930. -
  1931. // ***** Cached SIM State; cleared on channel close
  1932.  
  1933. protected boolean mRecordsRequested = false; // true if we've made requests for the sim records
  1934. @@ -131,7 +127,6 @@ public abstract class IccRecords extends Handler implements IccConstants {
  1935. + " mCi=" + mCi
  1936. + " mFh=" + mFh
  1937. + " mParentApp=" + mParentApp
  1938. - + " mSpnOverride=" + "mSpnOverride"
  1939. + " recordsLoadedRegistrants=" + mRecordsLoadedRegistrants
  1940. + " mImsiReadyRegistrants=" + mImsiReadyRegistrants
  1941. + " mRecordsEventsRegistrants=" + mRecordsEventsRegistrants
  1942. @@ -184,7 +179,6 @@ public abstract class IccRecords extends Handler implements IccConstants {
  1943. } else {
  1944. mCi.registerForIccRefresh(this, EVENT_REFRESH, null);
  1945. }
  1946. - mSpnOverride = new SpnOverride();
  1947. }
  1948.  
  1949. /**
  1950. @@ -445,15 +439,6 @@ public abstract class IccRecords extends Handler implements IccConstants {
  1951. mSpn = spn;
  1952. }
  1953.  
  1954. - protected void setSpnFromConfig(String carrier) {
  1955. - if (mSpnOverride.containsCarrier(carrier)) {
  1956. - String overrideSpn = mSpnOverride.getSpn(carrier);
  1957. - log("set override spn carrier: " + carrier + ", spn: " + overrideSpn);
  1958. - setServiceProviderName(overrideSpn);
  1959. - setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, getServiceProviderName());
  1960. - }
  1961. - }
  1962. -
  1963. /**
  1964. * Set voice mail number to SIM record
  1965. *
  1966. @@ -873,7 +858,6 @@ public abstract class IccRecords extends Handler implements IccConstants {
  1967. pw.println(" mCi=" + mCi);
  1968. pw.println(" mFh=" + mFh);
  1969. pw.println(" mParentApp=" + mParentApp);
  1970. - pw.println(" mSpnOverride=" + mSpnOverride);
  1971. pw.println(" recordsLoadedRegistrants: size=" + mRecordsLoadedRegistrants.size());
  1972. for (int i = 0; i < mRecordsLoadedRegistrants.size(); i++) {
  1973. pw.println(" recordsLoadedRegistrants[" + i + "]="
  1974. diff --git a/src/java/com/android/internal/telephony/uicc/RuimRecords.java b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
  1975. index 4d16293..b7edcec 100644
  1976. --- a/src/java/com/android/internal/telephony/uicc/RuimRecords.java
  1977. +++ b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
  1978. @@ -425,7 +425,7 @@ public final class RuimRecords extends IccRecords {
  1979. }
  1980. if (DBG) log("spn=" + getServiceProviderName());
  1981. if (DBG) log("spnCondition=" + mCsimSpnDisplayCondition);
  1982. - setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, getServiceProviderName());
  1983. + SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, getServiceProviderName());
  1984. }
  1985. }
  1986.  
  1987. @@ -923,7 +923,6 @@ public final class RuimRecords extends IccRecords {
  1988. operator + "'");
  1989. setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
  1990. setSystemProperty(PROPERTY_APN_RUIM_OPERATOR_NUMERIC, operator);
  1991. - setSpnFromConfig(operator);
  1992. } else {
  1993. log("onAllRecordsLoaded empty 'gsm.sim.operator.numeric' skipping");
  1994. }
  1995. diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
  1996. index cd65830..65139d5 100644
  1997. --- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java
  1998. +++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
  1999. @@ -61,6 +61,8 @@ public class SIMRecords extends IccRecords {
  2000. VoiceMailConstants mVmConfig;
  2001.  
  2002.  
  2003. + SpnOverride mSpnOverride;
  2004. +
  2005. // ***** Cached SIM State; cleared on channel close
  2006.  
  2007. private boolean mCallForwardingEnabled;
  2008. @@ -99,6 +101,7 @@ public class SIMRecords extends IccRecords {
  2009. public String toString() {
  2010. return "SimRecords: " + super.toString()
  2011. + " mVmConfig" + mVmConfig
  2012. + + " mSpnOverride=" + "mSpnOverride"
  2013. + " callForwardingEnabled=" + mCallForwardingEnabled
  2014. + " spnState=" + mSpnState
  2015. + " mCphsInfo=" + mCphsInfo
  2016. @@ -197,6 +200,7 @@ public class SIMRecords extends IccRecords {
  2017. mAdnCache = new AdnRecordCache(mFh);
  2018.  
  2019. mVmConfig = new VoiceMailConstants();
  2020. + mSpnOverride = new SpnOverride();
  2021.  
  2022. mRecordsRequested = false; // No load request is made till SIM ready
  2023.  
  2024. @@ -1499,6 +1503,14 @@ public class SIMRecords extends IccRecords {
  2025.  
  2026. //***** Private methods
  2027.  
  2028. + private void setSpnFromConfig(String carrier) {
  2029. + if (mSpnOverride.containsCarrier(carrier)) {
  2030. + setServiceProviderName(mSpnOverride.getSpn(carrier));
  2031. + setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, getServiceProviderName());
  2032. + }
  2033. + }
  2034. +
  2035. +
  2036. private void setVoiceMailByCountry (String spn) {
  2037. if (mVmConfig.containsCarrier(spn)) {
  2038. mIsVoiceMailFixed = true;
  2039. @@ -1716,7 +1728,6 @@ public class SIMRecords extends IccRecords {
  2040. */
  2041. private void getSpnFsm(boolean start, AsyncResult ar) {
  2042. byte[] data;
  2043. - boolean foundSpn = false;
  2044.  
  2045. if (start) {
  2046. // Check previous state to see if there is outstanding
  2047. @@ -1754,13 +1765,9 @@ public class SIMRecords extends IccRecords {
  2048. if (DBG) log("Load EF_SPN: " + getServiceProviderName()
  2049. + " spnDisplayCondition: " + mSpnDisplayCondition);
  2050. setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, getServiceProviderName());
  2051. - if (!TextUtils.isEmpty(getServiceProviderName())) {
  2052. - foundSpn = true;
  2053. - }
  2054.  
  2055. mSpnState = GetSpnFsmState.IDLE;
  2056. - }
  2057. - if (!foundSpn) {
  2058. + } else {
  2059. mFh.loadEFTransparent( EF_SPN_CPHS,
  2060. obtainMessage(EVENT_GET_SPN_DONE));
  2061. mRecordsToLoad++;
  2062. @@ -1780,13 +1787,8 @@ public class SIMRecords extends IccRecords {
  2063. if (DBG) log("Load EF_SPN_CPHS: " + getServiceProviderName());
  2064. setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, getServiceProviderName());
  2065.  
  2066. - if (!TextUtils.isEmpty(getServiceProviderName())) {
  2067. - foundSpn = true;
  2068. - }
  2069. -
  2070. mSpnState = GetSpnFsmState.IDLE;
  2071. - }
  2072. - if (!foundSpn) {
  2073. + } else {
  2074. mFh.loadEFTransparent(
  2075. EF_SPN_SHORT_CPHS, obtainMessage(EVENT_GET_SPN_DONE));
  2076. mRecordsToLoad++;
  2077. @@ -1801,16 +1803,9 @@ public class SIMRecords extends IccRecords {
  2078.  
  2079. if (DBG) log("Load EF_SPN_SHORT_CPHS: " + getServiceProviderName());
  2080. setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, getServiceProviderName());
  2081. -
  2082. - if (!TextUtils.isEmpty(getServiceProviderName())) {
  2083. - foundSpn = true;
  2084. - }
  2085. -
  2086. - }
  2087. -
  2088. - if (!foundSpn) {
  2089. + }else {
  2090. if (DBG) log("No SPN loaded in either CHPS or 3GPP");
  2091. - if (mPnnHomeName != null && (mSpn == null || TextUtils.isEmpty(mSpn))) {
  2092. + if (mPnnHomeName != null && mSpn == null) {
  2093. if (DBG) log("Falling back to home network name for SPN");
  2094. mSpn = mPnnHomeName;
  2095. setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, mSpn);
  2096. @@ -1948,6 +1943,7 @@ public class SIMRecords extends IccRecords {
  2097. pw.println(" extends:");
  2098. super.dump(fd, pw, args);
  2099. pw.println(" mVmConfig=" + mVmConfig);
  2100. + pw.println(" mSpnOverride=" + mSpnOverride);
  2101. pw.println(" mCallForwardingEnabled=" + mCallForwardingEnabled);
  2102. pw.println(" mSpnState=" + mSpnState);
  2103. pw.println(" mCphsInfo=" + mCphsInfo);
  2104. diff --git a/src/java/com/android/internal/telephony/util/BlacklistUtils.java b/src/java/com/android/internal/telephony/util/BlacklistUtils.java
  2105. deleted file mode 100644
  2106. index 1c37ef2..0000000
  2107. --- a/src/java/com/android/internal/telephony/util/BlacklistUtils.java
  2108. +++ /dev/null
  2109. @@ -1,184 +0,0 @@
  2110. -/*
  2111. - * Copyright (C) 2013 The CyanogenMod Project
  2112. - *
  2113. - * Licensed under the Apache License, Version 2.0 (the "License");
  2114. - * you may not use this file except in compliance with the License.
  2115. - * You may obtain a copy of the License at
  2116. - *
  2117. - * http://www.apache.org/licenses/LICENSE-2.0
  2118. - *
  2119. - * Unless required by applicable law or agreed to in writing, software
  2120. - * distributed under the License is distributed on an "AS IS" BASIS,
  2121. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2122. - * See the License for the specific language governing permissions and
  2123. - * limitations under the License.
  2124. - */
  2125. -
  2126. -package com.android.internal.telephony.util;
  2127. -
  2128. -import android.content.ContentValues;
  2129. -import android.content.Context;
  2130. -import android.database.Cursor;
  2131. -import android.net.Uri;
  2132. -import android.os.UserHandle;
  2133. -import android.provider.Settings;
  2134. -import android.provider.Telephony.Blacklist;
  2135. -import android.text.TextUtils;
  2136. -import android.util.Log;
  2137. -
  2138. -import java.util.ArrayList;
  2139. -import java.util.List;
  2140. -
  2141. -import com.android.internal.telephony.CallerInfo;
  2142. -
  2143. -/**
  2144. - * Blacklist Utility Class
  2145. - * @hide
  2146. - */
  2147. -public class BlacklistUtils {
  2148. - private static final String TAG = "BlacklistUtils";
  2149. - private static final boolean DEBUG = false;
  2150. -
  2151. - // Blacklist matching type
  2152. - public final static int MATCH_NONE = 0;
  2153. - public final static int MATCH_PRIVATE = 1;
  2154. - public final static int MATCH_UNKNOWN = 2;
  2155. - public final static int MATCH_LIST = 3;
  2156. - public final static int MATCH_REGEX = 4;
  2157. -
  2158. - public final static int BLOCK_CALLS =
  2159. - Settings.System.BLACKLIST_BLOCK << Settings.System.BLACKLIST_PHONE_SHIFT;
  2160. - public final static int BLOCK_MESSAGES =
  2161. - Settings.System.BLACKLIST_BLOCK << Settings.System.BLACKLIST_MESSAGE_SHIFT;
  2162. -
  2163. - public static boolean addOrUpdate(Context context, String number, int flags, int valid) {
  2164. - ContentValues cv = new ContentValues();
  2165. -
  2166. - if ((valid & BLOCK_CALLS) != 0) {
  2167. - cv.put(Blacklist.PHONE_MODE, (flags & BLOCK_CALLS) != 0 ? 1 : 0);
  2168. - }
  2169. - if ((valid & BLOCK_MESSAGES) != 0) {
  2170. - cv.put(Blacklist.MESSAGE_MODE, (flags & BLOCK_MESSAGES) != 0 ? 1 : 0);
  2171. - }
  2172. -
  2173. - Uri uri = Uri.withAppendedPath(Blacklist.CONTENT_FILTER_BYNUMBER_URI, number);
  2174. - int count = context.getContentResolver().update(uri, cv, null, null);
  2175. -
  2176. - return count > 0;
  2177. - }
  2178. -
  2179. - /**
  2180. - * Check if the number is in the blacklist
  2181. - * @param number: Number to check
  2182. - * @return one of: MATCH_NONE, MATCH_PRIVATE, MATCH_UNKNOWN, MATCH_LIST or MATCH_REGEX
  2183. - */
  2184. - public static int isListed(Context context, String number, int mode) {
  2185. - if (!isBlacklistEnabled(context)) {
  2186. - return MATCH_NONE;
  2187. - }
  2188. -
  2189. - if (DEBUG) {
  2190. - Log.d(TAG, "Checking number " + number + " against the Blacklist for mode " + mode);
  2191. - }
  2192. -
  2193. - final String type;
  2194. -
  2195. - if (mode == BLOCK_CALLS) {
  2196. - if (DEBUG) Log.d(TAG, "Checking if an incoming call should be blocked");
  2197. - type = Blacklist.PHONE_MODE;
  2198. - } else if (mode == BLOCK_MESSAGES) {
  2199. - if (DEBUG) Log.d(TAG, "Checking if an incoming message should be blocked");
  2200. - type = Blacklist.MESSAGE_MODE;
  2201. - } else {
  2202. - Log.e(TAG, "Invalid mode " + mode);
  2203. - return MATCH_NONE;
  2204. - }
  2205. -
  2206. - if (isBlacklistUnknownNumberEnabled(context, mode)) {
  2207. - CallerInfo ci = CallerInfo.getCallerInfo(context, number);
  2208. - if (ci == null || !ci.contactExists) {
  2209. - if (DEBUG) Log.d(TAG, "Blacklist matched due to unknown number");
  2210. - return MATCH_UNKNOWN;
  2211. - }
  2212. - }
  2213. -
  2214. - // Private and unknown number matching
  2215. - if (TextUtils.isEmpty(number)) {
  2216. - if (isBlacklistPrivateNumberEnabled(context, mode)) {
  2217. - if (DEBUG) Log.d(TAG, "Blacklist matched due to private number");
  2218. - return MATCH_PRIVATE;
  2219. - }
  2220. - return MATCH_NONE;
  2221. - }
  2222. -
  2223. - Uri.Builder builder = Blacklist.CONTENT_FILTER_BYNUMBER_URI.buildUpon();
  2224. - builder.appendPath(number);
  2225. - if (isBlacklistRegexEnabled(context)) {
  2226. - builder.appendQueryParameter(Blacklist.REGEX_KEY, "1");
  2227. - }
  2228. -
  2229. - int result = MATCH_NONE;
  2230. - Cursor c = context.getContentResolver().query(builder.build(),
  2231. - new String[] { Blacklist.IS_REGEX, type }, null, null, null);
  2232. -
  2233. - if (c != null) {
  2234. - if (DEBUG) Log.d(TAG, "Blacklist query successful, " + c.getCount() + " matches");
  2235. - int regexColumnIndex = c.getColumnIndexOrThrow(Blacklist.IS_REGEX);
  2236. - int modeColumnIndex = c.getColumnIndexOrThrow(type);
  2237. - boolean whitelisted = false;
  2238. -
  2239. - c.moveToPosition(-1);
  2240. - while (c.moveToNext()) {
  2241. - boolean isRegex = c.getInt(regexColumnIndex) != 0;
  2242. - boolean blocked = c.getInt(modeColumnIndex) != 0;
  2243. -
  2244. - if (!isRegex) {
  2245. - whitelisted = !blocked;
  2246. - result = MATCH_LIST;
  2247. - if (blocked) {
  2248. - break;
  2249. - }
  2250. - } else if (blocked) {
  2251. - result = MATCH_REGEX;
  2252. - }
  2253. - }
  2254. - if (whitelisted) {
  2255. - result = MATCH_NONE;
  2256. - }
  2257. - c.close();
  2258. - }
  2259. -
  2260. - if (DEBUG) Log.d(TAG, "Blacklist check result for number " + number + " is " + result);
  2261. - return result;
  2262. - }
  2263. -
  2264. - public static boolean isBlacklistEnabled(Context context) {
  2265. - return Settings.System.getIntForUser(context.getContentResolver(),
  2266. - Settings.System.PHONE_BLACKLIST_ENABLED, 1,
  2267. - UserHandle.USER_CURRENT_OR_SELF) != 0;
  2268. - }
  2269. -
  2270. - public static boolean isBlacklistNotifyEnabled(Context context) {
  2271. - return Settings.System.getIntForUser(context.getContentResolver(),
  2272. - Settings.System.PHONE_BLACKLIST_NOTIFY_ENABLED, 1,
  2273. - UserHandle.USER_CURRENT_OR_SELF) != 0;
  2274. - }
  2275. -
  2276. - public static boolean isBlacklistPrivateNumberEnabled(Context context, int mode) {
  2277. - return (Settings.System.getIntForUser(context.getContentResolver(),
  2278. - Settings.System.PHONE_BLACKLIST_PRIVATE_NUMBER_MODE, 0,
  2279. - UserHandle.USER_CURRENT_OR_SELF) & mode) != 0;
  2280. - }
  2281. -
  2282. - public static boolean isBlacklistUnknownNumberEnabled(Context context, int mode) {
  2283. - return (Settings.System.getIntForUser(context.getContentResolver(),
  2284. - Settings.System.PHONE_BLACKLIST_UNKNOWN_NUMBER_MODE, 0,
  2285. - UserHandle.USER_CURRENT_OR_SELF) & mode) != 0;
  2286. - }
  2287. -
  2288. - public static boolean isBlacklistRegexEnabled(Context context) {
  2289. - return Settings.System.getIntForUser(context.getContentResolver(),
  2290. - Settings.System.PHONE_BLACKLIST_REGEX_ENABLED, 0,
  2291. - UserHandle.USER_CURRENT_OR_SELF) != 0;
  2292. - }
  2293. -}
  2294. diff --git a/src/java/com/google/android/mms/pdu/RetrieveConf.java b/src/java/com/google/android/mms/pdu/RetrieveConf.java
  2295. index 7d2396e..98e67c0 100644
  2296. --- a/src/java/com/google/android/mms/pdu/RetrieveConf.java
  2297. +++ b/src/java/com/google/android/mms/pdu/RetrieveConf.java
  2298. @@ -34,7 +34,6 @@ public class RetrieveConf extends MultimediaMessagePdu {
  2299. public RetrieveConf() throws InvalidHeaderValueException {
  2300. super();
  2301. setMessageType(PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF);
  2302. - setTransactionId(generateTransactionId());
  2303. }
  2304.  
  2305. /**
  2306. @@ -44,7 +43,6 @@ public class RetrieveConf extends MultimediaMessagePdu {
  2307. */
  2308. RetrieveConf(PduHeaders headers) {
  2309. super(headers);
  2310. - setTransactionId(generateTransactionId());
  2311. }
  2312.  
  2313. /**
  2314. @@ -55,12 +53,6 @@ public class RetrieveConf extends MultimediaMessagePdu {
  2315. */
  2316. RetrieveConf(PduHeaders headers, PduBody body) {
  2317. super(headers, body);
  2318. - setTransactionId(generateTransactionId());
  2319. - }
  2320. -
  2321. - private byte[] generateTransactionId() {
  2322. - String transactionId = "T" + Long.toHexString(System.currentTimeMillis());
  2323. - return transactionId.getBytes();
  2324. }
  2325.  
  2326. /**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement