比如我要看手机热点的信息,手机热点属于connectivity服务。
adb shell dumpsys connectivity
截取的热点部分的dump信息。主要看热点状态:
Tethering:
Configuration:
tetherableUsbRegexs: [usb\d, rndis\d]
tetherableWifiRegexs: [wigig0, wlan0]
tetherableBluetoothRegexs: [bnep\d, bt-pan]
isDunRequired: false
chooseUpstreamAutomatically: false
preferredUpstreamIfaceTypes: [ETHERNET, MOBILE, WIFI, MOBILE_HIPRI, BLUETOOTH]
dhcpRanges: [192.168.42.2, 192.168.42.254, 192.168.43.2, 192.168.43.254, 192.168.44.2, 192.168.44.254, 192.168.45.2, 192.168.45.254, 192.168.46.2, 192.168.46.254, 192.168.47.2, 192.168.47.254, 192.168.48.2, 192.168.48.254, 192.168.49.2, 192.168.49.254, 192.168.50.2, 192.168.50.254, 192.168.51.2, 192.168.51.254]
defaultIPv4DNS: [8.8.4.4, 8.8.8.8]
provisioningApp: []
provisioningAppNoUi:
Tether state:
wlan0 - LocalHotspotState - lastError = 0
Upstream wanted: false
Current upstream interface(s): null
Hardware offload:
Offload HALs not started
Current upstream: null
Exempt prefixes: [ff00::/8, 192.168.49.0/24, 127.0.0.0/8, 169.254.0.0/16, fe80::/64, fc00::/7, ::/3]
NAT timeout update callbacks received during the last offload session: 0
NAT timeout update netlink errors during the last offload session: 0
Tethering.java中的dump()函数部分内容。主要看状态:
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
// Binder.java closes the resource for us.
@SuppressWarnings("resource")
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
pw.println("Tethering:");
pw.increaseIndent();
pw.println("Configuration:");
pw.increaseIndent();
final TetheringConfiguration cfg = mConfig;
cfg.dump(pw);
pw.decreaseIndent();
synchronized (mPublicSync) {
pw.println("Tether state:");
pw.increaseIndent();
for (int i = 0; i < mTetherStates.size(); i++) {
final String iface = mTetherStates.keyAt(i);
final TetherState tetherState = mTetherStates.valueAt(i);
pw.print(iface + " - ");
switch (tetherState.lastState) {
case IControlsTethering.STATE_UNAVAILABLE:
pw.print("UnavailableState");
break;
case IControlsTethering.STATE_AVAILABLE:
pw.print("AvailableState");
break;
case IControlsTethering.STATE_TETHERED:
pw.print("TetheredState");
break;
case IControlsTethering.STATE_LOCAL_ONLY:
pw.print("LocalHotspotState");
break;
default:
pw.print("UnknownState");
break;
}
pw.println(" - lastError = " + tetherState.lastError);
}
pw.println("Upstream wanted: " + upstreamWanted());
pw.println("Current upstream interface(s): " + mCurrentUpstreamIfaceSet);
pw.decreaseIndent();
}
ts@ts-OptiPlex-3020:~$ adb shell service list
下面就是获得所有的服务。
Found 159 services:
0 sip: [android.net.sip.ISipService]
1 com.qualcomm.location.izat.IzatService: [com.qti.izat.IIzatService]
2 dpmservice: [com.qti.dpm.IDpmService]
3 felica: [com.felicanetworks.felica.IFelicaAdapter]
4 nfc: [android.nfc.INfcAdapter]
5 secure_element: [android.se.omapi.ISecureElementService]
6 qti.ims.ext: [org.codeaurora.ims.internal.IQtiImsExt]
7 carrier_config: [com.android.internal.telephony.ICarrierConfigLoader]
8 phone: [com.android.internal.telephony.ITelephony]
9 extphone: [org.codeaurora.internal.IExtTelephony]
10 isms: [com.android.internal.telephony.ISms]
11 iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
12 simphonebook: [com.android.internal.telephony.IIccPhoneBook]
13 isub: [com.android.internal.telephony.ISub]
14 telecom: [com.android.internal.telecom.ITelecomService]
15 cneservice: [com.quicinc.cne.ICNEManager]
16 FjMsgTransitServer: [com.fujitsu.mobile_phone.fjserver.IFjMsgTransitServer]
17 mdlogctld: []
18 contexthub: [android.hardware.location.IContextHubService]
19 netd_listener: [android.net.metrics.INetdEventListener]
20 connmetrics: [android.net.IIpConnectivityMetrics]
21 bluetooth_manager: [android.bluetooth.IBluetoothManager]
22 autofill: [android.view.autofill.IAutoFillManager]
23 imms: [com.android.internal.telephony.IMms]
24 statscompanion: [android.os.IStatsCompanionService]
25 media.camera.proxy: [android.hardware.ICameraServiceProxy]
26 slice: [android.app.slice.ISliceManager]
27 media_projection: [android.media.projection.IMediaProjectionManager]
28 crossprofileapps: [android.content.pm.ICrossProfileApps]
29 launcherapps: [android.content.pm.ILauncherApps]
30 shortcut: [android.content.pm.IShortcutService]
31 fingerprint: [android.hardware.fingerprint.IFingerprintService]
32 media_router: [android.media.IMediaRouterService]
33 media_resource_monitor: [android.media.IMediaResourceMonitor]
34 media_session: [android.media.session.ISessionManager]
35 restrictions: [android.content.IRestrictionsManager]
36 companiondevice: [android.companion.ICompanionDeviceManager]
37 print: [android.print.IPrintManager]
38 graphicsstats: [android.view.IGraphicsStats]
39 dreams: [android.service.dreams.IDreamManager]
40 commontime_management: []
41 network_time_update_service: []
42 diskstats: []
43 voiceinteraction: [com.android.internal.app.IVoiceInteractionManagerService]
44 appwidget: [com.android.internal.appwidget.IAppWidgetService]
45 backup: [android.app.backup.IBackupManager]
46 trust: [android.app.trust.ITrustManager]
47 soundtrigger: [com.android.internal.app.ISoundTriggerService]
48 jobscheduler: [android.app.job.IJobScheduler]
49 overlay: [android.content.om.IOverlayManager]
50 hardware_properties: [android.os.IHardwarePropertiesManager]
51 serial: [android.hardware.ISerialManager]
52 usb: [android.hardware.usb.IUsbManager]
53 midi: [android.media.midi.IMidiManager]
54 DockObserver: []
55 audio: [android.media.IAudioService]
56 wallpaper: [android.app.IWallpaperManager]
57 search: [android.app.ISearchManager]
58 country_detector: [android.location.ICountryDetector]
59 location: [android.location.ILocationManager]
60 devicestoragemonitor: []
61 notification: [android.app.INotificationManager]
62 updatelock: [android.os.IUpdateLock]
63 system_update: [android.os.ISystemUpdateManager]
64 servicediscovery: [android.net.nsd.INsdManager]
65 connectivity: [android.net.IConnectivityManager]
66 ethernet: [android.net.IEthernetManager]
67 wifip2p: [android.net.wifi.p2p.IWifiP2pManager]
68 wifiscanner: [android.net.wifi.IWifiScanner]
69 wifi: [android.net.wifi.IWifiManager]
70 netpolicy: [android.net.INetworkPolicyManager]
71 netstats: [android.net.INetworkStatsService]
72 network_score: [android.net.INetworkScoreService]
73 textclassification: [android.service.textclassifier.ITextClassifierService]
74 textservices: [com.android.internal.textservice.ITextServicesManager]
75 ipsec: [android.net.IIpSecService]
76 network_management: [android.os.INetworkManagementService]
77 clipboard: [android.content.IClipboard]
78 statusbar: [com.android.internal.statusbar.IStatusBarService]
79 device_policy: [android.app.admin.IDevicePolicyManager]
80 deviceidle: [android.os.IDeviceIdleController]
81 persistent_data_block: [android.service.persistentdata.IPersistentDataBlockService]
82 oem_lock: [android.service.oemlock.IOemLockService]
83 lock_settings: [com.android.internal.widget.ILockSettings]
84 uimode: [android.app.IUiModeManager]
85 storagestats: [android.app.usage.IStorageStatsManager]
86 mount: [android.os.storage.IStorageManager]
87 accessibility: [android.view.accessibility.IAccessibilityManager]
88 FC: [android.os.IFCService]
89 input_method: [com.android.internal.view.IInputMethodManager]
90 pinner: []
91 network_watchlist: [com.android.internal.net.INetworkWatchlistManager]
92 vrmanager: [android.service.vr.IVrManager]
93 input: [android.hardware.input.IInputManager]
94 window: [android.view.IWindowManager]
95 alarm: [android.app.IAlarmManager]
96 consumer_ir: [android.hardware.IConsumerIrService]
97 vibrator: [android.os.IVibratorService]
98 dropbox: [com.android.internal.os.IDropBoxManagerService]
99 settings: []
100 fjsettings: []
101 content: [android.content.IContentService]
102 account: [android.accounts.IAccountManager]
103 telephony.registry: [com.android.internal.telephony.ITelephonyRegistry]
104 scheduling_policy: [android.os.ISchedulingPolicyService]
105 sec_key_att_app_id_provider: [android.security.keymaster.IKeyAttestationApplicationIdProvider]
106 binder_calls_stats: []
107 webviewupdate: [android.webkit.IWebViewUpdateService]
108 usagestats: [android.app.usage.IUsageStatsManager]
109 batteryproperties: [android.os.IBatteryPropertiesRegistrar]
110 battery: []
111 sensorservice: [android.gui.SensorServer]
112 media.sound_trigger_hw: [android.hardware.ISoundTriggerHwService]
113 media.audio_policy: [android.media.IAudioPolicyService]
114 media.camera: [android.hardware.ICameraService]
115 processinfo: [android.os.IProcessInfoService]
116 permission: [android.os.IPermissionController]
117 cpuinfo: []
118 dbinfo: []
119 gfxinfo: []
120 meminfo: []
121 procstats: [com.android.internal.app.procstats.IProcessStats]
122 activity: [android.app.IActivityManager]
123 user: [android.os.IUserManager]
124 otadexopt: [android.content.pm.IOtaDexopt]
125 package_native: [android.content.pm.IPackageManagerNative]
126 package: [android.content.pm.IPackageManager]
127 display: [android.hardware.display.IDisplayManager]
128 recovery: [android.os.IRecoverySystem]
129 power: [android.os.IPowerManager]
130 appops: [com.android.internal.app.IAppOpsService]
131 batterystats: [com.android.internal.app.IBatteryStats]
132 device_identifiers: [android.os.IDeviceIdentifiersPolicyService]
133 kitSettings: [com.fujitsu.mobile_phone.android.os.IKitSettingsManager]
134 kitting: [com.fujitsu.mobile_phone.android.os.IKittingManager]
135 acm: [com.fujitsu.mobilephone.facm.IAccessControlManager]
136 gpu: [android.ui.IGpuService]
137 SurfaceFlinger: [android.ui.ISurfaceComposer]
138 media.extractor.update: [android.media.IMediaExtractorUpdateService]
139 media.extractor: [android.media.IMediaExtractorService]
140 perfprofd: [android.os.IPerfProfd]
141 android.service.gatekeeper.IGateKeeperService: [android.service.gatekeeper.IGateKeeperService]
142 media.metrics: [android.media.IMediaAnalyticsService]
143 wificond: [android.net.wifi.IWificond]
144 stats: [android.os.IStatsManager]
145 drm.drmManager: [drm.IDrmManagerService]
146 media.resource_manager: [android.media.IResourceManagerService]
147 media.player: [android.media.IMediaPlayerService]
148 vendor.perfservice: [com.qualcomm.qti.IPerfManager]
149 android.security.keystore: [android.security.IKeystoreService]
150 storaged_pri: [android.os.storaged.IStoragedPrivate]
151 storaged: [android.os.IStoraged]
152 incident: [android.os.IIncidentManager]
153 media.drm: [android.media.IMediaDrmService]
154 installd: [android.os.IInstalld]
155 media.audio_flinger: [android.media.IAudioFlinger]
156 thermalservice: [android.os.IThermalService]
157 netd: [android.net.INetd]
158 vold: [android.os.IVold]
关注公众号,获取更多开发必备知识