bug: rotating the device while the photo picker is open relaunches it, stacking a second picker over the preview
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- android, typescript
- Ambito
- mobile
Direzione di ricerca
Individua IONCAMROpenPhotoPickerActivity e la relativa dichiarazione nel manifest della libreria, quindi esamina come onCreate utilizza savedInstanceState prima di avviare il picker. Riproduci il flusso di rotazione su Android con il selettore di foto aperto. Il lavoro è completato quando la rotazione conserva il picker esistente senza sovrapporre un'altra istanza; verifica se l'editor di immagini e le attività di caricamento dichiarati in modo simile mostrano lo stesso schema.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Report
Plugin version: @capacitor/camera 8.2.0 — also reproduced against ioncamera-android 1.0.2 (shipped in 8.2.2)
Capacitor version: 8.4.0
Platform: Android 13, Samsung Galaxy Tab Active3 (SM-T570), com.google.android.photopicker versionName 17
Current behavior
Rotating the device while the system photo picker is open launches a second picker instance on top of the first one. It is most visible when the user has opened the picker's preview screen: after rotating, the selection grid reappears over the preview.
Expected behavior
A configuration change should not relaunch the picker. The already-open picker should simply handle the rotation itself.
Steps to reproduce
- Call
Camera.chooseFromGallery({ allowMultipleSelection: true }). - In the system photo picker, select a photo and open the preview.
- Rotate the device to landscape.
- A second picker opens on top.
The picker options are irrelevant — the same happens with default options and with allowMultipleSelection: false.
Root cause
IONCAMROpenPhotoPickerActivity is declared in the library manifest without android:configChanges:
<activity
android:name="io.ionic.libs.ioncameralib.view.IONCAMROpenPhotoPickerActivity"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
So a rotation destroys and recreates it. Its onCreate then passes savedInstanceState to super and never reads it again, calling launchSinglePicker / launchMultiplePicker unconditionally:
protected void onCreate(android.os.Bundle);
0: aload_0
1: aload_1
2: invokespecial // ComponentActivity.onCreate
... // reads intent extras only — savedInstanceState is never tested
110: invokespecial // launchMultiplePicker
119: invokespecial // launchSinglePicker
Every recreation therefore launches another picker. This is visible in the activity stack, captured while the bug was on screen:
#3 com.google.android.photopicker/MainActivity <- resumed, the one "on top"
#2 com.google.android.photopicker/MainActivity <- first instance, showing the preview
#1 <app>/io.ionic.libs.ioncameralib.view.IONCAMROpenPhotoPickerActivity
#0 <app>/MainActivity
Both picker instances have resultTo=IONCAMROpenPhotoPickerActivity.
Note that the host app's own MainActivity declares android:configChanges="orientation|screenSize|…" (the Capacitor default), which is why the rest of the app absorbs rotation without issue — the library's proxy activity does not inherit that.
Suggested fix
Either guard the launch in onCreate:
if (savedInstanceState == null) {
// launchSinglePicker / launchMultiplePicker
}
or declare android:configChanges on the activity in the library manifest.
IONCAMRImageEditorActivity and IONCAMRLoadingActivity are declared the same way and may be affected by the same pattern.
Workaround
Overriding the declaration in the app manifest stops the relaunch:
<activity
android:name="io.ionic.libs.ioncameralib.view.IONCAMROpenPhotoPickerActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
tools:node="merge" />
- Lingua principale
- TypeScript
- Stelle
- 6
- Fork
- 3
- Merge medio
- 2g 18h
- PR unite (30g)
- 6
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ionic-team/capacitor-camera
-
bug(android): NullPointerException on ActivityResultLauncher.unregister() in LegacyCameraFlowAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
ionic-team/capacitor-camera#75 · 1 reazione ·
-
[Bug]: Crash SecurityException: No persistable permission grants found in IONCAMROpenPhotoPickerActivityForse già presa @ankit-edii l’ha presa 24 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ionic-team/capacitor-camera#58 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
ionic-team/capacitor-camera#76 · 1 commento · 1 reazione ·
Tutte le issue di ionic-team/capacitor-camera
Issue simili
-
twilio.webhook() rejects valid requests when the query string has an encoded `?` and a `+` spaceAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
twilio/twilio-node#1232 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Tiling managers are not destroyed in disable(), so window-created handlers keep running (Gio.Settings constructed without schema)Forse già presa @gnacho l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
domferr/tilingshell#641 ·
I maintainer di solito rispondono entro 3 giorni
-
🐛 bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
LibreChat-AI/LibreChat#17887 ·
I maintainer di solito rispondono entro 1 giorno
-
`isCI` is `true` inside a running Google Cloud Run service (also Railway, Render, Deno Deploy)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100