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

Commit 3a96b0ee authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Phone refactor

This change is to replace deleteAndCreatePhone() with a simple switch
of RAT in GsmCdmaPhone. It also merges a number of other GSM and
CDMA files (Call, CallTracker, Connection, Phone,
PhoneBookIntefaceManager, CallFailCause), and gets rid of PhoneProxy.

Main pending items:
1. General cleanup of merged code
2. Sanity, regression testing by test team

Bug: 25793157
Change-Id: I08f55b325992fdc0f568d42433507b70b6ceb06d
parent be5b7041
Loading
Loading
Loading
Loading
+78 −0
Original line number Diff line number Diff line
@@ -14,46 +14,65 @@
 * limitations under the License.
 */

package com.android.internal.telephony.gsm;
package com.android.internal.telephony;

/**
 * Call fail causes from TS 24.008 .
 * These are mostly the cause codes we need to distinguish for the UI.
 * See 22.001 Annex F.4 for mapping of cause codes to local tones.
 *
 * CDMA call failure reasons are derived from the possible call failure scenarios described
 * in "CDMA IS2000 - Release A (C.S0005-A v6.0)" standard.
 *
 * {@hide}
 *
 */
public interface CallFailCause {
    // Unassigned/Unobtainable number
    static final int UNOBTAINABLE_NUMBER = 1;
    int UNOBTAINABLE_NUMBER = 1;

    static final int NORMAL_CLEARING     = 16;
    int NORMAL_CLEARING     = 16;
    // Busy Tone
    static final int USER_BUSY           = 17;
    int USER_BUSY           = 17;

    // No Tone
    static final int NUMBER_CHANGED      = 22;
    static final int STATUS_ENQUIRY      = 30;
    static final int NORMAL_UNSPECIFIED  = 31;
    int NUMBER_CHANGED      = 22;
    int STATUS_ENQUIRY      = 30;
    int NORMAL_UNSPECIFIED  = 31;

    // Congestion Tone
    static final int NO_CIRCUIT_AVAIL    = 34;
    static final int TEMPORARY_FAILURE   = 41;
    static final int SWITCHING_CONGESTION    = 42;
    static final int CHANNEL_NOT_AVAIL   = 44;
    static final int QOS_NOT_AVAIL       = 49;
    static final int BEARER_NOT_AVAIL    = 58;
    int NO_CIRCUIT_AVAIL    = 34;
    int TEMPORARY_FAILURE   = 41;
    int SWITCHING_CONGESTION    = 42;
    int CHANNEL_NOT_AVAIL   = 44;
    int QOS_NOT_AVAIL       = 49;
    int BEARER_NOT_AVAIL    = 58;

    // others
    static final int ACM_LIMIT_EXCEEDED = 68;
    static final int CALL_BARRED        = 240;
    static final int FDN_BLOCKED        = 241;
    int ACM_LIMIT_EXCEEDED = 68;
    int CALL_BARRED        = 240;
    int FDN_BLOCKED        = 241;

    // Stk Call Control
    static final int DIAL_MODIFIED_TO_USSD = 244;
    static final int DIAL_MODIFIED_TO_SS = 245;
    static final int DIAL_MODIFIED_TO_DIAL = 246;
    int DIAL_MODIFIED_TO_USSD = 244;
    int DIAL_MODIFIED_TO_SS   = 245;
    int DIAL_MODIFIED_TO_DIAL = 246;

    int CDMA_LOCKED_UNTIL_POWER_CYCLE  = 1000;
    int CDMA_DROP                      = 1001;
    int CDMA_INTERCEPT                 = 1002;
    int CDMA_REORDER                   = 1003;
    int CDMA_SO_REJECT                 = 1004;
    int CDMA_RETRY_ORDER               = 1005;
    int CDMA_ACCESS_FAILURE            = 1006;
    int CDMA_PREEMPTED                 = 1007;

    // For non-emergency number dialed while in emergency callback mode.
    int CDMA_NOT_EMERGENCY             = 1008;

    // Access Blocked by CDMA Network.
    int CDMA_ACCESS_BLOCKED            = 1009;

    int ERROR_UNSPECIFIED = 0xffff;

    static final int ERROR_UNSPECIFIED = 0xffff;
}
+0 −3
Original line number Diff line number Diff line
@@ -212,9 +212,6 @@ public final class CallManager {
     * or the Phone itself if Phone is not a PhoneProxy obj
     */
    private static Phone getPhoneBase(Phone phone) {
        if (phone instanceof PhoneProxy) {
            return phone.getForegroundCall().getPhone();
        }
        return phone;
    }

+33 −45
Original line number Diff line number Diff line
/*
 * Copyright (C) 2006 The Android Open Source Project
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,9 +14,7 @@
 * limitations under the License.
 */

package com.android.internal.telephony.cdma;

import java.util.List;
package com.android.internal.telephony;

import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallStateException;
@@ -24,34 +22,32 @@ import com.android.internal.telephony.Connection;
import com.android.internal.telephony.DriverCall;
import com.android.internal.telephony.Phone;

import java.util.List;

/**
 * {@hide}
 */
public final class CdmaCall extends Call {
public class GsmCdmaCall extends Call {
    /*************************** Instance Variables **************************/

    /*package*/ CdmaCallTracker mOwner;
    /*package*/ GsmCdmaCallTracker mOwner;

    /****************************** Constructors *****************************/
    /*package*/
    CdmaCall (CdmaCallTracker owner) {
    GsmCdmaCall (GsmCdmaCallTracker owner) {
        mOwner = owner;
    }

    public void dispose() {
    }

    /************************** Overridden from Call *************************/

    @Override
    public List<Connection>
    getConnections() {
    public List<Connection> getConnections() {
        // FIXME should return Collections.unmodifiableList();
        return mConnections;
    }

    @Override
    public Phone
    getPhone() {
    public Phone getPhone() {
        return mOwner.mPhone;
    }

@@ -65,47 +61,40 @@ public final class CdmaCall extends Call {
     *  because an AT+CHLD=1 will be sent
     */
    @Override
    public void
    hangup() throws CallStateException {
    public void hangup() throws CallStateException {
        mOwner.hangup(this);
    }

    @Override
    public String
    toString() {
    public String toString() {
        return mState.toString();
    }

    //***** Called from CdmaConnection
    //***** Called from GsmCdmaConnection

    /*package*/ void
    attach(Connection conn, DriverCall dc) {
    /*package*/ void attach(Connection conn, DriverCall dc) {
        mConnections.add(conn);

        mState = stateFromDCState (dc.state);
    }

    /*package*/ void
    attachFake(Connection conn, State state) {
    /*package*/ void attachFake(Connection conn, State state) {
        mConnections.add(conn);

        mState = state;
    }

    /**
     * Called by CdmaConnection when it has disconnected
     * Called by GsmCdmaConnection when it has disconnected
     */
    boolean
    connectionDisconnected(CdmaConnection conn) {
    boolean connectionDisconnected(GsmCdmaConnection conn) {
        if (mState != State.DISCONNECTED) {
            /* If only disconnected connections remain, we are disconnected*/

            boolean hasOnlyDisconnectedConnections = true;

            for (int i = 0, s = mConnections.size(); i < s; i ++) {
                if (mConnections.get(i).getState()
                    != State.DISCONNECTED
                ) {
                if (mConnections.get(i).getState() != State.DISCONNECTED) {
                    hasOnlyDisconnectedConnections = false;
                    break;
                }
@@ -120,9 +109,7 @@ public final class CdmaCall extends Call {
        return false;
    }


    /*package*/ void
    detach(CdmaConnection conn) {
    /*package*/ void detach(GsmCdmaConnection conn) {
        mConnections.remove(conn);

        if (mConnections.size() == 0) {
@@ -130,8 +117,7 @@ public final class CdmaCall extends Call {
        }
    }

    /*package*/ boolean
    update (CdmaConnection conn, DriverCall dc) {
    /*package*/ boolean update (GsmCdmaConnection conn, DriverCall dc) {
        State newState;
        boolean changed = false;

@@ -149,12 +135,15 @@ public final class CdmaCall extends Call {
     * @return true if there's no space in this call for additional
     * connections to be added via "conference"
     */
    /*package*/ boolean
    isFull() {
        return mConnections.size() == CdmaCallTracker.MAX_CONNECTIONS_PER_CALL;
    /*package*/ boolean isFull() {
        if (mOwner.mPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
            return mConnections.size() == GsmCdmaCallTracker.MAX_CONNECTIONS_PER_CALL_GSM;
        } else {
            return mConnections.size() == GsmCdmaCallTracker.MAX_CONNECTIONS_PER_CALL_CDMA;
        }
    }

    //***** Called from CdmaCallTracker
    //***** Called from GsmCdmaCallTracker


    /**
@@ -162,10 +151,9 @@ public final class CdmaCall extends Call {
     * Note that at this point, the hangup request has been dispatched to the radio
     * but no response has yet been received so update() has not yet been called
     */
    void
    onHangupLocal() {
    void onHangupLocal() {
        for (int i = 0, s = mConnections.size(); i < s; i++) {
            CdmaConnection cn = (CdmaConnection)mConnections.get(i);
            GsmCdmaConnection cn = (GsmCdmaConnection)mConnections.get(i);

            cn.onHangupLocal();
        }
@@ -177,7 +165,7 @@ public final class CdmaCall extends Call {
     */
    void clearDisconnected() {
        for (int i = mConnections.size() - 1 ; i >= 0 ; i--) {
        CdmaConnection cn = (CdmaConnection)mConnections.get(i);
            GsmCdmaConnection cn = (GsmCdmaConnection)mConnections.get(i);

            if (cn.getState() == State.DISCONNECTED) {
                mConnections.remove(i);
+631 −289

File changed and moved.File mode changed from 100644 to 100755.

Preview size limit exceeded, changes collapsed.

+341 −191

File changed and moved.File mode changed from 100755 to 100644.

Preview size limit exceeded, changes collapsed.

Loading