b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

解析xml android Android源代码解析之(十三)

电脑杂谈  发布时间:2018-02-14 21:57:48  来源:网络整理

androidxml解析官方_android layout xml_解析xml android

本文我们就来详细看一下apk的详细安装过程,通过本文的学习希望帮助大家大概的了解到Android系统安装Apk文件的基本流程。好了,话不多说,开始我们今天的学习吧。

相信大家都知道假设我们想在代码里运行apk的安装,那么一般都是这样:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.parse("file://" + path),"application/vnd.android.package-archive");
context.startActivity(intent);

这样,我们就会打开安装apk文件的程序并运行安装逻辑了。大家应该都知道这段代码运行的结果是打开一个隐式的Activity,那么这段代码详细是打开那个activity呢?从这个问题开始。我们来解析apk的安装流程…

这里顺便跟大家简介一下android的源代码,平时我们使用的android.jar里面的java源代码仅仅是android系统源代码的一部分,还有好多源代码并没有打入到android.jar中。这里为大家推荐一个android源代码的地址:https://github.com/android

里面依据android系统的不同模块包括了很多android模块的源代码。

这里写图片描写叙述

这里我们找到platform_packages_apps_packageinstaller库,这里面就是android系统安装程序的源代码了。

这里写图片描写叙述

这里我们找到其androidManifest.xml,然后我们来看一下其详细的定义:

<?

xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.packageinstaller" coreApp="true"> <original-package android:name="com.android.packageinstaller" /> ... <application android:label="@string/app_name" android:allowBackup="false" android:theme="@style/Theme.DialogWhenLarge" android:supportsRtl="true"> <activity android:name=".PackageInstallerActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:excludeFromRecents="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.INSTALL_PACKAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="file" /> <data android:mimeType="application/vnd.android.package-archive" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.INSTALL_PACKAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="file" /> <data android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.content.pm.action.CONFIRM_PERMISSIONS" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name=".InstallAppProgress" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="false" /> ... </application> </manifest>


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-77978-1.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...