Repository: flutter
Issue: [google_maps_flutter] Android animation display is not smooth
Labels: e: device-specific,c: performance,p: maps,package,P2,team-android,triaged-android

### Steps to reproduce

1. Launching app
2. Scrolling through map

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart';
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final GoogleMapsFlutterPlatform mapsImplementation =
      GoogleMapsFlutterPlatform.instance;

  AndroidMapRenderer mapRenderer = AndroidMapRenderer.platformDefault;
  if (mapsImplementation is GoogleMapsFlutterAndroid) {
    mapsImplementation.useAndroidViewSurface = false;
    mapRenderer = await mapsImplementation
        .initializeWithRenderer(AndroidMapRenderer.latest);
  }
  runApp(MapScreen());
}

class MapScreen extends StatelessWidget {
  MapScreen({Key? key}) : super(key: key);

  final Completer<GoogleMapController> _controller =
  Completer<GoogleMapController>();

  static const CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );

  static const CameraPosition _kLake = CameraPosition(
      bearing: 192.8334901395799,
      target: LatLng(37.43296265331129, -122.08832357078792),
      tilt: 59.440717697143555,
      zoom: 19.151926040649414);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: GoogleMap(
          mapType: MapType.normal,
          initialCameraPosition: _kGooglePlex,
          onMapCreated: (GoogleMapController controller) {
            _controller.complete(controller);
          },
        ),
        floatingActionButton: FloatingActionButton.extended(
          onPressed: _goToTheLake,
          label: const Text('To the lake!'),
          icon: const Icon(Icons.directions_boat),
        ),
      ),
    );
  }

  Future<void> _goToTheLake() async {
    final GoogleMapController controller = await _controller.future;
    await controller.animateCamera(CameraUpdate.newCameraPosition(_kLake));
  }
}
```

</details>


### Performance profiling on master channel

- [X] The issue still persists on the master channel


### Video demonstration

<details open>
<summary>Video demonstration</summary>

[[Link to video recorder]](https://photos.app.goo.gl/VJSVaeEyuWbUz5As5)

</details>


### What target platforms are you seeing this bug on?

Android

### OS/Browser name and version | Device information

Android 14, phone POCO F5, Snapdragon 7+ Gen 2 Mobile Platform

### Does the problem occur on emulator/simulator as well as on physical devices?

Unknown

### Is the problem only reproducible with Impeller?

No

### Logs

<details open><summary>Logs</summary>

```console
D/MapsInitializer( 8241): preferredRenderer: null
D/zzcc    ( 8241): preferredRenderer: null
I/Google Android Maps SDK( 8241): Google Play services package version: 242335038
I/Google Android Maps SDK( 8241): Google Play services maps renderer version(maps_core): 241610202
D/CompatibilityChangeReporter( 8241): Compat change id reported: 210923482; UID 10432; state: ENABLED
D/CompatibilityChangeReporter( 8241): Compat change id reported: 171228096; UID 10432; state: ENABLED
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
D/CompatibilityChangeReporter( 8241): Compat change id reported: 236825255; UID 10432; state: ENABLED
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/libEGL  ( 8241): pre_cache appList: com.sina.weibo,com.ss.android.article.news,com.taobao.taobao,com.smile.gifmaker,com.ss.android.ugc.aweme,com.tencent.mm,tv.danmaku.bili,
I/GoogleMapController( 8241): Installing custom TextureView driven invalidator.
E/GoogleMapController( 8241): Cannot enable MyLocation layer as location permissions are not granted
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
I/HandWritingStubImpl( 8241): refreshLastKeyboardType: 1
I/HandWritingStubImpl( 8241): getCurrentKeyboardType: 1
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
I/HandWritingStubImpl( 8241): getCurrentKeyboardType: 1

