Fix small issues that stops the Chromium DEPS roll.

Some imports of classes in the same package are a bit silly.

Removing = false for booleans is safe because Java guarantees that
an uninitialized bool will always be false.

Tbr: sakal@chromium.org
Bug: None
Change-Id: I04baa78a6e21b1c4fc74c5e46665e66481da2495
Reviewed-on: https://webrtc-review.googlesource.com/c/111243
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25678}
This commit is contained in:
Patrik Höglund
2018-11-16 14:55:16 +01:00
committed by Commit Bot
parent 179a3923b9
commit bd6ffaf73b
8 changed files with 39 additions and 25 deletions

View File

@ -7,6 +7,7 @@
* in the file PATENTS. All contributing project authors may * in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
package org.webrtc; package org.webrtc;
/** /**
@ -108,10 +109,10 @@ public final class CryptoOptions {
} }
public static class Builder { public static class Builder {
private boolean enableGcmCryptoSuites = false; private boolean enableGcmCryptoSuites;
private boolean enableAes128Sha1_32CryptoCipher = false; private boolean enableAes128Sha1_32CryptoCipher;
private boolean enableEncryptedRtpHeaderExtensions = false; private boolean enableEncryptedRtpHeaderExtensions;
private boolean requireFrameEncryption = false; private boolean requireFrameEncryption;
private Builder() {} private Builder() {}

View File

@ -14,11 +14,10 @@ import static org.webrtc.NetworkMonitorAutoDetect.INVALID_NET_ID;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.webrtc.NetworkMonitorAutoDetect.ConnectionType; import javax.annotation.Nullable;
import org.webrtc.NetworkMonitorAutoDetect.NetworkInformation; import org.webrtc.NetworkMonitorAutoDetect;
/** /**
* Borrowed from Chromium's * Borrowed from Chromium's
@ -33,7 +32,7 @@ public class NetworkMonitor {
* Alerted when the connection type of the network changes. The alert is fired on the UI thread. * Alerted when the connection type of the network changes. The alert is fired on the UI thread.
*/ */
public interface NetworkObserver { public interface NetworkObserver {
public void onConnectionTypeChanged(ConnectionType connectionType); public void onConnectionTypeChanged(NetworkMonitorAutoDetect.ConnectionType connectionType);
} }
private static final String TAG = "NetworkMonitor"; private static final String TAG = "NetworkMonitor";
@ -55,13 +54,13 @@ public class NetworkMonitor {
// Also guarded by autoDetectLock. // Also guarded by autoDetectLock.
private int numObservers; private int numObservers;
private volatile ConnectionType currentConnectionType; private volatile NetworkMonitorAutoDetect.ConnectionType currentConnectionType;
private NetworkMonitor() { private NetworkMonitor() {
nativeNetworkObservers = new ArrayList<Long>(); nativeNetworkObservers = new ArrayList<Long>();
networkObservers = new ArrayList<NetworkObserver>(); networkObservers = new ArrayList<NetworkObserver>();
numObservers = 0; numObservers = 0;
currentConnectionType = ConnectionType.CONNECTION_UNKNOWN; currentConnectionType = NetworkMonitorAutoDetect.ConnectionType.CONNECTION_UNKNOWN;
} }
// TODO(sakal): Remove once downstream dependencies have been updated. // TODO(sakal): Remove once downstream dependencies have been updated.
@ -155,7 +154,7 @@ public class NetworkMonitor {
return Build.VERSION.SDK_INT; return Build.VERSION.SDK_INT;
} }
private ConnectionType getCurrentConnectionType() { private NetworkMonitorAutoDetect.ConnectionType getCurrentConnectionType() {
return currentConnectionType; return currentConnectionType;
} }
@ -169,12 +168,13 @@ public class NetworkMonitor {
return new NetworkMonitorAutoDetect(new NetworkMonitorAutoDetect.Observer() { return new NetworkMonitorAutoDetect(new NetworkMonitorAutoDetect.Observer() {
@Override @Override
public void onConnectionTypeChanged(ConnectionType newConnectionType) { public void onConnectionTypeChanged(
NetworkMonitorAutoDetect.ConnectionType newConnectionType) {
updateCurrentConnectionType(newConnectionType); updateCurrentConnectionType(newConnectionType);
} }
@Override @Override
public void onNetworkConnect(NetworkInformation networkInfo) { public void onNetworkConnect(NetworkMonitorAutoDetect.NetworkInformation networkInfo) {
notifyObserversOfNetworkConnect(networkInfo); notifyObserversOfNetworkConnect(networkInfo);
} }
@ -185,13 +185,15 @@ public class NetworkMonitor {
}, appContext); }, appContext);
} }
private void updateCurrentConnectionType(ConnectionType newConnectionType) { private void updateCurrentConnectionType(
NetworkMonitorAutoDetect.ConnectionType newConnectionType) {
currentConnectionType = newConnectionType; currentConnectionType = newConnectionType;
notifyObserversOfConnectionTypeChange(newConnectionType); notifyObserversOfConnectionTypeChange(newConnectionType);
} }
/** Alerts all observers of a connection change. */ /** Alerts all observers of a connection change. */
private void notifyObserversOfConnectionTypeChange(ConnectionType newConnectionType) { private void notifyObserversOfConnectionTypeChange(
NetworkMonitorAutoDetect.ConnectionType newConnectionType) {
List<Long> nativeObservers = getNativeNetworkObserversSync(); List<Long> nativeObservers = getNativeNetworkObserversSync();
for (Long nativeObserver : nativeObservers) { for (Long nativeObserver : nativeObservers) {
nativeNotifyConnectionTypeChanged(nativeObserver); nativeNotifyConnectionTypeChanged(nativeObserver);
@ -206,7 +208,8 @@ public class NetworkMonitor {
} }
} }
private void notifyObserversOfNetworkConnect(NetworkInformation networkInfo) { private void notifyObserversOfNetworkConnect(
NetworkMonitorAutoDetect.NetworkInformation networkInfo) {
List<Long> nativeObservers = getNativeNetworkObserversSync(); List<Long> nativeObservers = getNativeNetworkObserversSync();
for (Long nativeObserver : nativeObservers) { for (Long nativeObserver : nativeObservers) {
nativeNotifyOfNetworkConnect(nativeObserver, networkInfo); nativeNotifyOfNetworkConnect(nativeObserver, networkInfo);
@ -221,7 +224,7 @@ public class NetworkMonitor {
} }
private void updateObserverActiveNetworkList(long nativeObserver) { private void updateObserverActiveNetworkList(long nativeObserver) {
List<NetworkInformation> networkInfoList; List<NetworkMonitorAutoDetect.NetworkInformation> networkInfoList;
synchronized (autoDetectLock) { synchronized (autoDetectLock) {
networkInfoList = (autoDetect == null) ? null : autoDetect.getActiveNetworkList(); networkInfoList = (autoDetect == null) ? null : autoDetect.getActiveNetworkList();
} }
@ -229,7 +232,8 @@ public class NetworkMonitor {
return; return;
} }
NetworkInformation[] networkInfos = new NetworkInformation[networkInfoList.size()]; NetworkMonitorAutoDetect.NetworkInformation[] networkInfos =
new NetworkMonitorAutoDetect.NetworkInformation[networkInfoList.size()];
networkInfos = networkInfoList.toArray(networkInfos); networkInfos = networkInfoList.toArray(networkInfos);
nativeNotifyOfActiveNetworkList(nativeObserver, networkInfos); nativeNotifyOfActiveNetworkList(nativeObserver, networkInfos);
} }
@ -274,17 +278,18 @@ public class NetworkMonitor {
/** Checks if there currently is connectivity. */ /** Checks if there currently is connectivity. */
public static boolean isOnline() { public static boolean isOnline() {
ConnectionType connectionType = getInstance().getCurrentConnectionType(); NetworkMonitorAutoDetect.ConnectionType connectionType =
return connectionType != ConnectionType.CONNECTION_NONE; getInstance().getCurrentConnectionType();
return connectionType != NetworkMonitorAutoDetect.ConnectionType.CONNECTION_NONE;
} }
private native void nativeNotifyConnectionTypeChanged(long nativeAndroidNetworkMonitor); private native void nativeNotifyConnectionTypeChanged(long nativeAndroidNetworkMonitor);
private native void nativeNotifyOfNetworkConnect( private native void nativeNotifyOfNetworkConnect(
long nativeAndroidNetworkMonitor, NetworkInformation networkInfo); long nativeAndroidNetworkMonitor, NetworkMonitorAutoDetect.NetworkInformation networkInfo);
private native void nativeNotifyOfNetworkDisconnect( private native void nativeNotifyOfNetworkDisconnect(
long nativeAndroidNetworkMonitor, long networkHandle); long nativeAndroidNetworkMonitor, long networkHandle);
private native void nativeNotifyOfActiveNetworkList( private native void nativeNotifyOfActiveNetworkList(
long nativeAndroidNetworkMonitor, NetworkInformation[] networkInfos); long nativeAndroidNetworkMonitor, NetworkMonitorAutoDetect.NetworkInformation[] networkInfos);
// For testing only. // For testing only.
@Nullable @Nullable

View File

@ -14,6 +14,9 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.webrtc.DataChannel;
import org.webrtc.MediaStreamTrack;
import org.webrtc.RtpTransceiver;
/** /**
* Java-land version of the PeerConnection APIs; wraps the C++ API * Java-land version of the PeerConnection APIs; wraps the C++ API

View File

@ -14,6 +14,7 @@ import android.content.Context;
import java.util.List; import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.webrtc.Logging.Severity; import org.webrtc.Logging.Severity;
import org.webrtc.PeerConnection;
import org.webrtc.audio.AudioDeviceModule; import org.webrtc.audio.AudioDeviceModule;
import org.webrtc.audio.LegacyAudioDeviceModule; import org.webrtc.audio.LegacyAudioDeviceModule;

View File

@ -10,6 +10,8 @@
package org.webrtc; package org.webrtc;
import org.webrtc.PeerConnection;
/** /**
* Easily storable/serializable version of a native C++ RTCCertificatePEM. * Easily storable/serializable version of a native C++ RTCCertificatePEM.
*/ */

View File

@ -13,6 +13,7 @@ package org.webrtc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.webrtc.MediaStreamTrack;
/** /**
* Java wrapper for a C++ RtpTransceiverInterface. * Java wrapper for a C++ RtpTransceiverInterface.

View File

@ -12,13 +12,13 @@ package org.webrtc;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import android.support.test.filters.SmallTest; import android.support.test.filters.SmallTest;
import org.junit.runner.RunWith; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.PeerConnection;
import org.webrtc.RtcCertificatePem; import org.webrtc.RtcCertificatePem;
import org.webrtc.PeerConnection.KeyType;
/** Tests for RtcCertificatePem.java. */ /** Tests for RtcCertificatePem.java. */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)

View File

@ -11,6 +11,7 @@
package org.webrtc; package org.webrtc;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.webrtc.VideoFrame;
/** /**
* Implements VideoCapturer.CapturerObserver and feeds frames to * Implements VideoCapturer.CapturerObserver and feeds frames to