<!--
**
** Copyright 2014, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.managedprovisioning" >

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.MANAGE_USERS" />
    <uses-permission android:name="android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
    <uses-permission android:name="android.permission.DELETE_PACKAGES"/>
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
    <uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" />
    <uses-permission android:name="android.permission.MANAGE_DEVICE_ADMINS" />
    <uses-permission android:name="android.permission.MANAGE_CA_CERTIFICATES" />

    <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

    <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.MASTER_CLEAR" />
    <uses-permission android:name="android.permission.NFC" />
    <uses-permission android:name="android.permission.SET_TIME" />
    <uses-permission android:name="android.permission.SET_TIME_ZONE" />

    <uses-permission android:name="android.permission.CRYPT_KEEPER" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.SHUTDOWN" />

    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />

    <uses-permission android:name="android.permission.PERFORM_CDMA_PROVISIONING" />
    <uses-permission android:name="android.permission.ACCESS_PDB_STATE" />

    <application
        android:allowClearUserData="false"
        android:hardwareAccelerated="true"
        android:usesCleartextTraffic="true"
        android:supportsRtl="true">

        <!--
             Note: Setup activities are android:immersive to prevent full-screen notifications (USB
            mass storage; incoming calls) from taking over. Note that high-priority notifications
            (phone calls) will still pop up a small window that can be activated.
        -->
        <activity
            android:name="DeviceOwnerPreProvisioningActivity"
            android:excludeFromRecents="true"
            android:immersive="true"
            android:launchMode="singleTop"
            android:theme="@style/SetupWorkSpaceTheme">
            <intent-filter android:priority="10">
                <action android:name="android.app.action.PROVISION_MANAGED_DEVICE" />
                <action android:name="com.android.managedprovisioning.ACTION_PROVISION_MANAGED_DEVICE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <!--
            Nfc bump entry for device owner provisioning, protected by a permission so only the Nfc
            stack can trigger this.
        -->
        <activity-alias
            android:name="DeviceOwnerPreProvisioningActivityViaNfc"
            android:targetActivity="DeviceOwnerPreProvisioningActivity"
            android:permission="android.permission.DISPATCH_NFC_MESSAGE"
            android:exported="true">
            <intent-filter android:priority="10">
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="application/com.android.managedprovisioning" />
                <data android:mimeType="application/com.android.managedprovisioning.v2"/>
            </intent-filter>
        </activity-alias>

        <activity
             android:name="DeviceOwnerProvisioningActivity"
             android:excludeFromRecents="true"
             android:immersive="true"
             android:launchMode="singleTop"
             android:theme="@style/SetupWorkSpaceTheme">
        </activity>
        <activity
            android:name="ProfileOwnerPreProvisioningActivity"
            android:excludeFromRecents="true"
            android:immersive="true"
            android:launchMode="singleTop"
            android:theme="@style/SetupWorkSpaceTheme">
            <intent-filter android:priority="10">
                <action android:name="android.app.action.PROVISION_MANAGED_PROFILE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name="ProfileOwnerProvisioningActivity"
            android:excludeFromRecents="true"
            android:immersive="true"
            android:launchMode="singleTop"
            android:theme="@style/SetupWorkSpaceTheme">
        </activity>
        <activity-alias
            android:name="ProfileOwnerProvisioningActivityNoCallerCheck"
            android:targetActivity="ProfileOwnerPreProvisioningActivity"
            android:permission="android.permission.MANAGE_USERS"
            android:exported="true">
        </activity-alias>
        <activity
            android:name="EncryptDeviceActivity"
            android:immersive="true"
            android:launchMode="singleTop"
            android:theme="@style/SetupWorkSpaceTheme">
        </activity>

        <activity
            android:name="WebActivity"
            android:immersive="true"
            android:launchMode="singleTop"
            android:theme="@style/SetupWorkSpaceTheme">
        </activity>

        <activity
            android:name=".TrampolineActivity"
            android:theme="@android:style/Theme.NoDisplay"
            android:excludeFromRecents="true">
        </activity>

        <service
            android:name="ProfileOwnerProvisioningService" >
        </service>
        <service
            android:name="DeviceOwnerProvisioningService" >
        </service>

        <receiver android:name="com.android.managedprovisioning.BootReminder">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.android.managedprovisioning.PreBootListener">
            <intent-filter>
                <action android:name="android.intent.action.PRE_BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <activity android:name="com.android.managedprovisioning.HomeReceiverActivity"
                  android:theme="@android:style/Theme.NoDisplay"
                  android:noHistory="true"
                  android:excludeFromRecents="true"
                  android:enabled="false">
            <intent-filter android:priority="2">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <receiver android:name=".UserInitializedReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.USER_INITIALIZE" />
            </intent-filter>
        </receiver>

        <!-- These 2 receivers, along with the CertService, handle installing CA certs for
             secondary users. On initialization of secondary users, a broadcast
             (InstallCertRequestReceiver) is sent to the primary user to request the CA certs. The
             primary user responds, via CertService, with a broadcast (InstallCertReceiver)
             containing the CA certs, which are then installed for the secondary user. -->
        <receiver android:name=".InstallCertRequestReceiver"
                  android:exported="false">
            <intent-filter>
                <action android:name="com.android.managedprovisioning.REQUEST_CERT_ACTION" />
            </intent-filter>
        </receiver>
        <receiver android:name=".InstallCertReceiver"
                  android:exported="false">
            <intent-filter>
                <action android:name="com.android.managedprovisioning.INSTALL_CERT_ACTION" />
            </intent-filter>
        </receiver>

        <service android:name=".CertService"
                 android:exported = "false"/>

    </application>
</manifest>