【Android源码-PMS】(三)ApplicationInfo类解析

本文详细解析了Android中的ApplicationInfo类,包括其主要成员如taskAffinity、permission、processName等属性,以及如何从AndroidManifest.xml中获取这些信息。此外,还介绍了ApplicationInfo的构造、实现Parcelable接口、相关方法及其在系统中的调用情况,如如何在PackageManagerService中获取和使用ApplicationInfo。
摘要由CSDN通过智能技术生成

注:转载请注明来自Nemo, http://blog.csdn.net/nemo__

一、包名

包名:android.content.pm.ApplicationInfo
父类:android.content.pm.PackageItemInfo
接口:android.os.Parcelable
子类:无

二、概述

Information you can retrieve about a particular application. This corresponds to information collected from the AndroidManifest.xml’s < application > tag.
        ApplicationInfo, 通过它可以得到一个应用基本信息。这些信息是从AndroidManifest.xml的< application >标签获取的。

三、主要成员

public String taskAffinity;
String型, 当前应用所有Activity的默认task密切性。可以参考ActivityInfo的taskAffinity,从”android:taskAffinity“属性得到。具体taskAffinity是怎么影响到Activity在task的启动, 后面会在Activity启动模式中细讲。

public String permission;
String型, 可选项,访问当前应用所有组件需要声明的权限,从”android:permission“属性得到。

public String processName;
String型, 从”android:process“属性得到,注明应用运行的进程名。或不设置则默认为应用包名。

public String className;
String型, 从”android:class“属性得到,应用实现的Application类的类名。

public int descriptionRes;
int型, 从”android:description“属性得到,对Application组件的描述。若不设置则为0。

public int theme;
int型, 从”android:theme“属性得到,注明应用的主题。若不设置则为0。

public String manageSpaceActivityName;
String型, 从”android:manageSpaceActivity“属性得到,用于指定一个Activity来管理数据,它最终会出现在设置->应用程序管理中,默认为按钮为”清除数据”,指定此属性后,该按钮可点击跳转到该Activity, 让用户选择性清除哪些数据。若不设置则为null.

public String backupAgentName;
String型, 从”android:backupAgent“属性得到,Android原生的备份引擎BackupManagerService在应用端的实现类,是backupAgent的子类。默认不会由系统备份,若”android:allowBackup“值为false, 则该属性设置无效。

public int fullBackupContent = 0;
int型, 可选项,注明应用是否支持自动备份。

public int uiOptions = 0;
int型, 为应用内所有Activity设置的默认UI选项,可选值为"none", "splitActionBarWhenNarrow"

public int flags = 0;
int型, 应用manifest中设置的各项属性的按位或的组合, 共31个:

manifest FLAG value
==system/app== FLAG_SYSTEM 1<<0
android:debuggable FLAG_DEBUGGABLE 1<<1
android:hasCode FLAG_HAS_CODE 1<<2
android:persistent FLAG_PERSISTENT 1<< 3
==factory test mode== FLAG_FACTORY_TEST 1<<4
android:allowTaskReparenting FLAG_ALLOW_TASK_REPARENTING 1<<5
android:allowClearUserData FLAG_ALLOW_CLEAR_USER_DATA 1<<6
==an update to a built-in== FLAG_UPDATED_SYSTEM_APP 1<<7
android:testOnly FLAG_TEST_ONLY 1<<8
android: smallScreens FLAG_SUPPORTS_SMALL_SCREENS 1<<9
android:normalScreens FLAG_SUPPORTS_NORMAL_SCREENS 1<<10
android:largeScreens FLAG_SUPPORTS_LARGE_SCREENS 1<<11
android:resizeable FLAG_RESIZEABLE_FOR_SCREENS 1<<12
android:anyDensity FLAG_SUPPORTS_SCREEN_DENSITIES 1<<13
android:vmSafeMode FLAG_VM_SAFE_MODE 1<<14
android:allowBackup FLAG_ALLOW_BACKUP 1<<15
android:killAfterRestore FLAG_KILL_AFTER_RESTORE 1<<16
android:restoreAnyVersion FLAG_RESTORE_ANY_VERSION 1<<17
==installed on removable storage== FLAG_EXTERNAL_STORAGE 1<<18
android:xlargeScreens FLAG_SUPPORTS_XLARGE_SCREENS 1<<19
android:largeHeap FLAG_LARGE_HEAP 1<<20
==package in stopped state== FLAG_STOPPED 1<<21
==support RTL(right to left)== FLAG_SUPPORTS_RTL 1<<22
==is currently installed== FLAG_INSTALLED 1<<23
==only data installed== FLAG_IS_DATA_ONLY 1<<24
==declared to be a game== FLAG_IS_GAME 1<<25
==full-data streaming backups== FLAG_FULL_BACKUP_ONLY 1<<26
android:usesCleartextTraffic FLAG_USES_CLEARTEXT_TRAFFIC 1<<27
==set installer extracts native libs from .apk files== FLAG_EXTRACT_NATIVE_LIBS 1<<28
==hardware accelerated== FLAG_HARDWARE_ACCELERATED 1<<29
==support multiple instruction sets== FLAG_MULTIARCH 1<< 31

public String sourceDir;
String型, 应用APK的全路径。

public String publicSourceDir;
String型, sourceDir公开可访问的部分。被

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值