Skip to content

Commit

Permalink
android: specify whether or not receivers are exported
Browse files Browse the repository at this point in the history
  • Loading branch information
kari-ts committed Dec 4, 2024
1 parent f96b632 commit 0e64680
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@
</intent-filter>
</receiver>

<receiver
android:name=".MDMSettingsChangedReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_RESTRICTIONS_CHANGED" />
</intent-filter>
< /receiver>

<service
android:name=".IPNService"
android:exported="false"
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/tailscale/ipn/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ open class UninitializedApp : Application() {

// Register the receiver before stopping VPN
val intentFilter = IntentFilter(IPNService.ACTION_STOP_VPN)
this.registerReceiver(stopReceiver, intentFilter)
this.registerReceiver(stopReceiver, intentFilter, Context.RECEIVER_NOT_EXPORTED)

stopVPN()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.tailscale.ipn.util.TSLog

class MDMSettingsChangedReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent?.action == android.content.Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED) {
if (intent?.action == Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED) {
TSLog.d("syspolicy", "MDM settings changed")
val restrictionsManager = context?.getSystemService(Context.RESTRICTIONS_SERVICE) as RestrictionsManager
MDMSettings.update(App.get(), restrictionsManager)
Expand Down

0 comments on commit 0e64680

Please sign in to comment.