E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ample.reproduce( 8241): Long monitor contention with owner androidmapsapi-TilePrep_3 (1971) at void m.erb.run()(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:305) waiters=0 in void m.erb.run() for 333ms
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ample.reproduce( 8241): Long monitor contention with owner androidmapsapi-TilePrep_3 (1971) at void m.erb.run()(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:305) waiters=1 in void m.erb.run() for 211ms
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ample.reproduce( 8241): Long monitor contention with owner androidmapsapi-TilePrep_3 (1971) at void m.erb.run()(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:305) waiters=1 in void m.erb.run() for 114ms
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
I/ample.reproduce( 8241): Compiler allocated 7524KB to compile void m.eiq.V(m.enc, m.fdq, android.content.res.Resources, m.ele, m.evm, boolean, m.dld, java.util.Map, boolean, boolean)
W/GL-Map  ( 8241): type=1400 audit(0.0:3368031): avc:  denied  { getattr } for  path="/sys/module/metis/parameters/minor_window_app" dev="sysfs" ino=69806 scontext=u:r:untrusted_app:s0:c176,c257,c512,c768 tcontext=u:object_r:sysfs_migt:s0 tclass=file permissive=0 app=com.example.reproduce
E/LB      ( 8241): fail to open node: No such file or directory
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
I/ample.reproduce( 8241): Compiler allocated 7511KB to compile void m.eiq.V(m.enc, m.fdq, android.content.res.Resources, m.ele, m.evm, boolean, m.dld, java.util.Map, boolean, boolean)
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
I/ample.reproduce( 8241): Compiler allocated 8407KB to compile void m.eiq.V(m.enc, m.fdq, android.content.res.Resources, m.ele, m.evm, boolean, m.dld, java.util.Map, boolean, boolean)
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
I/ample.reproduce( 8241): Compiler allocated 4627KB to compile void m.edh.b(m.dls, m.eca, m.eec, m.elq, boolean)
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
I/ample.reproduce( 8241): Compiler allocated 5160KB to compile void m.ezm.e()
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
I/ample.reproduce( 8241): Compiler allocated 4505KB to compile m.emy m.enc.k(m.bff, m.hxc, m.emr, byte[], boolean, m.chs, m.dgk, java.lang.Iterable)
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
E/FrameEvents( 8241): updateAcquireFence: Did not find frame.
W/DynamiteModule( 8241): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule( 8241): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:7
I/DynamiteModule( 8241): Selected remote version of com.google.android.gms.googlecertificates, version >= 7
W/ample.reproduce( 8241): ClassLoaderContext classpath size mismatch. expected=12, found=5 (DLC[];PCL[base.apk*61578492:base.apk!classes2.dex*754617187:base.apk!classes3.dex*2136026185:base.apk!classes4.dex*536683883:base.apk!classe
s5.dex*2428116329:base.apk!classes6.dex*3311553477:base.apk!classes7.dex*546458987:base.apk!classes8.dex*1064795178:base.apk!classes9.dex*3205764977:base.apk!classes10.dex*2622192443:base.apk!classes11.dex*1514544215:base.apk!classe
s12.dex*2342603168]{PCL[/system/framework/org.apache.http.legacy.jar*2865211570]#PCL[/system/framework/com.android.media.remotedisplay.jar*2114713713]#PCL[/system/framework/com.android.location.provider.jar*3994156536]#PCL[/system/f
ramework/org.apache.http.legacy.jar*2865211570]} | DLC[];PCL[/data/app/~~sN8uWpYs_jhrHHwc2Bz9kg==/com.example.reproduce-cPZ__tVxkuBuuKYIa1DVIQ==/base.apk*515890742:/data/app/~~sN8uWpYs_jhrHHwc2Bz9kg==/com.example.reproduce-cPZ__tVxk
uBuuKYIa1DVIQ==/base.apk!classes2.dex*3270264795:/data/app/~~sN8uWpYs_jhrHHwc2Bz9kg==/com.example.reproduce-cPZ__tVxkuBuuKYIa1DVIQ==/base.apk!classes3.dex*351728567:/data/app/~~sN8uWpYs_jhrHHwc2Bz9kg==/com.example.reproduce-cPZ__tVxkuBuuKYIa1DVIQ==/base.apk!classes4.dex*811417418:/data/app/~~sN8uWpYs_jhrHHwc2Bz9kg==/com.example.reproduce-cPZ__tVxkuBuuKYIa1DVIQ==/base.apk!classes5.dex*3036514985]{PCL[/system/framework/org.apache.http.legacy.jar*2865211570]})   
W/ProxyAndroidLoggerBackend( 8241): Too many Flogger logs received before configuration. Dropping old logs.
W/MobStoreFlagStore( 8241): Unable to update local snapshot for com.google.android.libraries.consentverifier#com.example.reproduce, may result in stale flags.
W/MobStoreFlagStore( 8241): java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.example.reproduce, sha256=[59a8e83f13b1cc8bf8983424a550170213f2ed2c4f28999cf8a02eab8a69ab8b], atk=false, ver=242335038.true (go/gsrlt)
W/MobStoreFlagStore( 8241):     at m.gxi.s(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:21)
W/MobStoreFlagStore( 8241):     at m.gxi.get(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:3)
W/MobStoreFlagStore( 8241):     at m.hai.a(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:2)
W/MobStoreFlagStore( 8241):     at m.gzb.h(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:10)
W/MobStoreFlagStore( 8241):     at m.fjb.d(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:1)
W/MobStoreFlagStore( 8241):     at m.fit.run(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:5)
W/MobStoreFlagStore( 8241):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
W/MobStoreFlagStore( 8241):     at java.util.concurrent.FutureTask.run(FutureTask.java:264)
W/MobStoreFlagStore( 8241):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
W/MobStoreFlagStore( 8241):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
W/MobStoreFlagStore( 8241):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
W/MobStoreFlagStore( 8241):     at java.lang.Thread.run(Thread.java:1012)
W/MobStoreFlagStore( 8241): Caused by: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.example.reproduce, sha256=[59a8e83f13b1cc8bf8983424a550170213f2ed2c4f28999cf8a02eab8a69ab8b], atk=false, ver=242335038.true (go/gsrlt)
W/MobStoreFlagStore( 8241):     at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
W/MobStoreFlagStore( 8241):     at android.os.Parcel.createException(Parcel.java:3041)
W/MobStoreFlagStore( 8241):     at android.os.Parcel.readException(Parcel.java:3024)
W/MobStoreFlagStore( 8241):     at android.os.Parcel.readException(Parcel.java:2966)
W/MobStoreFlagStore( 8241):     at m.bcv.c(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:11)
W/MobStoreFlagStore( 8241):     at m.cxd.a(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:39)
W/MobStoreFlagStore( 8241):     at m.coi.e(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:11)
W/MobStoreFlagStore( 8241):     at m.cph.u(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:10)
W/MobStoreFlagStore( 8241):     at m.cph.v(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:22)
W/MobStoreFlagStore( 8241):     at m.cph.e(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:16)
W/MobStoreFlagStore( 8241):     at m.cpl.handleMessage(:com.google.android.gms.policy_maps_core_dynamite@241610205@241610202042.636179997.636179997:766)
W/MobStoreFlagStore( 8241):     at android.os.Handler.dispatchMessage(Handler.java:102)
W/MobStoreFlagStore( 8241):     at android.os.Looper.loopOnce(Looper.java:224)
W/MobStoreFlagStore( 8241):     at android.os.Looper.loop(Looper.java:318)
W/MobStoreFlagStore( 8241):     at android.os.HandlerThread.run(HandlerThread.java:67)
D/ProfileInstaller( 8241): Installing profile for com.example.reproduce
W/FinalizerDaemon( 8241): type=1400 audit(0.0:3368032): avc:  denied  { getopt } for  path="/dev/socket/usap_pool_primary" scontext=u:r:untrusted_app:s0:c176,c257,c512,c768 tcontext=u:r:zygote:s0 tclass=unix_stream_socket permissive=0 app=com.example.reproduce
I/ample.reproduce( 8241): DynamicFPS DF top: com.example.reproduce : 120
I/ample.reproduce( 8241): DF com.example.reproduce Support DynamicFPS.
W/MiuiStubRegistry( 8241): Failed to collect stub providers in android.magicpointer.util.MiuiMagicPointerUtilsStubHeadManifest$$: /system_ext/framework/miui-framework-pointer-pad.jar not exist

```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[√] Flutter (Channel master, 3.23.0-13.0.pre.370, on Microsoft Windows [Version 10.0.22631.3737], locale pl-PL)
    • Flutter version 3.23.0-13.0.pre.370 on channel master at C:\Users\KarolW\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb58fe16b6 (2 hours ago), 2024-06-28 07:36:03 +0100
    • Engine revision a78f5ce743
    • Dart version 3.5.0 (build 3.5.0-311.0.dev)
    • DevTools version 2.36.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at C:\Users\KarolW\AppData\Local\Android\sdk
    • Platform android-34, build-tools 32.0.0
    • Java binary at: C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
    • Java version Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[!] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.3737]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 126.0.6478.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 126.0.2592.68

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

```

</details>


I have a problem with performance of ```google_maps_flutter 2.7.0```
As you can see on a video recording, scrolling through map is not smooth, however in DevTools there is no show of less than 60FPS, but it's visibly not smooth.
I am forcing TLHC and latest renderer.