Fixed crashes
This commit is contained in:
parent
cd1606643a
commit
1b4dd6240b
15 changed files with 54 additions and 7 deletions
|
@ -401,8 +401,11 @@ public class LinphoneManager implements SensorEventListener {
|
|||
}
|
||||
|
||||
public synchronized void destroy() {
|
||||
mExited = true;
|
||||
destroyManager();
|
||||
// Wait for Manager to destroy everything before setting mExited to true
|
||||
// Otherwise some objects might crash during their own destroy if they try to call
|
||||
// LinphoneManager.getCore(), for example to unregister a listener
|
||||
mExited = true;
|
||||
}
|
||||
|
||||
public void restartCore() {
|
||||
|
|
|
@ -256,15 +256,18 @@ public final class LinphoneService extends Service {
|
|||
core = null; // To allow the gc calls below to free the Core
|
||||
}
|
||||
|
||||
mLinphoneManager.destroy();
|
||||
sInstance = null;
|
||||
|
||||
// Make sure our notification is gone.
|
||||
if (mNotificationManager != null) {
|
||||
mNotificationManager.destroy();
|
||||
}
|
||||
mContactsManager.destroy();
|
||||
|
||||
// Destroy the LinphoneManager second to last to ensure any getCore() call will work
|
||||
mLinphoneManager.destroy();
|
||||
|
||||
// Wait for every other object to be destroyed to make LinphoneService.instance() invalid
|
||||
sInstance = null;
|
||||
|
||||
if (LinphonePreferences.instance().useJavaLogger()) {
|
||||
Factory.instance().getLoggingService().removeListener(mJavaLoggingService);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,9 @@ public class AccountConnectionAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_account_connection);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.linphone.LinphoneManager;
|
|||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.activities.DialerActivity;
|
||||
import org.linphone.activities.ThemeableActivity;
|
||||
import org.linphone.activities.LinphoneGenericActivity;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.DialPlan;
|
||||
|
@ -40,7 +40,7 @@ import org.linphone.core.ProxyConfig;
|
|||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.settings.LinphonePreferences;
|
||||
|
||||
public abstract class AssistantActivity extends ThemeableActivity
|
||||
public abstract class AssistantActivity extends LinphoneGenericActivity
|
||||
implements CountryPicker.CountryPickedListener {
|
||||
static AccountCreator mAccountCreator;
|
||||
|
||||
|
@ -52,6 +52,9 @@ public abstract class AssistantActivity extends ThemeableActivity
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccountCreator == null) {
|
||||
String url = LinphonePreferences.instance().getXmlrpcUrl();
|
||||
|
|
|
@ -44,6 +44,9 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_email_account_creation);
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@ public class EmailAccountValidationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_email_account_validation);
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ public class GenericConnectionAssistantActivity extends AssistantActivity implem
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_generic_connection);
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ public class MenuAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_menu);
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ public class OpenH264DownloadAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_openh264_codec_download);
|
||||
mHelper = Factory.instance().createOpenH264DownloadHelper(this);
|
||||
|
|
|
@ -43,6 +43,9 @@ public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_phone_account_creation);
|
||||
|
||||
|
|
|
@ -49,6 +49,9 @@ public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_phone_account_linking);
|
||||
|
||||
|
|
|
@ -46,6 +46,9 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_phone_account_validation);
|
||||
|
||||
|
|
|
@ -38,6 +38,9 @@ public class QrCodeConfigurationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_qr_code_remote_configuration);
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ public class RemoteConfigurationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.assistant_remote_configuration);
|
||||
|
||||
|
|
|
@ -48,7 +48,12 @@ public class DeviceOrientationEventListener extends OrientationEventListener {
|
|||
return;
|
||||
}
|
||||
mAlwaysChangingPhoneAngle = degrees;
|
||||
Log.i("[Orientation Helper] Device orientation changed to " + degrees);
|
||||
Log.i(
|
||||
"[Orientation Helper] Device orientation changed to "
|
||||
+ degrees
|
||||
+ " (raw value is "
|
||||
+ orientation
|
||||
+ ")");
|
||||
|
||||
int rotation = (360 - degrees) % 360;
|
||||
Core core = LinphoneManager.getCore();
|
||||
|
|
Loading…
Reference in a new issue