Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 | |
| 17 | package android.net; |
| 18 | |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 19 | import android.annotation.NonNull; |
Remi NGUYEN VAN | 11f3924 | 2020-03-09 13:56:18 +0900 | [diff] [blame] | 20 | import android.annotation.RequiresPermission; |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 21 | import android.annotation.SystemApi; |
Jeff Sharkey | ad1cebe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 22 | import android.annotation.SystemService; |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 23 | import android.annotation.TestApi; |
Artur Satayev | 164c756 | 2019-12-10 17:47:52 +0000 | [diff] [blame] | 24 | import android.compat.annotation.UnsupportedAppUsage; |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 25 | import android.content.Context; |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 26 | import android.os.Build; |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 27 | import android.os.RemoteException; |
| 28 | |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 29 | import com.android.internal.annotations.GuardedBy; |
| 30 | import com.android.internal.os.BackgroundThread; |
| 31 | |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 32 | import java.util.ArrayList; |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 33 | import java.util.Objects; |
markchien | c8e7d75 | 2020-02-26 20:54:55 +0800 | [diff] [blame] | 34 | import java.util.concurrent.Executor; |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 35 | |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 36 | /** |
| 37 | * A class representing the IP configuration of the Ethernet network. |
| 38 | * |
| 39 | * @hide |
| 40 | */ |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 41 | @SystemApi |
Jeff Sharkey | ad1cebe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 42 | @SystemService(Context.ETHERNET_SERVICE) |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 43 | public class EthernetManager { |
| 44 | private static final String TAG = "EthernetManager"; |
| 45 | |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 46 | private final IEthernetManager mService; |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 47 | @GuardedBy("mListeners") |
| 48 | private final ArrayList<ListenerInfo> mListeners = new ArrayList<>(); |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 49 | private final IEthernetServiceListener.Stub mServiceListener = |
| 50 | new IEthernetServiceListener.Stub() { |
| 51 | @Override |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 52 | public void onAvailabilityChanged(String iface, boolean isAvailable) { |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 53 | synchronized (mListeners) { |
| 54 | for (ListenerInfo li : mListeners) { |
| 55 | li.executor.execute(() -> |
| 56 | li.listener.onAvailabilityChanged(iface, isAvailable)); |
| 57 | } |
| 58 | } |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 59 | } |
| 60 | }; |
| 61 | |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 62 | private static class ListenerInfo { |
| 63 | @NonNull |
| 64 | public final Executor executor; |
| 65 | @NonNull |
| 66 | public final Listener listener; |
| 67 | |
| 68 | private ListenerInfo(@NonNull Executor executor, @NonNull Listener listener) { |
| 69 | this.executor = executor; |
| 70 | this.listener = listener; |
| 71 | } |
| 72 | } |
| 73 | |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 74 | /** |
| 75 | * A listener interface to receive notification on changes in Ethernet. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 76 | * @hide |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 77 | */ |
| 78 | public interface Listener { |
| 79 | /** |
| 80 | * Called when Ethernet port's availability is changed. |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 81 | * @param iface Ethernet interface name |
| 82 | * @param isAvailable {@code true} if Ethernet port exists. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 83 | * @hide |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 84 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 85 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 86 | void onAvailabilityChanged(String iface, boolean isAvailable); |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 87 | } |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Create a new EthernetManager instance. |
| 91 | * Applications will almost always want to use |
| 92 | * {@link android.content.Context#getSystemService Context.getSystemService()} to retrieve |
| 93 | * the standard {@link android.content.Context#ETHERNET_SERVICE Context.ETHERNET_SERVICE}. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 94 | * @hide |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 95 | */ |
| 96 | public EthernetManager(Context context, IEthernetManager service) { |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 97 | mService = service; |
| 98 | } |
| 99 | |
| 100 | /** |
Lorenzo Colitti | 56e4e58 | 2014-05-22 11:51:27 -0700 | [diff] [blame] | 101 | * Get Ethernet configuration. |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 102 | * @return the Ethernet Configuration, contained in {@link IpConfiguration}. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 103 | * @hide |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 104 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 105 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 106 | public IpConfiguration getConfiguration(String iface) { |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 107 | try { |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 108 | return mService.getConfiguration(iface); |
Jeff Sharkey | f713828 | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 109 | } catch (RemoteException e) { |
| 110 | throw e.rethrowFromSystemServer(); |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 111 | } |
| 112 | } |
| 113 | |
| 114 | /** |
Lorenzo Colitti | 56e4e58 | 2014-05-22 11:51:27 -0700 | [diff] [blame] | 115 | * Set Ethernet configuration. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 116 | * @hide |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 117 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 118 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 119 | public void setConfiguration(String iface, IpConfiguration config) { |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 120 | try { |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 121 | mService.setConfiguration(iface, config); |
Jeff Sharkey | f713828 | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 122 | } catch (RemoteException e) { |
| 123 | throw e.rethrowFromSystemServer(); |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 124 | } |
| 125 | } |
| 126 | |
| 127 | /** |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 128 | * Indicates whether the system currently has one or more Ethernet interfaces. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 129 | * @hide |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 130 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 131 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 132 | public boolean isAvailable() { |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 133 | return getAvailableInterfaces().length > 0; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Indicates whether the system has given interface. |
| 138 | * |
| 139 | * @param iface Ethernet interface name |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 140 | * @hide |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 141 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 142 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 143 | public boolean isAvailable(String iface) { |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 144 | try { |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 145 | return mService.isAvailable(iface); |
Jeff Sharkey | f713828 | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 146 | } catch (RemoteException e) { |
| 147 | throw e.rethrowFromSystemServer(); |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 148 | } |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Adds a listener. |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 153 | * |
| 154 | * Consider using {@link #addListener(Listener, Executor)} instead: this method uses a default |
| 155 | * executor that may have higher latency than a provided executor. |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 156 | * @param listener A {@link Listener} to add. |
| 157 | * @throws IllegalArgumentException If the listener is null. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 158 | * @hide |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 159 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 160 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 161 | public void addListener(@NonNull Listener listener) { |
| 162 | addListener(listener, BackgroundThread.getExecutor()); |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Adds a listener. |
| 167 | * @param listener A {@link Listener} to add. |
| 168 | * @param executor Executor to run callbacks on. |
| 169 | * @throws IllegalArgumentException If the listener or executor is null. |
| 170 | * @hide |
| 171 | */ |
| 172 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 173 | public void addListener(@NonNull Listener listener, @NonNull Executor executor) { |
| 174 | if (listener == null || executor == null) { |
| 175 | throw new NullPointerException("listener and executor must not be null"); |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 176 | } |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 177 | synchronized (mListeners) { |
| 178 | mListeners.add(new ListenerInfo(executor, listener)); |
| 179 | if (mListeners.size() == 1) { |
| 180 | try { |
| 181 | mService.addListener(mServiceListener); |
| 182 | } catch (RemoteException e) { |
| 183 | throw e.rethrowFromSystemServer(); |
| 184 | } |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | /** |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 190 | * Returns an array of available Ethernet interface names. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 191 | * @hide |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 192 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 193 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Pavel Maltsev | 50ec1f3 | 2017-10-31 15:34:16 -0700 | [diff] [blame] | 194 | public String[] getAvailableInterfaces() { |
| 195 | try { |
| 196 | return mService.getAvailableInterfaces(); |
| 197 | } catch (RemoteException e) { |
| 198 | throw e.rethrowAsRuntimeException(); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | /** |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 203 | * Removes a listener. |
| 204 | * @param listener A {@link Listener} to remove. |
| 205 | * @throws IllegalArgumentException If the listener is null. |
Remi NGUYEN VAN | 199d685 | 2020-01-24 22:57:09 +0900 | [diff] [blame] | 206 | * @hide |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 207 | */ |
Mathew Inwood | fe2fed7 | 2020-11-04 09:29:36 +0000 | [diff] [blame] | 208 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 209 | public void removeListener(@NonNull Listener listener) { |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 210 | if (listener == null) { |
| 211 | throw new IllegalArgumentException("listener must not be null"); |
| 212 | } |
Remi NGUYEN VAN | 55838a8 | 2020-12-03 17:58:49 +0900 | [diff] [blame] | 213 | synchronized (mListeners) { |
| 214 | mListeners.removeIf(l -> l.listener == listener); |
| 215 | if (mListeners.isEmpty()) { |
| 216 | try { |
| 217 | mService.removeListener(mServiceListener); |
| 218 | } catch (RemoteException e) { |
| 219 | throw e.rethrowFromSystemServer(); |
| 220 | } |
Jaewan Kim | 32b3f2c | 2014-10-20 12:04:13 +0900 | [diff] [blame] | 221 | } |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 222 | } |
| 223 | } |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 224 | |
| 225 | /** |
Lorenzo Colitti | 013187d | 2020-03-17 00:16:13 +0900 | [diff] [blame] | 226 | * Whether to treat interfaces created by {@link TestNetworkManager#createTapInterface} |
| 227 | * as Ethernet interfaces. The effects of this method apply to any test interfaces that are |
| 228 | * already present on the system. |
| 229 | * @hide |
| 230 | */ |
| 231 | @TestApi |
| 232 | public void setIncludeTestInterfaces(boolean include) { |
| 233 | try { |
| 234 | mService.setIncludeTestInterfaces(include); |
| 235 | } catch (RemoteException e) { |
| 236 | throw e.rethrowFromSystemServer(); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | /** |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 241 | * A request for a tethered interface. |
| 242 | */ |
| 243 | public static class TetheredInterfaceRequest { |
| 244 | private final IEthernetManager mService; |
| 245 | private final ITetheredInterfaceCallback mCb; |
| 246 | |
| 247 | private TetheredInterfaceRequest(@NonNull IEthernetManager service, |
| 248 | @NonNull ITetheredInterfaceCallback cb) { |
| 249 | this.mService = service; |
| 250 | this.mCb = cb; |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Release the request, causing the interface to revert back from tethering mode if there |
| 255 | * is no other requestor. |
| 256 | */ |
| 257 | public void release() { |
| 258 | try { |
| 259 | mService.releaseTetheredInterface(mCb); |
| 260 | } catch (RemoteException e) { |
| 261 | e.rethrowFromSystemServer(); |
| 262 | } |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * Callback for {@link #requestTetheredInterface(TetheredInterfaceCallback)}. |
| 268 | */ |
| 269 | public interface TetheredInterfaceCallback { |
| 270 | /** |
| 271 | * Called when the tethered interface is available. |
| 272 | * @param iface The name of the interface. |
| 273 | */ |
| 274 | void onAvailable(@NonNull String iface); |
| 275 | |
| 276 | /** |
| 277 | * Called when the tethered interface is now unavailable. |
| 278 | */ |
| 279 | void onUnavailable(); |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Request a tethered interface in tethering mode. |
| 284 | * |
| 285 | * <p>When this method is called and there is at least one ethernet interface available, the |
| 286 | * system will designate one to act as a tethered interface. If there is already a tethered |
| 287 | * interface, the existing interface will be used. |
| 288 | * @param callback A callback to be called once the request has been fulfilled. |
| 289 | */ |
Remi NGUYEN VAN | 11f3924 | 2020-03-09 13:56:18 +0900 | [diff] [blame] | 290 | @RequiresPermission(anyOf = { |
| 291 | android.Manifest.permission.NETWORK_STACK, |
| 292 | android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK |
| 293 | }) |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 294 | @NonNull |
markchien | c8e7d75 | 2020-02-26 20:54:55 +0800 | [diff] [blame] | 295 | public TetheredInterfaceRequest requestTetheredInterface(@NonNull final Executor executor, |
| 296 | @NonNull final TetheredInterfaceCallback callback) { |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 297 | Objects.requireNonNull(callback, "Callback must be non-null"); |
markchien | c8e7d75 | 2020-02-26 20:54:55 +0800 | [diff] [blame] | 298 | Objects.requireNonNull(executor, "Executor must be non-null"); |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 299 | final ITetheredInterfaceCallback cbInternal = new ITetheredInterfaceCallback.Stub() { |
| 300 | @Override |
| 301 | public void onAvailable(String iface) { |
markchien | c8e7d75 | 2020-02-26 20:54:55 +0800 | [diff] [blame] | 302 | executor.execute(() -> callback.onAvailable(iface)); |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | @Override |
| 306 | public void onUnavailable() { |
markchien | c8e7d75 | 2020-02-26 20:54:55 +0800 | [diff] [blame] | 307 | executor.execute(() -> callback.onUnavailable()); |
Lorenzo Colitti | 19b8b88 | 2020-01-24 19:29:17 +0900 | [diff] [blame] | 308 | } |
| 309 | }; |
| 310 | |
| 311 | try { |
| 312 | mService.requestTetheredInterface(cbInternal); |
| 313 | } catch (RemoteException e) { |
| 314 | throw e.rethrowFromSystemServer(); |
| 315 | } |
| 316 | return new TetheredInterfaceRequest(mService, cbInternal); |
| 317 | } |
Lorenzo Colitti | 2edad7a | 2014-05-21 16:23:43 -0700 | [diff] [blame] | 318 | } |