Cotton code
244 lines · 15.1 KB · HTMLRaw
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools">    <!-- A chat's arrival while the app is closed (MessagesPush), and a call's ring. -->    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />    <!-- Calls (as Cotton Calling had them): the microphone always, the camera for video; each asked when a call first needs it. -->    <uses-permission android:name="android.permission.RECORD_AUDIO" />    <uses-permission android:name="android.permission.CAMERA" />    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />    <!-- Telecom: a self-managed PhoneAccount, so a call rings and holds like a phone call. -->    <uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />    <!-- The ring's full-screen call screen over the lock screen. -->    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />    <uses-permission android:name="android.permission.VIBRATE" />    <!-- The foreground service a call holds while it is up. -->    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />    <!-- A speech model's download stands in the foreground while it runs (ModelFetch, the engine Comms carries). -->    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />    <uses-permission android:name="android.permission.WAKE_LOCK" />    <uses-feature android:name="android.hardware.camera" android:required="false" />    <uses-feature android:name="android.hardware.microphone" android:required="false" />    <uses-feature android:name="android.software.telecom" android:required="false" />    <!-- SMS (DECISIONS "SMS on Android"): held only while Comms is the phone's SMS app, which he chooses on You's         Texts (SMS) page; Android grants these with the role and never asks for them alone. -->    <uses-permission android:name="android.permission.READ_SMS" />    <uses-permission android:name="android.permission.SEND_SMS" />    <uses-permission android:name="android.permission.RECEIVE_SMS" />    <uses-permission android:name="android.permission.RECEIVE_MMS" />    <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />    <uses-permission android:name="android.permission.READ_PHONE_STATE" android:maxSdkVersion="29" />    <uses-feature android:name="android.hardware.telephony" android:required="false" />    <!-- The Cotton apps a done download opens in (Downloads chat's Open): each answers its own links. -->    <queries>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottoncinemas" /></intent>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottoncinemasdev" /></intent>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottonmusic" /></intent>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottonmusicdev" /></intent>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottonbooks" /></intent>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottonbooksdev" /></intent>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottonphotos" /></intent>        <intent><action android:name="android.intent.action.VIEW" /><data android:scheme="cottonphotosdev" /></intent>        <!-- A web link tapped in Comms (chat.link): whether Cotton Sites is on this phone, to hand it the link explicitly. -->        <package android:name="com.cottondb.sites${serverSuffix}" />    </queries>    <application android:name="com.cottondb.messages.MessagesApplication">        <!-- Comms hands its sites to Cotton Sites once (SitesMoveProvider): only a Cotton app may ask, which the             provider checks by the registry's certificates (CottonSigners), never a permission (android-permissions). -->        <provider            android:name="com.cottondb.messages.sites.SitesMoveProvider"            android:authorities="${applicationId}.sitesmove"            android:exported="true" />        <!-- A chat notification's Reply and Mark as read (ChatNotices), done without opening the app. -->        <receiver android:name="com.cottondb.messages.ChatNoticeReceiver" android:exported="false" />        <!-- singleTask: one chat face, never a second. adjustResize: the typing line rides above the keyboard. -->        <activity            android:name="com.cottondb.messages.MainActivity"            android:exported="true"            android:launchMode="singleTask"            android:supportsPictureInPicture="true"            android:showOnLockScreen="true"            android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboardHidden|uiMode|density|fontScale"            android:windowSoftInputMode="adjustResize">            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>            <!-- A number tapped outside Comms (a contact's Message, an sms: link): its chat, Cotton's or WhatsApp's as                 the core routes it (FEEDBACK-2 A). -->            <intent-filter>                <action android:name="android.intent.action.SENDTO" />                <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>            <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="sms" />                <data android:scheme="smsto" />            </intent-filter>            <!-- A Circle invitation (`https://<open host>/c/<code>#<secret>`, the core's circle.invite): verified against the                 host's assetlinks.json, so Comms opens it and hands the whole link to circle.invite.open. -->            <intent-filter android:autoVerify="true">                <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="${openHost}" />                <data android:pathPrefix="/c/" />            </intent-filter>            <!-- WhatsApp's Export chat, shared here: the _chat.txt or the .zip, imported by the core (import.whatsappExport). -->            <intent-filter>                <action android:name="android.intent.action.SEND" />                <category android:name="android.intent.category.DEFAULT" />                <data android:mimeType="text/plain" />            </intent-filter>            <intent-filter>                <action android:name="android.intent.action.SEND" />                <category android:name="android.intent.category.DEFAULT" />                <data android:mimeType="application/zip" />            </intent-filter>            <!-- An audio file shared or opened here becomes a recording (DECISIONS "Recordings": m4a, mp3, ogg/opus,                 amr, 3gp, wav; the core's meetings.import). -->            <intent-filter>                <action android:name="android.intent.action.SEND" />                <category android:name="android.intent.category.DEFAULT" />                <data android:mimeType="audio/*" />            </intent-filter>            <intent-filter>                <action android:name="android.intent.action.SEND" />                <category android:name="android.intent.category.DEFAULT" />                <data android:mimeType="application/ogg" />            </intent-filter>            <intent-filter>                <action android:name="android.intent.action.VIEW" />                <category android:name="android.intent.category.DEFAULT" />                <data android:scheme="content" />                <data android:mimeType="audio/*" />            </intent-filter>        </activity>        <!-- "Downloads" in the share sheet (DLCHAT): a link or a .torrent shared here goes to the Downloads chat's queue             (ShareIntake reads `com.cottondb.share.to`, the core `share.fetchLinks { to: downloads }`). -->        <activity-alias            android:name="com.cottondb.messages.DownloadsShare"            android:targetActivity="com.cottondb.messages.MainActivity"            android:label="@string/messages_downloads_share"            android:exported="true">            <meta-data android:name="com.cottondb.share.to" android:value="downloads" />            <intent-filter>                <action android:name="android.intent.action.SEND" />                <category android:name="android.intent.category.DEFAULT" />                <data android:mimeType="text/plain" />            </intent-filter>            <intent-filter>                <action android:name="android.intent.action.SEND" />                <category android:name="android.intent.category.DEFAULT" />                <data android:mimeType="application/x-bittorrent" />            </intent-filter>        </activity-alias>        <!-- Calls (com.cottondb.calling, shared with Cotton Calling): Telecom binds the connection service for the             PhoneAccount; the call's foreground service holds its notice, microphone and camera; the receiver takes             the ring's Decline and the ongoing call's Hang up. -->        <service            android:name="com.cottondb.calling.CallConnectionService"            android:exported="true"            android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE">            <intent-filter>                <action android:name="android.telecom.ConnectionService" />            </intent-filter>        </service>        <service            android:name="com.cottondb.calling.CallService"            android:exported="false"            android:foregroundServiceType="phoneCall|microphone|camera" />        <receiver android:name="com.cottondb.calling.CallActionReceiver" android:exported="false" />        <!-- A recording (DECISIONS "Recordings"): in the foreground with the microphone's type; swiping Comms away leaves             it recording (Meetings' recorder, shared). -->        <service            android:name="com.cottondb.meetings.record.RecorderService"            android:exported="false"            android:foregroundServiceType="microphone"            android:stopWithTask="false" />        <!-- A recording started outside Comms (MEETINGS-RETIRE "Quick starts"): the Quick Settings tile and the launcher             shortcut open this, which holds the microphone, starts or stops the recorder and closes. -->        <activity            android:name="com.cottondb.meetings.record.RecordActivity"            android:exported="false"            android:excludeFromRecents="true"            android:noHistory="true"            android:taskAffinity=""            android:theme="@android:style/Theme.Translucent.NoTitleBar" />        <!-- The Quick Settings tile: one tap records, a second stops; lit while recording. -->        <service            android:name="com.cottondb.meetings.record.RecordTile"            android:exported="true"            android:icon="@drawable/meetings_recording"            android:label="@string/messages_record_tile"            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">            <intent-filter>                <action android:name="android.service.quicksettings.action.QS_TILE" />            </intent-filter>            <meta-data android:name="android.service.quicksettings.TOGGLEABLE_TILE" android:value="true" />        </service>        <!-- The speech engine Comms carries (Cotton Voice's, shared): bound by Comms alone. -->        <service            android:name="com.cottondb.voice.VoiceService"            android:exported="false">            <intent-filter>                <action android:name="com.cottondb.action.VOICE" />            </intent-filter>        </service>        <service            android:name="androidx.work.impl.foreground.SystemForegroundService"            android:foregroundServiceType="dataSync"            tools:node="merge" />        <!-- SMS (DECISIONS "SMS on Android"): what Android asks of the SMS app. A text arriving (SMS_DELIVER), a picture             message's notice (WAP_PUSH_DELIVER), a quick reply from a call's screen (RESPOND_VIA_MESSAGE); the radio's             answer for each part Comms sends. SENDTO sms:/smsto:/mms:/mmsto: is MainActivity's above. -->        <receiver            android:name="com.cottondb.messages.sms.SmsDeliverReceiver"            android:exported="true"            android:permission="android.permission.BROADCAST_SMS">            <intent-filter>                <action android:name="android.provider.Telephony.SMS_DELIVER" />            </intent-filter>        </receiver>        <receiver            android:name="com.cottondb.messages.sms.MmsDeliverReceiver"            android:exported="true"            android:permission="android.permission.BROADCAST_WAP_PUSH">            <intent-filter>                <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />                <data android:mimeType="application/vnd.wap.mms-message" />            </intent-filter>        </receiver>        <service            android:name="com.cottondb.messages.sms.SmsRespondService"            android:exported="true"            android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE">            <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>        <receiver android:name="com.cottondb.messages.sms.SmsSentReceiver" android:exported="false" />        <!-- FCM's data message {kind: chat}: what the object holds is landed and said; {kind: ring|stop}: a call's (MessagesPush). -->        <service android:name="com.cottondb.messages.MessagesPush" android:exported="false">            <intent-filter>                <action android:name="com.google.firebase.MESSAGING_EVENT" />            </intent-filter>        </service>    </application></manifest>