bug: rotating the device while the photo picker is open relaunches it, stacking a second picker over the preview
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- android, typescript
- 領域
- mobile
調査の方向性
IONCAMROpenPhotoPickerActivity とそのライブラリマニフェスト宣言を見つけ、picker を起動する前に onCreate が savedInstanceState をどのように使用しているかを確認します。フォトピッカーを開いた状態で、Android 上で回転フローを再現します。回転によって別のインスタンスが積み重ならず、既存の picker が維持されれば完了です。同様に宣言されている画像エディターと読み込みアクティビティでも同じパターンが見られるか確認します。
索引モデルが issue の本文から書いたものです。
説明
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" />
- 主要言語
- TypeScript
- スター
- 6
- フォーク
- 3
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ionic-team/capacitor-camera のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ionic-team/capacitor-camera#75 · リアクション 1 件 ·
-
[Bug]: Crash SecurityException: No persistable permission grants found in IONCAMROpenPhotoPickerActivity対応中かも @ankit-edii が 24 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ionic-team/capacitor-camera#58 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 67/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
ionic-team/capacitor-camera#76 · コメント 1 件 · リアクション 1 件 ·
ionic-team/capacitor-camera の issue をすべて見る
似ている issue
-
twilio.webhook() rejects valid requests when the query string has an encoded `?` and a `+` spaceオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
twilio/twilio-node#1232 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
Tiling managers are not destroyed in disable(), so window-created handlers keep running (Gio.Settings constructed without schema)対応中かも @gnacho が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
domferr/tilingshell#641 ·
メンテナーはふだん 3 日以内に返信
-
🐛 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
LibreChat-AI/LibreChat#17887 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100