services.net: Use the new ModuleNetworkStackClient

Use the new ModuleNetworkStackClient to retrieve instances IpMemoryStore
& IpClient.

Bug: 145825329
Test: Compiles
Change-Id: I065525fdbd64b9509ef0f47bb35954d267c65fd2
This commit is contained in:
Roshan Pius
2020-02-20 21:47:01 -08:00
parent 98955a625c
commit 86a84576b5
3 changed files with 14 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ package android.net;
import android.annotation.NonNull;
import android.content.Context;
import android.net.networkstack.ModuleNetworkStackClient;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
@@ -41,7 +42,7 @@ public class IpMemoryStore extends IpMemoryStoreClient {
super(context);
mService = new CompletableFuture<>();
mTailNode = new AtomicReference<CompletableFuture<IIpMemoryStore>>(mService);
getNetworkStackClient().fetchIpMemoryStore(
getModuleNetworkStackClient(context).fetchIpMemoryStore(
new IIpMemoryStoreCallbacks.Stub() {
@Override
public void onIpMemoryStoreFetched(@NonNull final IIpMemoryStore memoryStore) {
@@ -85,8 +86,8 @@ public class IpMemoryStore extends IpMemoryStoreClient {
}
@VisibleForTesting
protected NetworkStackClient getNetworkStackClient() {
return NetworkStackClient.getInstance();
protected ModuleNetworkStackClient getModuleNetworkStackClient(Context context) {
return ModuleNetworkStackClient.getInstance(context);
}
/** Gets an instance of the memory store */

View File

@@ -22,7 +22,7 @@ import android.content.Context;
import android.net.DhcpResultsParcelable;
import android.net.Layer2PacketParcelable;
import android.net.LinkProperties;
import android.net.NetworkStackClient;
import android.net.networkstack.ModuleNetworkStackClient;
import android.os.ConditionVariable;
import java.io.FileDescriptor;
@@ -75,11 +75,11 @@ public class IpClientUtil {
*
* <p>This is a convenience method to allow clients to use {@link IpClientCallbacks} instead of
* {@link IIpClientCallbacks}.
* @see {@link NetworkStackClient#makeIpClient(String, IIpClientCallbacks)}
* @see {@link ModuleNetworkStackClient#makeIpClient(String, IIpClientCallbacks)}
*/
public static void makeIpClient(Context context, String ifName, IpClientCallbacks callback) {
// TODO: migrate clients and remove context argument
NetworkStackClient.getInstance().makeIpClient(ifName, new IpClientCallbacksProxy(callback));
ModuleNetworkStackClient.getInstance(context)
.makeIpClient(ifName, new IpClientCallbacksProxy(callback));
}
/**