Default Camera Issue Only Honor Magic Pro 7

55 views
Skip to first unread message

Qasim Abdani

unread,
Jan 23, 2026, 1:08:36 AMJan 23
to Android CameraX Discussion Group

I have tested the app on multiple device brands, and it works 100% correctly on all of them. The issue occurs only on the Honor Magic Pro 7, which is being used by my client.

On this device, the camera opens normally, captures the picture, and shows the image preview. However, when the user clicks the tick/confirm button, the app turns into a blank white screen.

There is no crash reported in Firebase Crashlytics, and no error logs are generated, so I’m unable to identify the cause of the issue. 
------------------------------------------------------------------
val imageChooserLauncher = rememberLauncherForActivityResult(contract = StartActivityForResult()) { resultt ->
if (resultt.resultCode == RESULT_OK) {
val data = resultt.data
// ------------------ Multiple videos/images from gallery ------------------
if (data?.clipData != null) {
val clipData = data.clipData
val videoUris = mutableListOf<Uri>()
for (i in 0 until clipData!!.itemCount) {
videoUris.add(clipData.getItemAt(i).uri)
}

videoUris.forEach { b ->
val updatedMediaList = (result.value ?: emptyList()).toMutableList()
val uri = getFileAbsolutePath1(
applicationContext,
b,
EnumCRItemType.IMAGE.value
)
updatedMediaList.add(
MMedia(
type = EnumCRItemType.IMAGE.value,
key = uri
)
)
result.value = updatedMediaList
formField.media = updatedMediaList
if (formField.type == EnumCRItemType.FILE.value) {
formField.values?.add(
FieldValue(
text = EnumCRItemType.IMAGE.value,
value = uri
)
)
}
}
reportViewModel.updateFormData(formSection)
}
// ------------------ Single video/image from gallery ------------------
else if (data?.data != null) {
val singleVideoUri = data.data!!
val updatedMediaList = (result.value ?: emptyList()).toMutableList()
val uri = getFileAbsolutePath1(
applicationContext,
singleVideoUri,
EnumCRItemType.IMAGE.value
)
updatedMediaList.add(
MMedia(
type = EnumCRItemType.IMAGE.value,
key = uri
)
)
result.value = updatedMediaList
formField.media = updatedMediaList
if (formField.type == EnumCRItemType.FILE.value) {
formField.values?.add(
FieldValue(
text = EnumCRItemType.IMAGE.value,
value = uri
)
)
}
reportViewModel.updateFormData(formSection)
}

else if (data == null || data.data == null) {
Handler(Looper.getMainLooper()).postDelayed({
cameraImageUri?.let { uri ->

// try {
//
// contentResolver.takePersistableUriPermission(
// uri,
// Intent.FLAG_GRANT_READ_URI_PERMISSION or
// Intent.FLAG_GRANT_WRITE_URI_PERMISSION
// )
// }catch(e:Exception){}


val updatedMediaList = (result.value
?: emptyList()).toMutableList()
val path = getFileAbsolutePath1(
applicationContext,
uri,
EnumCRItemType.IMAGE.value
)
updatedMediaList.add(
MMedia(
type = EnumCRItemType.IMAGE.value,
key = path
)
)
result.value = updatedMediaList
formField.media = updatedMediaList

if (formField.type == EnumCRItemType.FILE.value) {
formField.values?.add(
FieldValue(
text = EnumCRItemType.IMAGE.value,
value = path
)
)
}
reportViewModel.updateFormData(formSection)


}
},300)

}

}
}

------------------------------------------------------------------
val uri = CommonMethods.createCameraImageFile(applicationContext)
cameraImageUri = uri // Save to the 'rememberSaveable' state

val captureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE).apply {
putExtra(MediaStore.EXTRA_OUTPUT, uri)

clipData = ClipData.newUri(contentResolver, "camera", uri)

addFlags(
Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or
Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
)
}

val pickIntent = Intent(Intent.ACTION_GET_CONTENT).apply {
type = "image/*"
putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
addCategory(Intent.CATEGORY_OPENABLE)
}

val chooserIntent = Intent.createChooser(pickIntent, "Select or Capture Image").apply {
putExtra(Intent.EXTRA_INITIAL_INTENTS, arrayOf(captureIntent))
// Standard flags for the chooser itself
addFlags(
Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or
Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
)
}

imageChooserLauncher.launch(chooserIntent)


