我正在开发一个音频录制应用程序。它在大多数设备中工作良好,但在Huawei p8(lite)
和Samsung S7
中。
在那些设备(p8 specially
) service stopped and restart
(因为sticky
服务)。前台活动也重新启动,但没有crash or close
。问题是,没有关于崩溃的logcat message
。我试着在foreground
中运行service
,但没有运气。我在崩溃前后发现了以下日志。
服务从MainActivity
启动,当RecordingActivity
在前台时,服务崩溃(5-10分钟后)
10-27 22:15:18.173: D/hw_netstat(3089): total/11828/12216,com.example.recorder/11828/12216
10-27 22:15:18.174: E/HwCHRWebMonitor(3089): getFileResult throw exceptionjava.io.FileNotFoundException: proc/net/wifi_network_stat: open failed: ENOENT (No such file or directory)
10-27 22:15:18.182: D/WifiHW(3089): wifi_command: g_p2p_enabled=0,command=IFNAME=wlan0 SIGNAL_POLL,pthread_mutex_lock begin.
10-27 22:15:18.182: D/WifiHW(3089): wifi_send_command: cmd:'IFNAME=wlan0 SIGNAL_POLL'
10-27 22:15:18.182: D/WifiHW(3089): wifi_send_command enter, cmd=IFNAME=wlan0 SIGNAL_POLL,g_p2p_enabled=0
10-27 22:15:18.183: D/wpa_supplicant(3907): wlan0: Control interface command 'SIGNAL_POLL'
10-27 22:15:18.183: D/WifiHW(3089): wpa_ctrl_request ret=0,reply_len=48
10-27 22:15:18.183: D/WifiHW(3089): wpa_ctrl_request reply=RSSI=-55
10-27 22:15:18.183: D/WifiHW(3089): LINKSPEED=72
10-27 22:15:18.183: D/WifiHW(3089): NOISE=9999
10-27 22:15:18.183: D/WifiHW(3089): FREQUENCY=2422
10-27 22:15:18.183: D/WifiHW(3089): 0��l
10-27 22:15:18.183: D/WifiHW(3089): wifi_command: g_p2p_enabled=0,command=IFNAME=wlan0 SIGNAL_POLL pthread_mutex_unlock ok.
10-27 22:15:18.184: E/WifiConfigStore(3089): updateConfiguration freq=2422 BSSID=e8:de:27:ea:1a:96 RSSI=-54 "TP-LINK_SAHA"WPA_PSK
10-27 22:15:18.184: D/WifiHW(3089): wifi_command: g_p2p_enabled=0,command=IFNAME=wlan0 PKTCNT_POLL,pthread_mutex_lock begin.
10-27 22:15:18.184: D/WifiHW(3089): wifi_send_command: cmd:'IFNAME=wlan0 PKTCNT_POLL'
10-27 22:15:18.184: D/WifiHW(3089): wifi_send_command enter, cmd=IFNAME=wlan0 PKTCNT_POLL,g_p2p_enabled=0
10-27 22:15:18.184: D/wpa_supplicant(3907): wlan0: Control interface command 'PKTCNT_POLL'
10-27 22:15:18.184: D/WifiHW(3089): wpa_ctrl_request ret=0,reply_len=36
10-27 22:15:18.184: D/WifiHW(3089): wpa_ctrl_request reply=TXGOOD=131285
10-27 22:15:18.184: D/WifiHW(3089): TXBAD=0
10-27 22:15:18.184: D/WifiHW(3089): RXGOOD=212440
10-27 22:15:18.184: D/WifiHW(3089):
10-27 22:15:18.184: D/WifiHW(3089): wifi_command: g_p2p_enabled=0,command=IFNAME=wlan0 PKTCNT_POLL pthread_mutex_unlock ok.
10-27 22:15:18.185: D/HuaweiWifiWatchdogStateMachine(3089): LM mrssi=-55
10-27 22:15:18.372: I/ActivityManager(3089): Process com.example.recorder (pid 26678) has died
10-27 22:15:18.374: W/ActivityManager(3089): Scheduling restart of crashed service com.example.recorder/com.example.MyService in 1000ms
10-27 22:15:18.374: I/WindowState(3089): WIN DEATH: Window{c073671 u0 com.example.recorder/com.example.recorder.RecordingActivity}
10-27 22:15:18.374: D/GraphicsStats(3089): Buffer count: 5
10-27 22:15:18.375: D/Sensors(3089): sensors_poll_context_t->activate(handle: 4, enabled: 0)
10-27 22:15:18.376: D/Sensors(3089): ProximitySensor: fd (220 ),flags(0), mEnabled(1),input_sys_path (/sys/class/sensors/ps_sensor/enable)
10-27 22:15:18.376: W/InputDispatcher(3089): channel '1393541 com.example.recorder/com.example.recorder.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
10-27 22:15:18.376: E/InputDispatcher(3089): channel '1393541 com.example.recorder/com.example.recorder.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
10-27 22:15:18.378: E/HsmCoreServiceImpl(3089): onTransact in code is: 102
10-27 22:15:18.379: I/MediaProcessHandler(3089): processOp opType: 1, uid: 10100, pid: 26678
10-27 22:15:18.382: I/WindowState(3089): WIN DEATH: Window{1393541 u0 com.example.recorder/com.example.recorder.MainActivity}
10-27 22:15:18.382: W/InputDispatcher(3089): Attempted to unregister already unregistered input channel '1393541 com.example.recorder/com.example.recorder.MainActivity (server)'
10-27 22:15:18.388: I/APM::AudioPolicyManager(2627): stopInput() input 131
10-27 22:15:18.394: I/audio_hw_primary(2627): do_in_standby standby: 0, in_device: 4
10-27 22:15:18.398: I/ActivityManager(3089): Start proc 27173:com.example.recorder/u0a100 for activity com.example.recorder/.RecordingActivity
10-27 22:15:18.401: I/art(27173): Late-enabling -Xcheck:jni
10-27 22:15:18.413: I/audio_hw_primary(2627): select_devices++ mode[0]
10-27 22:15:18.414: I/audio_hw_primary(2627): output_device_id is 1, output_route is media-earpiece;input_source_id is 0, input_route is null.
实际上日志记录是这样的:
10-27 22:15:18.374: W/ActivityManager(3089): Scheduling restart of crashed service com.example.recorder/com.example.MyService in 1000ms
并不意味着某些Service
实际上由于某些代码缺陷或致命错误而崩溃。它仅仅意味着承载此服务的进程已经死亡。仅此而已。实际原因可能不同:它可能是未处理的java异常(进程中的任何地方,不仅仅是在Service
代码中),一些本机崩溃或进程只是由于任何原因被系统杀死,但通常是为了资源回收。
所以如果你看到这样的消息-不要生气。如果没有关于实际崩溃的消息-没有崩溃。
注:如果你感兴趣,看看这些线条。