<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.cts.normalapp">
    <uses-sdk
        android:minSdkVersion="24" />

    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
    <application
        android:label="@string/app_name">
        <uses-library android:name="android.test.runner" />
        <activity
            android:name=".NormalActivity"
            android:theme="@android:style/Theme.NoDisplay">
            <!-- TEST: ephemeral apps can't see this activity using query methods -->
            <intent-filter android:priority="-20">
                <action android:name="com.android.cts.ephemeraltest.QUERY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- TEST: ephemeral apps can't start this activity using directed intent -->
            <intent-filter>
                <action android:name="com.android.cts.ephemeraltest.START_NORMAL" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
            <meta-data android:name="default-url"
                       android:value="https://normalapp.cts.android.com/search" />
            <meta-data
                       android:name="android.app.searchable"
                       android:resource="@xml/searchable" />
        </activity>
        <activity
            android:name=".NormalWebActivity"
            android:theme="@android:style/Theme.NoDisplay">
            <!-- TEST: implicitly exposes this activity to ephemeral apps -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" />
                <data android:host="cts.google.com" />
                <data android:path="/normal" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ExposedActivity"
            android:visibleToInstantApps="true"
            android:theme="@android:style/Theme.NoDisplay">
          <!-- TEST: ephemeral apps can see this activity using query methods -->
            <intent-filter android:priority="-10">
                <action android:name="com.android.cts.ephemeraltest.QUERY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- TEST: ephemeral apps can start this activity using directed intent -->
            <intent-filter android:priority="-10">
                <action android:name="com.android.cts.ephemeraltest.START_EXPOSED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
            <meta-data android:name="default-url"
                       android:value="https://normalapp.cts.android.com/search" />
            <meta-data
                       android:name="android.app.searchable"
                       android:resource="@xml/searchable" />
        </activity>
        <provider android:name=".SearchSuggestionProvider"
            android:authorities="com.android.cts.normalapp.Search" />

        <service
            android:name=".NormalService">
            <!-- TEST: ephemeral apps can't see this service using query methods -->
            <intent-filter android:priority="-20">
                <action android:name="com.android.cts.ephemeraltest.QUERY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- TEST: ephemeral apps can't start this service using directed intent -->
            <intent-filter>
                <action android:name="com.android.cts.ephemeraltest.START_NORMAL" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </service>
        <service
            android:name=".ExposedService"
            android:visibleToInstantApps="true">
            <!-- TEST: ephemeral apps can see this service using query methods -->
            <intent-filter android:priority="-10">
                <action android:name="com.android.cts.ephemeraltest.QUERY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- TEST: ephemeral apps can start this service using directed intent -->
            <intent-filter android:priority="-10">
                <action android:name="com.android.cts.ephemeraltest.START_EXPOSED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </service>

        <provider
            android:name=".NormalProvider"
            android:authorities="com.android.cts.normalapp.provider"
            android:exported="true">
            <intent-filter android:priority="-20">
                <action android:name="com.android.cts.ephemeraltest.QUERY" />
            </intent-filter>
        </provider>
        <provider
            android:name=".ExposedProvider"
            android:authorities="com.android.cts.normalapp.exposed.provider"
            android:visibleToInstantApps="true"
            android:exported="true">
            <intent-filter android:priority="-10">
                <action android:name="com.android.cts.ephemeraltest.QUERY" />
            </intent-filter>
        </provider>
    </application>

    <instrumentation
        android:name="android.support.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.cts.normalapp" />
</manifest>