Make NetworkEventDispatcher class final
(cherry picked from commit 4423217d24338963329c75907d84b0ee3eeea5b4)
Bug: 185153775
Test: m
Merged-In: I3edf4d8662da906dc001ea77adbf1cae438352e1
Change-Id: I0ef901d78672d186e3c9ccf86969f5354b5cbedc
diff --git a/luni/src/main/java/libcore/net/event/NetworkEventDispatcher.java b/luni/src/main/java/libcore/net/event/NetworkEventDispatcher.java
index 256c008..a42763f 100644
--- a/luni/src/main/java/libcore/net/event/NetworkEventDispatcher.java
+++ b/luni/src/main/java/libcore/net/event/NetworkEventDispatcher.java
@@ -26,7 +26,7 @@
* @hide
*/
@libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
-public class NetworkEventDispatcher {
+public final class NetworkEventDispatcher {
private static final NetworkEventDispatcher instance = new NetworkEventDispatcher();
@@ -44,8 +44,8 @@
return instance;
}
- /** Visible for testing. Use {@link #getInstance()} instead. */
- protected NetworkEventDispatcher() {
+ /** @hide Visible for testing. Use {@link #getInstance()} instead. */
+ public NetworkEventDispatcher() {
}
/**
diff --git a/luni/src/test/java/libcore/libcore/net/event/NetworkEventDispatcherTest.java b/luni/src/test/java/libcore/libcore/net/event/NetworkEventDispatcherTest.java
index 1a5cd40bb..0fedd6d 100644
--- a/luni/src/test/java/libcore/libcore/net/event/NetworkEventDispatcherTest.java
+++ b/luni/src/test/java/libcore/libcore/net/event/NetworkEventDispatcherTest.java
@@ -31,7 +31,7 @@
}
public void testAddListener_null() throws Exception {
- NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher() {};
+ NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher();
try {
networkEventDispatcher.addListener(null);
fail();
@@ -40,13 +40,13 @@
}
public void testOnNetworkConfigurationChanged_noListeners() throws Exception {
- NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher() {};
+ NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher();
networkEventDispatcher.onNetworkConfigurationChanged();
}
public void testFireNetworkEvent_oneListener() throws Exception {
FakeNetworkEventListener listener = new FakeNetworkEventListener();
- NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher() {};
+ NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher();
networkEventDispatcher.addListener(listener);
networkEventDispatcher.onNetworkConfigurationChanged();
@@ -56,7 +56,7 @@
public void testRemoveEventListener() throws Exception {
FakeNetworkEventListener listener = new FakeNetworkEventListener();
- NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher() {};
+ NetworkEventDispatcher networkEventDispatcher = new NetworkEventDispatcher();
networkEventDispatcher.addListener(listener);
networkEventDispatcher.removeListener(listener);
diff --git a/mmodules/core_platform_api/api/legacy_platform/current.txt b/mmodules/core_platform_api/api/legacy_platform/current.txt
index 2b7013f..7bbc627 100644
--- a/mmodules/core_platform_api/api/legacy_platform/current.txt
+++ b/mmodules/core_platform_api/api/legacy_platform/current.txt
@@ -646,7 +646,7 @@
package libcore.net.event {
- public class NetworkEventDispatcher {
+ public final class NetworkEventDispatcher {
method public static libcore.net.event.NetworkEventDispatcher getInstance();
method public void onNetworkConfigurationChanged();
}
diff --git a/mmodules/core_platform_api/api/stable_platform/current.txt b/mmodules/core_platform_api/api/stable_platform/current.txt
index cf63a2f..5aa96ab 100644
--- a/mmodules/core_platform_api/api/stable_platform/current.txt
+++ b/mmodules/core_platform_api/api/stable_platform/current.txt
@@ -554,7 +554,7 @@
package libcore.net.event {
- public class NetworkEventDispatcher {
+ public final class NetworkEventDispatcher {
method public static libcore.net.event.NetworkEventDispatcher getInstance();
method public void onNetworkConfigurationChanged();
}