移动开发最新Android 的manifest解析(1),Android程序员春招三面蚂蚁金服

最后

Android学习是一条漫长的道路,我们要学习的东西不仅仅只有表面的 技术,还要深入底层,弄明白下面的 原理,只有这样,我们才能够提高自己的竞争力,在当今这个竞争激烈的世界里立足。

人生不可能一帆风顺,有高峰自然有低谷,要相信,那些打不倒我们的,终将使我们更强大,要做自己的摆渡人。

资源持续更新中,欢迎大家一起学习和探讨。

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  1. public ActivityInfo[] activities;

  2. /**

  3. * Array of all {@link android.R.styleable#AndroidManifestReceiver

  4. * } tags included under ,

  5. * or null if there were none.  This is only filled in if the flag

  6. * {@link PackageManager#GET_RECEIVERS} was set.

  7. */

  8. public ActivityInfo[] receivers;

  9. /**

  10. * Array of all {@link android.R.styleable#AndroidManifestService

  11. * } tags included under ,

  12. * or null if there were none.  This is only filled in if the flag

  13. * {@link PackageManager#GET_SERVICES} was set.

  14. */

  15. public ServiceInfo[] services;

  16. /**

  17. * Array of all {@link android.R.styleable#AndroidManifestProvider

  18. * } tags included under ,

  19. * or null if there were none.  This is only filled in if the flag

  20. * {@link PackageManager#GET_PROVIDERS} was set.

  21. */

  22. public ProviderInfo[] providers;

  23. /**

  24. * Array of all {@link android.R.styleable#AndroidManifestInstrumentation

  25. * } tags included under ,

  26. * or null if there were none.  This is only filled in if the flag

  27. * {@link PackageManager#GET_INSTRUMENTATION} was set.

  28. */

  29. public InstrumentationInfo[] instrumentation;

  30. /**

  31. * Array of all {@link android.R.styleable#AndroidManifestPermission

  32. * } tags included under ,

  33. * or null if there were none.  This is only filled in if the flag

  34. * {@link PackageManager#GET_PERMISSIONS} was set.

  35. */

  36. public PermissionInfo[] permissions;

  37. /**

  38. * Array of all {@link android.R.styleable#AndroidManifestUsesPermission

  39. * } tags included under ,

  40. * or null if there were none.  This is only filled in if the flag

  41. * {@link PackageManager#GET_PERMISSIONS} was set.  This list includes

  42. * all permissions requested, even those that were not granted or known

  43. * by the system at install time.

  44. */

  45. public String[] requestedPermissions;

  46. /**

  47. * Array of flags of all {@link android.R.styleable#AndroidManifestUsesPermission

  48. * } tags included under ,

  49. * or null if there were none.  This is only filled in if the flag

  50. * {@link PackageManager#GET_PERMISSIONS} was set.  Each value matches

  51. * the corresponding entry in {@link #requestedPermissions}, and will have

  52. * the flags {@link #REQUESTED_PERMISSION_REQUIRED} and

  53. * {@link #REQUESTED_PERMISSION_GRANTED} set as appropriate.

  54. */

  55. public int[] requestedPermissionsFlags;

  56. /**

  57. * Flag for {@link #requestedPermissionsFlags}: the requested permission

  58. * is required for the application to run; the user can not optionally

  59. * disable it.  Currently all permissions are required.

  60. */

  61. public static final int REQUESTED_PERMISSION_REQUIRED = 1<<0;

  62. /**

  63. * Flag for {@link #requestedPermissionsFlags}: the requested permission

  64. * is currently granted to the application.

  65. */

  66. public static final int REQUESTED_PERMISSION_GRANTED = 1<<1;

  67. /**

  68. * Array of all signatures read from the package file.  This is only filled

  69. * in if the flag {@link PackageManager#GET_SIGNATURES} was set.

  70. */

  71. public Signature[] signatures;

  72. /**

  73. * Application specified preferred configuration

  74. * {@link android.R.styleable#AndroidManifestUsesConfiguration

  75. * } tags included under ,

  76. * or null if there were none. This is only filled in if the flag

  77. * {@link PackageManager#GET_CONFIGURATIONS} was set.

  78. */

  79. public ConfigurationInfo[] configPreferences;

  80. /**

  81. * The features that this application has said it requires.

  82. */

  83. public FeatureInfo[] reqFeatures;

  84. /**

  85. * Constant corresponding to auto in

  86. * the {@link android.R.attr#installLocation} attribute.

  87. * @hide

  88. */

  89. public static final int INSTALL_LOCATION_UNSPECIFIED = -1;

  90. /**

  91. * Constant corresponding to auto in

  92. * the {@link android.R.attr#installLocation} attribute.

  93. * @hide

  94. */

  95. public static final int INSTALL_LOCATION_AUTO = 0;

  96. /**

  97. * Constant corresponding to internalOnly in

  98. * the {@link android.R.attr#installLocation} attribute.

  99. * @hide

  100. */

  101. public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1;

  102. /**

  103. * Constant corresponding to preferExternal in

  104. * the {@link android.R.attr#installLocation} attribute.

  105. * @hide

  106. */

  107. public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;

  108. /**

  109. * The install location requested by the activity.  From the

  110. * {@link android.R.attr#installLocation} attribute, one of

  111. * {@link #INSTALL_LOCATION_AUTO},

  112. * {@link #INSTALL_LOCATION_INTERNAL_ONLY},

  113. * {@link #INSTALL_LOCATION_PREFER_EXTERNAL}

  114. * @hide

  115. */

  116. public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY;

  117. public PackageInfo() {

  118. }

  119. public String toString() {

  120. return “PackageInfo{”

  121. + Integer.toHexString(System.identityHashCode(this))

  122. + " " + packageName + “}”;

  123. }

  124. public int describeContents() {

  125. return 0;

  126. }

  127. public void writeToParcel(Parcel dest, int parcelableFlags) {

  128. dest.writeString(packageName);

  129. dest.writeInt(versionCode);

  130. dest.writeString(versionName);

  131. dest.writeString(sharedUserId);

  132. dest.writeInt(sharedUserLabel);

  133. if (applicationInfo != null) {

  134. dest.writeInt(1);

  135. applicationInfo.writeToParcel(dest, parcelableFlags);

  136. } else {

  137. dest.writeInt(0);

  138. }

  139. dest.writeLong(firstInstallTime);

  140. dest.writeLong(lastUpdateTime);

  141. dest.writeIntArray(gids);

  142. dest.writeTypedArray(activities, parcelableFlags);

  143. dest.writeTypedArray(receivers, parcelableFlags);

  144. dest.writeTypedArray(services, parcelableFlags);

  145. dest.writeTypedArray(providers, parcelableFlags);

  146. dest.writeTypedArray(instrumentation, parcelableFlags);

  147. dest.writeTypedArray(permissions, parcelableFlags);

  148. dest.writeStringArray(requestedPermissions);

  149. dest.writeIntArray(requestedPermissionsFlags);

  150. dest.writeTypedArray(signatures, parcelableFlags);

  151. dest.writeTypedArray(configPreferences, parcelableFlags);

  152. dest.writeTypedArray(reqFeatures, parcelableFlags);

  153. dest.writeInt(installLocation);

  154. }

  155. public static final Parcelable.Creator CREATOR

  156. = new Parcelable.Creator() {

  157. public PackageInfo createFromParcel(Parcel source) {

  158. return new PackageInfo(source);

  159. }

  160. public PackageInfo[] newArray(int size) {

  161. return new PackageInfo[size];

  162. }

  163. };

  164. private PackageInfo(Parcel source) {

  165. <span style=“color:#3333ff;”> packageName = source.readString();

  166. versionCode = source.readInt();

  167. versionName = source.readString();

  168. sharedUserId = source.readString();

  169. sharedUserLabel = source.readInt();

  170. int hasApp = source.readInt();

  171. if (hasApp != 0) {

  172. applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source);

  173. }

  174. <span style=“color:#333399;”>firstInstallTime = source.readLong();

  175. lastUpdateTime = source.readLong();

  176. gids = source.createIntArray();

  177. activities = source.createTypedArray(ActivityInfo.CREATOR);

  178. receivers = source.createTypedArray(ActivityInfo.CREATOR);

  179. services = source.createTypedArray(ServiceInfo.CREATOR);

  180. providers = source.createTypedArray(ProviderInfo.CREATOR);

  181. instrumentation = source.createTypedArray(InstrumentationInfo.CREATOR);

  182. permissions = source.createTypedArray(PermissionInfo.CREATOR);

  183. requestedPermissions = source.createStringArray();

  184. requestedPermissionsFlags = source.createIntArray();

  185. signatures = source.createTypedArray(Signature.CREATOR);

  186. configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR);

  187. reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);

  188. installLocation = source.readInt();

  189. }

  190. }

