Merge "request{LinkProperties,NetworkCapabilities} no longer needed"

This commit is contained in:
Treehugger Robot
2017-03-07 13:27:09 +00:00
committed by Gerrit Code Review
4 changed files with 0 additions and 122 deletions

View File

@@ -1051,28 +1051,6 @@ public class ConnectivityManager {
} }
} }
/**
* Request that this callback be invoked at ConnectivityService's earliest
* convenience with the current satisfying network's LinkProperties.
* If no such network exists no callback invocation is performed.
*
* The callback must have been registered with #requestNetwork() or
* #registerDefaultNetworkCallback(); callbacks registered with
* registerNetworkCallback() are not specific to any particular Network so
* do not cause any updates.
*
* TODO: Delete once callers are updated.
*
* @hide
*/
public void requestLinkProperties(NetworkCallback networkCallback) {
try {
mService.requestLinkProperties(networkCallback.networkRequest);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/** /**
* Get the {@link android.net.NetworkCapabilities} for the given {@link Network}. This * Get the {@link android.net.NetworkCapabilities} for the given {@link Network}. This
* will return {@code null} if the network is unknown. * will return {@code null} if the network is unknown.
@@ -1090,28 +1068,6 @@ public class ConnectivityManager {
} }
} }
/**
* Request that this callback be invoked at ConnectivityService's earliest
* convenience with the current satisfying network's NetworkCapabilities.
* If no such network exists no callback invocation is performed.
*
* The callback must have been registered with #requestNetwork() or
* #registerDefaultNetworkCallback(); callbacks registered with
* registerNetworkCallback() are not specific to any particular Network so
* do not cause any updates.
*
* TODO: Delete once callers are updated.
*
* @hide
*/
public void requestNetworkCapabilities(NetworkCallback networkCallback) {
try {
mService.requestNetworkCapabilities(networkCallback.networkRequest);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/** /**
* Gets the URL that should be used for resolving whether a captive portal is present. * Gets the URL that should be used for resolving whether a captive portal is present.
* 1. This URL should respond with a 204 response to a GET request to indicate no captive * 1. This URL should respond with a 204 response to a GET request to indicate no captive

View File

@@ -156,8 +156,6 @@ interface IConnectivityManager
void pendingListenForNetwork(in NetworkCapabilities networkCapabilities, void pendingListenForNetwork(in NetworkCapabilities networkCapabilities,
in PendingIntent operation); in PendingIntent operation);
void requestLinkProperties(in NetworkRequest networkRequest);
void requestNetworkCapabilities(in NetworkRequest networkRequest);
void releaseNetworkRequest(in NetworkRequest networkRequest); void releaseNetworkRequest(in NetworkRequest networkRequest);
void setAcceptUnvalidated(in Network network, boolean accept, boolean always); void setAcceptUnvalidated(in Network network, boolean accept, boolean always);

View File

@@ -395,16 +395,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
*/ */
private static final int EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT = 31; private static final int EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT = 31;
/**
* Indicates a caller has requested to have its callback invoked with
* the latest LinkProperties or NetworkCapabilities.
*
* arg1 = UID of caller
* obj = NetworkRequest
*/
private static final int EVENT_REQUEST_LINKPROPERTIES = 32;
private static final int EVENT_REQUEST_NETCAPABILITIES = 33;
/** Handler thread used for both of the handlers below. */ /** Handler thread used for both of the handlers below. */
@VisibleForTesting @VisibleForTesting
protected final HandlerThread mHandlerThread; protected final HandlerThread mHandlerThread;
@@ -2574,34 +2564,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
return nri; return nri;
} }
private void handleRequestCallbackUpdate(NetworkRequest request, int callingUid,
String description, int callbackType) {
final NetworkRequestInfo nri = getNriForAppRequest(request, callingUid, description);
if (nri == null) return;
final NetworkAgentInfo nai = mNetworkForRequestId.get(nri.request.requestId);
// The network that is satisfying this request may have changed since
// the application requested the update.
//
// - If the request is no longer satisfied, don't send any updates.
// - If the request is satisfied by a different network, it is the
// caller's responsibility to check that the Network object in the
// callback matches the network that was returned in the last
// onAvailable() callback for this request.
if (nai == null) return;
callCallbackForRequest(nri, nai, callbackType, 0);
}
private void handleRequestLinkProperties(NetworkRequest request, int callingUid) {
handleRequestCallbackUpdate(request, callingUid,
"request LinkProperties", ConnectivityManager.CALLBACK_IP_CHANGED);
}
private void handleRequestNetworkCapabilities(NetworkRequest request, int callingUid) {
handleRequestCallbackUpdate(request, callingUid,
"request NetworkCapabilities", ConnectivityManager.CALLBACK_CAP_CHANGED);
}
private void handleTimedOutNetworkRequest(final NetworkRequestInfo nri) { private void handleTimedOutNetworkRequest(final NetworkRequestInfo nri) {
if (mNetworkRequests.get(nri.request) != null && mNetworkForRequestId.get( if (mNetworkRequests.get(nri.request) != null && mNetworkForRequestId.get(
nri.request.requestId) == null) { nri.request.requestId) == null) {
@@ -2983,12 +2945,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
handleMobileDataAlwaysOn(); handleMobileDataAlwaysOn();
break; break;
} }
case EVENT_REQUEST_LINKPROPERTIES:
handleRequestLinkProperties((NetworkRequest) msg.obj, msg.arg1);
break;
case EVENT_REQUEST_NETCAPABILITIES:
handleRequestNetworkCapabilities((NetworkRequest) msg.obj, msg.arg1);
break;
// Sent by KeepaliveTracker to process an app request on the state machine thread. // Sent by KeepaliveTracker to process an app request on the state machine thread.
case NetworkAgent.CMD_START_PACKET_KEEPALIVE: { case NetworkAgent.CMD_START_PACKET_KEEPALIVE: {
mKeepaliveTracker.handleStartKeepalive(msg); mKeepaliveTracker.handleStartKeepalive(msg);
@@ -4348,24 +4304,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri)); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri));
} }
// TODO: Delete once callers are updated.
@Override
public void requestLinkProperties(NetworkRequest networkRequest) {
ensureNetworkRequestHasType(networkRequest);
if (networkRequest.type == NetworkRequest.Type.LISTEN) return;
mHandler.sendMessage(mHandler.obtainMessage(
EVENT_REQUEST_LINKPROPERTIES, getCallingUid(), 0, networkRequest));
}
// TODO: Delete once callers are updated.
@Override
public void requestNetworkCapabilities(NetworkRequest networkRequest) {
ensureNetworkRequestHasType(networkRequest);
if (networkRequest.type == NetworkRequest.Type.LISTEN) return;
mHandler.sendMessage(mHandler.obtainMessage(
EVENT_REQUEST_NETCAPABILITIES, getCallingUid(), 0, networkRequest));
}
@Override @Override
public void releaseNetworkRequest(NetworkRequest networkRequest) { public void releaseNetworkRequest(NetworkRequest networkRequest) {
ensureNetworkRequestHasType(networkRequest); ensureNetworkRequestHasType(networkRequest);

View File

@@ -1927,20 +1927,6 @@ public class ConnectivityServiceTest extends AndroidTestCase {
dfltNetworkCallback.expectAvailableAndSuspendedCallbacks(mCellNetworkAgent); dfltNetworkCallback.expectAvailableAndSuspendedCallbacks(mCellNetworkAgent);
dfltNetworkCallback.assertNoCallback(); dfltNetworkCallback.assertNoCallback();
// Request a NetworkCapabilities update; only the requesting callback is notified.
// TODO: Delete this together with Connectivity{Manager,Service} code.
mCm.requestNetworkCapabilities(dfltNetworkCallback);
dfltNetworkCallback.expectCallback(CallbackState.NETWORK_CAPABILITIES, mCellNetworkAgent);
cellNetworkCallback.assertNoCallback();
dfltNetworkCallback.assertNoCallback();
// Request a LinkProperties update; only the requesting callback is notified.
// TODO: Delete this together with Connectivity{Manager,Service} code.
mCm.requestLinkProperties(dfltNetworkCallback);
dfltNetworkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
cellNetworkCallback.assertNoCallback();
dfltNetworkCallback.assertNoCallback();
mCm.unregisterNetworkCallback(dfltNetworkCallback); mCm.unregisterNetworkCallback(dfltNetworkCallback);
mCm.unregisterNetworkCallback(cellNetworkCallback); mCm.unregisterNetworkCallback(cellNetworkCallback);
} }