chromium/chromecast/browser/android/apk/CastBrowserAndroidManifest.xml.jinja2

<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright 2022 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"
          xmlns:dist="http://schemas.android.com/apk/distribution"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.google.android.apps.mediashell"
          featureSplit="cast_browser"
          {% set device_type_digit = {
            'generic': 0,
            'atv': 1,
            'tablet': 2,
            'automotive': 3,
          }[cast_device_type] %}
          {% set architecture_digit = {
            'arm': 1,
            'x86': 2,
            'arm64': 3,
            'x64': 4,
          }[target_cpu] %}
          {% set bundle_digit = {
            "BROWSER_PACKAGING_MONOLITH": 0,
            "BROWSER_PACKAGING_APK": 1,
            "BROWSER_PACKAGING_BUNDLE": 2,
          }[ browser_packaging] %}
          android:versionCode="{{ cast_build_incremental }}{{ device_type_digit }}{{ architecture_digit }}{{ bundle_digit }}" >
    <dist:module
        dist:onDemand="false"
        dist:title="cast_browser">
        <!-- This will fuse the module into the base APK if a system image
             APK is built from this bundle. -->
        <dist:fusing dist:include="true" />
    </dist:module>

    <uses-sdk android:minSdkVersion="24"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>

    <application android:icon="@drawable/ic_settings_cast">
        <service android:name="org.chromium.chromecast.shell.CastBrowserService"
                 android:process=":cast_browser_process"
                 android:hardwareAccelerated="true"
                 android:label="Chromecast Web Browser"
                 android:exported="true"
                 tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="com.google.cast.action.START_CAST_BROWSER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </service>
        <service android:name="org.chromium.chromecast.shell.CastWebContentsService"
                 android:process=":cast_browser_process">
        </service>
        <activity android:name="org.chromium.chromecast.shell.CastWebContentsActivity"
                  android:process=":cast_browser_process"
                  android:theme="@style/CastShellTheme"
                  android:exported="true"
                  android:hardwareAccelerated="true"
                  android:launchMode="singleInstance"
                  android:screenOrientation="landscape"
                  android:taskAffinity=".CastWebContentsActivity"
                  android:supportsPictureInPicture="true"
                  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|screenLayout|smallestScreenSize|uiMode"
                  android:excludeFromRecents="false"
                  android:noHistory="false"
                  android:showWhenLocked="true">
        </activity>
        <service android:name="org.chromium.chromecast.shell.TaskRemovedMonitorService"
                 android:exported="false">
        </service>

        <!-- The following service entries exist in order to allow us to
             start more than one sandboxed process. -->
        {% set num_sandboxed_services = 40 %}
        <meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
                   android:value="{{ num_sandboxed_services }}"/>
        <meta-data android:name="org.chromium.content.browser.SANDBOXED_SERVICES_NAME"
                     android:value="org.chromium.content.app.SandboxedProcessService"/>

        {% for i in range(num_sandboxed_services) %}
        <service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
                 android:process=":sandboxed_process{{ i }}"
                 android:permission="com.google.android.apps.mediashell.permission.SANDBOX"
                 android:isolatedProcess="true"
                 android:exported="false" />
        {% endfor %}

        {% set num_privileged_services = 5 %}
        <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
                   android:value="{{ num_privileged_services }}"/>
        <meta-data android:name="org.chromium.content.browser.PRIVILEGED_SERVICES_NAME"
                     android:value="org.chromium.content.app.PrivilegedProcessService"/>

        {% for i in range(num_privileged_services) %}
        <service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
                 android:process=":privileged_process{{ i }}"
                 android:isolatedProcess="false"
                 android:exported="false" />
        {% endfor %}
    </application>

</manifest>