async_wallpaper
async_wallpaper copied to clipboard
Second call failed when invoked in succession
Describe the bug
I want to set different images for the lock screen and the home screen. So I called AsyncWallpaper.setWallpaperFromFile twice in succession:
if (item.data.lockScreen != null) {
await AsyncWallpaper.setWallpaperFromFile(
filePath: item.data.lockScreen!,
wallpaperLocation: AsyncWallpaper.LOCK_SCREEN,
);
}
if (item.data.homeScreen != null) {
await AsyncWallpaper.setWallpaperFromFile(
filePath: item.data.homeScreen!,
wallpaperLocation: AsyncWallpaper.HOME_SCREEN,
);
}
(edit) On emulator, it works always. However on real device, sometimes it works, but most of the time the second call doesn't. Log says:
I/Arguments (25285): configureFlutterEngine: /data/user/0/com.innomatic.ludiaapp/app_flutter/ddd_2238994064123313798.jpg
W/omatic.ludiaapp(25285): Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (unsupported,core-platform-api, reflection, allowed)
W/omatic.ludiaapp(25285): Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (unsupported,core-platform-api, reflection, allowed)
W/omatic.ludiaapp(25285): Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (unsupported,core-platform-api, reflection, allowed)
I/Arguments (25285): configureFlutterEngine: Image Downloaded
I/Arguments (25285): configureFlutterEngine: /data/user/0/com.innomatic.ludiaapp/app_flutter/ddd_2891432521155819000.jpg
I/Arguments (25285): configureFlutterEngine: Image Downloaded
E/libEGL (25285): call to OpenGL ES API with no current context (logged once per thread)
E/SurfaceSyncer(25285): Failed to find sync for id=0
My guess is that if I can set both the lock screen and the home screen at the same call, problem can be solved.
Thanks,
Flutter:
- 3.3.9
- stable
Dart:
- 2.18.5