<?xml version="1.0" encoding="utf-8"?>
<!-- .alert is appended to the package name to fix Samsung AlarmListener bug as per
  https://code.google.com/p/android/issues/detail?id=82001
  https://stackoverflow.com/questions/34074955/android-exact-alarm-is-always-3-minutes-off/34085645 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
		xmlns:tools="http://schemas.android.com/tools"
		android:installLocation="internalOnly">
	<!-- communication permissions -->
	<uses-feature
		android:name="android.hardware.telephony"
		android:required="false" />

	<uses-permission android:name="android.permission.INTERNET"/>
	<uses-permission android:name="android.permission.RECEIVE_SMS"/>
	<uses-permission android:name="android.permission.SEND_SMS"/>

	<!-- WakefulIntentService permissions -->
	<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
	<uses-permission android:name="android.permission.WAKE_LOCK"/>

	<!-- File permissions for log of unprocessed WT messages.  READ is implied by WRITE. -->
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
		tools:ignore="ScopedStorage" />

	<!-- Required internally for sending multipart UCS2 messages - see:
	       https://github.com/medic/cht-gateway/issues/103 -->
	<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

	<application android:label="@string/app_name"
			android:icon="@mipmap/ic_launcher"
			android:allowBackup="false"
			android:supportsRtl="false"
			tools:ignore="GoogleAppIndexingWarning">
		<activity android:name="StartupActivity"
				android:exported="true"
				android:configChanges="orientation|screenSize"
				android:theme="@android:style/Theme.NoDisplay"
				>
			<intent-filter>
				<action android:name="android.intent.action.MAIN"/>
				<category android:name="android.intent.category.LAUNCHER"/>
			</intent-filter>
		</activity>
		<activity android:name="SettingsDialogActivity"/>
		<activity android:name="PromptToSetAsDefaultMessageAppActivity"/>
		<activity android:name="PromptForPermissionsActivity"/>
		<activity android:name="ExternalLogProcessorActivity"/>
		<activity android:name="MessageListsActivity"/>
		<activity android:name="GatewayEventLogActivity"/>
		<activity android:name="WoListActivity"/>
		<activity android:name="WtListActivity"/>
		<receiver android:name="IntentProcessor" android:label="@string/app_name"
				android:permission="android.permission.BROADCAST_SMS"
				android:exported="true">
			<!--
			  priority is set here so that on supported android
			  versions we can abort SMS_RECEIVED broadcasts - we
			  don't want the incoming messages to reach the standard
			  inbox
			-->
			<intent-filter android:priority="999">
				<action android:name="android.provider.Telephony.SMS_DELIVER"/>
				<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
			</intent-filter>
		</receiver>
		<!-- Android 4.4+ (kitkat) SMS support -->
		<receiver android:name="MmsIntentProcessor" android:label="@string/app_name"
				android:permission="android.permission.BROADCAST_WAP_PUSH"
				android:exported="true">
			<intent-filter>
				<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER"/>
				<data android:mimeType="application/vnd.wap.mms-message"/>
			</intent-filter>
		</receiver>
		<receiver android:name="com.commonsware.cwac.wakeful.AlarmReceiver"
				android:exported="true">
			<intent-filter>
				<action android:name="android.intent.action.BOOT_COMPLETED"/>
				<!--
				  The following QUICKBOOT_POWERON intents are used on HTC phones when
				  a soft-restart is done from the OEM's power menu
				-->
				<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
				<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
			</intent-filter>
			<meta-data android:name="com.commonsware.cwac.wakeful"
					android:resource="@xml/wakeful"/>
		</receiver>
		<service android:name="WakefulService"/>

		<!-- Android 4.4+ (kitkat) SMS support
		     I think this refers to an external Activity, although it may just be that it doesn't work currently.
		     Activity that allows the user to send new SMS/MMS messages -->
		<activity android:name="ComposeSmsActivity"
				android:windowSoftInputMode="adjustResize"
				android:enabled="@bool/kitkat_plus"
				android:exported="true">
			<intent-filter>
				<action android:name="android.intent.action.SEND"/>
				<action android:name="android.intent.action.SENDTO"/>
				<category android:name="android.intent.category.DEFAULT"/>
				<category android:name="android.intent.category.BROWSABLE"/>
				<data android:scheme="sms"/>
				<data android:scheme="smsto"/>
				<data android:scheme="mms"/>
				<data android:scheme="mmsto"/>
			</intent-filter>
		</activity>

		<!-- Android 4.4+ (kitkat) SMS support
		     I think this refers to an external Service, although it may just be that it doesn't work currently.
		     Service that delivers messages from the phone "quick response" -->
		<service android:name="HeadlessSmsSendService"
				android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
				android:exported="true"
				tools:ignore="MissingRegistered"
				android:enabled="@bool/kitkat_plus">
			<intent-filter>
				<action android:name="android.intent.action.RESPOND_VIA_MESSAGE"/>
				<category android:name="android.intent.category.DEFAULT"/>
				<data android:scheme="sms"/>
				<data android:scheme="smsto"/>
				<data android:scheme="mms"/>
				<data android:scheme="mmsto"/>
			</intent-filter>
		</service>
        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>
</manifest>
