Android Pie テザリングできない現象のデバッグ

これは2022/06/28のMK社内LTで発表した内容です。

概要

  • Android にてテザリングができない現象が発生いたしました
  • 対策方法、及びAndroid のデバッグ方法を紹介します

Android デバッグツール:ADB 紹介

  • ADB (Android Debug Bridge)は、デバイスと通信するための多用途のコマンドライン ツールです
  • adbは、Android SDK Platform-Tools パッケージに含まれています。

SDK Platform-Tools インストール for Mac

  • brew install --cask android-platform-tools

SDK Platform-Tools インストール for Windows/Linux

adb 使用

Android 側の設定

  1. 設定アプリを起動
  • ビルド番号を連続タップ
  • 開発者向けオプション
  • USBでパソコンに接続
  • USBデバッグを許可

Host 側

  • adb devices
List of devices attached
FA75V1801831	device

Wi-Fi 経由でデバイスに接続する

  • adb tcpip 5555
  • adb connect device_ip_address:5555
connected to 192.168.174.71:5555
  • adb devices
List of devices attached
FA75V1801831	device
192.168.174.71:5555	device

Android のバージョンを確認する

adb shell
htc_ocndugl:/ $ getprop ro.build.id
PQ2A.190205.003

DhOooaY

  • android-9.0.0_r33

Logの確認

adb shell
htc_ocndugl:/ $
  • logcat -c
  • logcat Tethering:* *:S
  • テザリングを起動

下記のようなログを確認することができました

htc_ocndugl:/ $ logcat Tethering:* *:S
--------- beginning of main
--------- beginning of system
06-27 23:25:18.020  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-27 23:25:18.023  1796  1871 D Tethering: ignore interface down for wlan0
06-27 23:25:18.024  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-27 23:25:18.024  1796  1871 D Tethering: ignore interface down for wlan0
06-27 23:25:18.029  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-27 23:25:18.030  1796  1871 D Tethering: ignore interface down for wlan0
06-27 23:25:18.047  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-27 23:25:18.048  1796  1871 D Tethering: ignore interface down for wlan0
06-27 23:25:18.133  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-27 23:25:18.133  1796  1871 D Tethering: ignore interface down for wlan0
06-27 23:25:18.193  1796  2069 W Tethering: setWifiInuse: false
06-27 23:25:18.193  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: WIFI[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
06-27 23:25:18.414  1796  1857 D Tethering: Tethering wlan0
06-27 23:25:18.483  1796  1857 D Tethering: sendTetherStateChangedBroadcast avail=[] local_only=[] tether=[wlan0] error=[]
06-27 23:25:18.484  1796  1857 D Tethering: Tether Mode requested by name=wlan0 state=TetheredState
06-27 23:25:18.484  1796  1857 V Tethering: TetherMasterSM: enter TetherModeAliveState
06-27 23:25:18.493  1796  1857 I Tethering: [OffloadController] tethering offload disabled
06-27 23:25:18.536  1796  1857 I Tethering: [UpstreamNetworkMonitor] requesting mobile upstream network: NetworkRequest [ NONE id=0, [ Transports: CELLULAR Capabilities: DUN&TRUSTED&NOT_VPN Unwanted: ] ]
06-27 23:25:18.716  1796  1871 D Tethering: interfaceStatusChanged rmnet_data1, true
06-27 23:25:19.157  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: MOBILE[LTE], state: CONNECTED/CONNECTED, reason: (unspecified), extra: bmobile.ne.jp, failover: false, available: true, roaming: false]
06-27 23:25:19.370  1796  1857 E Tethering: [UpstreamNetworkMonitor] ERROR registerMobileNetworkRequest() already registered
06-27 23:25:20.502  1796  1871 D Tethering: interfaceStatusChanged wlan0, true
06-27 23:25:20.519  1796  1871 D Tethering: interfaceStatusChanged wlan0, true
06-27 23:25:29.200  1796  1857 E Tethering: [UpstreamNetworkMonitor] ERROR registerMobileNetworkRequest() already registered
06-27 23:25:39.213  1796  1857 E Tethering: [UpstreamNetworkMonitor] ERROR registerMobileNetworkRequest() already registered
06-27 23:25:49.598  1796  1857 E Tethering: [UpstreamNetworkMonitor] ERROR registerMobileNetworkRequest() already registered

