blob: 173d7860e4ac272d2db7cbb7a633a4bd804d439d [file] [log] [blame]
Erik Kline5a7c8a02017-04-30 19:36:15 +09001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.connectivity.tethering;
18
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090019import android.content.Context;
Erik Kline72302902018-06-14 17:36:40 +090020import android.net.NetworkRequest;
Erik Kline7a4ccc62018-08-27 17:26:47 +090021import android.net.ip.IpServer;
Erik Klinef4b6e342017-04-25 19:19:59 +090022import android.net.util.SharedLog;
markchienb6eb2c22018-07-18 14:29:20 +080023import android.os.Handler;
markchien0b595072019-01-08 23:52:21 +080024import android.telephony.SubscriptionManager;
Erik Klinef4b6e342017-04-25 19:19:59 +090025
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090026import com.android.internal.util.StateMachine;
markchienb6eb2c22018-07-18 14:29:20 +080027import com.android.server.connectivity.MockableSystemProperties;
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090028
29import java.util.ArrayList;
30
Erik Kline5a7c8a02017-04-30 19:36:15 +090031
32/**
33 * Capture tethering dependencies, for injection.
34 *
35 * @hide
36 */
37public class TetheringDependencies {
Remi NGUYEN VAN73105e112018-12-21 16:17:09 +090038 /**
39 * Get a reference to the offload hardware interface to be used by tethering.
40 */
Erik Klinef4b6e342017-04-25 19:19:59 +090041 public OffloadHardwareInterface getOffloadHardwareInterface(Handler h, SharedLog log) {
42 return new OffloadHardwareInterface(h, log);
Erik Kline5a7c8a02017-04-30 19:36:15 +090043 }
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090044
Remi NGUYEN VAN73105e112018-12-21 16:17:09 +090045 /**
46 * Get a reference to the UpstreamNetworkMonitor to be used by tethering.
47 */
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090048 public UpstreamNetworkMonitor getUpstreamNetworkMonitor(Context ctx, StateMachine target,
49 SharedLog log, int what) {
50 return new UpstreamNetworkMonitor(ctx, target, log, what);
51 }
52
Remi NGUYEN VAN73105e112018-12-21 16:17:09 +090053 /**
54 * Get a reference to the IPv6TetheringCoordinator to be used by tethering.
55 */
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090056 public IPv6TetheringCoordinator getIPv6TetheringCoordinator(
Erik Kline7a4ccc62018-08-27 17:26:47 +090057 ArrayList<IpServer> notifyList, SharedLog log) {
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090058 return new IPv6TetheringCoordinator(notifyList, log);
59 }
60
Remi NGUYEN VAN73105e112018-12-21 16:17:09 +090061 /**
62 * Get dependencies to be used by IpServer.
63 */
Remi NGUYEN VAN5db454c2019-02-14 18:04:20 +090064 public IpServer.Dependencies getIpServerDependencies() {
65 return new IpServer.Dependencies();
Remi NGUYEN VANa911e842018-03-15 11:57:14 +090066 }
Erik Kline465ff3a2018-03-09 14:18:02 +090067
Remi NGUYEN VAN73105e112018-12-21 16:17:09 +090068 /**
69 * Indicates whether tethering is supported on the device.
70 */
Erik Kline465ff3a2018-03-09 14:18:02 +090071 public boolean isTetheringSupported() {
72 return true;
73 }
Erik Kline72302902018-06-14 17:36:40 +090074
Remi NGUYEN VAN73105e112018-12-21 16:17:09 +090075 /**
76 * Get the NetworkRequest that should be fulfilled by the default network.
77 */
Erik Kline72302902018-06-14 17:36:40 +090078 public NetworkRequest getDefaultNetworkRequest() {
79 return null;
80 }
markchienb6eb2c22018-07-18 14:29:20 +080081
Remi NGUYEN VAN73105e112018-12-21 16:17:09 +090082 /**
83 * Get a reference to the EntitlementManager to be used by tethering.
84 */
markchienf2731272019-01-16 17:44:13 +080085 public EntitlementManager getEntitlementManager(Context ctx, StateMachine target,
86 SharedLog log, MockableSystemProperties systemProperties) {
87 return new EntitlementManager(ctx, target, log, systemProperties);
markchienb6eb2c22018-07-18 14:29:20 +080088 }
markchien0b595072019-01-08 23:52:21 +080089
90 /**
91 * Get default data subscription id to build TetheringConfiguration.
92 */
93 public int getDefaultDataSubscriptionId() {
94 return SubscriptionManager.getDefaultDataSubscriptionId();
95 }
Erik Kline5a7c8a02017-04-30 19:36:15 +090096}