Fix/suppress new warnings introduced in Chromium roll.
TBR=henrika@webrtc.org Bug: webrtc:6597 Change-Id: Id26945a7be05250673b58de8220f78bc62886688 Reviewed-on: https://webrtc-review.googlesource.com/16860 Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20477}
This commit is contained in:
committed by
Commit Bot
parent
1d4c152a38
commit
bde473e4fa
@ -179,14 +179,11 @@ public class AppRTCAudioManager {
|
||||
// Create and initialize the proximity sensor.
|
||||
// Tablet devices (e.g. Nexus 7) does not support proximity sensors.
|
||||
// Note that, the sensor will not be active until start() has been called.
|
||||
proximitySensor = AppRTCProximitySensor.create(context, new Runnable() {
|
||||
// This method will be called each time a state change is detected.
|
||||
// Example: user holds his hand over the device (closer than ~5 cm),
|
||||
// or removes his hand from the device.
|
||||
public void run() {
|
||||
onProximitySensorChangedState();
|
||||
}
|
||||
});
|
||||
proximitySensor = AppRTCProximitySensor.create(context,
|
||||
// This method will be called each time a state change is detected.
|
||||
// Example: user holds his hand over the device (closer than ~5 cm),
|
||||
// or removes his hand from the device.
|
||||
this ::onProximitySensorChangedState);
|
||||
|
||||
Log.d(TAG, "defaultAudioDevice: " + defaultAudioDevice);
|
||||
AppRTCUtils.logDeviceInfo(TAG);
|
||||
|
||||
@ -47,7 +47,7 @@ public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener
|
||||
int firstFps = calculateFramerate(targetBandwidth, first);
|
||||
int secondFps = calculateFramerate(targetBandwidth, second);
|
||||
|
||||
if (firstFps >= FRAMERATE_THRESHOLD && secondFps >= FRAMERATE_THRESHOLD
|
||||
if ((firstFps >= FRAMERATE_THRESHOLD && secondFps >= FRAMERATE_THRESHOLD)
|
||||
|| firstFps == secondFps) {
|
||||
// Compare resolution.
|
||||
return first.width * first.height - second.width * second.height;
|
||||
|
||||
@ -535,6 +535,7 @@ public class ConnectActivity extends Activity {
|
||||
.setCancelable(false)
|
||||
.setNeutralButton(R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
|
||||
@ -17,9 +17,13 @@ import android.os.BatteryManager;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -68,7 +72,6 @@ import java.util.concurrent.TimeUnit;
|
||||
* correct value, and then returns to back to correct reading. Both when
|
||||
* jumping up and back down we might create faulty CPU load readings.
|
||||
*/
|
||||
|
||||
class CpuMonitor {
|
||||
private static final String TAG = "CpuMonitor";
|
||||
private static final int MOVING_AVERAGE_SAMPLES = 5;
|
||||
@ -224,9 +227,10 @@ class CpuMonitor {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
try (FileReader fin = new FileReader("/sys/devices/system/cpu/present")) {
|
||||
BufferedReader reader = new BufferedReader(fin);
|
||||
Scanner scanner = new Scanner(reader).useDelimiter("[-\n]");
|
||||
try (FileInputStream fin = new FileInputStream("/sys/devices/system/cpu/present");
|
||||
InputStreamReader streamReader = new InputStreamReader(fin, Charset.forName("UTF-8"));
|
||||
BufferedReader reader = new BufferedReader(streamReader);
|
||||
Scanner scanner = new Scanner(reader).useDelimiter("[-\n]");) {
|
||||
scanner.nextInt(); // Skip leading number 0.
|
||||
cpusPresent = 1 + scanner.nextInt();
|
||||
scanner.close();
|
||||
@ -432,7 +436,9 @@ class CpuMonitor {
|
||||
*/
|
||||
private long readFreqFromFile(String fileName) {
|
||||
long number = 0;
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
|
||||
try (FileInputStream stream = new FileInputStream(fileName);
|
||||
InputStreamReader streamReader = new InputStreamReader(stream, Charset.forName("UTF-8"));
|
||||
BufferedReader reader = new BufferedReader(streamReader)) {
|
||||
String line = reader.readLine();
|
||||
number = parseLong(line);
|
||||
} catch (FileNotFoundException e) {
|
||||
@ -463,7 +469,9 @@ class CpuMonitor {
|
||||
long userTime = 0;
|
||||
long systemTime = 0;
|
||||
long idleTime = 0;
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader("/proc/stat"))) {
|
||||
try (FileInputStream stream = new FileInputStream("/proc/stat");
|
||||
InputStreamReader streamReader = new InputStreamReader(stream, Charset.forName("UTF-8"));
|
||||
BufferedReader reader = new BufferedReader(streamReader)) {
|
||||
// line should contain something like this:
|
||||
// cpu 5093818 271838 3512830 165934119 101374 447076 272086 0 0 0
|
||||
// user nice system idle iowait irq softirq
|
||||
|
||||
@ -17,6 +17,7 @@ import android.util.Log;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -1261,6 +1262,7 @@ public class PeerConnectionClient {
|
||||
return;
|
||||
|
||||
dc.registerObserver(new DataChannel.Observer() {
|
||||
@Override
|
||||
public void onBufferedAmountChange(long previousAmount) {
|
||||
Log.d(TAG, "Data channel buffered amount changed: " + dc.label() + ": " + dc.state());
|
||||
}
|
||||
@ -1279,7 +1281,7 @@ public class PeerConnectionClient {
|
||||
ByteBuffer data = buffer.data;
|
||||
final byte[] bytes = new byte[data.capacity()];
|
||||
data.get(bytes);
|
||||
String strData = new String(bytes);
|
||||
String strData = new String(bytes, Charset.forName("UTF-8"));
|
||||
Log.d(TAG, "Got msg: " + strData + " over " + dc);
|
||||
}
|
||||
});
|
||||
|
||||
@ -11,24 +11,24 @@
|
||||
package org.appspot.apprtc;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.webrtc.ThreadUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.webrtc.ThreadUtils;
|
||||
|
||||
/**
|
||||
* Replacement for WebSocketChannelClient for direct communication between two IP addresses. Handles
|
||||
* the signaling between the two clients using a TCP connection.
|
||||
*
|
||||
* <p>All public methods should be called from a looper executor thread
|
||||
* <p>
|
||||
* All public methods should be called from a looper executor thread
|
||||
* passed in a constructor, otherwise exception will be thrown.
|
||||
* All events are dispatched on the same thread.
|
||||
*/
|
||||
@ -56,8 +56,8 @@ public class TCPChannelClient {
|
||||
* that IP. If not, instead connects to the IP.
|
||||
*
|
||||
* @param eventListener Listener that will receive events from the client.
|
||||
* @param ip IP address to listen on or connect to.
|
||||
* @param port Port to listen on or connect to.
|
||||
* @param ip IP address to listen on or connect to.
|
||||
* @param port Port to listen on or connect to.
|
||||
*/
|
||||
public TCPChannelClient(
|
||||
ExecutorService executor, TCPChannelEvents eventListener, String ip, int port) {
|
||||
@ -132,6 +132,7 @@ public class TCPChannelClient {
|
||||
* @return Socket connection, null if connection failed.
|
||||
*/
|
||||
public abstract Socket connect();
|
||||
|
||||
/** Returns true if sockets is a server rawSocket. */
|
||||
public abstract boolean isServer();
|
||||
|
||||
@ -165,8 +166,10 @@ public class TCPChannelClient {
|
||||
}
|
||||
|
||||
try {
|
||||
out = new PrintWriter(rawSocket.getOutputStream(), true);
|
||||
in = new BufferedReader(new InputStreamReader(rawSocket.getInputStream()));
|
||||
out = new PrintWriter(
|
||||
new OutputStreamWriter(rawSocket.getOutputStream(), Charset.forName("UTF-8")), true);
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(rawSocket.getInputStream(), Charset.forName("UTF-8")));
|
||||
} catch (IOException e) {
|
||||
reportError("Failed to open IO on rawSocket: " + e.getMessage());
|
||||
return;
|
||||
@ -218,9 +221,7 @@ public class TCPChannelClient {
|
||||
disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the rawSocket if it is still open. Also fires the onTCPClose event.
|
||||
*/
|
||||
/** Closes the rawSocket if it is still open. Also fires the onTCPClose event. */
|
||||
public void disconnect() {
|
||||
try {
|
||||
synchronized (rawSocketLock) {
|
||||
|
||||
@ -37,6 +37,7 @@ public class UnhandledExceptionHandler implements Thread.UncaughtExceptionHandle
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncaughtException(Thread unusedThread, final Throwable e) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
||||
@ -50,12 +50,7 @@ public class AsyncHttpURLConnection {
|
||||
}
|
||||
|
||||
public void send() {
|
||||
Runnable runHttp = new Runnable() {
|
||||
public void run() {
|
||||
sendHttpMessage();
|
||||
}
|
||||
};
|
||||
new Thread(runHttp).start();
|
||||
new Thread(this ::sendHttpMessage).start();
|
||||
}
|
||||
|
||||
private void sendHttpMessage() {
|
||||
|
||||
Reference in New Issue
Block a user