Skip to content

Conversation

@shantanunautiyal
Copy link

🎯 Summary

This PR introduces several major new features and improvements to AirSync Android, including ADB-less screen mirroring with audio support, Health Connect integration, improved file transfer, Samsung wallpaper fixes, and many stability improvements.

✨ New Features

📱 ADB-less Screen Mirroring

  • No ADB required: Screen mirroring now works entirely over WebSocket without needing ADB connection
  • Audio mirroring support: Stream device audio to Mac alongside video (Android 10+)
  • Remote control: Tap, swipe, scroll gestures work via Accessibility Service
  • Keyboard input: Text input and key events via Accessibility Service
  • ⚠️ Requires Accessibility Permission: Users must enable the AirSync Accessibility Service for remote control features

🏥 Health Connect Integration

  • Health data sync: Sync steps, calories, distance, heart rate, sleep, and more to Mac
  • Real-time updates: Health summary sent automatically when connected
  • Health Connect permission: Integrates with Android's Health Connect API

📁 Android to Mac File Sharing

  • Send files from Android: Share files directly from Android to Mac
  • Chunked transfer: Large files transferred in chunks with progress tracking
  • SHA-256 checksums: File integrity verification
  • Rate limiting: Prevents overwhelming the connection

🖼️ Samsung Wallpaper Fix

  • WallpaperHandler: Special handling for Samsung devices that use different wallpaper APIs
  • Fallback mechanisms: Multiple methods to retrieve wallpaper on different devices

🎵 Mac Media Control

  • Control Mac media from Android: Play/pause, next/previous track
  • Media info display: Show currently playing track info from Mac

📲 Smartspacer Integration

  • Battery status: Display phone battery in Smartspacer
  • Media playback: Show currently playing media
  • Connection status: Show AirSync connection state

🔧 Improvements

Screen Capture Performance

  • Triple buffering: Smoother frame capture with 3-buffer ImageReader
  • Adaptive JPEG quality: Quality adjusts based on frame rate performance
  • Frame skipping optimization: Allows 30% faster bursts during scrolling
  • Raw JPEG encoding: Simpler and lower latency than H.264

Audio Capture

  • Throttled streaming: Audio frames sent at ~25fps to prevent blocking video
  • Accumulated buffers: Audio data batched for efficient transmission

Input Handling

  • Shell command fallback: Key injection falls back to shell commands when accessibility fails
  • Improved gesture handling: Better tap/swipe/scroll coordinate mapping

Stability & Reliability

  • Threading fixes: Proper coroutine scopes and thread safety
  • Error handling: Better error recovery and logging
  • Permission management: Improved permission request flow

📋 New Files Added

  • AudioCaptureService.kt - Audio streaming from device
  • ScreenMirroringManager.kt - H.264 video encoding for mirroring
  • RawFrameEncoder.kt - JPEG frame capture for mirroring
  • InputAccessibilityService.kt - Remote control via accessibility
  • RemoteInputHandler.kt - Input event processing
  • RemoteControlReceiver.kt - Broadcast receiver for remote commands
  • WallpaperHandler.kt - Samsung wallpaper compatibility
  • HealthDataCache.kt - Health data caching
  • SimpleHealthConnectManager.kt - Health Connect API integration
  • AutoApproveMirrorActivity.kt - Auto-approve mirroring requests
  • PermissionUtil.kt - Centralized permission handling

⚙️ Configuration Changes

  • Updated gradle/libs.versions.toml with new dependencies
  • Added accessibility_service_config.xml for Accessibility Service
  • Updated AndroidManifest.xml with new services and permissions

🔐 New Permissions Required

  • RECORD_AUDIO - For audio mirroring
  • FOREGROUND_SERVICE_MEDIA_PROJECTION - For screen capture
  • Accessibility Service - For remote control (tap, swipe, keyboard)
  • Health Connect - For health data sync (optional)

📝 Notes

  • Audio mirroring requires Android 10+ (API 29)
  • Remote control features require enabling Accessibility Service in device settings
  • Health Connect features require the Health Connect app to be installed
  • Samsung wallpaper fix specifically handles Samsung's custom wallpaper implementation

sameerasw and others added 30 commits September 18, 2025 22:29
UI redesign, Reconnect fix, and more
	app/src/main/java/com/sameerasw/airsync/utils/WebSocketUtil.kt
Added haptics for buttons,switches, actions and connecting status
…s, add health data features

- Fixed SimpleHealthScreen syntax errors
- Fixed MediaNotificationListener ClassCastException for SpannableString
- Added FileTransferScreen with file/folder picker
- Implemented FileReceiveManager with SHA-256 checksum verification
- Added FileTransferUtil for sending files with checksum
- Updated JsonUtil to include checksum in file transfer JSON
- Added file transfer notification support
- Fixed all build issues
- Added DocumentFile dependency for folder access
- Improved real-time notification capture
- Added live notification/activity sharing to macOS
…with chunks

