Fixed possible ANR when using auto answer
This commit is contained in:
parent
de7a2877c8
commit
9d41dc4026
1 changed files with 5 additions and 7 deletions
|
@ -90,7 +90,7 @@ public class LinphoneManager implements SensorEventListener {
|
|||
private final SensorManager mSensorManager;
|
||||
private final Sensor mProximity;
|
||||
private final MediaScanner mMediaScanner;
|
||||
private Timer mTimer, mAutoAnswerTimer;
|
||||
private Timer mTimer;
|
||||
|
||||
private final LinphonePreferences mPrefs;
|
||||
private Core mCore;
|
||||
|
@ -182,8 +182,8 @@ public class LinphoneManager implements SensorEventListener {
|
|||
} else if (state == State.IncomingReceived
|
||||
&& (LinphonePreferences.instance().isAutoAnswerEnabled())
|
||||
&& !getCallGsmON()) {
|
||||
TimerTask lTask =
|
||||
new TimerTask() {
|
||||
LinphoneUtils.dispatchOnUIThreadAfter(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mCore != null) {
|
||||
|
@ -193,9 +193,8 @@ public class LinphoneManager implements SensorEventListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mAutoAnswerTimer = new Timer("Auto answer");
|
||||
mAutoAnswerTimer.schedule(lTask, mPrefs.getAutoAnswerTime());
|
||||
},
|
||||
mPrefs.getAutoAnswerTime());
|
||||
} else if (state == State.End || state == State.Error) {
|
||||
if (mCore.getCallsNb() == 0) {
|
||||
// Disabling proximity sensor
|
||||
|
@ -391,7 +390,6 @@ public class LinphoneManager implements SensorEventListener {
|
|||
if (mAudioManager != null) mAudioManager.destroy();
|
||||
|
||||
if (mTimer != null) mTimer.cancel();
|
||||
if (mAutoAnswerTimer != null) mAutoAnswerTimer.cancel();
|
||||
|
||||
if (mCore != null) {
|
||||
destroyCore();
|
||||
|
|
Loading…
Reference in a new issue