Android源码学习------SystemUI(二)

SystemUI----AndroidManifest文件

AndroidManifest是Android应用程序中最重要的文件之一。它是Android程序的全局配置文件,是每个 android程序中必须的文件,apk需要的权限,特征以及四大组件,都在这里进行配置。它位于我们开发的应用程序的根目录下。

主要功能

  • 指定了该应用程序的Java包:该包名作为应用程序的一个独特标识。
  • 它描述了应用程序组件:该应用程序由哪些activity,service,broadcast receiver和content provider组成。它指定了实现每个组件的类以及公开发布它们的能力(例如,它们能持有哪个Intent信息)。这些声明使Android系统知道这儿有什么组件以及在什么条件下它们可以被载入。
  • 确定托管应用组件的进程。
  • 它声明了本应用程序必须拥有哪些许可,以便访问API的被保护部分,以及与其他应用程序交互。也声明了其他应用程序在和该应用程序交互时需要持有的许可。
  • 它列出了Instrumentation类,可以在应用程序运行时提供简档和其他信息。这些声明仅当应用程序在开发和测试过程中被提供;它们将在应用程序正式发布之前被移除。
  • 它声明了该应用程序所需的Android API的最小化水平。
  • 它列出了该应用程序必须链接的库。

主要源码

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
        <!--标注包名为:com.android.systemui-->
        package="com.android.systemui"
        <!--分配的userID为android.uid.systemui-->
        android:sharedUserId="android.uid.systemui"
        <!--标明此应用为系统核心App-->
        coreApp="true">
        
    <!-- 一系列的权限声明:Networking and telephony,Physical hardware,ActivityManager,WindowManager,DreamManager,Alarm clocks,Keyguard,Recents,Wifi Display,Screen Capturing等方面的权限-->
    <permission android:name="android.permission.systemui.IDENTITY"
        android:protectionLevel="signature" />

    <!-- Used to read storage for all users -->
    <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
   ......
    <!-- Self permission for internal broadcasts. -->
    <permission android:name="com.android.systemui.permission.SELF"
            android:protectionLevel="signature" />
    <uses-permission android:name="com.android.systemui.permission.SELF" />
    ......
    <protected-broadcast android:name="com.android.settingslib.action.REGISTER_SLICE_RECEIVER" />
    <protected-broadcast android:name="com.android.settingslib.action.UNREGISTER_SLICE_RECEIVER" />

    <application
        android:name=".SystemUIApplication"
        <!--表示应用不会被kill,如果通过root方式kill掉应用,会自动启动-->
        android:persistent="true"
        <!--用户数据不可清除-->
        android:allowClearUserData="false"
        android:allowBackup="false"
        android:hardwareAccelerated="true"
        android:label="@string/app_label"
        android:icon="@drawable/icon"
        <!--设置为系统进程-->
        android:process="com.android.systemui"
        android:supportsRtl="true"
        android:theme="@style/Theme.SystemUI"
        android:defaultToDeviceProtectedStorage="true"
        android:directBootAware="true"
        android:appComponentFactory="android.support.v4.app.CoreComponentFactory">
  
        <service android:name="SystemUIService"
            android:exported="true"
        />
        ......
        <!-- started from PhoneWindowManager
             TODO: Should have an android:permission attribute -->
        <service android:name=".screenshot.TakeScreenshotService"
            android:process=":screenshot"
            android:exported="false" />

        <!-- Called from PhoneWindowManager -->
        <receiver android:name=".screenshot.ScreenshotServiceErrorReceiver"
            android:process=":screenshot"
            android:exported="false">
            <intent-filter>
                <action android:name="com.android.systemui.screenshot.SHOW_ERROR" />
            </intent-filter>
        </receiver>
        ......
        <activity-alias android:name=".DemoMode"
                  android:targetActivity=".tuner.TunerActivity"
                  android:icon="@drawable/tuner"
                  android:theme="@style/TunerSettings"
                  android:label="@string/demo_mode"
                  android:process=":tuner"
                  android:exported="true">
            <intent-filter>
                <action android:name="com.android.settings.action.DEMO_MODE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity-alias>
        <!-- Alternate Recents -->
        <activity android:name=".recents.RecentsActivity"
                  android:label="@string/acc
  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值