@Override // From ContactListItemView.HostInterface
 public boolean isContactSelected(final ContactListItemData item) {
   return mSelectedPhoneNumbers != null
       && mSelectedPhoneNumbers.contains(
           PhoneUtils.getDefault()
               .getCanonicalBySystemLocale(item.getRecipientEntry().getDestination()));
 }
 /** {@inheritDoc} */
 @Override
 public void dump(final FileDescriptor fd, final PrintWriter writer, final String[] args) {
   // First dump out the default SMS app package name
   String defaultSmsApp = PhoneUtils.getDefault().getDefaultSmsApp();
   if (TextUtils.isEmpty(defaultSmsApp)) {
     if (OsUtil.isAtLeastKLP()) {
       defaultSmsApp = "None";
     } else {
       defaultSmsApp = "None (pre-Kitkat)";
     }
   }
   writer.println("Default SMS app: " + defaultSmsApp);
   // Now dump logs
   LogUtil.dump(writer);
 }
Example #3
0
 /**
  * Process one apn
  *
  * @param apnValues Where we store the parsed apn
  * @throws IOException
  * @throws XmlPullParserException
  */
 private void processApn(ContentValues apnValues) throws IOException, XmlPullParserException {
   Assert.notNull(apnValues);
   apnValues.clear();
   // Collect all the attributes
   for (int i = 0; i < mInputParser.getAttributeCount(); i++) {
     final String key = APN_ATTRIBUTE_MAP.get(mInputParser.getAttributeName(i));
     if (key != null) {
       apnValues.put(key, mInputParser.getAttributeValue(i));
     }
   }
   // Set numeric to be canonicalized mcc/mnc like "310120", always 6 digits
   final String canonicalMccMnc =
       PhoneUtils.canonicalizeMccMnc(
           apnValues.getAsString(Telephony.Carriers.MCC),
           apnValues.getAsString(Telephony.Carriers.MNC));
   apnValues.put(Telephony.Carriers.NUMERIC, canonicalMccMnc);
   // Some of the values should not be string type, converting them to desired types
   final String authType = apnValues.getAsString(Telephony.Carriers.AUTH_TYPE);
   if (authType != null) {
     apnValues.put(Telephony.Carriers.AUTH_TYPE, parseInt(authType, -1, "apn authtype"));
   }
   final String carrierEnabled = apnValues.getAsString(Telephony.Carriers.CARRIER_ENABLED);
   if (carrierEnabled != null) {
     apnValues.put(
         Telephony.Carriers.CARRIER_ENABLED,
         parseBoolean(carrierEnabled, null, "apn carrierEnabled"));
   }
   final String bearer = apnValues.getAsString(Telephony.Carriers.BEARER);
   if (bearer != null) {
     apnValues.put(Telephony.Carriers.BEARER, parseInt(bearer, 0, "apn bearer"));
   }
   // We are at the end tag
   if (mInputParser.next() != XmlPullParser.END_TAG) {
     throw new XmlPullParserException("Apn: expecting end tag @" + xmlParserDebugContext());
   }
   // We are done parsing one APN, call the handler
   if (mApnHandler != null) {
     mApnHandler.process(apnValues);
   }
 }
Example #4
0
 /**
  * Process one mms_config.
  *
  * @throws IOException
  * @throws XmlPullParserException
  */
 private void processMmsConfig() throws IOException, XmlPullParserException {
   // Get the mcc and mnc attributes
   final String canonicalMccMnc =
       PhoneUtils.canonicalizeMccMnc(
           mInputParser.getAttributeValue(null, "mcc"),
           mInputParser.getAttributeValue(null, "mnc"));
   // We are at the start tag
   for (; ; ) {
     int nextEvent;
     // Skipping spaces
     while ((nextEvent = mInputParser.next()) == XmlPullParser.TEXT) {}
     if (nextEvent == XmlPullParser.START_TAG) {
       // Parse one mms config key/value
       processMmsConfigKeyValue(canonicalMccMnc);
     } else if (nextEvent == XmlPullParser.END_TAG) {
       break;
     } else {
       throw new XmlPullParserException(
           "MmsConfig: expecting start or end tag @" + xmlParserDebugContext());
     }
   }
 }
Example #5
0
 /**
  * Send AcknowledgeInd (response to mms manual download). Ignore failures.
  *
  * @param context Context
  * @param subId The SIM's subId we are currently using
  * @param transactionId The transaction id of the MMS message
  * @param contentLocation The url of the MMS message
  * @throws MmsFailureException
  * @throws InvalidHeaderValueException
  */
 public static void sendAcknowledgeForMmsDownload(
     final Context context,
     final int subId,
     final byte[] transactionId,
     final String contentLocation)
     throws MmsFailureException, InvalidHeaderValueException {
   final String selfNumber = PhoneUtils.get(subId).getCanonicalForSelf(true /*allowOverride*/);
   // Create the M-Acknowledge.ind
   final AcknowledgeInd acknowledgeInd =
       new AcknowledgeInd(PduHeaders.CURRENT_MMS_VERSION, transactionId);
   acknowledgeInd.setFrom(new EncodedStringValue(selfNumber));
   final Uri messageUri = Uri.parse(contentLocation);
   // Sending
   sendMms(
       context,
       subId,
       messageUri,
       MmsConfig.get(subId).getNotifyWapMMSC() ? contentLocation : null,
       acknowledgeInd,
       false /*responseImportant*/,
       null /* sentIntentExtras */);
 }