Index: pjproject/trunk/pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2/app/CallActivity.java
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2/app/CallActivity.java	(revision 5014)
+++ pjproject/trunk/pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2/app/CallActivity.java	(revision 5017)
@@ -32,165 +32,178 @@
 
 public class CallActivity extends Activity
-	implements Handler.Callback, SurfaceHolder.Callback
+			  implements Handler.Callback, SurfaceHolder.Callback
 {
-	
-	public static Handler handler_;
-
-	private final Handler handler = new Handler(this);
-	private static CallInfo lastCallInfo;
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_call);
-		
-		SurfaceView surfaceView = (SurfaceView)findViewById(R.id.surfaceIncomingVideo);
-		if (MainActivity.currentCall == null ||
-			MainActivity.currentCall.vidWin == null)
-		{
-			surfaceView.setVisibility(View.GONE);
-		}
-		surfaceView.getHolder().addCallback(this);
-		
-		handler_ = handler;
-		if (MainActivity.currentCall != null) {
-			try {
-				lastCallInfo = MainActivity.currentCall.getInfo();
-				updateCallState(lastCallInfo);
-			} catch (Exception e) {
-				System.out.println(e);
-			}
-		} else {
-			updateCallState(lastCallInfo);
-		}
-	}
+
+    public static Handler handler_;
+
+    private final Handler handler = new Handler(this);
+    private static CallInfo lastCallInfo;
 
     @Override
