Search in sources :

Example 1 with GsmCdmaPhone

use of com.android.internal.telephony.GsmCdmaPhone in project packages_services_Telephony by Evolution-X.

the class GsmUmtsCallBarringOptions method updatePWChangeState.

/**
 * Attempt to change the password for call barring settings.
 */
private void updatePWChangeState(boolean positiveResult) {
    if (!positiveResult) {
        // Reset the state on cancel
        resetPwChangeState();
        return;
    }
    // appears with text to indicate what the issue is.
    switch(mPwChangeState) {
        case PW_CHANGE_OLD:
            mOldPassword = mButtonChangePW.getText();
            mButtonChangePW.setText("");
            if (validatePassword(mOldPassword)) {
                mPwChangeState = PW_CHANGE_NEW;
                displayPwChangeDialog();
            } else {
                displayPwChangeDialog(R.string.call_barring_right_pwd_number, true);
            }
            break;
        case PW_CHANGE_NEW:
            mNewPassword = mButtonChangePW.getText();
            mButtonChangePW.setText("");
            if (validatePassword(mNewPassword)) {
                mPwChangeState = PW_CHANGE_REENTER;
                displayPwChangeDialog();
            } else {
                displayPwChangeDialog(R.string.call_barring_right_pwd_number, true);
            }
            break;
        case PW_CHANGE_REENTER:
            // and reset the state.
            if (!mNewPassword.equals(mButtonChangePW.getText())) {
                mPwChangeState = PW_CHANGE_NEW;
                mButtonChangePW.setText("");
                displayPwChangeDialog(R.string.call_barring_pwd_not_match, true);
            } else {
                // If the password is valid, then submit the change password request
                mButtonChangePW.setText("");
                Message onComplete = mHandler.obtainMessage(EVENT_PW_CHANGE_COMPLETE);
                ((GsmCdmaPhone) mPhone).changeCallBarringPassword(CommandsInterface.CB_FACILITY_BA_ALL, mOldPassword, mNewPassword, onComplete);
                this.onStarted(mButtonChangePW, false);
            }
            break;
        default:
            if (DBG) {
                Log.d(LOG_TAG, "updatePWChangeState: Unknown password change state: " + mPwChangeState);
            }
            break;
    }
}
Also used : GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) Message(android.os.Message)

Example 2 with GsmCdmaPhone

use of com.android.internal.telephony.GsmCdmaPhone in project packages_services_Telephony by Evolution-X.

the class TelephonyConnectionService method maybeSendInternationalCallEvent.

/**
 * For outgoing dialed calls, potentially send a ConnectionEvent if the user is on WFC and is
 * dialing an international number.
 * @param telephonyConnection The connection.
 */
private void maybeSendInternationalCallEvent(TelephonyConnection telephonyConnection) {
    if (telephonyConnection == null || telephonyConnection.getPhone() == null || telephonyConnection.getPhone().getDefaultPhone() == null) {
        return;
    }
    Phone phone = telephonyConnection.getPhone().getDefaultPhone();
    if (phone instanceof GsmCdmaPhone) {
        GsmCdmaPhone gsmCdmaPhone = (GsmCdmaPhone) phone;
        if (telephonyConnection.isOutgoingCall() && gsmCdmaPhone.isNotificationOfWfcCallRequired(telephonyConnection.getOriginalConnection().getOrigDialString())) {
            // Send connection event to InCall UI to inform the user of the fact they
            // are potentially placing an international call on WFC.
            Log.i(this, "placeOutgoingConnection - sending international call on WFC " + "confirmation event");
            telephonyConnection.sendTelephonyConnectionEvent(TelephonyManager.EVENT_NOTIFY_INTERNATIONAL_CALL_ON_WFC, null);
        }
    }
}
Also used : GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) ImsPhone(com.android.internal.telephony.imsphone.ImsPhone) Phone(com.android.internal.telephony.Phone)

Example 3 with GsmCdmaPhone

use of com.android.internal.telephony.GsmCdmaPhone in project packages_services_Telephony by Evolution-X.

the class PstnIncomingCallNotifier method maybeSwapWithUnknownConnection.

