`
OliveExcel
  • 浏览: 70540 次
文章分类
社区版块
存档分类
最新评论

Android系统中STOPPED应用无法接收广播的研究

阅读更多

之前写过一篇文章: 

Android 3.1后, 新安装的以及用户强行停止的apk, 无法监听广播的问题

 

今天终于研究了一下原理, 把代码执行逻辑贴上来:

ContextImpl.sendBroadcast()
    ActivityManagerNative.getDefault().broadcastIntent()
        ActivityManagerService.broadcastIntent()
            ActivityManagerService.broadcastIntentLocked()
                ActivityManagerService.collectReceiverComponents()
                    PackageManagerService.queryIntentReceivers()
                        PackageManagerService.ActivityIntentResolver.queryIntentForPackage()
                            IntentResolver.queryIntentFromList()
                                IntentResolver.buildResolveList()
                                    PackageManagerService.ActivityIntentResolver.isFilterStopped()
                                        return (ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0 && ps.getStopped(userId);

 

结论: 

只有非STOPPED状态的应用, 以及系统应用, 可以接收到Intent中不包含FLAG_INCLUDE_STOPPED_PACKAGES的广播.

分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

    Android应用源码之KeyChain.zip

    源码参考,欢迎下载

    Android代码-jitsi-android

    The development of Jitsi for Android has been stopped in early 2015. Issues and Pull Requests will not be addressed. Jitsi for Android Jitsi for Android is an Android port of the Jitsi project: The ...

    Android代码-ForceStopGB

    Android 3.1 introduces Launch controls on stopped applications. However, there are no such features on android 2.3, some 4.X devices didn't implement it well. Furthermore, there are some way for apps ...

    Android acitivity &Intent;

    如果一个Activity是Paused或者Stopped状态,系统可以将该Activity从内存中删除,Android系统采用两种方式进行删除,要么要求该Activity结束,要么直接终止它的进程。当该Activity再次显示给用户时,它必须重新开始和...

    adb1.0.26包含fastboot.exe

    注意这个状态并不能标识 Android 系统已经完全启动和可操作,在设备启动过程中设备实例就可连接到 adb,但启动完毕后系统才处于可操作状态。 no device —— 没有设备/模拟器连接。 以上输出显示当前已经连接了...

    AndroidLogger V1.1.1

    ->(5) Some shell cmd, within 6's no output, will cause the shell cmd stopped! 4. Support capture device screenshot, now just save at d:\device.bmp [NOTE] Compatible with Notepad++ 6.5 later version ...

    Linux下如何查杀stopped进程详解

    主要给大家介绍了关于Linux下如何查杀stopped进程的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用linux系统具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

    嵌入式系统/ARM技术中的Android的公开引发混乱,谷歌需适当封闭

    Android以Java为编程语言,从接口到功能,都有...如果运行中的 Activity 全部画面被其他 Activity 取代时,该 Activity 便被停止(stopped),甚至被系统清除(kill)。  Android是基于Linux开放性内核的操作系统,是G

    20210222-中金公司-海外策略:GameStop事件,Game_Stopped?.pdf

    20210222-中金公司-海外策略:GameStop事件,Game_Stopped?.pdf

    Android中程序的停止状态详细介绍

    很多人遇到过广播收不到的问题,比如Google Play推广安装广播没有收到等,诸如这些问题,又都是什么原因呢,这篇文章将进行回答. 从Android 3.1(HoneyComb) 也就是API 12开始,Android引入了一套新的启动控制,这就是程序...

    海外策略:GameStop事件,Game_Stopped?.rar

    海外策略:GameStop事件,Game_Stopped?

    (Weberdo) Play Service Info APK android app

    (Weberdo) Play Service Info APK android app 2017-07 用于检测安卓手机上安装Google Play Service的情况和版本。并提供了安装Play Service的指引和下载链接。 Small utility app to quickly check the status of ...

    Android代码-CustomActivityOnCrash

    This library allows launching a custom activity when the app crashes, instead of showing the hated "Unfortunately, X has stopped" dialog. How to use One-step install Add the following dependency to ...

    Android中的Activity生命周期总结

    上图是从Android官网截下的Activity的生命周期流程图,结构非常清晰,它描述了Activity在其生命周期中所有可能发生的情况以及发生的先后顺序,下面就将结合此图详细介绍一下Activity的生命周期。 Activity四大基本...

    Android的公开引发混乱,谷歌需适当封闭

    Android以Java为编程语言,从接口到功能,都有...如果运行中的 Activity 全部画面被其他 Activity 取代时,该 Activity 便被停止(stopped),甚至被系统清除(kill)。  Android是基于Linux开放性内核的操作系统,是G

    Adaptive-Dereverberation-Algorithm-master_stopped8qm_混响_dereverb

    Adaptive-Dereverberation-Algorithm-master_stopped8qm_混响_dereverb

    实例讲解Android应用开发中Fragment生命周期的控制

    如果Activity是stopped状态,这个Activity中所有的Fragment都不能被启动;如果Activity被销毁,那么它其中的所有Fragment都会被销毁。 但是,当Activity在活动状态,可以独立控制Fragment的状态,比如加上或者移除...

    海外策略:GameStop事件,Game_Stopped?-20210222-中金公司-22页.pdf

    海外策略:GameStop事件,Game_Stopped?-20210222-中金公司-22页.pdf

    Android代码-可以用于音频的波形效果

    The animation becomes intense when music plays, and once it is paused or stopped – waves calm down. The library is a part of implementation of music player. Great visualization can spruce up any ...

Global site tag (gtag.js) - Google Analytics