cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
527 stars 625 forks source link

[Health 10.2.0] Health connect permissions don't match what is asked #984

Open louisdeveseleer opened 2 weeks ago

louisdeveseleer commented 2 weeks ago

Device / Emulator and OS

Describe the bug

The permissions appearing in Health connect do not match the list of permissions passed to the plugin method requestAuthorization.

Dart:

  final types = [
    HealthDataType.WEIGHT,
    HealthDataType.HEIGHT,
    HealthDataType.WORKOUT,
    HealthDataType.ACTIVE_ENERGY_BURNED,
  ];
  final permissions = [
    HealthDataAccess.WRITE,
    HealthDataAccess.WRITE,
    HealthDataAccess.WRITE,
    HealthDataAccess.WRITE,
  ];
  await health.requestAuthorization(types, permissions: permissions);

Android Manifest:

    <uses-permission android:name="android.permission.health.WRITE_HEIGHT"/>
    <uses-permission android:name="android.permission.health.WRITE_WEIGHT"/>
    <uses-permission android:name="android.permission.health.WRITE_EXERCISE"/>
    <uses-permission android:name="android.permission.health.WRITE_ACTIVE_CALORIES_BURNED"/>

Health connect screen: Screenshot_20240618-105608

The "write" permissions in health connect do not include the ones that were requested, and the "read" permissions include all of them, although none was requested.

As a consequence:

To Reproduce

Ask for Write-only permissions.

Expected behavior

For Health connect to list the exact permissions requested, no more, no less.

Actual behavior

The permissions requested do not appear, and others that were not requested do appear.

Flutter doctor

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.90.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
louisdeveseleer commented 1 week ago

After further investigation, I was able to narrow down the precise issues: