Minimize the use of exported="true" in android Manifest

- Add comments on Add exported="true" attributes
 - Disable manifest exporting for:
      - (service) VectorConnectionService
      - (receiver) MediaButtonReceiver
This commit is contained in:
ariskotsomitopoulos 2021-09-14 19:09:50 +03:00
parent 1fcb9f284a
commit f21d89eb29
2 changed files with 18 additions and 8 deletions

1
changelog.d/4018.misc Normal file
View File

@ -0,0 +1 @@
Minimize the use of exported="true" in android Manifest (link: https://github.com/matrix-org/matrix-dinsic/issues/618)

View File

@ -92,8 +92,10 @@
android:theme="@style/Theme.Vector.Launcher" /> android:theme="@style/Theme.Vector.Launcher" />
<!-- Activity alias for the launcher Activity (must be declared after the Activity it targets) --> <!-- Activity alias for the launcher Activity (must be declared after the Activity it targets) -->
<!-- exported="true" is required to launch application -->
<activity-alias <activity-alias
android:name=".features.Alias" android:name=".features.Alias"
android:exported="true"
android:targetActivity=".features.MainActivity"> android:targetActivity=".features.MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -107,9 +109,12 @@
</activity-alias> </activity-alias>
<activity android:name=".features.home.HomeActivity" /> <activity android:name=".features.home.HomeActivity" />
<!-- exported="true" is required to handle android.intent.action.VIEW for URL redirection-->
<activity <activity
android:name=".features.login.LoginActivity" android:name=".features.login.LoginActivity"
android:enabled="@bool/useLoginV1" android:enabled="@bool/useLoginV1"
android:exported="true"
android:launchMode="singleTask" android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<!-- Add intent filter to handle redirection URL after SSO login in external browser --> <!-- Add intent filter to handle redirection URL after SSO login in external browser -->
@ -124,9 +129,12 @@
android:scheme="element" /> android:scheme="element" />
</intent-filter> </intent-filter>
</activity> </activity>
<!-- exported="true" is required to handle android.intent.action.VIEW for URL redirection-->
<activity <activity
android:name=".features.login2.LoginActivity2" android:name=".features.login2.LoginActivity2"
android:enabled="@bool/useLoginV2" android:enabled="@bool/useLoginV2"
android:exported="true"
android:launchMode="singleTask" android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<!-- Add intent filter to handle redirection URL after SSO login in external browser --> <!-- Add intent filter to handle redirection URL after SSO login in external browser -->
@ -147,7 +155,6 @@
android:name=".features.media.VectorAttachmentViewerActivity" android:name=".features.media.VectorAttachmentViewerActivity"
android:theme="@style/Theme.Vector.Black.Transparent" android:theme="@style/Theme.Vector.Black.Transparent"
tools:ignore="Instantiatable" /> tools:ignore="Instantiatable" />
<activity android:name=".features.media.BigImageViewerActivity" /> <activity android:name=".features.media.BigImageViewerActivity" />
<activity <activity
android:name=".features.rageshake.BugReportActivity" android:name=".features.rageshake.BugReportActivity"
@ -165,7 +172,6 @@
<activity <activity
android:name=".features.crypto.keysbackup.settings.KeysBackupManageActivity" android:name=".features.crypto.keysbackup.settings.KeysBackupManageActivity"
android:label="@string/encryption_message_recovery" /> android:label="@string/encryption_message_recovery" />
<activity <activity
android:name=".features.reactions.EmojiReactionPickerActivity" android:name=".features.reactions.EmojiReactionPickerActivity"
android:label="@string/title_activity_emoji_reaction_picker" /> android:label="@string/title_activity_emoji_reaction_picker" />
@ -186,6 +192,7 @@
<activity android:name=".features.webview.VectorWebViewActivity" /> <activity android:name=".features.webview.VectorWebViewActivity" />
<!-- Activity to intercept links coming from a web instance --> <!-- Activity to intercept links coming from a web instance -->
<!-- exported="true" is required to handle android.intent.action.VIEW for URL redirection-->
<activity <activity
android:name=".features.link.LinkHandlerActivity" android:name=".features.link.LinkHandlerActivity"
android:enabled="true" android:enabled="true"
@ -206,6 +213,7 @@
</activity> </activity>
<!-- Activity alias for matrix.to or element permalinks --> <!-- Activity alias for matrix.to or element permalinks -->
<!-- exported="true" is required to handle android.intent.action.VIEW for URL redirection-->
<activity-alias <activity-alias
android:name=".features.permalink.PermalinkHandlerActivity" android:name=".features.permalink.PermalinkHandlerActivity"
android:enabled="true" android:enabled="true"
@ -231,8 +239,10 @@
</intent-filter> </intent-filter>
</activity-alias> </activity-alias>
<!-- exported="true" is required for the share functionality-->
<activity <activity
android:name=".features.share.IncomingShareActivity" android:name=".features.share.IncomingShareActivity"
android:exported="true"
android:parentActivityName=".features.home.HomeActivity"> android:parentActivityName=".features.home.HomeActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
@ -257,10 +267,8 @@
android:name="android.service.chooser.chooser_target_service" android:name="android.service.chooser.chooser_target_service"
android:value="androidx.sharetarget.ChooserTargetServiceCompat" /> android:value="androidx.sharetarget.ChooserTargetServiceCompat" />
</activity> </activity>
<activity android:name=".features.roomprofile.RoomProfileActivity" /> <activity android:name=".features.roomprofile.RoomProfileActivity" />
<activity android:name=".features.roomprofile.settings.joinrule.RoomJoinRuleActivity" /> <activity android:name=".features.roomprofile.settings.joinrule.RoomJoinRuleActivity" />
<activity android:name=".features.signout.hard.SignedOutActivity" /> <activity android:name=".features.signout.hard.SignedOutActivity" />
<activity <activity
android:name=".features.signout.soft.SoftLogoutActivity" android:name=".features.signout.soft.SoftLogoutActivity"
@ -275,12 +283,10 @@
</activity> </activity>
<activity android:name=".features.qrcode.QrCodeScannerActivity" /> <activity android:name=".features.qrcode.QrCodeScannerActivity" />
<activity android:name=".features.crypto.quads.SharedSecureStorageActivity" /> <activity android:name=".features.crypto.quads.SharedSecureStorageActivity" />
<activity <activity
android:name="com.yalantis.ucrop.UCropActivity" android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name=".features.attachments.preview.AttachmentsPreviewActivity" android:name=".features.attachments.preview.AttachmentsPreviewActivity"
android:theme="@style/Theme.Vector.Black.AttachmentsPreview" /> android:theme="@style/Theme.Vector.Black.AttachmentsPreview" />
@ -308,7 +314,6 @@
<!-- Single instance is very important for the custom scheme callback--> <!-- Single instance is very important for the custom scheme callback-->
<activity <activity
android:name=".features.auth.ReAuthActivity" android:name=".features.auth.ReAuthActivity"
android:exported="false"
android:launchMode="singleInstance"> android:launchMode="singleInstance">
<!-- XXX: UIA SSO has only web fallback, i.e no url redirect, so for now we comment this out <!-- XXX: UIA SSO has only web fallback, i.e no url redirect, so for now we comment this out
@ -334,6 +339,7 @@
<activity android:name=".features.spaces.manage.SpaceManageActivity" /> <activity android:name=".features.spaces.manage.SpaceManageActivity" />
<activity android:name=".features.spaces.people.SpacePeopleActivity" /> <activity android:name=".features.spaces.people.SpacePeopleActivity" />
<activity android:name=".features.spaces.leave.SpaceLeaveAdvancedActivity" /> <activity android:name=".features.spaces.leave.SpaceLeaveAdvancedActivity" />
<!-- Services --> <!-- Services -->
<service <service
@ -353,6 +359,7 @@
<service <service
android:name=".features.call.telecom.VectorConnectionService" android:name=".features.call.telecom.VectorConnectionService"
android:exported="false"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"> android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE">
<intent-filter> <intent-filter>
<action android:name="android.telecom.ConnectionService" /> <action android:name="android.telecom.ConnectionService" />
@ -379,7 +386,9 @@
A media button receiver receives and helps translate hardware media playback buttons, A media button receiver receives and helps translate hardware media playback buttons,
such as those found on wired and wireless headsets, into the appropriate callbacks in your app. such as those found on wired and wireless headsets, into the appropriate callbacks in your app.
--> -->
<receiver android:name="androidx.media.session.MediaButtonReceiver"> <receiver
android:name="androidx.media.session.MediaButtonReceiver"
android:exported="false">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" /> <action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter> </intent-filter>