每次启动新的调试实例时,我的辅助功能服务都会重置为禁用状态.
是否有任何方法可以在连续的调试运行中保持启用(因为每次启用调试服务都很长很无聊)?
我在真实设备和模拟器上有相同的行为.
服务中没有异常,我在事件处理程序中尝试了没有代码的事件.
我的日志中有可疑的行:
10:47:32.801 31669-31669/? E/AffinityControl: AffinityControl: registerfunction enter 10:47:32.821 3650-3690/? I/ActivityManager: Force stopping com.test.testaccessibilityservice appid=10241 user=0: from pid 31669 10:47:32.821 3650-3690/? I/ActivityManager: Killing 31271:com.test.testaccessibilityservice/u0a241 (adj 1): stop com.test.testaccessibilityservice cause from pid 10:47:32.821 3650-3690/? W/ActivityManager: Scheduling restart of crashed service com.test.testaccessibilityservice/.MyAccessibilityService in 1000ms 10:47:32.821 3650-3690/? I/ActivityManager: Force stopping service ServiceRecord{3f5e1fc4 u0 com.test.testaccessibilityservice/.MyAccessibilityService}
因此服务被强制停止并且从未重新启动.
笔记:
如果我重新启动手机,则启动该服务.
我对ApiDemos示例和ClockBackService(QueryBackService)也有相同的行为:
18:07:15.871 3523-4251/? I/ActivityManager: Force stopping com.example.android.apis appid=10242 user=0: from pid 19382 18:07:15.871 3523-4251/? I/ActivityManager: Killing 16542:com.example.android.apis/u0a242 (adj 1): stop com.example.android.apis cause from pid 19382 18:07:15.871 3523-4251/? W/ActivityManager: Scheduling restart of crashed service com.example.android.apis/.accessibility.ClockBackService in 1000ms 18:07:15.871 3523-4251/? I/ActivityManager: Force finishing activity 3 ActivityRecord{2f907c7b u0 com.example.android.apis/.ApiDemos t8248} 18:07:15.881 3523-4251/? I/ActivityManager: Force finishing activity 3 ActivityRecord{190ca05c u0 com.example.android.apis/.ApiDemos t8248} 18:07:15.881 3523-4251/? I/ActivityManager: Force finishing activity 3 ActivityRecord{27ada6e8 u0 com.example.android.apis/.accessibility.ClockBackActivity t8248} 18:07:15.881 3523-4251/? I/ActivityManager: Force finishing activity 3 ActivityRecord{51f4c32 u0 com.android.settings/.Settings$AccessibilitySettingsActivity t8248} 18:07:15.881 3523-4251/? I/ActivityManager: Force stopping service ServiceRecord{113bf024 u0 com.example.android.apis/.accessibility.ClockBackService} 18:07:15.891 19382-19382/? D/AndroidRuntime: Shutting down VM
我试图通过覆盖onStartCommand而不做任何更改来返回START_STICKY.
它对这个尚未解决的问题非常封闭如何调试辅助功能服务?,但在我的情况下,该服务显示为禁用,我不需要停止它并再次启动它.
我在AOSP上填写了这个错误报告.