private boolean maybeSwapWithUnknownConnection(TelephonyConnection telephonyConnection, Connection unknown) {
    Connection original = telephonyConnection.getOriginalConnection();
    if (original != null && !original.isIncoming() && Objects.equals(original.getAddress(), unknown.getAddress())) {
        // to disconnect.
        if (unknown instanceof ImsExternalConnection && !(telephonyConnection.getOriginalConnection() instanceof ImsExternalConnection)) {
            Log.v(this, "maybeSwapWithUnknownConnection - not swapping regular connection " + "with external connection.");
            return false;
        }
        telephonyConnection.setOriginalConnection(unknown);
        // not supported.
        if (original instanceof ImsExternalConnection) {
            return true;
        }
        // call stuck in the call tracker preventing other calls from being placed.
        if (original.getCall() != null && original.getCall().getPhone() != null && original.getCall().getPhone() instanceof GsmCdmaPhone) {
            GsmCdmaPhone phone = (GsmCdmaPhone) original.getCall().getPhone();
            phone.getCallTracker().cleanupCalls();
            Log.i(this, "maybeSwapWithUnknownConnection - Invoking call tracker cleanup " + "for connection: " + original);
        }
        return true;
    }
    return false;
}
Also used : GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) ImsExternalConnection(com.android.internal.telephony.imsphone.ImsExternalConnection) ImsPhoneConnection(com.android.internal.telephony.imsphone.ImsPhoneConnection) ImsExternalConnection(com.android.internal.telephony.imsphone.ImsExternalConnection) Connection(com.android.internal.telephony.Connection)

Example 4 with GsmCdmaPhone

use of com.android.internal.telephony.GsmCdmaPhone in project android_frameworks_opt_telephony by LineageOS.

the class GsmMmiCodeTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp(getClass().getSimpleName());
    doReturn(mExecutor).when(mContext).getMainExecutor();
    mGsmCdmaPhoneUT = new GsmCdmaPhone(mContext, mSimulatedCommands, mNotifier, true, 0, PhoneConstants.PHONE_TYPE_GSM, mTelephonyComponentFactory, (c, p) -> mImsManager);
    setCarrierSupportsCallerIdVerticalServiceCodesCarrierConfig();
}
Also used : Assert.fail(junit.framework.Assert.fail) GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) Executor(java.util.concurrent.Executor) TestableLooper(android.testing.TestableLooper) AndroidTestingRunner(android.testing.AndroidTestingRunner) TelephonyTest(com.android.internal.telephony.TelephonyTest) RunWith(org.junit.runner.RunWith) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) PhoneConstants(com.android.internal.telephony.PhoneConstants) After(org.junit.After) PersistableBundle(android.os.PersistableBundle) CarrierConfigManager(android.telephony.CarrierConfigManager) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) Mockito.doReturn(org.mockito.Mockito.doReturn) Before(org.junit.Before) GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) Before(org.junit.Before)

Example 5 with GsmCdmaPhone

use of com.android.internal.telephony.GsmCdmaPhone in project packages_services_Telephony by Evolution-X.

the class PhoneInterfaceManager method startEmergencyCallbackMode.

/**
 * Start emergency callback mode for GsmCdmaPhone for testing.
 */
@Override
public void startEmergencyCallbackMode() {
    TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(), "startEmergencyCallbackMode");
    enforceModifyPermission();
    final long identity = Binder.clearCallingIdentity();
    try {
        for (Phone phone : PhoneFactory.getPhones()) {
            Rlog.d(LOG_TAG, "startEmergencyCallbackMode phone type: " + phone.getPhoneType());
            if (phone != null && ((phone.getPhoneType() == PHONE_TYPE_GSM) || (phone.getPhoneType() == PHONE_TYPE_CDMA))) {
                GsmCdmaPhone gsmCdmaPhone = (GsmCdmaPhone) phone;
                gsmCdmaPhone.obtainMessage(GsmCdmaPhone.EVENT_EMERGENCY_CALLBACK_MODE_ENTER).sendToTarget();
                Rlog.d(LOG_TAG, "startEmergencyCallbackMode: triggered");
            }
        }
    } finally {
        Binder.restoreCallingIdentity(identity);
    }
}
Also used : GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) GsmCdmaPhone(com.android.internal.telephony.GsmCdmaPhone) ImsPhone(com.android.internal.telephony.imsphone.ImsPhone) Phone(com.android.internal.telephony.Phone)

Aggregations

GsmCdmaPhone (com.android.internal.telephony.GsmCdmaPhone)5 Phone (com.android.internal.telephony.Phone)2 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)2 Message (android.os.Message)1 PersistableBundle (android.os.PersistableBundle)1 CarrierConfigManager (android.telephony.CarrierConfigManager)1 AndroidTestingRunner (android.testing.AndroidTestingRunner)1 TestableLooper (android.testing.TestableLooper)1 Connection (com.android.internal.telephony.Connection)1 PhoneConstants (com.android.internal.telephony.PhoneConstants)1 TelephonyTest (com.android.internal.telephony.TelephonyTest)1 ImsExternalConnection (com.android.internal.telephony.imsphone.ImsExternalConnection)1 ImsPhoneConnection (com.android.internal.telephony.imsphone.ImsPhoneConnection)1 Executor (java.util.concurrent.Executor)1 Assert.fail (junit.framework.Assert.fail)1 After (org.junit.After)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1