Merge "Start of tethering OffloadController"
am: 121006f428
Change-Id: I590569818c7d7ac50dcc61bd7058bd7c5cad4e77
This commit is contained in:
@@ -76,6 +76,7 @@ import com.android.internal.util.StateMachine;
|
|||||||
import com.android.server.connectivity.tethering.IControlsTethering;
|
import com.android.server.connectivity.tethering.IControlsTethering;
|
||||||
import com.android.server.connectivity.tethering.IPv6TetheringCoordinator;
|
import com.android.server.connectivity.tethering.IPv6TetheringCoordinator;
|
||||||
import com.android.server.connectivity.tethering.IPv6TetheringInterfaceServices;
|
import com.android.server.connectivity.tethering.IPv6TetheringInterfaceServices;
|
||||||
|
import com.android.server.connectivity.tethering.OffloadController;
|
||||||
import com.android.server.connectivity.tethering.TetheringConfiguration;
|
import com.android.server.connectivity.tethering.TetheringConfiguration;
|
||||||
import com.android.server.connectivity.tethering.TetherInterfaceStateMachine;
|
import com.android.server.connectivity.tethering.TetherInterfaceStateMachine;
|
||||||
import com.android.server.connectivity.tethering.UpstreamNetworkMonitor;
|
import com.android.server.connectivity.tethering.UpstreamNetworkMonitor;
|
||||||
@@ -145,6 +146,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
|||||||
.getSystem().getString(com.android.internal.R.string.config_wifi_tether_enable));
|
.getSystem().getString(com.android.internal.R.string.config_wifi_tether_enable));
|
||||||
|
|
||||||
private final StateMachine mTetherMasterSM;
|
private final StateMachine mTetherMasterSM;
|
||||||
|
private final OffloadController mOffloadController;
|
||||||
private final UpstreamNetworkMonitor mUpstreamNetworkMonitor;
|
private final UpstreamNetworkMonitor mUpstreamNetworkMonitor;
|
||||||
private String mCurrentUpstreamIface;
|
private String mCurrentUpstreamIface;
|
||||||
|
|
||||||
@@ -175,6 +177,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
|||||||
mTetherMasterSM = new TetherMasterSM("TetherMaster", mLooper);
|
mTetherMasterSM = new TetherMasterSM("TetherMaster", mLooper);
|
||||||
mTetherMasterSM.start();
|
mTetherMasterSM.start();
|
||||||
|
|
||||||
|
mOffloadController = new OffloadController(mTetherMasterSM.getHandler());
|
||||||
mUpstreamNetworkMonitor = new UpstreamNetworkMonitor(
|
mUpstreamNetworkMonitor = new UpstreamNetworkMonitor(
|
||||||
mContext, mTetherMasterSM, TetherMasterSM.EVENT_UPSTREAM_CALLBACK);
|
mContext, mTetherMasterSM, TetherMasterSM.EVENT_UPSTREAM_CALLBACK);
|
||||||
|
|
||||||
@@ -1203,6 +1206,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
|||||||
|
|
||||||
protected void handleNewUpstreamNetworkState(NetworkState ns) {
|
protected void handleNewUpstreamNetworkState(NetworkState ns) {
|
||||||
mIPv6TetheringCoordinator.updateUpstreamNetworkState(ns);
|
mIPv6TetheringCoordinator.updateUpstreamNetworkState(ns);
|
||||||
|
mOffloadController.setUpstreamLinkProperties(ns.linkProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1359,12 +1363,14 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
|||||||
class TetherModeAliveState extends TetherMasterUtilState {
|
class TetherModeAliveState extends TetherMasterUtilState {
|
||||||
final SimChangeListener simChange = new SimChangeListener(mContext);
|
final SimChangeListener simChange = new SimChangeListener(mContext);
|
||||||
boolean mTryCell = true;
|
boolean mTryCell = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
// TODO: examine if we should check the return value.
|
// TODO: examine if we should check the return value.
|
||||||
turnOnMasterTetherSettings(); // may transition us out
|
turnOnMasterTetherSettings(); // may transition us out
|
||||||
simChange.startListening();
|
simChange.startListening();
|
||||||
mUpstreamNetworkMonitor.start();
|
mUpstreamNetworkMonitor.start();
|
||||||
|
mOffloadController.start();
|
||||||
|
|
||||||
// Better try something first pass or crazy tests cases will fail.
|
// Better try something first pass or crazy tests cases will fail.
|
||||||
chooseUpstreamType(true);
|
chooseUpstreamType(true);
|
||||||
@@ -1373,6 +1379,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
mOffloadController.stop();
|
||||||
unrequestUpstreamMobileConnection();
|
unrequestUpstreamMobileConnection();
|
||||||
mUpstreamNetworkMonitor.stop();
|
mUpstreamNetworkMonitor.stop();
|
||||||
simChange.stopListening();
|
simChange.stopListening();
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.connectivity.tethering;
|
||||||
|
|
||||||
|
import android.net.LinkProperties;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A wrapper around hardware offload interface.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public class OffloadController {
|
||||||
|
private static final String TAG = OffloadController.class.getSimpleName();
|
||||||
|
|
||||||
|
private final Handler mHandler;
|
||||||
|
private LinkProperties mUpstreamLinkProperties;
|
||||||
|
|
||||||
|
public OffloadController(Handler h) {
|
||||||
|
mHandler = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
// TODO: initOffload() and configure callbacks to be handled on our
|
||||||
|
// preferred Handler.
|
||||||
|
Log.d(TAG, "tethering offload not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
// TODO: stopOffload().
|
||||||
|
mUpstreamLinkProperties = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpstreamLinkProperties(LinkProperties lp) {
|
||||||
|
// TODO: setUpstreamParameters().
|
||||||
|
mUpstreamLinkProperties = lp;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user