<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools">
  <!-- ===== Permissions ===== -->
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING" />
  <uses-permission android:name="android.permission.USE_BIOMETRIC" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
  <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.MODIFY_AUDIO_SETTINGS" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
  <uses-permission android:name="android.permission.READ_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <uses-permission android:name="android.permission.QUICKBOOT_POWERON" />
  <uses-permission android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
  <uses-permission android:name="android.permission.PICTURE_IN_PICTURE" />
  <uses-feature android:name="android.hardware.camera" />
  <uses-feature android:name="android.hardware.camera.autofocus" />

  <!-- Package visibility declarations for external apps like maps and WhatsApp -->
  <queries>
      <package android:name="com.whatsapp" />
      <package android:name="com.google.android.apps.maps" />
      <intent>
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.BROWSABLE" />
          <data android:scheme="https" />
      </intent>
      <intent>
          <action android:name="android.intent.action.VIEW" />
          <data android:scheme="geo" />
      </intent>
  </queries>

  <application android:name="${applicationName}" android:icon="@mipmap/launcher_icon"
    android:label="@string/label" android:enableOnBackInvokedCallback="true"
    android:allowBackup="false" android:fullBackupContent="false"
    android:networkSecurityConfig="@xml/network_security_config"
    android:usesCleartextTraffic="false" android:theme="@style/LaunchTheme">
    <!-- Flutter embedding v2 -->
    <meta-data android:name="flutterEmbedding" android:value="2" />
    <!-- تحديد نقطة دخول خلفية (للـ overlay / background executor) -->
    <!-- <meta-data
            android:name="io.flutter.embedding.android.BackgroundExecutor.DART_ENTRYPOINT"
            android:value="overlayMain" />
        <meta-data
            android:name="io.flutter.embedding.android.BackgroundExecutor.DART_LIBRARY_URI"
            android:value="main.dart" /> -->
    <!-- خرائط + إشعارات فFirebase (قناة افتراضية) -->
    <meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="${mapsApiKey}" />
    <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"
      android:value="@string/default_notification_channel_id" />
    <meta-data android:name="io.flutter.embedding.android.EnableImpeller" android:value="false" />
    <!-- Main Activity -->
    <activity android:name=".MainActivity"
      android:configChanges="orientation|keyboardHidden|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
      android:exported="true" android:hardwareAccelerated="true" android:launchMode="singleTask"
      android:theme="@style/LaunchTheme" android:windowSoftInputMode="adjustResize">
      <meta-data android:name="io.flutter.embedding.android.NormalTheme"
        android:resource="@style/NormalTheme" />
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <!-- Deep Link: siromove://... -->
      <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="siromove" />
      </intent-filter>

      <!-- App Links for siromove.com -->
      <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" android:host="siromove.com" android:pathPrefix="/" />
        <data android:scheme="https" android:host="www.siromove.com" android:pathPrefix="/" />
      </intent-filter>

      <!-- Navigation Intents -->
      <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="geo" />
      </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="google.navigation" />
      </intent-filter>

      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="vnd.android.cursor.item/map" />
      </intent-filter>
    </activity>
    <!-- أنشطة ومكوّنات إضافية -->
    <activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait"
      android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
    <!-- خدماتك الخاصة -->
    <service
      android:name="id.flutter.flutter_background_service.BackgroundService"
      android:foregroundServiceType="location"
      android:enabled="true"
      android:exported="true"
    />
    <service
      android:name="com.siro.siro_driver.trip_overlay_plugin.TripOverlayService"
      android:exported="false"
      android:foregroundServiceType="specialUse" />
    <service android:name=".MyFirebaseMessagingService" android:exported="false" />
    <service android:name=".LocationUpdatesService" android:exported="false"
      android:foregroundServiceType="location" />
    <!-- خدمة Firebase الرسمية لاستقبال رسائل FCM -->
    <service android:name="com.google.firebase.messaging.FirebaseMessagingService"
      android:exported="false" tools:replace="android:exported">
      <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>
    <!-- خدمة overlay للمكتبة الأولى (إن كنت تستخدمها) -->
    <!-- <service
            android:name="com.phan_tech.flutter_overlay_apps.OverlayService"
            android:exported="false" /> -->
    <service
      android:name="com.trip_overlay.TripOverlayService"
      android:exported="false"
      android:foregroundServiceType="specialUse"
      android:stopWithTask="false" />

    <receiver
      android:name="com.trip_overlay.TripOverlayReceiver"
      android:exported="false">
      <intent-filter>
        <action android:name="com.trip_overlay.SHOW_OVERLAY" />
      </intent-filter>
    </receiver>
    <service android:name="flutter.overlay.window.flutter_overlay_window.OverlayService"
      android:exported="false" android:foregroundServiceType="specialUse" />
    <!-- خدمة overlay الخاصة بمكتبة flutter_overlay_window -->
    <!-- استقبال توكن/رسائل قديمة (توافقية) -->
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
      android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <category android:name="com.siro.siro_driver" />
      </intent-filter>
    </receiver>
    <!-- خدمة الفقاعة الخاصة بك -->
    <service android:name="com.dsaved.bubblehead.bubble.BubbleHeadService" android:enabled="true"
      android:exported="false">
      <intent-filter>
        <action android:name="intent.bring.app.to.foreground" />
        <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </service>
    <!-- Notif schedulers -->
    <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
      android:exported="false" />
    <receiver
      android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
      android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
        <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
      </intent-filter>
    </receiver>
    <!-- مستقبل برودكاست خاص بك -->
    <receiver android:name=".YourBroadcastReceiver" android:exported="false" />

    <!-- Android Auto Support -->
    <meta-data
        android:name="androidx.car.app.minCarAppApiLevel"
        android:value="1" />
    <meta-data
        android:name="com.google.android.gms.car.application"
        android:resource="@xml/automotive_app_desc" />
    <service
        android:name=".MyCarAppService"
        android:exported="true">
        <intent-filter>
            <action android:name="androidx.car.app.CarAppService" />
            <category android:name="androidx.car.app.category.NAVIGATION" />
        </intent-filter>
    </service>
  </application>
  <uses-permission android:name="android.permission.INTERNET" />
</manifest>