我有一个用于android.intent.action.SIM_STATE_CHANGED的广播接收器,并且我假设每次sim状态更改时都会调用此接收器。一些较早的帖子here
也证实了这一点但是我在Android P中观察到的是,每次调用此接收器时,我的应用程序进程都会被OS杀死。
01-01 01:01:06.764 1020 1064 I am_proc_start: [0,3334,10036,com.testapp,broadcast,com.testapp/.receivers.SIMBroadcastReceiver]
01-01 01:01:06.764 1020 1064 I am_proc_start: [0,3334,10036,com.testapp,broadcast,com.testapp/.receivers.SIMBroadcastReceiver]
01-01 01:01:06.764 1020 1064 I ActivityManager: Start proc 3334:com.testapp/u0a36 for broadcast com.testapp/.receivers.SIMBroadcastReceiver
01-01 01:01:06.764 1020 1064 I ActivityManager: Start proc 3334:com.testapp/u0a36 for broadcast com.testapp/.receivers.SIMBroadcastReceiver
01-01 01:01:06.878 1020 1988 I am_proc_bound: [0,3334,com.testapp]
01-01 01:01:07.269 1020 1045 D PowerManagerService: acquireWakeLockInternal: lock=11990847, flags=0x1, tag="fiid-sync", ws=null, uid=10036, pid=3334, packageName=com.testapp
01-01 01:01:07.282 1020 1045 D PowerManagerService: releaseWakeLockInternal: lock=11990847 [fiid-sync], flags=0x0,packageName=com.testapp, total_time=11ms
01-01 01:01:09.021 1020 1988 I sysui_multi_action: [757,856,758,1,806,com.testapp,857,channel_services_updates,858,3]
01-01 01:01:09.025 1020 1988 I sysui_multi_action: [757,856,758,1,806,com.testapp,857,channel_push_custom_content,858,4]
01-01 01:01:09.030 1020 1988 I sysui_multi_action: [757,856,758,1,806,com.testapp,857,channel_app_installations,858,2]
01-01 01:01:12.543 1020 2486 I ActivityManager: Killing 3334:com.testapp/u0a36 (adj 906): empty #9
01-01 01:01:12.543 1020 2486 I am_kill : [0,3334,com.testapp,906,empty #9]
01-01 01:01:12.911 1020 2486 I am_proc_died: [0,3334,com.testapp,906,18]
从事件am_kill和am_proc_died可以看出。这两个事件甚至都不允许调用onReceive()方法。
这在android P中一直在发生。