Skip to content

When displaying Google Maps on Virtual Displays, the ZoomControl does not function properly on certain Android OS versions. #128925

@keisuke-kiriyama

Description

@keisuke-kiriyama

Is there an existing issue for this?

Steps to reproduce

After executing the code sample, manipulate the ZoomControl.

Expected results

The ZoomControl functions properly, allowing the user to zoom in and zoom out.

Actual results

ZoomControl works on Android versions prior to Android 12, but it does not function on Android 12L and later OS versions.

Code sample

main.dart
void main() {
  final GoogleMapsFlutterPlatform mapsImplementation =
      GoogleMapsFlutterPlatform.instance;
  if (mapsImplementation is GoogleMapsFlutterAndroid) {
    mapsImplementation.useAndroidViewSurface = false;
  }
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MapPage(),
    );
  }
}

class MapPage extends StatelessWidget {
  const MapPage({Key? key}) : super(key: key);

  static const CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Map Page'),
      ),
      body: const GoogleMap(initialCameraPosition: _kGooglePlex),
    );
  }
}
pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
  google_maps_flutter: 2.3.0

To avoid following issue, we are using Virtual Display instead of Hybrid Composition.
#105965

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.3, on macOS 12.6.1 21G217 darwin-arm64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.79.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

Metadata

Metadata

Assignees

Labels

Bot is counting down the days until it unassigns the issueP2Important issues not at the top of the work liste: OS-version specificAffects only some versions of the relevant operating systemfound in release: 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12p: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyplatform-views: vdIssues specific to the Android VirtualDisplay platform views backendr: fixedIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions