fix crashes with call quality indicator
This commit is contained in:
parent
0e724b843d
commit
efe00e9911
1 changed files with 24 additions and 25 deletions
|
@ -56,9 +56,9 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
private Handler refreshHandler = new Handler();
|
private Handler refreshHandler = new Handler();
|
||||||
|
|
||||||
AndroidVideoWindowImpl androidVideoWindowImpl;
|
AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||||
|
private Runnable mCallQualityUpdater;
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
launched = true;
|
|
||||||
Log.d("onCreate VideoCallActivity");
|
Log.d("onCreate VideoCallActivity");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.videocall);
|
setContentView(R.layout.videocall);
|
||||||
|
@ -119,28 +119,6 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
|
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
|
|
||||||
Runnable runnable = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
while (launched && LinphoneManager.getLc().isIncall())
|
|
||||||
{
|
|
||||||
refreshHandler.post(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
int oldQuality = 0;
|
|
||||||
float newQuality = LinphoneManager.getLc().getCurrentCall().getCurrentQuality();
|
|
||||||
if ((int) newQuality != oldQuality)
|
|
||||||
updateQualityOfSignalIcon(newQuality);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
new Thread(runnable).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateQualityOfSignalIcon(float quality)
|
void updateQualityOfSignalIcon(float quality)
|
||||||
|
@ -191,6 +169,24 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (mVideoViewReady != null)
|
if (mVideoViewReady != null)
|
||||||
((GLSurfaceView)mVideoViewReady).onResume();
|
((GLSurfaceView)mVideoViewReady).onResume();
|
||||||
|
launched=true;
|
||||||
|
refreshHandler.postDelayed(mCallQualityUpdater=new Runnable(){
|
||||||
|
LinphoneCall mCurrentCall=LinphoneManager.getLc().getCurrentCall();
|
||||||
|
public void run() {
|
||||||
|
if (mCurrentCall==null){
|
||||||
|
mCallQualityUpdater=null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int oldQuality = 0;
|
||||||
|
float newQuality = mCurrentCall.getCurrentQuality();
|
||||||
|
if ((int) newQuality != oldQuality){
|
||||||
|
updateQualityOfSignalIcon(newQuality);
|
||||||
|
}
|
||||||
|
if (launched){
|
||||||
|
refreshHandler.postDelayed(this, 1000);
|
||||||
|
}else mCallQualityUpdater=null;
|
||||||
|
}
|
||||||
|
},1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,13 +271,13 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
androidVideoWindowImpl.release();
|
androidVideoWindowImpl.release();
|
||||||
launched = false;
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
Log.d("onPause VideoCallActivity");
|
Log.d("onPause VideoCallActivity");
|
||||||
|
launched=false;
|
||||||
LinphoneManager.getLc().setVideoWindow(null);
|
LinphoneManager.getLc().setVideoWindow(null);
|
||||||
LinphoneManager.getLc().setPreviewWindow(null);
|
LinphoneManager.getLc().setPreviewWindow(null);
|
||||||
|
|
||||||
|
@ -294,7 +290,10 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
LinphoneManager.getLc().updateCall(LinphoneManager.getLc().getCurrentCall(), null);
|
LinphoneManager.getLc().updateCall(LinphoneManager.getLc().getCurrentCall(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mCallQualityUpdater!=null){
|
||||||
|
refreshHandler.removeCallbacks(mCallQualityUpdater);
|
||||||
|
mCallQualityUpdater=null;
|
||||||
|
}
|
||||||
|
|
||||||
if (mWakeLock.isHeld()) mWakeLock.release();
|
if (mWakeLock.isHeld()) mWakeLock.release();
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
Loading…
Reference in a new issue