Skip to content

[fix] Android 햅틱 피드백 강도 보정#10

Merged
hyejj19 merged 2 commits intomainfrom
feature/fix-haptic-intensity
Mar 6, 2026
Merged

[fix] Android 햅틱 피드백 강도 보정#10
hyejj19 merged 2 commits intomainfrom
feature/fix-haptic-intensity

Conversation

@hyejj19
Copy link
Copy Markdown
Collaborator

@hyejj19 hyejj19 commented Mar 5, 2026

변경 사항

  • Android에서 Flutter HapticFeedback API의 light/medium/heavy 강도가 실제 체감과 불일치하는 문제 수정
  • vibration 패키지를 도입하여 Android에서 amplitude(0~255)를 직접 제어
  • iOS는 기존 Flutter HapticFeedback API 유지 (Apple이 강도 순서를 보장하므로 문제 없음)
  • amplitude 미지원 Android 기기(API 26 미만)에 대한 fallback 처리

원인

Flutter의 heavyImpact() → Android CONTEXT_CLICK(마우스 우클릭용, OEM이 약하게 튜닝)
Flutter의 lightImpact() → Android VIRTUAL_KEY(키보드 탭용, OEM이 강하게 튜닝)
Android의 HapticFeedbackConstants는 강도 스케일이 아닌 UI 맥락 레이블이며, 실제 강도는 OEM별로 상이함

적용 amplitude 값

타입 Duration Amplitude 근거
light 50ms 30 expo-haptics 프로덕션 값
medium 43ms 50 expo-haptics 프로덕션 값 (light 대비 1.67배)
heavy 60ms 70 expo-haptics 프로덕션 값 (medium 대비 1.4배)
selection 20ms 20 AOSP PRIMITIVE_LOW_TICK 기준
vibrate 500ms 128 알림/경고급 진동

레벨 간 최소 1.4배 차이 유지 (Android Haptics Design Principles)

테스트

  • 로컬 테스트 완료
  • iOS 빌드/실행 확인
  • Android 빌드/실행 확인

관련 이슈

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Android에서 Flutter HapticFeedback API의 light/medium/heavy가
실제 체감 강도와 불일치하는 문제를 vibration 패키지의
amplitude 직접 제어로 해결.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 5, 2026 08:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Android에서 HapticFeedback의 light/medium/heavy 체감 강도가 뒤섞이는 문제를 해결하기 위해, Android(Amplitude 지원)에서는 vibration 패키지로 amplitude를 직접 제어하고 그 외(iOS/미지원 Android)는 기존 HapticFeedback로 fallback 하도록 변경한 PR입니다.

Changes:

  • vibration 패키지 의존성 추가
  • DeviceBridgeHandler.triggerHaptic()에서 Android amplitude 지원 시 타입별 duration/amplitude로 진동 호출
  • pubspec.lock에 신규/전이 의존성 반영

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
pubspec.yaml vibration 패키지 추가로 Android 진동 amplitude 제어 기반 마련
pubspec.lock vibration 및 관련 전이 의존성 잠금 반영
lib/bridge/handlers/device_bridge_handler.dart Android는 amplitude 기반 진동으로 보정, iOS/미지원 Android는 기존 API 유지

Comment on lines +54 to +66
Vibration.vibrate(duration: 50, amplitude: 30);
break;
case 'medium':
Vibration.vibrate(duration: 43, amplitude: 50);
break;
case 'heavy':
Vibration.vibrate(duration: 60, amplitude: 70);
break;
case 'selection':
Vibration.vibrate(duration: 20, amplitude: 20);
break;
case 'vibrate':
Vibration.vibrate(duration: 500, amplitude: 128);
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vibration.vibrate(...)await하지 않아, 플러그인 채널 에러/예외가 발생해도 현재 try/catch에서 잡히지 않고 unhandled Future error로 남을 수 있습니다. 동일한 메서드 내에서 iOS 경로는 await HapticFeedback...로 처리하고 있으니, Android amplitude 경로도 await로 통일하거나(권장) 의도적으로 fire-and-forget이면 unawaited(...) + 에러 처리로 명시해 주세요.

Suggested change
Vibration.vibrate(duration: 50, amplitude: 30);
break;
case 'medium':
Vibration.vibrate(duration: 43, amplitude: 50);
break;
case 'heavy':
Vibration.vibrate(duration: 60, amplitude: 70);
break;
case 'selection':
Vibration.vibrate(duration: 20, amplitude: 20);
break;
case 'vibrate':
Vibration.vibrate(duration: 500, amplitude: 128);
await Vibration.vibrate(duration: 50, amplitude: 30);
break;
case 'medium':
await Vibration.vibrate(duration: 43, amplitude: 50);
break;
case 'heavy':
await Vibration.vibrate(duration: 60, amplitude: 70);
break;
case 'selection':
await Vibration.vibrate(duration: 20, amplitude: 20);
break;
case 'vibrate':
await Vibration.vibrate(duration: 500, amplitude: 128);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2daa22d.

변경 내용: 모든 Vibration.vibrate() 호출에 await 추가
이유: iOS 경로와 동일하게 await로 통일하여 try/catch에서 에러를 정상적으로 캐치할 수 있도록 수정

Addresses review comment by @copilot-pull-request-reviewer on device_bridge_handler.dart:66.
PR: #10
@hyejj19 hyejj19 merged commit 027c8f5 into main Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants