#Authors: Bernd Paysan, Anton Ertl
#Copyright (C) 2015,2014,2016,2018,2019,2020,2021,2023 Free Software Foundation, Inc.

#This file is part of Gforth.

#Gforth is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation, either version 3
#of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program. If not, see http://www.gnu.org/licenses/.

cat <<EOF
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.RECORD_VIDEO" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
$(extra_perms)

    <uses-feature android:name="android.hardware.camera"
		  android:required="false" />
    <uses-feature android:name="android.hardware.camera.autofocus"
		  android:required="false" />
    <uses-feature android:name="android.hardware.microphone"
		  android:required="false" />
    <uses-feature android:name="android.hardware.touchscreen"
		  android:required="false" />
    <uses-feature android:name="android.hardware.location"
		  android:required="false" />
    <uses-feature android:name="android.hardware.location.gps"
		  android:required="false" />
    <uses-feature android:name="android.hardware.location.network"
		  android:required="false" />
    <uses-feature android:name="android.hardware.audio.low_latency"
		  android:required="false" />
    <uses-feature android:name="android.hardware.usb.host"
		  android:required="false" />
    <uses-feature android:glEsVersion="0x00020000" />

    <application android:icon="@drawable/ic_launcher"
                 android:resizeableActivity="true">
        <!-- Our activity is a homebrewn variant of the NativeAcitivity.
             This will take care of integrating with our NDK code. -->
        <activity android:name="gnu.gforth.Gforth"
                android:label="@string/app_name"
                android:icon="@drawable/ic_launcher"
                android:windowAnimationStyle="@android:style/Animation.Activity"
		android:windowSoftInputMode="stateHidden|adjustResize"
                android:configChanges="orientation|screenSize|keyboardHidden"
                android:theme="@android:style/Theme.NoTitleBar"
                android:launchMode="singleTop"
                android:exported="true">
            <!-- Tell NativeActivity the name of or .so -->
            <meta-data android:name="android.app.lib_name"
                    android:value="gforth-fast" />
            <meta-data android:name="android.app.startfile"
                    android:value="starta.fs" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
	    <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
            </intent-filter>
	    <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
                android:resource="@xml/usb_serial" />
	    <intent-filter
		android:icon='@drawable/ic_launcher'
		android:label='Forth File'
		android:priority='1'>
	      <action android:name="android.intent.action.VIEW" />
	      <action android:name="android.intent.action.EDIT" /> 
	      <action android:name="android.intent.action.RUN" />
	      <category android:name="android.intent.category.DEFAULT" />
	      <category android:name="android.intent.category.BROWSABLE" />
	      <data android:scheme="file" />
	      <data android:host="*" />
	      <data android:pathPattern=".*\\.fs" />
	    </intent-filter>
        </activity>
        <activity android:name="gnu.gforth.Gforth_itc"
                android:label="@string/app_name_itc"
                android:icon="@drawable/ic_launcher"
                android:windowAnimationStyle="@android:style/Animation.Activity"
		android:windowSoftInputMode="stateHidden|adjustResize"
                android:configChanges="orientation|screenSize|keyboardHidden"
                android:theme="@android:style/Theme.NoTitleBar"
                android:launchMode="singleTop"
                android:exported="true">
            <!-- Tell NativeActivity the name of or .so -->
            <meta-data android:name="android.app.lib_name"
                    android:value="gforth-itc" />
            <meta-data android:name="android.app.startfile"
                    android:value="starta.fs" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
$(extra_apps)
    </application>
$(extra_features)
</manifest> 
<!-- END_INCLUDE(manifest) -->
EOF
