Add test to prevent NPE crash
This commit is contained in:
parent
c3654e947f
commit
a0b2feecb2
1 changed files with 17 additions and 9 deletions
|
@ -1034,7 +1034,9 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
return InCallActivity.instance();
|
return InCallActivity.instance();
|
||||||
else if (IncomingCallActivity.isInstanciated())
|
else if (IncomingCallActivity.isInstanciated())
|
||||||
return IncomingCallActivity.instance();
|
return IncomingCallActivity.instance();
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1062,9 +1064,12 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == CallEnd || state == Error) {
|
if (state == CallEnd || state == Error) {
|
||||||
TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
|
Context activity = getActivity();
|
||||||
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
if (activity != null) {
|
||||||
mAudioManager.setMode(MODE_NORMAL);
|
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
||||||
|
mAudioManager.setMode(MODE_NORMAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1432,16 +1437,19 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCallStateChanged(LinphoneCall call, State state,
|
public void onCallStateChanged(LinphoneCall call, State state, String message) {
|
||||||
String message) {
|
|
||||||
if (state == State.OutgoingInit || state == State.IncomingReceived) {
|
if (state == State.OutgoingInit || state == State.IncomingReceived) {
|
||||||
setVideoInitiator(state == State.OutgoingInit);
|
setVideoInitiator(state == State.OutgoingInit);
|
||||||
boolean sendCamera = mLc.getConferenceSize() == 0;
|
boolean sendCamera = mLc.getConferenceSize() == 0;
|
||||||
enableCamera(call, sendCamera);
|
enableCamera(call, sendCamera);
|
||||||
}
|
}
|
||||||
TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
|
|
||||||
if (state == State.CallEnd && mLc.getCallsNb() == 0 && tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
Context activity = getActivity();
|
||||||
routeAudioToReceiver();
|
if (activity != null) {
|
||||||
|
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
if (state == State.CallEnd && mLc.getCallsNb() == 0 && tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
||||||
|
routeAudioToReceiver();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serviceListener != null) serviceListener.onCallStateChanged(call, state, message);
|
if (serviceListener != null) serviceListener.onCallStateChanged(call, state, message);
|
||||||
|
|
Loading…
Reference in a new issue