------------------------------------------------------------------
var cameraImageUri by rememberSaveable { mutableStateOf<Uri?>(null) }

------------------------------------------------------------------

fun getFileAbsolutePath1(
context: Context,
uri: Uri,
type: String
): String {

val resolver = context.contentResolver
val inputStream = resolver.openInputStream(uri) ?: return ""

val directory =
if (type == EnumCRItemType.IMAGE.value)
Environment.DIRECTORY_PICTURES
else
Environment.DIRECTORY_DOCUMENTS

val extension = when (type) {
EnumCRItemType.VIDEO.value -> ".mp4"
EnumCRItemType.DOCUMENT.value -> ".pdf"
else -> ".jpg"
}

val file = File(
context.getExternalFilesDir(directory),
"${System.currentTimeMillis()}$extension"
)

FileOutputStream(file).use { output ->
inputStream.use { input ->
input.copyTo(output)
}
}

return file.absolutePath
}

------------------------------------------------------------------

fun createCameraImageFile(context: Context): Uri {
val file = File(
context.getExternalFilesDir(Environment.DIRECTORY_PICTURES),
"camera_image_${System.currentTimeMillis()}.jpg"
)

return FileProvider.getUriForFile(
context,
"${context.packageName}.fileprovider",
file
)
}


------------------------------------------------------


<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.krank.inspeq.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
/>
</provider>

-----------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">

<!-- REQUIRED for Honor / Huawei camera -->
<external-files-path
name="images"
path="Pictures/" />

<!-- Optional (safe to keep) -->
<cache-path
name="cache"
path="." />

</paths>













Qasim Abdani

unread,
Jan 28, 2026, 12:44:45 AMJan 28
to Android CameraX Discussion Group, Qasim Abdani
Can anyone help me regarding above

Scott Nien

unread,
Feb 5, 2026, 1:03:43 AM (13 days ago) Feb 5
to Qasim Abdani, Android CameraX Discussion Group
Can you explain what your app do after the user clicks the tick/confirm button ?


--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/eeb9f26d-117f-4b38-bc42-f757a378bd3bn%40android.com.

Qasim Abdani

unread,
Feb 6, 2026, 12:33:39 AM (12 days ago) Feb 6
to Scott Nien, Android CameraX Discussion Group
The user clicks the tick/confirm button  is the default behaviour of the camera. I do not use my default camera button. Screen become blank on honor magic pro 7 device while all other devices working

Scott Nien

unread,
Feb 8, 2026, 9:58:32 AM (9 days ago) Feb 8
to Qasim Abdani, Android CameraX Discussion Group
Sorry I need more information,  what do you mean by "default behaviour of the camera"?   Specifically, I would like to know what CameraX APIs are invoked after user clicks the tick/confirm button. 

Qasim Abdani

unread,
Feb 9, 2026, 12:02:55 AM (9 days ago) Feb 9
to Scott Nien, Android CameraX Discussion Group
There is no cameraX api involve

------------------------------------------------------------------
val uri = CommonMethods.createCameraImageFile(applicationContext)
cameraImageUri = uri // Save to the 'rememberSaveable' state

val captureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE).apply {
putExtra(MediaStore.EXTRA_OUTPUT, uri)

clipData = ClipData.newUri(contentResolver, "camera", uri)

addFlags(
Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or
Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
)
}

val pickIntent = Intent(Intent.ACTION_GET_CONTENT).apply {
type = "image/*"
putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
addCategory(Intent.CATEGORY_OPENABLE)
}

val chooserIntent = Intent.createChooser(pickIntent, "Select or Capture Image").apply {
putExtra(Intent.EXTRA_INITIAL_INTENTS, arrayOf(captureIntent))
// Standard flags for the chooser itself
addFlags(
Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or
Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
)
}

imageChooserLauncher.launch(chooserIntent)
------------------------------------------------------------------------------------------------------------

val imageChooserLauncher = rememberLauncherForActivityResult(contract = StartActivityForResult()) resultt ->
if (resultt.resultCode == RESULT_OK) {
}
}

Can you look at this code? This is opening the default camera of mobile using intent. and check the code of first email please

Scott Nien

unread,
Feb 11, 2026, 4:08:47 AM (6 days ago) Feb 11
to Qasim Abdani, Android CameraX Discussion Group
This should be an issue of Honor's system camera app. I am sorry we can' t help you with this. 
Reply all
Reply to author
Forward
0 new messages