四川铁科建设监理公司网站怎样建设一个公司网站
web/
2025/10/9 10:05:39/
文章来源:
四川铁科建设监理公司网站,怎样建设一个公司网站,网站维护中怎么解决,c 网站做微信收款功能一、ActivityManagerService提供的主要功能#xff1a;(1)统一调度各应用程序的Activity(2)内存管理(3)进程管理二、启动一个Activity的方式有以下几种#xff1a;(1)在应用程序中调用startActivity启动指定的Activity(2)在Home程序中单击一个应用图标#xff0c;启动新的Ac…一、ActivityManagerService提供的主要功能(1)统一调度各应用程序的Activity(2)内存管理(3)进程管理二、启动一个Activity的方式有以下几种(1)在应用程序中调用startActivity启动指定的Activity(2)在Home程序中单击一个应用图标启动新的Activity(3)按“Back”键结束当前Activity返回到上一个Activity(4)长按“Home”键显示出当前正在运行的程序列表从中选择一个启动这四种启动方式的主体处理流程都会按照第一种启动方式运行后面三种方式只是在前端消息处理上各有不同。三、进程数据类ProcessRecord该类的源代码在~\frameworks\base\services\java\com\android\server\am路径下。一般情况下一个APK文件运行时会对应一个进程ProcessRecord用来记录一个进程中的相关信息主要包含的变量有(1)进程文件信息与该进程对应的APK文件的内部信息如final ApplicationInfo info; // all about the first app in the processfinal String processName; // name of the processfinal ArrayMap pkgList new ArrayMap(); //保存进程中所有APK文件包名(2)进程的内存状态信息用于Linux系统的out of memory(OOM)情况的处理当发生内存紧张时Linux系统会根据进程的内存状态信息杀掉低优先级的进程包括的变量有int maxAdj; // Maximum OOM adjustment for this processint curRawAdj; // Current OOM unlimited adjustment for this processint setRawAdj; // Last set OOM unlimited adjustment for this processint curAdj; // Current OOM adjustment for this processint setAdj; // Last set OOM adjustment for this process变量中Adj的含义是调整值(adjustment)(3)进程中包含的Activity、Provider、Service等如下final ArrayList activities new ArrayList();final ArraySet services new ArraySet();final ArraySet executingServices new ArraySet();final ArraySet connections new ArraySet();final ArraySet receivers new ArraySet();final ArrayMappubProviders new ArrayMapContentProviderRecord();final ArrayList conProviders new ArrayList();四、ActivityRecord数据类(Android 2.3以前版本叫HistoryRecord类)ActivityManagerService使用ActivityRecord数据类来保存每个Activity的信息ActivityRecord类基于IApplicationToken.Stub类也是一个Binder,所以可以被IPC调用。主要包含的变量有(1)环境信息Activity的工作环境比如进程名称、文件路径、数据路径、图标、主题等这些信息一般是固定的比如以下变量final String packageName; // the package implementing intents componentfinal String processName; // process where this component wants to runfinal String baseDir; // where activity source (resources etc) locatedfinal String resDir; // where public activity source (public resources etc) locatedfinal String dataDir; // where activity data should goint theme; // resource identifier of activitys theme.int realTheme; // actual theme resource we will use, never 0.(2)运行状态数据信息如idle、stop、finishing等一般为boolean类型如下boolean haveState; // have we gotten the last activity state?boolean stopped; // is activity pause finished?boolean delayedResume; // not yet resumed because of stopped app switches?boolean finishing; // activity in pending finish list?boolean configDestroy; // need to destroy due to config change?五、TaskRecord类ActivityManagerService中使用任务的概念来确保Activity启动和退出的顺序。TaskRecord中的几个重要变量如下final int taskId; // 每个任务的标识.Intent intent; // 创建该任务时对应的intentint numActivities; //该任务中的Activity数目final ArrayList mActivities new ArrayList(); //按照出现的先后顺序列出该任务中的所有Activity六、ActivityManagerService中一些重要的与调度相关的变量(1)记录最近启动的Activity如果RAM容量较小则记录的最大值为10个否则为20个超过该值后Ams会舍弃最早记录的Activitystatic final int MAX_RECENT_TASKS ActivityManager.isLowRamDeviceStatic() ? 10 : 20;(2)当Ams通知应用程序启动(Launch)某个Activity时如果超过10sAms就会放弃static final int PROC_START_TIMEOUT 10*1000;(3)当Ams启动某个客户进程后客户进程必须在10s之内报告Ams自己已经启动否则Ams会认为指定的客户进程不存在static final int PROC_START_TIMEOUT 10*1000;(4)等待序列当Ams内部还没有准备好时如果客户进程请求启动某个Activity那么会被暂时保存到该变量中final ArrayList mPendingActivityLaunches new ArrayList();(5)优先启动其次再停止。进程A1包含两个Activity启动顺序为A1-A2当用户请求启动A2时如果A1正在运行Ams会先暂停A1然后启动A2当A2启动后再停止A1。private final ArrayList mRecentTasks new ArrayList();七、startActivity()的流程当用户单击某个应用图标后执行程序会在该图标的onClick()事件中调用startActivity()方法该方法会调用startActivityForResult()在这个方法内部会调用Instrumentation对象的executeStartActivity()方法每个Activity内部都有一个Instrumentation对象的引用它就是一个管家ActivityThread要创建或者暂停某个Activity都是通过它实现的。流程图如下所示下面附上ActivityManagerService的完整源代码有兴趣的童鞋可以深入研究。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/89575.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!