- Removed folder picker and sendFolder function
- Fixed file sending to use chunk-based protocol (init, chunks, complete)
- Files now sent in smaller chunks instead of one large JSON
- Added transfer ID for tracking
- Added proper progress tracking
- Files are now actually sent to macOS when selected
- Added timezone logging to identify time range issues
- Added permission checking before data fetch
- Added detailed logging for each metric query
- Improved error messages with full exception details
- Added query time range logging
- This will help identify why health data is not showing correctly
File Transfer Improvements:
- Added file selection preview showing selected files
- Added 'Send Now' button to explicitly send files
- Added 'Cancel' button to clear selection
- Shows sending progress with loading indicator
- Files are now sent only when user clicks Send

Background Sync Service:
- Created BackgroundSyncService for continuous syncing
- Runs as foreground service to stay alive
- Auto-reconnects when connection drops
- Syncs notifications, health data, calls, messages in background
- Added toggle in Settings to enable/disable background sync
- Shows persistent notification when running
- Maintains WebSocket connection automatically
- Fixed buffer reuse issue in FileTransferUtil causing incorrect chunk data
- Improved Base64 decoding with fallback strategy in FileReceiveManager
- Enhanced chunk assembly with pre-allocated arrays and validation
- Normalized checksum comparison (trim + lowercase)
- Added detailed logging for checksum verification and debugging

- Added macMediaControl message handler for Mac->Android media controls
- Implemented handleMacMediaControl() to process play/pause/next/previous/like actions
- Added macMediaControlResponse JSON creation and sending
- Bidirectional media controls now fully functional
… improvements

Android fixes:
- Fix Mac media controls always visible and functional
- Fix screen capture invalid parameters error
- Fix expand networking text overflow
- Add mirror request notification when app minimized

macOS fixes:
- Fix 10+ threading crashes with AppState calls
- Add hardware decoder optimization for better FPS
- Add timeout for mirror request button grey state
- Wrap all AppState updates in DispatchQueue.main.async

Consolidated documentation into single CHANGELOG.md
- Fix screen capture invalid parameters by providing default MirroringOptions
- Add rate limiting to file transfers (10ms delay every 10 chunks)
- Prevent network overload when sending multiple files
- Send files sequentially to prevent state conflicts
- Update UI state on main thread with proper dispatchers
- Add comprehensive changelog with all fixes
sameerasw and others added 14 commits November 1, 2025 08:20
- Added screen curtain (black overlay) feature with SYSTEM_ALERT_WINDOW permission
- Fixed app-specific mirroring to not auto-launch apps
- Improved screen state handling (overlay instead of locking device)
- Added RawFrameEncoder for better frame encoding
- Enhanced WebSocket message handling for screen state
- Improved input accessibility service
- Fixed mirroring options handling
- Cleaned up documentation files
- Fix onNewIntent signature for newer Android APIs
- Replace ExperimentalMaterial3ExpressiveApi/LoadingIndicator with CircularProgressIndicator
- Add missing PermissionUtil methods and constants
- Add Guava dependency for ListenableFuture (CameraX)
- Fix CameraX imports and API usage
- Add injectTextViaShell() fallback when accessibility injection fails
- Add injectKeyViaShell() for key codes when no focused input field
- Arrow keys now use proper input keyevent instead of swipe gestures
- All key handlers fall back to shell commands if accessibility fails
- Increase ImageReader buffer from 2 to 3 (triple buffering)
- Add adaptive JPEG quality that reduces when frame rate struggles
- Improve frame skipping logic to allow 30% faster bursts during scrolling
- Increase max consecutive skips to 2 for better burst handling
- Add throttling with minFrameIntervalMs = 40ms (~25 audio frames/sec)
- Accumulate audio data and send in batches instead of every read
- Prevents audio frames from flooding WebSocket and blocking video
@sameerasw sameerasw changed the base branch from main to multiple-features December 25, 2025 02:35
@sameerasw sameerasw self-requested a review December 25, 2025 02:35
@sameerasw sameerasw added the enhancement New feature or request label Dec 25, 2025
@sameerasw sameerasw moved this from Backlog to In progress in AirSync Features and Bugs Dec 25, 2025
… notifications

- CallStateCallback: Skip sending call events when WebSocket is not connected
- PhoneStateReceiver: Only send call notifications when connected to Mac
- Removed Android-side call notifications (LiveNotificationService calls)
- Call notifications should only appear on Mac, not on Android
…ssing to prevent resource exhaustion

Implements a Producer-Consumer pattern where handleChunk pushes to a Channel and a single coroutine writes to disk. This replaces the previous 'launch new coroutine per chunk' approach which caused high memory pressure, GC thrashing, and potential socket disconnects on large file transfers.
@sameerasw sameerasw moved this from In progress to In review in AirSync Features and Bugs Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants