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

Commit d3d48f52 authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "Cleanup CallManager code." am: 8de8bf1b

am: ded62ff8

Change-Id: Id26a75911f51e1dc8cd455da9d937f8c7e923c8a
parents 12927056 ded62ff8
Loading
Loading
Loading
Loading
+0 −129
Original line number Diff line number Diff line
@@ -201,14 +201,6 @@ public class CallManager {
        return INSTANCE;
    }

    /**
     * Returns all the registered phone objects.
     * @return all the registered phone objects.
     */
    public List<Phone> getAllPhones() {
        return Collections.unmodifiableList(mPhones);
    }

    /**
     * get Phone object corresponds to subId
     * @return Phone
@@ -346,19 +338,6 @@ public class CallManager {
        return phone;
    }

    public Phone getPhoneInCall(int subId) {
        Phone phone = null;
        if (!getFirstActiveRingingCall(subId).isIdle()) {
            phone = getFirstActiveRingingCall(subId).getPhone();
        } else if (!getActiveFgCall(subId).isIdle()) {
            phone = getActiveFgCall(subId).getPhone();
        } else {
            // If BG call is idle, we return default phone
            phone = getFirstActiveBgCall(subId).getPhone();
        }
        return phone;
    }

    /**
     * Register phone to CallManager
     * @param phone to be registered
@@ -446,14 +425,6 @@ public class CallManager {
        return getFirstActiveBgCall().getPhone();
    }

    /**
     * @return the phone associated with the background call
     * of a particular subId
     */
    public Phone getBgPhone(int subId) {
        return getFirstActiveBgCall(subId).getPhone();
    }

    /**
     * @return the phone associated with the ringing call
     */
@@ -1925,42 +1896,6 @@ public class CallManager {
        return mEmptyConnections;
    }

    /**
     * @return the connections of active background call
     * return empty list if there is no active background call
     */
    public List<Connection> getBgCallConnections(int subId) {
        Call bgCall = getFirstActiveBgCall(subId);
        if ( bgCall != null) {
            return bgCall.getConnections();
        }
        return mEmptyConnections;
    }

    /**
     * @return the latest connection of active foreground call
     * return null if there is no active foreground call
     */
    public Connection getFgCallLatestConnection() {
        Call fgCall = getActiveFgCall();
        if ( fgCall != null) {
            return fgCall.getLatestConnection();
        }
        return null;
    }

    /**
     * @return the latest connection of active foreground call
     * return null if there is no active foreground call
     */
    public Connection getFgCallLatestConnection(int subId) {
        Call fgCall = getActiveFgCall(subId);
        if ( fgCall != null) {
            return fgCall.getLatestConnection();
        }
        return null;
    }

    /**
     * @return true if there is at least one Foreground call in disconnected state
     */
@@ -2092,22 +2027,6 @@ public class CallManager {
        return false;
    }

    /* FIXME Taken from klp-sprout-dev but setAudioMode was removed in L.
    private boolean isServiceStateInService() {
        boolean bInService = false;

        for (Phone phone : mPhones) {
            bInService = (phone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE);
            if (bInService) {
                break;
            }
        }

        if (VDBG) Rlog.d(LOG_TAG, "[isServiceStateInService] bInService = " + bInService);
        return bInService;
    }
    */

    private class CallManagerHandler extends Handler {
        @Override
        public void handleMessage(Message msg) {
@@ -2236,52 +2155,4 @@ public class CallManager {
            }
        }
    };

    @Override
    public String toString() {
        Call call;
        StringBuilder b = new StringBuilder();
        for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) {
            b.append("CallManager {");
            b.append("\nstate = " + getState(i));
            call = getActiveFgCall(i);
            if (call != null) {
                b.append("\n- Foreground: " + getActiveFgCallState(i));
                b.append(" from " + call.getPhone());
                b.append("\n  Conn: ").append(getFgCallConnections(i));
            }
            call = getFirstActiveBgCall(i);
            if (call != null) {
                b.append("\n- Background: " + call.getState());
                b.append(" from " + call.getPhone());
                b.append("\n  Conn: ").append(getBgCallConnections(i));
            }
            call = getFirstActiveRingingCall(i);
            if (call != null) {
                b.append("\n- Ringing: " +call.getState());
                b.append(" from " + call.getPhone());
            }
        }

        for (Phone phone : getAllPhones()) {
            if (phone != null) {
                b.append("\nPhone: " + phone + ", name = " + phone.getPhoneName()
                        + ", state = " + phone.getState());
                call = phone.getForegroundCall();
                if (call != null) {
                    b.append("\n- Foreground: ").append(call);
                }
                call = phone.getBackgroundCall();
                if (call != null) {
                    b.append(" Background: ").append(call);
                }
                call = phone.getRingingCall();
                if (call != null) {
                    b.append(" Ringing: ").append(call);
                }
            }
        }
        b.append("\n}");
        return b.toString();
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -149,7 +149,6 @@ public class SubscriptionController extends ISub.Stub {
    protected static Phone[] sPhones;
    protected Context mContext;
    protected TelephonyManager mTelephonyManager;
    protected CallManager mCM;

    private AppOpsManager mAppOps;

@@ -199,7 +198,6 @@ public class SubscriptionController extends ISub.Stub {

    protected void init(Context c) {
        mContext = c;
        mCM = CallManager.getInstance();
        mTelephonyManager = TelephonyManager.from(mContext);

        mAppOps = (AppOpsManager)mContext.getSystemService(Context.APP_OPS_SERVICE);
@@ -218,7 +216,6 @@ public class SubscriptionController extends ISub.Stub {

    private SubscriptionController(Phone phone) {
        mContext = phone.getContext();
        mCM = CallManager.getInstance();
        mAppOps = mContext.getSystemService(AppOpsManager.class);

        if(ServiceManager.getService("isub") == null) {