Fix not send expires at 0 on device shutdown if push or background mode enabled
This commit is contained in:
parent
d98ad81dcd
commit
e81757739c
1 changed files with 14 additions and 47 deletions
|
@ -700,53 +700,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized final void destroyLinphoneCore() {
|
|
||||||
sExited = true;
|
|
||||||
ContactsManagerDestroy();
|
|
||||||
BluetoothManagerDestroy();
|
|
||||||
try {
|
|
||||||
mTimer.cancel();
|
|
||||||
mLc.destroy();
|
|
||||||
}
|
|
||||||
catch (RuntimeException e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
try {
|
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
|
|
||||||
mServiceContext.unregisterReceiver(mNetworkReceiver);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
mServiceContext.unregisterReceiver(mHookReceiver);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
mServiceContext.unregisterReceiver(mCallReceiver);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
dozeManager(false);
|
|
||||||
} catch (IllegalArgumentException iae) {
|
|
||||||
Log.e(iae);
|
|
||||||
}catch (Exception e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
mLc = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void restartLinphoneCore() {
|
public void restartLinphoneCore() {
|
||||||
destroyLinphoneCore();
|
doDestroy();
|
||||||
startLibLinphone(mServiceContext);
|
startLibLinphone(mServiceContext);
|
||||||
sExited = false;
|
sExited = false;
|
||||||
}
|
}
|
||||||
|
@ -1050,13 +1006,24 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void destroyLinphoneCore() {
|
||||||
|
if (LinphonePreferences.instance() != null) {
|
||||||
|
// We set network reachable at false before destroy LC to not send register with expires at 0
|
||||||
|
if (LinphonePreferences.instance().isPushNotificationEnabled()
|
||||||
|
|| LinphonePreferences.instance().isBackgroundModeEnabled()) {
|
||||||
|
mLc.setNetworkReachable(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mLc = null;
|
||||||
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
private void doDestroy() {
|
private void doDestroy() {
|
||||||
ContactsManagerDestroy();
|
ContactsManagerDestroy();
|
||||||
BluetoothManagerDestroy();
|
BluetoothManagerDestroy();
|
||||||
try {
|
try {
|
||||||
mTimer.cancel();
|
mTimer.cancel();
|
||||||
mLc.destroy();
|
destroyLinphoneCore();
|
||||||
}
|
}
|
||||||
catch (RuntimeException e) {
|
catch (RuntimeException e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
|
|
Loading…
Reference in a new issue