[UpstreamNetworkMonitor] ERROR registerMobileNetworkRequest() already registered

Android ソースコード検索

Android Code Search

  • registerMobileNetworkRequest() already registeredを検索する
  • `packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/UpstreamNetworkMonitor.java

`

  • ソースコードバージョンをandroid-9.0.0_r33に変更
この commit の時点ではファイルが存在しません
選択したファイルは、履歴のこの時点には存在しません。
  • Android Code Search は 2019/12/18 リリースのため、それ以前のコードはキーワード検索しかできないため使いづらいです

AndroidXRef

vy9v2mf

3qJCieX

cr4QkbN

IfV8KoQ

qvMVLM2

94HmkbN

wfs53VZ

fI1Rpmp

KGaqsTf

DChi0lm

public static final String TETHER_DUN_REQUIRED = "tether_dun_required";

TETHER_DUN_REQUIREDのチェックと設定

130|htc_ocndugl:/ $ settings get global tether_dun_required
null
130|htc_ocndugl:/ $ settings put global tether_dun_required 0
130|htc_ocndugl:/ $ logcat -c
htc_ocndugl:/ $ logcat Tethering:* *:S
--------- beginning of system
--------- beginning of main
06-28 00:34:18.527  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-28 00:34:18.527  1796  1871 D Tethering: ignore interface down for wlan0
06-28 00:34:18.530  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-28 00:34:18.530  1796  1871 D Tethering: ignore interface down for wlan0
06-28 00:34:18.532  1796  1871 D Tethering: interfaceStatusChanged wlan0, true
06-28 00:34:18.555  1796  1871 D Tethering: interfaceStatusChanged wlan0, true
06-28 00:34:18.586  1796  2064 W Tethering: setWifiInuse: true
06-28 00:34:19.206  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: MOBILE[LTE], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: bmobile.ne.jp, failover: false, available: true, roaming: false]
06-28 00:34:19.234  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
06-28 00:34:27.108  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-28 00:34:27.109  1796  1871 D Tethering: ignore interface down for wlan0
06-28 00:34:27.109  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-28 00:34:27.110  1796  1871 D Tethering: ignore interface down for wlan0
06-28 00:34:27.114  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-28 00:34:27.115  1796  1871 D Tethering: ignore interface down for wlan0
06-28 00:34:27.137  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-28 00:34:27.137  1796  1871 D Tethering: ignore interface down for wlan0
06-28 00:34:27.248  1796  1871 D Tethering: interfaceStatusChanged wlan0, false
06-28 00:34:27.249  1796  1871 D Tethering: ignore interface down for wlan0
06-28 00:34:27.269  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: WIFI[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
06-28 00:34:27.409  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: MOBILE[LTE], state: CONNECTED/CONNECTED, reason: (unspecified), extra: bmobile.ne.jp, failover: false, available: true, roaming: false]
06-28 00:34:27.411  1796  2069 W Tethering: setWifiInuse: false
06-28 00:34:27.617  1796  1857 D Tethering: Tethering wlan0
06-28 00:34:27.633  1796  1857 D Tethering: sendTetherStateChangedBroadcast avail=[] local_only=[] tether=[wlan0] error=[]
06-28 00:34:27.673  1796  1857 D Tethering: Tether Mode requested by name=wlan0 state=TetheredState
06-28 00:34:27.673  1796  1857 V Tethering: TetherMasterSM: enter TetherModeAliveState
06-28 00:34:27.683  1796  1857 I Tethering: [OffloadController] tethering offload disabled
06-28 00:34:27.688  1796  1857 I Tethering: [UpstreamNetworkMonitor] requesting mobile upstream network: NetworkRequest [ NONE id=0, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN Unwanted: ] ]
06-28 00:34:27.701  1796  1857 I Tethering: Looking for default routes on: {InterfaceName: rmnet_data1 LinkAddresses: [10.56.75.45/30,]  Routes: [0.0.0.0/0 -> 10.56.75.46 rmnet_data1,10.56.75.44/30 -> 0.0.0.0 rmnet_data1,] DnsAddresses: [223.25.162.10,223.25.162.9,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 1500 TcpBufferSizes: 1048576,2097152,10485760,262144,524288,3461120}
06-28 00:34:27.702  1796  1857 I Tethering: Found upstream interface(s): [rmnet_data1]
06-28 00:34:27.708  1796  1857 I Tethering: Looking for default routes on: {InterfaceName: rmnet_data1 LinkAddresses: [10.56.75.45/30,]  Routes: [0.0.0.0/0 -> 10.56.75.46 rmnet_data1,10.56.75.44/30 -> 0.0.0.0 rmnet_data1,] DnsAddresses: [223.25.162.10,223.25.162.9,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 1500 TcpBufferSizes: 1048576,2097152,10485760,262144,524288,3461120}
06-28 00:34:27.708  1796  1857 I Tethering: Found upstream interface(s): [rmnet_data1]
06-28 00:34:27.754  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: MOBILE[LTE], state: CONNECTED/CONNECTED, reason: (unspecified), extra: bmobile.ne.jp, failover: false, available: true, roaming: false]
06-28 00:34:27.756  1796  1857 I Tethering: Looking for default routes on: {InterfaceName: rmnet_data1 LinkAddresses: [10.56.75.45/30,]  Routes: [0.0.0.0/0 -> 10.56.75.46 rmnet_data1,10.56.75.44/30 -> 0.0.0.0 rmnet_data1,] DnsAddresses: [223.25.162.10,223.25.162.9,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 1500 TcpBufferSizes: 1048576,2097152,10485760,262144,524288,3461120}
06-28 00:34:27.756  1796  1857 I Tethering: Found upstream interface(s): [rmnet_data1]
06-28 00:34:27.778  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: MOBILE[LTE], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: bmobile.ne.jp, failover: false, available: true, roaming: false]
06-28 00:34:27.779  1796  1857 I Tethering: Looking for default routes on: {InterfaceName: rmnet_data1 LinkAddresses: [10.56.75.45/30,]  Routes: [0.0.0.0/0 -> 10.56.75.46 rmnet_data1,10.56.75.44/30 -> 0.0.0.0 rmnet_data1,] DnsAddresses: [223.25.162.10,223.25.162.9,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 1500 TcpBufferSizes: 1048576,2097152,10485760,262144,524288,3461120}
06-28 00:34:27.780  1796  1857 I Tethering: Found upstream interface(s): [rmnet_data1]
06-28 00:34:27.782  1796  1857 D Tethering: Tethering got CONNECTIVITY_ACTION: [type: MOBILE[LTE], state: CONNECTED/CONNECTED, reason: (unspecified), extra: bmobile.ne.jp, failover: false, available: true, roaming: false]
06-28 00:34:27.790  1796  1857 I Tethering: Looking for default routes on: {InterfaceName: rmnet_data1 LinkAddresses: [10.56.75.45/30,]  Routes: [0.0.0.0/0 -> 10.56.75.46 rmnet_data1,10.56.75.44/30 -> 0.0.0.0 rmnet_data1,] DnsAddresses: [223.25.162.10,223.25.162.9,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 1500 TcpBufferSizes: 1048576,2097152,10485760,262144,524288,3461120}
06-28 00:34:27.797  1796  1857 I Tethering: Found upstream interface(s): [rmnet_data1]
06-28 00:34:29.699  1796  1871 D Tethering: interfaceStatusChanged wlan0, true
06-28 00:34:29.709  1796  1871 D Tethering: interfaceStatusChanged wlan0, true

まとめ

  • テザリング起動する時、ネットワークレジスターでエラーが発生します
  • ソース検索ツールを使った回避方法の探し方をまとめました
  • アップデート前に前回のネットワーク設定を初期化する必要がありました
  • dnuRequired 関するパラメターを変更すれば、内部の設定を初期化してくれるようです
  • Android SettingsのTETHER_DUN_REQUIREDを0 にすれば、問題を解消することができます
  • adb settings put global tether_dun_required 0
この記事をシェア

弊社では、一緒に会社を面白くしてくれる仲間を募集しています。
お気軽にお問い合わせください!