Search in sources :

Example 1 with PreciseCallState

use of android.telephony.PreciseCallState in project android_frameworks_base by ResurrectionRemix.

the class TelephonyRegistry method notifyPreciseCallState.

public void notifyPreciseCallState(int ringingCallState, int foregroundCallState, int backgroundCallState) {
    if (!checkNotifyPermission("notifyPreciseCallState()")) {
        return;
    }
    synchronized (mRecords) {
        mRingingCallState = ringingCallState;
        mForegroundCallState = foregroundCallState;
        mBackgroundCallState = backgroundCallState;
        mPreciseCallState = new PreciseCallState(ringingCallState, foregroundCallState, backgroundCallState, DisconnectCause.NOT_VALID, PreciseDisconnectCause.NOT_VALID);
        for (Record r : mRecords) {
            if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) {
                try {
                    r.callback.onPreciseCallStateChanged(mPreciseCallState);
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastPreciseCallStateChanged(ringingCallState, foregroundCallState, backgroundCallState, DisconnectCause.NOT_VALID, PreciseDisconnectCause.NOT_VALID);
}
Also used : PreciseCallState(android.telephony.PreciseCallState) RemoteException(android.os.RemoteException)

Example 2 with PreciseCallState

use of android.telephony.PreciseCallState in project android_frameworks_base by DirtyUnicorns.

the class TelephonyRegistry method notifyDisconnectCause.

public void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause) {
    if (!checkNotifyPermission("notifyDisconnectCause()")) {
        return;
    }
    synchronized (mRecords) {
        mPreciseCallState = new PreciseCallState(mRingingCallState, mForegroundCallState, mBackgroundCallState, disconnectCause, preciseDisconnectCause);
        for (Record r : mRecords) {
            if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) {
                try {
                    r.callback.onPreciseCallStateChanged(mPreciseCallState);
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastPreciseCallStateChanged(mRingingCallState, mForegroundCallState, mBackgroundCallState, disconnectCause, preciseDisconnectCause);
}
Also used : PreciseCallState(android.telephony.PreciseCallState) RemoteException(android.os.RemoteException)

Example 3 with PreciseCallState

use of android.telephony.PreciseCallState in project platform_frameworks_base by android.

the class TelephonyRegistry method notifyDisconnectCause.

public void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause) {
    if (!checkNotifyPermission("notifyDisconnectCause()")) {
        return;
    }
    synchronized (mRecords) {
        mPreciseCallState = new PreciseCallState(mRingingCallState, mForegroundCallState, mBackgroundCallState, disconnectCause, preciseDisconnectCause);
        for (Record r : mRecords) {
            if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) {
                try {
                    r.callback.onPreciseCallStateChanged(mPreciseCallState);
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastPreciseCallStateChanged(mRingingCallState, mForegroundCallState, mBackgroundCallState, disconnectCause, preciseDisconnectCause);
}
Also used : PreciseCallState(android.telephony.PreciseCallState) RemoteException(android.os.RemoteException)

Example 4 with PreciseCallState

use of android.telephony.PreciseCallState in project android_frameworks_opt_telephony by LineageOS.

the class CallAttributesTest method testParcelUnparcelPreciseCallState.

@SmallTest
public void testParcelUnparcelPreciseCallState() {
    CallQuality quality = new CallQuality();
    PreciseCallState pcs = new PreciseCallState();
    CallAttributes data = new CallAttributes(pcs, 10, quality);
    Parcel parcel = Parcel.obtain();
    data.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    CallAttributes unparceledData = CallAttributes.CREATOR.createFromParcel(parcel);
    parcel.recycle();
    assertEquals("PreciseCallState is not equal after parceled/unparceled", data.getPreciseCallState(), unparceledData.getPreciseCallState());
}
Also used : PreciseCallState(android.telephony.PreciseCallState) CallQuality(android.telephony.CallQuality) Parcel(android.os.Parcel) CallAttributes(android.telephony.CallAttributes) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 5 with PreciseCallState

use of android.telephony.PreciseCallState in project android_frameworks_opt_telephony by LineageOS.

the class CallAttributesTest method testParcelUnparcelNetworkType.

@SmallTest
public void testParcelUnparcelNetworkType() {
    CallQuality quality = new CallQuality();
    PreciseCallState pcs = new PreciseCallState();
    CallAttributes data = new CallAttributes(pcs, 10, quality);
    Parcel parcel = Parcel.obtain();
    data.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    CallAttributes unparceledData = CallAttributes.CREATOR.createFromParcel(parcel);
    parcel.recycle();
    assertEquals("NetworkType is not equal after parceled/unparceled", data.getNetworkType(), unparceledData.getNetworkType());
}
Also used : PreciseCallState(android.telephony.PreciseCallState) CallQuality(android.telephony.CallQuality) Parcel(android.os.Parcel) CallAttributes(android.telephony.CallAttributes) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

PreciseCallState (android.telephony.PreciseCallState)13 RemoteException (android.os.RemoteException)10 Parcel (android.os.Parcel)3 CallAttributes (android.telephony.CallAttributes)3 CallQuality (android.telephony.CallQuality)3 SmallTest (android.test.suitebuilder.annotation.SmallTest)3