-    protected void onDestroy() {
-    	super.onDestroy();
-    	handler_ = null;
-    }
-
-    private void updateVideoWindow(SurfaceHolder holder) {
-		if (MainActivity.currentCall != null &&
-			MainActivity.currentCall.vidWin != null)
-		{
-			VideoWindowHandle vidWH = new VideoWindowHandle();
-			if (holder == null)
-				vidWH.getHandle().setWindow(null);
-			else
-			    	vidWH.getHandle().setWindow(holder.getSurface());
-			try {
-				MainActivity.currentCall.vidWin.setWindow(vidWH);
-			} catch (Exception e) {}
-		}
-    }
-    
-	public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
-		updateVideoWindow(holder);
-    }
-
-    public void surfaceCreated(SurfaceHolder holder) {
-    }
-
-    public void surfaceDestroyed(SurfaceHolder holder) {
-    	updateVideoWindow(null);
-    }
-    
-	public void acceptCall(View view) {
-		CallOpParam prm = new CallOpParam();
-		prm.setStatusCode(pjsip_status_code.PJSIP_SC_OK);
-		try {
-			MainActivity.currentCall.answer(prm);
-		} catch (Exception e) {
-			System.out.println(e);
-		}
-		
-		view.setVisibility(View.GONE);
-	}
-
-	public void hangupCall(View view) {
-		handler_ = null;
-		finish();
-		
-		if (MainActivity.currentCall != null) {
-			CallOpParam prm = new CallOpParam();
-			prm.setStatusCode(pjsip_status_code.PJSIP_SC_DECLINE);
-			try {
-				MainActivity.currentCall.hangup(prm);
-			} catch (Exception e) {
-				System.out.println(e);
-			}
-		}
-	}
-	
-	private void setupVideoSurface() {
-
-		SurfaceView surfaceView = (SurfaceView)findViewById(R.id.surfaceIncomingVideo);
-		surfaceView.setVisibility(View.VISIBLE);
-		updateVideoWindow(surfaceView.getHolder());
-		
-	}
-	
-	@Override
-	public boolean handleMessage(Message m) {
-		
-		if (m.what == MainActivity.MSG_TYPE.CALL_STATE) {
-			
-			lastCallInfo = (CallInfo) m.obj;
-			updateCallState(lastCallInfo);
-			
-		} else if (m.what == MainActivity.MSG_TYPE.CALL_MEDIA_STATE) {
-			
-			if (MainActivity.currentCall.vidWin != null) {
-				/* If there's incoming video, display it. */
-				setupVideoSurface();
-			}
-
-		} else {
-			
-			/* Message not handled */
-			return false;
-			
-		}
-			
-		return true;
-	}
-	
-	private void updateCallState(CallInfo ci) {
-		TextView tvPeer  = (TextView) findViewById(R.id.textViewPeer);
-		TextView tvState = (TextView) findViewById(R.id.textViewCallState);
-		Button buttonHangup = (Button) findViewById(R.id.buttonHangup);
-		Button buttonAccept = (Button) findViewById(R.id.buttonAccept);
-		String call_state = "";
-		
-		if (ci.getRole() == pjsip_role_e.PJSIP_ROLE_UAC) {
-			buttonAccept.setVisibility(View.GONE);
-		}
-				
-		if (ci.getState().swigValue() < pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue())
-		{
-			if (ci.getRole() == pjsip_role_e.PJSIP_ROLE_UAS) {
-				call_state = "Incoming call..";
-				/* Default button texts are already 'Accept' & 'Reject' */
-			} else {
-				buttonHangup.setText("Cancel");
-				call_state = ci.getStateText();
-			}
-		}
-		else if (ci.getState().swigValue() >= pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue())
-		{
-			buttonAccept.setVisibility(View.GONE);
-			call_state = ci.getStateText();
-			if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED) {
-				buttonHangup.setText("Hangup");
-			} else if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) {
-				buttonHangup.setText("OK");
-				call_state = "Call disconnected: " + ci.getLastReason();
-			}
-		}
-		
-		tvPeer.setText(ci.getRemoteUri());
-		tvState.setText(call_state);
-	}
+    protected void onCreate(Bundle savedInstanceState)
+    {
+	super.onCreate(savedInstanceState);
+	setContentView(R.layout.activity_call);
+
+	SurfaceView surfaceView = (SurfaceView)
+				  findViewById(R.id.surfaceIncomingVideo);
+	if (MainActivity.currentCall == null ||
+	    MainActivity.currentCall.vidWin == null)
+	{
+	    surfaceView.setVisibility(View.GONE);
+	}
+	surfaceView.getHolder().addCallback(this);
+
+	handler_ = handler;
+	if (MainActivity.currentCall != null) {
+	    try {
+		lastCallInfo = MainActivity.currentCall.getInfo();
+		updateCallState(lastCallInfo);
+	    } catch (Exception e) {
+		System.out.println(e);
+	    }
+	} else {
+	    updateCallState(lastCallInfo);
+	}
+    }
+
+    @Override
+    protected void onDestroy()
+    {
+	super.onDestroy();
+	handler_ = null;
+    }
+
+    private void updateVideoWindow(SurfaceHolder holder)
+    {
+	if (MainActivity.currentCall != null &&
+	    MainActivity.currentCall.vidWin != null)
+	{
+	    VideoWindowHandle vidWH = new VideoWindowHandle();
+	    if (holder == null)
+		vidWH.getHandle().setWindow(null);
+	    else
+		vidWH.getHandle().setWindow(holder.getSurface());
+	    try {
+		MainActivity.currentCall.vidWin.setWindow(vidWH);
+	    } catch (Exception e) {}
+	}
+    }
+
+    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h)
+    {
+	updateVideoWindow(holder);
+    }
+
+    public void surfaceCreated(SurfaceHolder holder)
+    {
+    }
+
+    public void surfaceDestroyed(SurfaceHolder holder)
+    {
+	updateVideoWindow(null);
+    }
+
+    public void acceptCall(View view)
+    {
+	CallOpParam prm = new CallOpParam();
+	prm.setStatusCode(pjsip_status_code.PJSIP_SC_OK);
+	try {
+	    MainActivity.currentCall.answer(prm);
+	} catch (Exception e) {
+	    System.out.println(e);
+	}
+
+	view.setVisibility(View.GONE);
+    }
+
+    public void hangupCall(View view)
+    {
+	handler_ = null;
+	finish();
+
+	if (MainActivity.currentCall != null) {
+	    CallOpParam prm = new CallOpParam();
+	    prm.setStatusCode(pjsip_status_code.PJSIP_SC_DECLINE);
+	    try {
+		MainActivity.currentCall.hangup(prm);
+	    } catch (Exception e) {
+		System.out.println(e);
+	    }
+	}
+    }
+
+    private void setupVideoSurface()
+    {
+	SurfaceView surfaceView = (SurfaceView)
+				  findViewById(R.id.surfaceIncomingVideo);
+	surfaceView.setVisibility(View.VISIBLE);
+	updateVideoWindow(surfaceView.getHolder());
+    }
+
+    @Override
+    public boolean handleMessage(Message m)
+    {
+	if (m.what == MainActivity.MSG_TYPE.CALL_STATE) {
+
+	    lastCallInfo = (CallInfo) m.obj;
+	    updateCallState(lastCallInfo);
+
+	} else if (m.what == MainActivity.MSG_TYPE.CALL_MEDIA_STATE) {
+
+	    if (MainActivity.currentCall.vidWin != null) {
+		/* If there's incoming video, display it. */
+		setupVideoSurface();
+	    }
+
+	} else {
+
+	    /* Message not handled */
+	    return false;
+
+	}
+
+	return true;
+    }
+
+    private void updateCallState(CallInfo ci) {
+	TextView tvPeer  = (TextView) findViewById(R.id.textViewPeer);
+	TextView tvState = (TextView) findViewById(R.id.textViewCallState);
+	Button buttonHangup = (Button) findViewById(R.id.buttonHangup);
+	Button buttonAccept = (Button) findViewById(R.id.buttonAccept);
+	String call_state = "";
+
+	if (ci.getRole() == pjsip_role_e.PJSIP_ROLE_UAC) {
+	    buttonAccept.setVisibility(View.GONE);
+	}
+
+	if (ci.getState().swigValue() <
+	    pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue())
+	{
+	    if (ci.getRole() == pjsip_role_e.PJSIP_ROLE_UAS) {
+		call_state = "Incoming call..";
+		/* Default button texts are already 'Accept' & 'Reject' */
+	    } else {
+		buttonHangup.setText("Cancel");
+		call_state = ci.getStateText();
+	    }
+	}
+	else if (ci.getState().swigValue() >=
+		 pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue())
+	{
+	    buttonAccept.setVisibility(View.GONE);
+	    call_state = ci.getStateText();
+	    if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED) {
+		buttonHangup.setText("Hangup");
+	    } else if (ci.getState() ==
+		       pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED)
+	    {
+		buttonHangup.setText("OK");
+		call_state = "Call disconnected: " + ci.getLastReason();
+	    }
+	}
+
+	tvPeer.setText(ci.getRemoteUri());
+	tvState.setText(call_state);
+    }
 }
