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

Commit b237a110 authored by Wink Saville's avatar Wink Saville
Browse files

Change subId to int from long

Change-Id: Idae6335e63e7b1e4e714bc17e71b1a4705e38474
parent 6137cc7b
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -356,7 +356,7 @@ public final class Telephony {
         * @return the URI for the new message
         * @hide
         */
        public static Uri addMessageToUri(long subId, ContentResolver resolver,
        public static Uri addMessageToUri(int subId, ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport) {
            return addMessageToUri(subId, resolver, uri, address, body, subject,
@@ -402,7 +402,7 @@ public final class Telephony {
         * @return the URI for the new message
         * @hide
         */
        public static Uri addMessageToUri(long subId, ContentResolver resolver,
        public static Uri addMessageToUri(int subId, ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, long threadId) {
            ContentValues values = new ContentValues(8);
@@ -538,7 +538,7 @@ public final class Telephony {
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date, boolean read) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
                        subject, date, read, false);
@@ -596,7 +596,7 @@ public final class Telephony {
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
                        subject, date, true, false);
@@ -641,7 +641,7 @@ public final class Telephony {
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
                        subject, date, true, false);
@@ -708,7 +708,7 @@ public final class Telephony {
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date,
                    boolean deliveryReport, long threadId) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
@@ -1133,7 +1133,7 @@ public final class Telephony {
            public static SmsMessage[] getMessagesFromIntent(Intent intent) {
                Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
                String format = intent.getStringExtra("format");
                long subId = intent.getLongExtra(PhoneConstants.SUBSCRIPTION_KEY,
                int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
                        SubscriptionManager.getDefaultSmsSubId());

                Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId);
+3 −3
Original line number Diff line number Diff line
@@ -54,14 +54,14 @@ public class CellBroadcastMessage implements Parcelable {
     *
     * @hide
     */
    private long mSubId = 0;
    private int mSubId = 0;

    /**
     * set Subscription information
     *
     * @hide
     */
    public void setSubId(long subId) {
    public void setSubId(int subId) {
        mSubId = subId;
    }

@@ -70,7 +70,7 @@ public class CellBroadcastMessage implements Parcelable {
     *
     * @hide
     */
    public long getSubId() {
    public int getSubId() {
        return mSubId;
    }

+6 −6
Original line number Diff line number Diff line
@@ -64,10 +64,10 @@ public final class SmsManager {
    /** Singleton object constructed during class initialization. */
    private static final SmsManager sInstance = new SmsManager(DEFAULT_SUB_ID);
    private static final Object sLockObject = new Object();
    private static final Map<Long, SmsManager> sSubInstances = new ArrayMap<Long, SmsManager>();
    private static final Map<Integer, SmsManager> sSubInstances = new ArrayMap<Integer, SmsManager>();

    /** A concrete subId, or the pseudo DEFAULT_SUB_ID */
    private long mSubId;
    private int mSubId;

    /*
     * Key for the various carrier-dependent configuration values.
@@ -470,7 +470,7 @@ public final class SmsManager {
     *   {@link android.telephony.SubscriptionManager}
     * @return the instance of the SmsManager associated with subId
     */
    public static SmsManager getSmsManagerForSubscriber(long subId) {
    public static SmsManager getSmsManagerForSubscriber(int subId) {
        // TODO(shri): Add javadoc link once SubscriptionManager is made public api
        synchronized(sLockObject) {
            SmsManager smsManager = sSubInstances.get(subId);
@@ -482,7 +482,7 @@ public final class SmsManager {
        }
    }

    private SmsManager(long subId) {
    private SmsManager(int subId) {
        mSubId = subId;
    }

@@ -494,7 +494,7 @@ public final class SmsManager {
     *
     * @return associated subId
     */
    public long getSubId() {
    public int getSubId() {
        if (mSubId == DEFAULT_SUB_ID) {
            return getDefaultSmsSubId();
        }
@@ -855,7 +855,7 @@ public final class SmsManager {
     * @return the default SubId
     * @hide
     */
    public static long getDefaultSmsSubId() {
    public static int getDefaultSmsSubId() {
        return SubscriptionManager.getDefaultSmsSubId();
    }

+3 −3
Original line number Diff line number Diff line
@@ -103,13 +103,13 @@ public class SmsMessage {
     *
     * @hide
     */
    private long mSubId = 0;
    private int mSubId = 0;

    /** set Subscription information
     *
     * @hide
     */
    public void setSubId(long subId) {
    public void setSubId(int subId) {
        mSubId = subId;
    }

@@ -117,7 +117,7 @@ public class SmsMessage {
     *
     * @hide
     */
    public long getSubId() {
    public int getSubId() {
        return mSubId;
    }

+31 −31
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ public final class CallManager {
     * get Phone object corresponds to subId
     * @return Phone
     */
    private Phone getPhone(long subId) {
    private Phone getPhone(int subId) {
        Phone p = null;
        for (Phone phone : mPhones) {
            if (phone.getSubId() == subId && !(phone instanceof ImsPhone)) {
@@ -285,7 +285,7 @@ public final class CallManager {
     * then the phone state is RINGING not OFFHOOK
     *
     */
    public PhoneConstants.State getState(long subId) {
    public PhoneConstants.State getState(int subId) {
        PhoneConstants.State s = PhoneConstants.State.IDLE;

        for (Phone phone : mPhones) {
@@ -338,7 +338,7 @@ public final class CallManager {
    /**
     * @return the Phone service state corresponds to subId
     */
    public int getServiceState(long subId) {
    public int getServiceState(int subId) {
        int resultState = ServiceState.STATE_OUT_OF_SERVICE;

        for (Phone phone : mPhones) {
@@ -381,7 +381,7 @@ public final class CallManager {
        return phone;
    }

    public Phone getPhoneInCall(long subId) {
    public Phone getPhoneInCall(int subId) {
        Phone phone = null;
        if (!getFirstActiveRingingCall(subId).isIdle()) {
            phone = getFirstActiveRingingCall(subId).getPhone();
@@ -474,7 +474,7 @@ public final class CallManager {
     * @return the phone associated with the foreground call
     * of a particular subId
     */
    public Phone getFgPhone(long subId) {
    public Phone getFgPhone(int subId) {
        return getActiveFgCall(subId).getPhone();
    }

@@ -489,7 +489,7 @@ public final class CallManager {
     * @return the phone associated with the background call
     * of a particular subId
     */
    public Phone getBgPhone(long subId) {
    public Phone getBgPhone(int subId) {
        return getFirstActiveBgCall(subId).getPhone();
    }

@@ -504,7 +504,7 @@ public final class CallManager {
     * @return the phone associated with the ringing call
     * of a particular subId
     */
    public Phone getRingingPhone(long subId) {
    public Phone getRingingPhone(int subId) {
        return getFirstActiveRingingCall(subId).getPhone();
    }

@@ -879,7 +879,7 @@ public final class CallManager {
     * to the provided subId.
     * @return true if the phone can conference; false otherwise.
     */
    public boolean canConference(Call heldCall, long subId) {
    public boolean canConference(Call heldCall, int subId) {
        Phone activePhone = null;
        Phone heldPhone = null;

@@ -904,7 +904,7 @@ public final class CallManager {
     * In these cases, this operation may not be performed.
     */
    public void conference(Call heldCall) throws CallStateException {
        long subId  = heldCall.getPhone().getSubId();
        int subId  = heldCall.getPhone().getSubId();

        if (VDBG) {
            Rlog.d(LOG_TAG, "conference(" +heldCall + ")");
@@ -944,7 +944,7 @@ public final class CallManager {
    public Connection dial(Phone phone, String dialString, int videoState)
            throws CallStateException {
        Phone basePhone = getPhoneBase(phone);
        long subId = phone.getSubId();
        int subId = phone.getSubId();
        Connection result;

        if (VDBG) {
@@ -1031,7 +1031,7 @@ public final class CallManager {
     * clear disconnect connection for a phone specific
     * to the provided subId
     */
    public void clearDisconnected(long subId) {
    public void clearDisconnected(int subId) {
        for(Phone phone : mPhones) {
            if (phone.getSubId() == subId) {
                phone.clearDisconnected();
@@ -1050,7 +1050,7 @@ public final class CallManager {
     */
    private boolean canDial(Phone phone) {
        int serviceState = phone.getServiceState().getState();
        long subId = phone.getSubId();
        int subId = phone.getSubId();
        boolean hasRingingCall = hasActiveRingingCall();
        Call.State fgCallState = getActiveFgCallState(subId);

@@ -1097,7 +1097,7 @@ public final class CallManager {
     * in the current phone state--that is, one call holding and one call active.
     * @return true if the phone can do explicit call transfer; false otherwise.
     */
    public boolean canTransfer(Call heldCall, long subId) {
    public boolean canTransfer(Call heldCall, int subId) {
        Phone activePhone = null;
        Phone heldPhone = null;

@@ -1815,7 +1815,7 @@ public final class CallManager {
     * Return true if there is at least one active foreground call
     * on a particular subId or an active sip call
     */
    public boolean hasActiveFgCall(long subId) {
    public boolean hasActiveFgCall(int subId) {
        return (getFirstActiveCall(mForegroundCalls, subId) != null);
    }

@@ -1832,7 +1832,7 @@ public final class CallManager {
     * Return true if there is at least one active background call
     * on a particular subId or an active sip call
     */
    public boolean hasActiveBgCall(long subId) {
    public boolean hasActiveBgCall(int subId) {
        // TODO since hasActiveBgCall may get called often
        // better to cache it to improve performance
        return (getFirstActiveCall(mBackgroundCalls, subId) != null);
@@ -1849,7 +1849,7 @@ public final class CallManager {
    /**
     * Return true if there is at least one active ringing call
     */
    public boolean hasActiveRingingCall(long subId) {
    public boolean hasActiveRingingCall(int subId) {
        return (getFirstActiveCall(mRingingCalls, subId) != null);
    }

@@ -1874,7 +1874,7 @@ public final class CallManager {
        return call;
    }

    public Call getActiveFgCall(long subId) {
    public Call getActiveFgCall(int subId) {
        Call call = getFirstNonIdleCall(mForegroundCalls, subId);
        if (call == null) {
            Phone phone = getPhone(subId);
@@ -1901,7 +1901,7 @@ public final class CallManager {

    // Returns the first call that is not in IDLE state. If both active calls
    // and disconnecting/disconnected calls exist, return the first active call.
    private Call getFirstNonIdleCall(List<Call> calls, long subId) {
    private Call getFirstNonIdleCall(List<Call> calls, int subId) {
        Call result = null;
        for (Call call : calls) {
            if ((call.getPhone().getSubId() == subId) ||
@@ -1953,7 +1953,7 @@ public final class CallManager {
     *
     * Complete background calls list can be get by getBackgroundCalls()
     */
    public Call getFirstActiveBgCall(long subId) {
    public Call getFirstActiveBgCall(int subId) {
        Phone phone = getPhone(subId);
        if (hasMoreThanOneHoldingCall(subId)) {
            return phone.getBackgroundCall();
@@ -1991,7 +1991,7 @@ public final class CallManager {
        return call;
    }

    public Call getFirstActiveRingingCall(long subId) {
    public Call getFirstActiveRingingCall(int subId) {
        Phone phone = getPhone(subId);
        Call call = getFirstNonIdleCall(mRingingCalls, subId);
        if (call == null) {
@@ -2016,7 +2016,7 @@ public final class CallManager {
        return Call.State.IDLE;
    }

    public Call.State getActiveFgCallState(long subId) {
    public Call.State getActiveFgCallState(int subId) {
        Call fgCall = getActiveFgCall(subId);

        if (fgCall != null) {
@@ -2042,7 +2042,7 @@ public final class CallManager {
     * @return the connections of active foreground call
     * return empty list if there is no active foreground call
     */
    public List<Connection> getFgCallConnections(long subId) {
    public List<Connection> getFgCallConnections(int subId) {
        Call fgCall = getActiveFgCall(subId);
        if ( fgCall != null) {
            return fgCall.getConnections();
@@ -2066,7 +2066,7 @@ public final class CallManager {
     * @return the connections of active background call
     * return empty list if there is no active background call
     */
    public List<Connection> getBgCallConnections(long subId) {
    public List<Connection> getBgCallConnections(int subId) {
        Call bgCall = getFirstActiveBgCall(subId);
        if ( bgCall != null) {
            return bgCall.getConnections();
@@ -2090,7 +2090,7 @@ public final class CallManager {
     * @return the latest connection of active foreground call
     * return null if there is no active foreground call
     */
    public Connection getFgCallLatestConnection(long subId) {
    public Connection getFgCallLatestConnection(int subId) {
        Call fgCall = getActiveFgCall(subId);
        if ( fgCall != null) {
            return fgCall.getLatestConnection();
@@ -2108,7 +2108,7 @@ public final class CallManager {
    /**
     * @return true if there is at least one Foreground call in disconnected state
     */
    public boolean hasDisconnectedFgCall(long subId) {
    public boolean hasDisconnectedFgCall(int subId) {
        return (getFirstCallOfState(mForegroundCalls, Call.State.DISCONNECTED,
                subId) != null);
    }
@@ -2123,7 +2123,7 @@ public final class CallManager {
    /**
     * @return true if there is at least one background call in disconnected state
     */
    public boolean hasDisconnectedBgCall(long subId) {
    public boolean hasDisconnectedBgCall(int subId) {
        return (getFirstCallOfState(mBackgroundCalls, Call.State.DISCONNECTED,
                subId) != null);
    }
@@ -2144,7 +2144,7 @@ public final class CallManager {
    /**
     * @return the first active call from a call list
     */
    private  Call getFirstActiveCall(ArrayList<Call> calls, long subId) {
    private  Call getFirstActiveCall(ArrayList<Call> calls, int subId) {
        for (Call call : calls) {
            if ((!call.isIdle()) && ((call.getPhone().getSubId() == subId) ||
                    (call.getPhone() instanceof SipPhone))) {
@@ -2170,7 +2170,7 @@ public final class CallManager {
     * @return the first call in a the Call.state from a call list
     */
    private Call getFirstCallOfState(ArrayList<Call> calls, Call.State state,
            long subId) {
            int subId) {
        for (Call call : calls) {
            if ((call.getState() == state) ||
                ((call.getPhone().getSubId() == subId) ||
@@ -2198,7 +2198,7 @@ public final class CallManager {
     * subId and also active calls on SIP Phone.
     *
     */
    private boolean hasMoreThanOneRingingCall(long subId) {
    private boolean hasMoreThanOneRingingCall(int subId) {
        int count = 0;
        for (Call call : mRingingCalls) {
            if ((call.getState().isRinging()) &&
@@ -2217,7 +2217,7 @@ public final class CallManager {
     * subId and also background calls on SIP Phone.
     *
     */
    private boolean hasMoreThanOneHoldingCall(long subId) {
    private boolean hasMoreThanOneHoldingCall(int subId) {
        int count = 0;
        for (Call call : mBackgroundCalls) {
            if ((call.getState() == Call.State.HOLDING) &&
@@ -2263,7 +2263,7 @@ public final class CallManager {
                case EVENT_NEW_RINGING_CONNECTION:
                    if (VDBG) Rlog.d(LOG_TAG, " handleMessage (EVENT_NEW_RINGING_CONNECTION)");
                    Connection c = (Connection) ((AsyncResult) msg.obj).result;
                    long subId = c.getCall().getPhone().getSubId();
                    int subId = c.getCall().getPhone().getSubId();
                    if (getActiveFgCallState(subId).isDialing() || hasMoreThanOneRingingCall()) {
                        try {
                            Rlog.d(LOG_TAG, "silently drop incoming call: " + c.getCall());
Loading