Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 145ff609 authored by Jake Hamby's avatar Jake Hamby
Browse files

Spelling corrections and other minor cosmetic cleanups.

- Fixed a bunch of typos in comments (plus a few variable names)
- Removed unused import lines from telephony classes
- Added @Override attribute to overriding methods
- Made SmsMessage.PduParser inner class private & deleted unused constructor
- Added type specifiers to declarations of ArrayList and HashMap
- SimulatedCommands.getRegistrationState() had an ArrayIndexOutOfBoundsException
  trying to write to index 14 of a 14-element array. I removed the
  out-of-bounds assignment.

Change-Id: I054b5156aa64ab6639028d5b45a7e688b2deee08
parent 1b2d7ec4
Loading
Loading
Loading
Loading
+18 −18
Original line number Diff line number Diff line
@@ -747,10 +747,10 @@ public class PhoneNumberUtils
        if (prependPlus) {
            // This is an "international number" and should have
            // a plus prepended to the dialing number. But there
            // can also be Gsm MMI codes as defined in TS 22.030 6.5.2
            // can also be GSM MMI codes as defined in TS 22.030 6.5.2
            // so we need to handle those also.
            //
            // http://web.telia.com/~u47904776/gsmkode.htm is a
            // http://web.telia.com/~u47904776/gsmkode.htm
            // has a nice list of some of these GSM codes.
            //
            // Examples are:
@@ -838,10 +838,10 @@ public class PhoneNumberUtils

            // FIXME(mkf) TS 23.040 9.1.2.3 says
            // "if a mobile receives 1111 in a position prior to
            // the last semi-octet then processing shall commense with
            // the last semi-octet then processing shall commence with
            // the next semi-octet and the intervening
            // semi-octet shall be ignored"
            // How does this jive with 24,008 10.5.4.7
            // How does this jive with 24.008 10.5.4.7

            b = (byte)((bytes[i] >> 4) & 0xf);

@@ -972,7 +972,7 @@ public class PhoneNumberUtils
     * Convert a dialing number to BCD byte array
     *
     * @param number dialing number string
     *        if the dialing number starts with '+', set to internationl TOA
     *        if the dialing number starts with '+', set to international TOA
     * @return BCD byte array
     */
    public static byte[]
@@ -1076,10 +1076,10 @@ public class PhoneNumberUtils
     *
     * @param source the phone number to format
     * @param defaultFormattingType The default formatting rules to apply if the number does
     * not begin with +<country_code>
     * not begin with +[country_code]
     * @return The phone number formatted with the given formatting type.
     *
     * @hide TODO:Shuold be unhidden.
     * @hide TODO: Should be unhidden.
     */
    public static String formatNumber(String source, int defaultFormattingType) {
        SpannableStringBuilder text = new SpannableStringBuilder(source);
@@ -1106,7 +1106,7 @@ public class PhoneNumberUtils
     *
     * @param text The number to be formatted, will be modified with the formatting
     * @param defaultFormattingType The default formatting rules to apply if the number does
     * not begin with +<country_code>
     * not begin with +[country_code]
     */
    public static void formatNumber(Editable text, int defaultFormattingType) {
        int formatType = defaultFormattingType;
@@ -1502,7 +1502,7 @@ public class PhoneNumberUtils
     * @hide
     */
    public static String
    cdmaCheckAndProcessPlusCodeByNumberFormat(String dialStr,int currFormat,int defaultFormt) {
    cdmaCheckAndProcessPlusCodeByNumberFormat(String dialStr,int currFormat,int defaultFormat) {
        String retStr = dialStr;

        // Checks if the plus sign character is in the passed-in dial string
@@ -1510,7 +1510,7 @@ public class PhoneNumberUtils
            dialStr.lastIndexOf(PLUS_SIGN_STRING) != -1) {
            // Format the string based on the rules for the country the number is from,
            // and the current country the phone is camped on.
            if ((currFormat == defaultFormt) && (currFormat == FORMAT_NANP)) {
            if ((currFormat == defaultFormat) && (currFormat == FORMAT_NANP)) {
                // Handle case where default and current telephone numbering plans are NANP.
                String postDialStr = null;
                String tempDialStr = dialStr;
@@ -1688,7 +1688,7 @@ public class PhoneNumberUtils
        return -1;
    }

    // This function appends the non-diablable P/W character to the original
    // This function appends the non-dialable P/W character to the original
    // dial string based on the dialable index passed in
    private static String
    appendPwCharBackToOrigDialStr(int dialableIndex,String origStr, String dialStr) {
@@ -1708,7 +1708,7 @@ public class PhoneNumberUtils
        return retStr;
    }

    //===== Begining of utility methods used in compareLoosely() =====
    //===== Beginning of utility methods used in compareLoosely() =====

    /**
     * Phone numbers are stored in "lookup" form in the database
@@ -1830,12 +1830,12 @@ public class PhoneNumberUtils

    //===== End of utility methods used only in compareLoosely() =====

    //===== Beggining of utility methods used only in compareStrictly() ====
    //===== Beginning of utility methods used only in compareStrictly() ====

    /*
     * If true, the number is country calling code.
     */
    private static final boolean COUNTLY_CALLING_CALL[] = {
    private static final boolean COUNTRY_CALLING_CALL[] = {
        true, true, false, false, false, false, false, true, false, false,
        false, false, false, false, false, false, false, false, false, false,
        true, false, false, false, false, false, false, true, true, false,
@@ -1847,18 +1847,18 @@ public class PhoneNumberUtils
        false, true, true, true, true, false, true, false, false, true,
        true, true, true, true, true, true, false, false, true, false,
    };
    private static final int CCC_LENGTH = COUNTLY_CALLING_CALL.length;
    private static final int CCC_LENGTH = COUNTRY_CALLING_CALL.length;

    /**
     * @return true when input is valid Country Calling Code.
     */
    private static boolean isCountryCallingCode(int countryCallingCodeCandidate) {
        return countryCallingCodeCandidate > 0 && countryCallingCodeCandidate < CCC_LENGTH &&
                COUNTLY_CALLING_CALL[countryCallingCodeCandidate];
                COUNTRY_CALLING_CALL[countryCallingCodeCandidate];
    }

    /**
     * Returns interger corresponding to the input if input "ch" is
     * Returns integer corresponding to the input if input "ch" is
     * ISO-LATIN characters 0-9.
     * Returns -1 otherwise
     */
@@ -1993,7 +1993,7 @@ public class PhoneNumberUtils

    /**
     * Return true if the prefix of "str" is "ignorable". Here, "ignorable" means
     * that "str" has only one digit and separater characters. The one digit is
     * that "str" has only one digit and separator characters. The one digit is
     * assumed to be trunk prefix.
     */
    private static boolean checkPrefixIsIgnorable(final String str,
+10 −13
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.text.TextUtils;

import com.android.internal.telephony.EncodeException;
import com.android.internal.telephony.ISms;
import com.android.internal.telephony.IccConstants;
import com.android.internal.telephony.SmsRawData;
@@ -33,7 +32,7 @@ import java.util.List;
/*
 * TODO(code review): Curious question... Why are a lot of these
 * methods not declared as static, since they do not seem to require
 * any local object state?  Assumedly this cannot be changed without
 * any local object state?  Presumably this cannot be changed without
 * interfering with the API...
 */

@@ -42,7 +41,8 @@ import java.util.List;
 * Get this object by calling the static method SmsManager.getDefault().
 */
public final class SmsManager {
    private static SmsManager sInstance;
    /** Singleton object constructed during class initialization. */
    private static final SmsManager sInstance = new SmsManager();

    /**
     * Send a text based SMS.
@@ -52,8 +52,8 @@ public final class SmsManager {
     *  the current default SMSC
     * @param text the body of the message to send
     * @param sentIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is sucessfully sent, or failed.
     *  The result code will be <code>Activity.RESULT_OK<code> for success,
     *  broadcast when the message is successfully sent, or failed.
     *  The result code will be <code>Activity.RESULT_OK</code> for success,
     *  or one of these errors:<br>
     *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
     *  <code>RESULT_ERROR_RADIO_OFF</code><br>
@@ -116,7 +116,7 @@ public final class SmsManager {
     * @param sentIntents if not null, an <code>ArrayList</code> of
     *   <code>PendingIntent</code>s (one for each message part) that is
     *   broadcast when the corresponding message part has been sent.
     *   The result code will be <code>Activity.RESULT_OK<code> for success,
     *   The result code will be <code>Activity.RESULT_OK</code> for success,
     *   or one of these errors:<br>
     *   <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
     *   <code>RESULT_ERROR_RADIO_OFF</code><br>
@@ -125,7 +125,7 @@ public final class SmsManager {
     *   the extra "errorCode" containing a radio technology specific value,
     *   generally only useful for troubleshooting.<br>
     *   The per-application based SMS control checks sentIntent. If sentIntent
     *   is NULL the caller will be checked against all unknown applicaitons,
     *   is NULL the caller will be checked against all unknown applications,
     *   which cause smaller number of SMS to be sent in checking period.
     * @param deliveryIntents if not null, an <code>ArrayList</code> of
     *   <code>PendingIntent</code>s (one for each message part) that is
@@ -178,8 +178,8 @@ public final class SmsManager {
     * @param destinationPort the port to deliver the message to
     * @param data the body of the message to send
     * @param sentIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is sucessfully sent, or failed.
     *  The result code will be <code>Activity.RESULT_OK<code> for success,
     *  broadcast when the message is successfully sent, or failed.
     *  The result code will be <code>Activity.RESULT_OK</code> for success,
     *  or one of these errors:<br>
     *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
     *  <code>RESULT_ERROR_RADIO_OFF</code><br>
@@ -188,7 +188,7 @@ public final class SmsManager {
     *  the extra "errorCode" containing a radio technology specific value,
     *  generally only useful for troubleshooting.<br>
     *  The per-application based SMS control checks sentIntent. If sentIntent
     *  is NULL the caller will be checked against all unknown applicaitons,
     *  is NULL the caller will be checked against all unknown applications,
     *  which cause smaller number of SMS to be sent in checking period.
     * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is delivered to the recipient.  The
@@ -224,9 +224,6 @@ public final class SmsManager {
     * @return the default instance of the SmsManager
     */
    public static SmsManager getDefault() {
        if (sInstance == null) {
            sInstance = new SmsManager();
        }
        return sInstance;
    }

+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.os.Parcel;
import android.util.Log;

import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.EncodeException;
import com.android.internal.telephony.SmsHeader;
import com.android.internal.telephony.SmsMessageBase;
import com.android.internal.telephony.SmsMessageBase.SubmitPduBase;
+9 −9
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ import android.os.Handler;
 */
public interface CommandsInterface {
    enum RadioState {
        RADIO_OFF,         /* Radio explictly powered off (eg CFUN=0) */
        RADIO_UNAVAILABLE, /* Radio unavailable (eg, resetting or not booted) */
        RADIO_OFF,         /* Radio explicitly powered off (e.g. CFUN=0) */
        RADIO_UNAVAILABLE, /* Radio unavailable (e.g. resetting or not booted) */
        SIM_NOT_READY,     /* Radio is on, but the SIM interface is not ready */
        SIM_LOCKED_OR_ABSENT,  /* SIM PIN locked, PUK required, network
                               personalization, or SIM absent */
@@ -121,7 +121,7 @@ public interface CommandsInterface {
    // See 27.007 +CCFC or +CLCK
    static final int SERVICE_CLASS_NONE     = 0; // no user input
    static final int SERVICE_CLASS_VOICE    = (1 << 0);
    static final int SERVICE_CLASS_DATA     = (1 << 1); //synoym for 16+32+64+128
    static final int SERVICE_CLASS_DATA     = (1 << 1); //synonym for 16+32+64+128
    static final int SERVICE_CLASS_FAX      = (1 << 2);
    static final int SERVICE_CLASS_SMS      = (1 << 3);
    static final int SERVICE_CLASS_DATA_SYNC = (1 << 4);
@@ -939,19 +939,19 @@ public interface CommandsInterface {
    void writeSmsToRuim(int status, String pdu, Message response);

    /**
     * @deprecated
     * @param apn
     * @param user
     * @param password
     * @param response
     */
    @Deprecated
    void setupDefaultPDP(String apn, String user, String password, Message response);

    /**
     * @deprecated
     * @param cid
     * @param response
     */
    @Deprecated
    void deactivateDefaultPDP(int cid, Message response);

    void setRadioPower(boolean on, Message response);
@@ -961,7 +961,7 @@ public interface CommandsInterface {
    void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message response);

    /**
     * parameters equivilient to 27.007 AT+CRSM command
     * parameters equivalent to 27.007 AT+CRSM command
     * response.obj will be an AsyncResult
     * response.obj.userObj will be a IccIoResult on success
     */
@@ -1066,7 +1066,7 @@ public interface CommandsInterface {

    /**
     * (AsyncResult)response.obj).result will be an Integer representing
     * the sum of enabled serivice classes (sum of SERVICE_CLASS_*)
     * the sum of enabled service classes (sum of SERVICE_CLASS_*)
     *
     * @param facility one of CB_FACILTY_*
     * @param password password or "" if not required
@@ -1139,7 +1139,7 @@ public interface CommandsInterface {

    /**
     * Request to enable/disable network state change notifications when
     * location informateion (lac and/or cid) has changed.
     * location information (lac and/or cid) has changed.
     *
     * @param enable true to enable, false to disable
     * @param response callback message
@@ -1170,7 +1170,7 @@ public interface CommandsInterface {

    /**
     * Indicates to the vendor ril that StkService is running
     * rand is eady to receive RIL_UNSOL_STK_XXXX commands.
     * and is ready to receive RIL_UNSOL_STK_XXXX commands.
     *
     * @param result callback message
     */
+5 −6
Original line number Diff line number Diff line
@@ -16,14 +16,13 @@

package com.android.internal.telephony;

import android.telephony.SmsMessage;
import android.util.SparseIntArray;

import android.util.Log;

/**
 * This class implements the character set mapping between
 * the GSM SMS 7-bit alphabet specifed in TS 23.038 6.2.1
 * the GSM SMS 7-bit alphabet specified in TS 23.038 6.2.1
 * and UTF-16
 *
 * {@hide}
@@ -171,7 +170,7 @@ public class GsmAlphabet {
     * array cannot contain more than 255 septets.
     *
     * @param data The text string to encode.
     * @param header Optional header (includeing length byte) that precedes
     * @param header Optional header (including length byte) that precedes
     * the encoded data, padded to septet boundary.
     * @return Byte array containing header and encoded data.
     */
@@ -204,7 +203,7 @@ public class GsmAlphabet {
     * the packed septets. The returned array cannot contain more than 255
     * septets.
     *
     * @param data the data string to endcode
     * @param data the data string to encode
     * @throws EncodeException if String is too large to encode
     */
    public static byte[] stringToGsm7BitPacked(String data)
@@ -223,7 +222,7 @@ public class GsmAlphabet {
     *
     * @param data the text to convert to septets
     * @param startingSeptetOffset the number of padding septets to put before
     *  the character data at the begining of the array
     *  the character data at the beginning of the array
     * @param throwException If true, throws EncodeException on invalid char.
     *   If false, replaces unencodable char with GSM alphabet space char.
     *
@@ -257,7 +256,7 @@ public class GsmAlphabet {
    }

    /**
     * Pack a 7-bit char into its appropirate place in a byte array
     * Pack a 7-bit char into its appropriate place in a byte array
     *
     * @param bitOffset the bit offset that the septet should be packed at
     *                  (septet index * 7)
Loading