ApplicationInfo.java源码:

[java]  view plain copy 外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传 外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

  1. /*

  2. * Copyright © 2007 The Android Open Source Project

  3. *

  4. * Licensed under the Apache License, Version 2.0 (the “License”);

  5. * you may not use this file except in compliance with the License.

  6. * You may obtain a copy of the License at

  7. *

  8. *      http://www.apache.org/licenses/LICENSE-2.0

  9. *

  10. * Unless required by applicable law or agreed to in writing, software

  11. * distributed under the License is distributed on an “AS IS” BASIS,

  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  13. * See the License for the specific language governing permissions and

  14. * limitations under the License.

  15. */

  16. package android.content.pm;

  17. import android.content.pm.PackageManager.NameNotFoundException;

  18. import android.content.res.Resources;

  19. import android.graphics.drawable.Drawable;

  20. import android.os.Parcel;

  21. import android.os.Parcelable;

  22. import android.util.Printer;

  23. import java.text.Collator;

  24. import java.util.Comparator;

  25. /**

  26. * Information you can retrieve about a particular application.  This

  27. * corresponds to information collected from the AndroidManifest.xml’s

  28. *  tag.

  29. */

  30. public class ApplicationInfo extends PackageItemInfo implements Parcelable {

  31. /**

  32. * Default task affinity of all activities in this application. See

  33. * {@link ActivityInfo#taskAffinity} for more information.  This comes

  34. * from the “taskAffinity” attribute.

  35. */

  36. public String taskAffinity;

  37. /**

  38. * Optional name of a permission required to be able to access this

  39. * application’s components.  From the “permission” attribute.

  40. */

  41. public String permission;

  42. /**

  43. * The name of the process this application should run in.  From the

  44. * “process” attribute or, if not set, the same as

  45. packageName.

  46. */

  47. public String processName;

  48. /**

  49. * Class implementing the Application object.  From the “class”

  50. * attribute.

  51. */

  52. public String className;

  53. /**

  54. * A style resource identifier (in the package’s resources) of the

  55. * description of an application.  From the “description” attribute

  56. * or, if not set, 0.

  57. */

  58. public int descriptionRes;

  59. /**

  60. * A style resource identifier (in the package’s resources) of the

  61. * default visual theme of the application.  From the “theme” attribute

  62. * or, if not set, 0.

  63. */

  64. public int theme;

  65. /**

  66. * Class implementing the Application’s manage space

  67. * functionality.  From the “manageSpaceActivity”

  68. * attribute. This is an optional attribute and will be null if

  69. * applications don’t specify it in their manifest

  70. */

  71. public String manageSpaceActivityName;

  72. /**

  73. * Class implementing the Application’s backup functionality.  From

  74. * the “backupAgent” attribute.  This is an optional attribute and

  75. * will be null if the application does not specify it in its manifest.

  76. *

  77. If android:allowBackup is set to false, this attribute is ignored.

  78. */

  79. public String backupAgentName;

  80. /**

  81. * The default extra UI options for activities in this application.

  82. * Set from the {@link android.R.attr#uiOptions} attribute in the

  83. * activity’s manifest.

  84. */

  85. public int uiOptions = 0;

  86. /**

  87. * Value for {@link #flags}: if set, this application is installed in the

  88. * device’s system image.

  89. */

  90. public static final int FLAG_SYSTEM = 1<<0;

  91. /**

  92. * Value for {@link #flags}: set to true if this application would like to

  93. * allow debugging of its

  94. * code, even when installed on a non-development system.  Comes

  95. * from {@link android.R.styleable#AndroidManifestApplication_debuggable

  96. * android:debuggable} of the  tag.

  97. */

  98. public static final int FLAG_DEBUGGABLE = 1<<1;

  99. /**

  100. * Value for {@link #flags}: set to true if this application has code

  101. * associated with it.  Comes

  102. * from {@link android.R.styleable#AndroidManifestApplication_hasCode

  103. * android:hasCode} of the  tag.

  104. */

  105. public static final int FLAG_HAS_CODE = 1<<2;

  106. /**

  107. * Value for {@link #flags}: set to true if this application is persistent.

  108. * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent

  109. * android:persistent} of the  tag.

  110. */

  111. public static final int FLAG_PERSISTENT = 1<<3;

  112. /**

  113. * Value for {@link #flags}: set to true if this application holds the

  114. * {@link android.Manifest.permission#FACTORY_TEST} permission and the

  115. * device is running in factory test mode.

  116. */

  117. public static final int FLAG_FACTORY_TEST = 1<<4;

  118. /**

  119. * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.

  120. * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting

  121. * android:allowTaskReparenting} of the  tag.

  122. */

  123. public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5;

  124. /**

  125. * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.

  126. * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData

  127. * android:allowClearUserData} of the  tag.

  128. */

  129. public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6;

  130. /**

  131. * Value for {@link #flags}: this is set if this application has been

  132. * install as an update to a built-in system application.

  133. */

  134. public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7;

  135. /**

  136. * Value for {@link #flags}: this is set of the application has specified

  137. * {@link android.R.styleable#AndroidManifestApplication_testOnly

  138. * android:testOnly} to be true.

  139. */

  140. public static final int FLAG_TEST_ONLY = 1<<8;

  141. /**

  142. * Value for {@link #flags}: true when the application’s window can be

  143. * reduced in size for smaller screens.  Corresponds to

  144. * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens

  145. * android:smallScreens}.

  146. */

  147. public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;

  148. /**

  149. * Value for {@link #flags}: true when the application’s window can be

  150. * displayed on normal screens.  Corresponds to

  151. * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens

  152. * android:normalScreens}.

  153. */

  154. public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10;

  155. /**

  156. * Value for {@link #flags}: true when the application’s window can be

  157. * increased in size for larger screens.  Corresponds to

  158. * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens

  159. * android:largeScreens}.

  160. */

  161. public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;

  162. /**

  163. * Value for {@link #flags}: true when the application knows how to adjust

  164. * its UI for different screen sizes.  Corresponds to

  165. * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable

  166. * android:resizeable}.

  167. */

  168. public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;

  169. /**

  170. * Value for {@link #flags}: true when the application knows how to

  171. * accomodate different screen densities.  Corresponds to

  172. * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity

  173. * android:anyDensity}.

  174. */

  175. public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;

  176. /**

  177. * Value for {@link #flags}: set to true if this application would like to

  178. * request the VM to operate under the safe mode. Comes from

  179. * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode

  180. * android:vmSafeMode} of the  tag.

  181. */

  182. public static final int FLAG_VM_SAFE_MODE = 1<<14;

  183. /**

  184. * Value for {@link #flags}: set to false if the application does not wish

  185. * to permit any OS-driven backups of its data; true otherwise.

  186. *

  187. Comes from the

  188. * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}

  189. * attribute of the  tag.

  190. */

  191. public static final int FLAG_ALLOW_BACKUP = 1<<15;

  192. /**

  193. * Value for {@link #flags}: set to false if the application must be kept

  194. * in memory following a full-system restore operation; true otherwise.

  195. * Ordinarily, during a full system restore operation each application is shut down

  196. * following execution of its agent’s onRestore() method.  Setting this attribute to

  197. false prevents this.  Most applications will not need to set this attribute.

  198. *

  199. If

  200. * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}

  201. * is set to false or no

  202. * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}

  203. * is specified, this flag will be ignored.

  204. *

  205. Comes from the

  206. * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore}

  207. * attribute of the  tag.

  208. */

  209. public static final int FLAG_KILL_AFTER_RESTORE = 1<<16;

  210. /**

  211. * Value for {@link #flags}: Set to true if the application’s backup

  212. * agent claims to be able to handle restore data even “from the future,”

  213. * i.e. from versions of the application with a versionCode greater than

  214. * the one currently installed on the device.  Use with caution!  By default

  215. * this attribute is false and the Backup Manager will ensure that data

  216. * from “future” versions of the application are never supplied during a restore operation.

  217. *

  218. If

  219. * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}

  220. * is set to false or no

  221. * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}

  222. * is specified, this flag will be ignored.

  223. *

  224. Comes from the

  225. * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion}

  226. * attribute of the  tag.

  227. */

  228. public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;

  229. /**

  230. * Value for {@link #flags}: Set to true if the application is

  231. * currently installed on external/removable/unprotected storage.  Such

  232. * applications may not be available if their storage is not currently

  233. * mounted.  When the storage it is on is not available, it will look like

  234. * the application has been uninstalled (its .apk is no longer available)

  235. * but its persistent data is not removed.

  236. */

  237. public static final int FLAG_EXTERNAL_STORAGE = 1<<18;

  238. /**

  239. * Value for {@link #flags}: true when the application’s window can be

  240. * increased in size for extra large screens.  Corresponds to

  241. * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens

  242. * android:xlargeScreens}.

  243. */

  244. public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;

  245. /**

  246. * Value for {@link #flags}: true when the application has requested a

  247. * large heap for its processes.  Corresponds to

  248. * {@link android.R.styleable#AndroidManifestApplication_largeHeap

  249. * android:largeHeap}.

  250. */

  251. public static final int FLAG_LARGE_HEAP = 1<<20;

  252. /**

  253. * Value for {@link #flags}: true if this application’s package is in

  254. * the stopped state.

  255. */

  256. public static final int FLAG_STOPPED = 1<<21;

  257. /**

  258. * Value for {@link #flags}: true  when the application is willing to support

  259. * RTL (right to left). All activities will inherit this value.

  260. *

  261. * Set from the {@link android.R.attr#supportsRtl} attribute in the

  262. * activity’s manifest.

  263. *

  264. * Default value is false (no support for RTL).

  265. */

  266. public static final int FLAG_SUPPORTS_RTL = 1<<22;

  267. /**

  268. * Value for {@link #flags}: true if the application is currently

  269. * installed for the calling user.

  270. */

  271. public static final int FLAG_INSTALLED = 1<<23;

  272. /**

  273. * Value for {@link #flags}: true if the application only has its

  274. * data installed; the application package itself does not currently

  275. * exist on the device.

  276. */

  277. public static final int FLAG_IS_DATA_ONLY = 1<<24;

  278. /**

  279. * Value for {@link #flags}: Set to true if the application has been

  280. * installed using the forward lock option.

  281. *

  282. * NOTE: DO NOT CHANGE THIS VALUE!  It is saved in packages.xml.

  283. *

  284. * {@hide}

  285. */

  286. public static final int FLAG_FORWARD_LOCK = 1<<29;

  287. /**

  288. * Value for {@link #flags}: set to true if the application

  289. * has reported that it is heavy-weight, and thus can not participate in

  290. * the normal application lifecycle.

  291. *

  292. Comes from the

  293. * {@link android.R.styleable#AndroidManifestApplication_cantSaveState android:cantSaveState}

  294. * attribute of the  tag.

  295. *

  296. * {@hide}

  297. */

  298. public static final int FLAG_CANT_SAVE_STATE = 1<<28;

  299. /**

  300. * Flags associated with the application.  Any combination of

  301. * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},

  302. * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and

  303. * {@link #FLAG_ALLOW_TASK_REPARENTING}

  304. * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},

  305. * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},

  306. * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},

  307. * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},

  308. * {@link #FLAG_RESIZEABLE_FOR_SCREENS},

  309. * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE},

  310. * {@link #FLAG_INSTALLED}.

  311. */

  312. public int flags = 0;

  313. /**

  314. * The required smallest screen width the application can run on.  If 0,

  315. * nothing has been specified.  Comes from

  316. * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp

  317. * android:requiresSmallestWidthDp} attribute of the  tag.

  318. */

  319. public int requiresSmallestWidthDp = 0;

  320. /**

  321. * The maximum smallest screen width the application is designed for.  If 0,

  322. * nothing has been specified.  Comes from

  323. * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp

  324. * android:compatibleWidthLimitDp} attribute of the  tag.

  325. */

  326. public int compatibleWidthLimitDp = 0;

  327. /**

  328. * The maximum smallest screen width the application will work on.  If 0,

  329. * nothing has been specified.  Comes from

  330. * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp

  331. * android:largestWidthLimitDp} attribute of the  tag.

  332. */

  333. public int largestWidthLimitDp = 0;

  334. /**

  335. * Full path to the location of this package.

  336. */

  337. public String sourceDir;

  338. /**

  339. * Full path to the location of the publicly available parts of this

  340. * package (i.e. the primary resource package and manifest).  For

  341. * non-forward-locked apps this will be the same as {@link #sourceDir).

  342. */

  343. public String publicSourceDir;

  344. /**

  345. * Full paths to the locations of extra resource packages this application

  346. * uses. This field is only used if there are extra resource packages,

  347. * otherwise it is null.

  348. *

  349. * {@hide}

  350. */

  351. public String[] resourceDirs;

  352. /**

  353. * Paths to all shared libraries this application is linked against.  This

  354. * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES

  355. * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving

  356. * the structure.

  357. */

  358. public String[] sharedLibraryFiles;

  359. /**

  360. * Full path to a directory assigned to the package for its persistent

  361. * data.

  362. */

  363. public String dataDir;

  364. /**

  365. * Full path to the directory where native JNI libraries are stored.

  366. */

  367. public String nativeLibraryDir;

  368. /**

  369. * The kernel user-ID that has been assigned to this application;

  370. * currently this is not a unique ID (multiple applications can have

  371. * the same uid).

  372. */

  373. public int uid;

  374. /**

  375. * The minimum SDK version this application targets.  It may run on earlier

  376. * versions, but it knows how to work with any new behavior added at this

  377. * version.  Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}

  378. * if this is a development build and the app is targeting that.  You should

  379. * compare that this number is >= the SDK version number at which your

  380. * behavior was introduced.

  381. */

  382. public int targetSdkVersion;

  383. /**

  384. * When false, indicates that all components within this application are

  385. * considered disabled, regardless of their individually set enabled status.

  386. */

  387. public boolean enabled = true;

  388. /**

  389. * For convenient access to the current enabled setting of this app.

  390. * @hide

  391. */

  392. public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;

  393. /**

  394. * For convenient access to package’s install location.

  395. * @hide

  396. */

  397. public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;

  398. public void dump(Printer pw, String prefix) {

  399. super.dumpFront(pw, prefix);

  400. if (className != null) {

  401. pw.println(prefix + “className=” + className);

  402. }

  403. if (permission != null) {

  404. pw.println(prefix + “permission=” + permission);

  405. }

  406. pw.println(prefix + “processName=” + processName);

  407. pw.println(prefix + “taskAffinity=” + taskAffinity);

  408. pw.println(prefix + “uid=” + uid + " flags=0x" + Integer.toHexString(flags)

  409. + " theme=0x" + Integer.toHexString(theme));

  410. pw.println(prefix + “requiresSmallestWidthDp=” + requiresSmallestWidthDp

  411. + " compatibleWidthLimitDp=" + compatibleWidthLimitDp

  412. + " largestWidthLimitDp=" + largestWidthLimitDp);

  413. pw.println(prefix + “sourceDir=” + sourceDir);

  414. if (sourceDir == null) {

  415. if (publicSourceDir != null) {

  416. pw.println(prefix + “publicSourceDir=” + publicSourceDir);

  417. }

  418. } else if (!sourceDir.equals(publicSourceDir)) {

  419. pw.println(prefix + “publicSourceDir=” + publicSourceDir);

  420. }

  421. if (resourceDirs != null) {

  422. pw.println(prefix + “resourceDirs=” + resourceDirs);

  423. }

  424. pw.println(prefix + “dataDir=” + dataDir);

  425. if (sharedLibraryFiles != null) {

  426. pw.println(prefix + “sharedLibraryFiles=” + sharedLibraryFiles);

  427. }

  428. pw.println(prefix + “enabled=” + enabled + " targetSdkVersion=" + targetSdkVersion);

  429. if (manageSpaceActivityName != null) {

  430. pw.println(prefix + “manageSpaceActivityName=”+manageSpaceActivityName);

  431. }

  432. if (descriptionRes != 0) {

  433. pw.println(prefix + “description=0x”+Integer.toHexString(descriptionRes));

  434. }

  435. if (uiOptions != 0) {

  436. pw.println(prefix + “uiOptions=0x” + Integer.toHexString(uiOptions));

  437. }

  438. pw.println(prefix + “supportsRtl=” + (hasRtlSupport() ? “true” : “false”));

  439. super.dumpBack(pw, prefix);

  440. }

  441. /**

  442. * @return true if “supportsRtl” has been set to true in the AndroidManifest

  443. * @hide

  444. */

  445. public boolean hasRtlSupport() {

  446. return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;

  447. }

  448. public static class DisplayNameComparator

  449. implements Comparator {

  450. public DisplayNameComparator(PackageManager pm) {

  451. mPM = pm;

  452. }

  453. public final int compare(ApplicationInfo aa, ApplicationInfo ab) {

  454. CharSequence  sa = mPM.getApplicationLabel(aa);

  455. if (sa == null) {

  456. sa = aa.packageName;

  457. }

  458. CharSequence  sb = mPM.getApplicationLabel(ab);

  459. if (sb == null) {

  460. sb = ab.packageName;

  461. }

  462. return sCollator.compare(sa.toString(), sb.toString());

  463. }

  464. private final Collator   sCollator = Collator.getInstance();

  465. private PackageManager   mPM;

  466. }

  467. public ApplicationInfo() {

  468. }

  469. public ApplicationInfo(ApplicationInfo orig) {

  470. super(orig);

  471. taskAffinity = orig.taskAffinity;

  472. permission = orig.permission;

  473. processName = orig.processName;

  474. className = orig.className;

  475. theme = orig.theme;

  476. flags = orig.flags;

  477. requiresSmallestWidthDp = orig.requiresSmallestWidthDp;

  478. compatibleWidthLimitDp = orig.compatibleWidthLimitDp;

  479. largestWidthLimitDp = orig.largestWidthLimitDp;

  480. sourceDir = orig.sourceDir;

  481. publicSourceDir = orig.publicSourceDir;

  482. nativeLibraryDir = orig.nativeLibraryDir;

  483. resourceDirs = orig.resourceDirs;

  484. sharedLibraryFiles = orig.sharedLibraryFiles;

  485. dataDir = orig.dataDir;

  486. uid = orig.uid;

  487. targetSdkVersion = orig.targetSdkVersion;

  488. enabled = orig.enabled;

  489. enabledSetting = orig.enabledSetting;

  490. installLocation = orig.installLocation;

  491. manageSpaceActivityName = orig.manageSpaceActivityName;

  492. descriptionRes = orig.descriptionRes;

  493. uiOptions = orig.uiOptions;

  494. backupAgentName = orig.backupAgentName;

  495. }

  496. public String toString() {

  497. return “ApplicationInfo{”

  498. + Integer.toHexString(System.identityHashCode(this))

  499. + " " + packageName + “}”;

  500. }

  501. public int describeContents() {

  502. return 0;

  503. }

  504. public void writeToParcel(Parcel dest, int parcelableFlags) {

  505. super.writeToParcel(dest, parcelableFlags);

  506. dest.writeString(taskAffinity);

  507. dest.writeString(permission);

  508. dest.writeString(processName);

  509. dest.writeString(className);

  510. dest.writeInt(theme);

  511. dest.writeInt(flags);

  512. dest.writeInt(requiresSmallestWidthDp);

  513. dest.writeInt(compatibleWidthLimitDp);

  514. dest.writeInt(largestWidthLimitDp);

  515. dest.writeString(sourceDir);

  516. dest.writeString(publicSourceDir);

  517. dest.writeString(nativeLibraryDir);

  518. dest.writeStringArray(resourceDirs);

  519. dest.writeStringArray(sharedLibraryFiles);

  520. dest.writeString(dataDir);

  521. dest.writeInt(uid);

  522. dest.writeInt(targetSdkVersion);

  523. dest.writeInt(enabled ? 1 : 0);

  524. dest.writeInt(enabledSetting);

  525. dest.writeInt(installLocation);

  526. dest.writeString(manageSpaceActivityName);

  527. dest.writeString(backupAgentName);

  528. dest.writeInt(descriptionRes);

  529. dest.writeInt(uiOptions);

  530. }

  531. public static final Parcelable.Creator CREATOR

面试复习路线,梳理知识,提升储备

自己的知识准备得怎么样,这直接决定了你能否顺利通过一面和二面,所以在面试前来一个知识梳理,看需不需要提升自己的知识储备是很有必要的。

关于知识梳理,这里再分享一下我面试这段时间的复习路线:(以下体系的复习资料是我从各路大佬收集整理好的)

  • 架构师筑基必备技能
  • Android高级UI与FrameWork源码
  • 360°全方面性能调优
  • 解读开源框架设计思想
  • NDK模块开发
  • 微信小程序
  • Hybrid 开发与Flutter

知识梳理完之后,就需要进行查漏补缺,所以针对这些知识点,我手头上也准备了不少的电子书和笔记,这些笔记将各个知识点进行了完美的总结:

Android开发七大模块核心知识笔记

《960全网最全Android开发笔记》

《379页Android开发面试宝典》

历时半年,我们整理了这份市面上最全面的安卓面试题解析大全
包含了腾讯、百度、小米、阿里、乐视、美团、58、猎豹、360、新浪、搜狐等一线互联网公司面试被问到的题目。熟悉本文中列出的知识点会大大增加通过前两轮技术面试的几率。

如何使用它?

1.可以通过目录索引直接翻看需要的知识点,查漏补缺。
2.五角星数表示面试问到的频率,代表重要推荐指数

《507页Android开发相关源码解析》

只要是程序员,不管是Java还是Android,如果不去阅读源码,只看API文档,那就只是停留于皮毛,这对我们知识体系的建立和完备以及实战技术的提升都是不利的。

真正最能锻炼能力的便是直接去阅读源码,不仅限于阅读各大系统源码,还包括各种优秀的开源库。

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  1. dest.writeInt(targetSdkVersion);

  2. dest.writeInt(enabled ? 1 : 0);

  3. dest.writeInt(enabledSetting);

  4. dest.writeInt(installLocation);

  5. dest.writeString(manageSpaceActivityName);

  6. dest.writeString(backupAgentName);

  7. dest.writeInt(descriptionRes);

  8. dest.writeInt(uiOptions);

  9. }

  10. public static final Parcelable.Creator CREATOR

