Bug 1511839 - Return the generated file if the camera result has "inline-data" action; r=VladBaicu

Handle the case when Camera would actually save a new photo but would return
just a thumbnail and not the full image
33c59af04a/src/com/android/camera/PhotoModule.java (L1345-L1371)

Differential Revision: https://phabricator.services.mozilla.com/D32307

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Petru Lingurar 2019-05-23 12:17:34 +00:00
Родитель 4bccc4cede
Коммит f2f3601226
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -34,6 +34,7 @@ import android.util.Log;
class FilePickerResultHandler implements ActivityResultHandler {
private static final String LOGTAG = "GeckoFilePickerResultHandler";
private static final String UPLOADS_DIR = "uploads";
private static final String ACTION_INLINE_DATA = "inline-data";
private final FilePicker.ResultHandler handler;
private final int tabId;
@ -77,7 +78,10 @@ class FilePickerResultHandler implements ActivityResultHandler {
// Camera results won't return an Intent. Use the file name we passed to the original intent.
// In Android M, camera results return an empty Intent rather than null.
if (intent == null || (intent.getAction() == null && intent.getData() == null)) {
final boolean emptyResult = intent == null || (intent.getAction() == null && intent.getData() == null);
// Camera returned a thumbnail of the photo. Use the file name we passed to the original intent.
final boolean haveThumbnail = intent != null && intent.getAction() != null && intent.getAction().equals(ACTION_INLINE_DATA);
if (emptyResult || haveThumbnail) {
if (mImageName != null) {
File file = new File(Environment.getExternalStorageDirectory(), mImageName);
sendResult(file.getAbsolutePath());