Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

SUPER HACK! completly recreate camera hal to restart preview (hammerhead) #10

Closed
wants to merge 1 commit into from

Conversation

mariogrip
Copy link
Member

This is a massive SUPER HACK! it completely destroy and recreate camera
hal to restart preview. ¯_(ツ)_/¯

Kinda fixes: ubports/ubuntu-touch#611

Lets keep this open as last resort if we don't find a better fix in time

…head)

This is a massive SUPER HACK! it completely destroy and recreate camera
hal to restart preview. ¯\_(ツ)_/¯

Kinda fixes: ubports/ubuntu-touch#611
@NeoTheThird
Copy link
Member

here at ubports we don't just do hacks, we do SUPER HACKS

@peat-psuwit
Copy link
Contributor

peat-psuwit commented Dec 21, 2019

I think it's better not to actually change the state, but to call m_service->stopCamera() and startCamera() directly. If we're gonna do this, it should not change the state, as that shows the intent of the application.

If the camera app needs to do something when this happen, see my xenial_-_gst-droid where I make it update the "status" property around those functions (and a couple more), as well as my camera-app's gst-droid branch.

@@ -54,6 +57,10 @@ AalImageCaptureControl::AalImageCaptureControl(AalCameraService *service, QObjec
m_audioPlayer->setMedia(QUrl::fromLocalFile("/system/media/audio/ui/camera_click.ogg"));
m_audioPlayer->setAudioRole(QAudio::NotificationRole);

char name[PROP_VALUE_MAX] = "";
property_get("ro.product.device", name, "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be broken again under device-info?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@@ -172,7 +179,13 @@ void AalImageCaptureControl::saveJpeg(const QByteArray& data)

// Restart the viewfinder and notify that the camera is ready to capture again
if (m_service->androidControl()) {
android_camera_start_preview(m_service->androidControl());
// SUPER HACK! completly destroy and recreate camera hal to restart preview
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem also occurs when flipping from front to rear camera or when entering video recording mode, so the workaround will have to happen there too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix that

@mariogrip
Copy link
Member Author

Not needed: fixed by ubports/android_kernel_lge_hammerhead#6

@mariogrip mariogrip closed this Jan 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[xenial] Camera app image freeze
4 participants