fix proximity sensor crashes while exiting

This commit is contained in:
Jehan Monnier 2010-03-22 12:03:53 +01:00
parent e8fa8e493c
commit cf93c422b5
3 changed files with 7 additions and 7 deletions

View file

@ -3,9 +3,9 @@
package="org.linphone"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<application android:icon="@drawable/linphone2" android:label="@string/app_name" android:debuggable = "true">
<uses-sdk android:minSdkVersion="3" />
<activity android:name=".LinphoneActivity"
android:label="@string/app_name"

View file

@ -21,9 +21,7 @@ package org.linphone;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.LinphoneCore.GeneralState;
import android.app.Activity;
@ -86,7 +84,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
/**
*
* @return nul if not ready yet
* @return null if not ready yet
*/
public static DialerActivity getDialer() {
if (theDialer == null) {
@ -351,7 +349,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
break;
}
case GSTATE_CALL_ERROR: {
Toast toast = Toast.makeText(this
,String.format(getString(R.string.call_error),lc.getRemoteAddress())
, Toast.LENGTH_LONG);

View file

@ -139,6 +139,9 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
@Override
protected void onDestroy() {
super.onDestroy();
if (isFinishing()) {
if (mSensorManager!=null) mSensorManager.unregisterListener(this);
}
}
@Override
@ -146,8 +149,6 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
// Inflate the currently selected menu XML resource.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.linphone_activity_menu, menu);
return true;
}
@ -207,6 +208,8 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
}
public void onSensorChanged(SensorEvent event) {
if (LinphoneService.isready() == false) return; //nop nothing to do
WindowManager.LayoutParams lAttrs =getWindow().getAttributes();
if (LinphoneService.instance().getLinphoneCore().isIncall() && event.values[0] == 0) {
lAttrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;