<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="org.chromium.native_test"
      android:versionCode="1"
      android:versionName="1.0">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.BLUETOOTH"
            android:maxSdkVersion="30"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
            android:maxSdkVersion="30"/>
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN"
            android:usesPermissionFlags="neverForLocation"/>
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.SET_TIME_ZONE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <!-- Explicitly set the attribute requestLegacyExternalStorage to "true"
         since it is "false" by default on apps targeting Android 10, and that
         breaks test listing. See
         https://developer.android.com/training/data-storage#scoped-storage and
         https://developer.android.com/training/data-storage/compatibility. -->
    {% if allow_cleartext_traffic == 'true' %}
    <application android:label="NativeTests"
            android:networkSecurityConfig="@xml/allow_cleartext_traffic"
            android:requestLegacyExternalStorage="true"
            android:memtagMode="sync"
            android:name="org.chromium.native_test.NativeTestApplication">
    {% else %}
    <application android:label="NativeTests"
            android:requestLegacyExternalStorage="true"
            android:memtagMode="sync"
            android:name="org.chromium.native_test.NativeTestApplication">
    {% endif %}
        {% if use_native_activity == 'true' %}
        <activity android:name=".NativeUnitTestNativeActivity"
                android:label="NativeTest"
                android:configChanges="orientation|keyboardHidden"
                android:process=":test_process"
                android:exported="true">
            <meta-data android:name="android.app.lib_name"
                       android:value="{{ native_library_name }}" />
        {% else %}
        <activity android:name=".NativeUnitTestActivity"
                android:label="NativeTest"
                android:configChanges="orientation|keyboardHidden"
                android:process=":test_process"
                android:exported="true">
        {% endif %}
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- If you change the number below, make sure to add/remove actual service classes
             org/chromium/base/MultiprocessTestClientService*.java -->
        {% set num_test_client_services = 10 %}
        <meta-data android:name="org.chromium.native_test.NUM_TEST_CLIENT_SERVICES"
                   android:value="{{ num_test_client_services }}"/>
        {% for i in range(num_test_client_services) %}
        <service android:name="org.chromium.base.MultiprocessTestClientService{{ i }}"
                 android:process=":test_client_process{{ i }}"
                 android:isolatedProcess="false"
                 android:exported="false" />
        {% endfor %}
        <service android:name="org.chromium.build.gtest_apk.ProcessKeepaliveService"
                 android:process=":test_process"
                 android:exported="false" />
    </application>

    <instrumentation android:name="org.chromium.build.gtest_apk.NativeTestInstrumentationTestRunner"
            android:targetPackage="org.chromium.native_test"
            android:label="Instrumentation entry point for org.chromium.native_test" />

</manifest>
