Fixed style issues from lint and got rid of unused fields.
BUG= R=jiayl@webrtc.org Review URL: https://webrtc-codereview.appspot.com/41379004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7995 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -106,7 +106,7 @@ public interface AppRTCClient {
|
|||||||
/**
|
/**
|
||||||
* Callback interface for messages delivered on signaling channel.
|
* Callback interface for messages delivered on signaling channel.
|
||||||
*
|
*
|
||||||
* Methods are guaranteed to be invoked on the UI thread of |activity|.
|
* <p>Methods are guaranteed to be invoked on the UI thread of |activity|.
|
||||||
*/
|
*/
|
||||||
public static interface SignalingEvents {
|
public static interface SignalingEvents {
|
||||||
/**
|
/**
|
||||||
|
@@ -54,11 +54,9 @@ public class AppRTCProximitySensor implements SensorEventListener {
|
|||||||
// the case. Only active when |DEBUG| is set to true.
|
// the case. Only active when |DEBUG| is set to true.
|
||||||
private final NonThreadSafe nonThreadSafe = new AppRTCUtils.NonThreadSafe();
|
private final NonThreadSafe nonThreadSafe = new AppRTCUtils.NonThreadSafe();
|
||||||
|
|
||||||
private final Context apprtcContext;
|
|
||||||
private final Runnable onSensorStateListener;
|
private final Runnable onSensorStateListener;
|
||||||
private final SensorManager sensorManager;
|
private final SensorManager sensorManager;
|
||||||
private Sensor proximitySensor = null;
|
private Sensor proximitySensor = null;
|
||||||
private boolean initialized = false;
|
|
||||||
private boolean lastStateReportIsNear = false;
|
private boolean lastStateReportIsNear = false;
|
||||||
|
|
||||||
/** Construction */
|
/** Construction */
|
||||||
@@ -69,7 +67,6 @@ public class AppRTCProximitySensor implements SensorEventListener {
|
|||||||
|
|
||||||
private AppRTCProximitySensor(Context context, Runnable sensorStateListener) {
|
private AppRTCProximitySensor(Context context, Runnable sensorStateListener) {
|
||||||
Log.d(TAG, "AppRTCProximitySensor" + AppRTCUtils.getThreadInfo());
|
Log.d(TAG, "AppRTCProximitySensor" + AppRTCUtils.getThreadInfo());
|
||||||
apprtcContext = context;
|
|
||||||
onSensorStateListener = sensorStateListener;
|
onSensorStateListener = sensorStateListener;
|
||||||
sensorManager = ((SensorManager) context.getSystemService(
|
sensorManager = ((SensorManager) context.getSystemService(
|
||||||
Context.SENSOR_SERVICE));
|
Context.SENSOR_SERVICE));
|
||||||
@@ -161,8 +158,9 @@ public class AppRTCProximitySensor implements SensorEventListener {
|
|||||||
|
|
||||||
/** Helper method for logging information about the proximity sensor. */
|
/** Helper method for logging information about the proximity sensor. */
|
||||||
private void logProximitySensorInfo() {
|
private void logProximitySensorInfo() {
|
||||||
if (proximitySensor == null)
|
if (proximitySensor == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Log.d(TAG, "Proximity sensor: " + "name=" + proximitySensor.getName()
|
Log.d(TAG, "Proximity sensor: " + "name=" + proximitySensor.getName()
|
||||||
+ ", vendor: " + proximitySensor.getVendor()
|
+ ", vendor: " + proximitySensor.getVendor()
|
||||||
+ ", type: " + proximitySensor.getStringType()
|
+ ", type: " + proximitySensor.getStringType()
|
||||||
|
@@ -46,8 +46,10 @@ import java.net.URLConnection;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
// AsyncTask that converts an AppRTC room URL into the set of signaling
|
/**
|
||||||
// parameters to use with that room.
|
* AsyncTask that converts an AppRTC room URL into the set of signaling
|
||||||
|
* parameters to use with that room.
|
||||||
|
*/
|
||||||
public class RoomParametersFetcher
|
public class RoomParametersFetcher
|
||||||
extends AsyncTask<String, Void, SignalingParameters> {
|
extends AsyncTask<String, Void, SignalingParameters> {
|
||||||
private static final String TAG = "RoomRTCClient";
|
private static final String TAG = "RoomRTCClient";
|
||||||
|
@@ -136,7 +136,7 @@ public class WebSocketChannelClient {
|
|||||||
ws.sendTextMessage(json.toString());
|
ws.sendTextMessage(json.toString());
|
||||||
state = WebSocketConnectionState.REGISTERED;
|
state = WebSocketConnectionState.REGISTERED;
|
||||||
// Send any previously accumulated messages.
|
// Send any previously accumulated messages.
|
||||||
synchronized(wsSendQueue) {
|
synchronized (wsSendQueue) {
|
||||||
for (String sendMessage : wsSendQueue) {
|
for (String sendMessage : wsSendQueue) {
|
||||||
send(sendMessage);
|
send(sendMessage);
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ public class WebSocketChannelClient {
|
|||||||
// Store outgoing messages and send them after websocket client
|
// Store outgoing messages and send them after websocket client
|
||||||
// is registered.
|
// is registered.
|
||||||
Log.d(TAG, "WS ACC: " + message);
|
Log.d(TAG, "WS ACC: " + message);
|
||||||
synchronized(wsSendQueue) {
|
synchronized (wsSendQueue) {
|
||||||
wsSendQueue.add(message);
|
wsSendQueue.add(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -194,8 +194,8 @@ public class WebSocketChannelClient {
|
|||||||
state = WebSocketConnectionState.CONNECTED;
|
state = WebSocketConnectionState.CONNECTED;
|
||||||
}
|
}
|
||||||
// Close WebSocket in CONNECTED or ERROR states only.
|
// Close WebSocket in CONNECTED or ERROR states only.
|
||||||
if (state == WebSocketConnectionState.CONNECTED ||
|
if (state == WebSocketConnectionState.CONNECTED
|
||||||
state == WebSocketConnectionState.ERROR) {
|
|| state == WebSocketConnectionState.ERROR) {
|
||||||
ws.disconnect();
|
ws.disconnect();
|
||||||
|
|
||||||
// Send DELETE to http WebSocket server.
|
// Send DELETE to http WebSocket server.
|
||||||
@@ -244,8 +244,8 @@ public class WebSocketChannelClient {
|
|||||||
try {
|
try {
|
||||||
// Send POST or DELETE request.
|
// Send POST or DELETE request.
|
||||||
String postUrl = postServerUrl + "/" + roomID + "/" + clientID;
|
String postUrl = postServerUrl + "/" + roomID + "/" + clientID;
|
||||||
Log.d(TAG, "WS " + wsHttpMessage.method + " : " + postUrl + " : " +
|
Log.d(TAG, "WS " + wsHttpMessage.method + " : " + postUrl + " : "
|
||||||
wsHttpMessage.message);
|
+ wsHttpMessage.message);
|
||||||
HttpURLConnection connection =
|
HttpURLConnection connection =
|
||||||
(HttpURLConnection) new URL(postUrl).openConnection();
|
(HttpURLConnection) new URL(postUrl).openConnection();
|
||||||
connection.setRequestProperty(
|
connection.setRequestProperty(
|
||||||
@@ -258,8 +258,8 @@ public class WebSocketChannelClient {
|
|||||||
}
|
}
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
if (responseCode != 200) {
|
if (responseCode != 200) {
|
||||||
reportError("Non-200 response to " + wsHttpMessage.method + " : " +
|
reportError("Non-200 response to " + wsHttpMessage.method + " : "
|
||||||
connection.getHeaderField(null));
|
+ connection.getHeaderField(null));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
reportError("WS POST error: " + e.getMessage());
|
reportError("WS POST error: " + e.getMessage());
|
||||||
@@ -280,8 +280,8 @@ public class WebSocketChannelClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(WebSocketCloseNotification code, String reason) {
|
public void onClose(WebSocketCloseNotification code, String reason) {
|
||||||
Log.d(TAG, "WebSocket connection closed. Code: " + code +
|
Log.d(TAG, "WebSocket connection closed. Code: " + code
|
||||||
". Reason: " + reason);
|
+ ". Reason: " + reason);
|
||||||
uiHandler.post(new Runnable() {
|
uiHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (state != WebSocketConnectionState.CLOSED) {
|
if (state != WebSocketConnectionState.CLOSED) {
|
||||||
@@ -298,8 +298,8 @@ public class WebSocketChannelClient {
|
|||||||
final String message = payload;
|
final String message = payload;
|
||||||
uiHandler.post(new Runnable() {
|
uiHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (state == WebSocketConnectionState.CONNECTED ||
|
if (state == WebSocketConnectionState.CONNECTED
|
||||||
state == WebSocketConnectionState.REGISTERED) {
|
|| state == WebSocketConnectionState.REGISTERED) {
|
||||||
events.onWebSocketMessage(message);
|
events.onWebSocketMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ import org.webrtc.SessionDescription;
|
|||||||
* Negotiates signaling for chatting with apprtc.appspot.com "rooms".
|
* Negotiates signaling for chatting with apprtc.appspot.com "rooms".
|
||||||
* Uses the client<->server specifics of the apprtc AppEngine webapp.
|
* Uses the client<->server specifics of the apprtc AppEngine webapp.
|
||||||
*
|
*
|
||||||
* To use: create an instance of this object (registering a message handler) and
|
* <p>To use: create an instance of this object (registering a message handler) and
|
||||||
* call connectToRoom(). Once room connection is established
|
* call connectToRoom(). Once room connection is established
|
||||||
* onConnectedToRoom() callback with room parameters is invoked.
|
* onConnectedToRoom() callback with room parameters is invoked.
|
||||||
* Messages to other party (with local Ice candidates and answer SDP) can
|
* Messages to other party (with local Ice candidates and answer SDP) can
|
||||||
@@ -94,10 +94,10 @@ public class WebSocketRTCClient implements AppRTCClient,
|
|||||||
Log.w(TAG, "No offer SDP in room response.");
|
Log.w(TAG, "No offer SDP in room response.");
|
||||||
}
|
}
|
||||||
initiator = params.initiator;
|
initiator = params.initiator;
|
||||||
postMessageUrl = params.roomUrl + "/message/" +
|
postMessageUrl = params.roomUrl + "/message/"
|
||||||
params.roomId + "/" + params.clientId;
|
+ params.roomId + "/" + params.clientId;
|
||||||
byeMessageUrl = params.roomUrl + "/bye/" +
|
byeMessageUrl = params.roomUrl + "/bye/"
|
||||||
params.roomId + "/" + params.clientId;
|
+ params.roomId + "/" + params.clientId;
|
||||||
roomState = ConnectionState.CONNECTED;
|
roomState = ConnectionState.CONNECTED;
|
||||||
|
|
||||||
// Connect to WebSocket server.
|
// Connect to WebSocket server.
|
||||||
@@ -176,8 +176,7 @@ public class WebSocketRTCClient implements AppRTCClient,
|
|||||||
} else {
|
} else {
|
||||||
reportError("Unexpected WebSocket message: " + msg);
|
reportError("Unexpected WebSocket message: " + msg);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (errorText != null && errorText.length() > 0) {
|
if (errorText != null && errorText.length() > 0) {
|
||||||
reportError("WebSocket error message: " + errorText);
|
reportError("WebSocket error message: " + errorText);
|
||||||
} else {
|
} else {
|
||||||
@@ -370,8 +369,8 @@ public class WebSocketRTCClient implements AppRTCClient,
|
|||||||
// Get response.
|
// Get response.
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
if (responseCode != 200) {
|
if (responseCode != 200) {
|
||||||
reportError("Non-200 response to POST: " +
|
reportError("Non-200 response to POST: "
|
||||||
connection.getHeaderField(null));
|
+ connection.getHeaderField(null));
|
||||||
}
|
}
|
||||||
InputStream responseStream = connection.getInputStream();
|
InputStream responseStream = connection.getInputStream();
|
||||||
String response = drainStream(responseStream);
|
String response = drainStream(responseStream);
|
||||||
|
Reference in New Issue
Block a user