面试复习路线,梳理知识,提升储备

自己的知识准备得怎么样,这直接决定了你能否顺利通过一面和二面,所以在面试前来一个知识梳理,看需不需要提升自己的知识储备是很有必要的。

关于知识梳理,这里再分享一下我面试这段时间的复习路线:(以下体系的复习资料是我从各路大佬收集整理好的)

  • 架构师筑基必备技能
  • Android高级UI与FrameWork源码
  • 360°全方面性能调优
  • 解读开源框架设计思想
  • NDK模块开发
  • 微信小程序
  • Hybrid 开发与Flutter

[外链图片转存中…(img-CnBTizVZ-1715434257960)]

知识梳理完之后,就需要进行查漏补缺,所以针对这些知识点,我手头上也准备了不少的电子书和笔记,这些笔记将各个知识点进行了完美的总结:

[外链图片转存中…(img-ZFzeeEUy-1715434257960)]

《960全网最全Android开发笔记》

[外链图片转存中…(img-C4q26Nm6-1715434257960)]

《379页Android开发面试宝典》

历时半年,我们整理了这份市面上最全面的安卓面试题解析大全
包含了腾讯、百度、小米、阿里、乐视、美团、58、猎豹、360、新浪、搜狐等一线互联网公司面试被问到的题目。熟悉本文中列出的知识点会大大增加通过前两轮技术面试的几率。

如何使用它?

1.可以通过目录索引直接翻看需要的知识点,查漏补缺。
2.五角星数表示面试问到的频率,代表重要推荐指数

[外链图片转存中…(img-prdDPtUw-1715434257961)]

《507页Android开发相关源码解析》

只要是程序员,不管是Java还是Android,如果不去阅读源码,只看API文档,那就只是停留于皮毛,这对我们知识体系的建立和完备以及实战技术的提升都是不利的。

真正最能锻炼能力的便是直接去阅读源码,不仅限于阅读各大系统源码,还包括各种优秀的开源库。

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值