Short version:
1. Download the apk posted below and install it.
2. Set the app to run on boot using the method of your choice (I use Tasker).
Updated app link:
http://forum.xda-developers.com/showthread.php?p=52696903
Long version:
Hello there,
This is basically a call for a bit of dev help for a potential workaround I think I may have stumbled upon for fixing the annoying hanging camera issue we seem to have on a bunch of the CM/AOSP based roms. The symptoms of the issue are:
1. Reboot phone
2. Open any camera app - there's a frozen frame for a moment then it either
a. works normally
b. freezes and camera apps then "cannot connect to camera" until you reboot and try again.
The issue I was seeing on my phone (running the awesome SlimKat ROM) was that sometimes it would end up at 2a, and sometimes at 2b. I could not see any pattern, rhyme, or reason for it. Until...
I opened the ROM's camera app (set to store on my SD card) with my SD card removed. This caused the camera app to crash before showing any camera preview. I then noticed that once I put the SD card back in the camera app would open and work perfectly and immediately. No freezing at all. I have replicated about 20 times successfully, with no instances of 2b.
That made me think. I've done some Android head tracking coding in the past and worked with camera previews and I know that to get a camera preview running, you first open the camera object then start the preview. Since normally, sometimes the situation would be 2a and sometimes 2b, that made me think that there might be a race condition happening between the "camera open" step and the "show preview" step.
So I made a simple app to open the camera, wait 5 seconds, and close, without showing any preview. I set this app to run on boot-up using Tasker. (This is meant to replace the manual SD card trick I was using, outlined above.)
I'm sharing this with the hope that the ROM developers, who are far more skilled than I, might use this information. I attached my apk (a better one is posted later in this thread with a link to that post in the next post), and I'll give you the code (again, updated later). I hope you can use it to confirm or reject my findings or even do a better job integrating it into your ROM then I did with my boot-up hack.
Thanks!
Code:
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.os.Bundle;
import android.app.Activity;
import android.view.TextureView;
import android.view.TextureView.SurfaceTextureListener;
public class MainActivity extends Activity implements SurfaceTextureListener{
private Camera mCamera;
private TextureView mTextureView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);
setContentView(mTextureView);
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
mCamera = Camera.open();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
mCamera.release();
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Ignored, the Camera does all the work for us
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mCamera.stopPreview();
mCamera.release();
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// Update your view here!
}
}
This is the apk mentioned above:
http://forum.xda-developers.com/showthread.php?p=52696903
drklaw said:
Long version:
Hello there,
This is basically a call for a bit of dev help for a potential workaround I think I may have stumbled upon for fixing the annoying hanging camera issue we seem to have on a bunch of the CM/AOSP based roms. The symptoms of the issue are:
1. Reboot phone
2. Open any camera app - there's a frozen frame for a moment then it either
a. works normally
b. freezes and camera apps then "cannot connect to camera" until you reboot and try again.
The issue I was seeing on my phone (running the awesome SlimKat ROM) was that sometimes it would end up at 2a, and sometimes at 2b. I could not see any pattern, rhyme, or reason for it. Until...
I opened the ROM's camera app (set to store on my SD card) with my SD card removed. This caused the camera app to crash before showing any camera preview. I then noticed that once I put the SD card back in the camera app would open and work perfectly and immediately. No freezing at all. I have replicated about 20 times successfully, with no instances of 2b.
That made me think. I've done some Android head tracking coding in the past and worked with camera previews and I know that to get a camera preview running, you first open the camera object then start the preview. Since normally, sometimes the situation would be 2a and sometimes 2b, that made me think that there might be a race condition happening between the "camera open" step and the "show preview" step.
So I made a simple app to open the camera, wait 5 seconds, and close, without showing any preview. I set this app to run on boot-up using Tasker. (This is meant to replace the manual SD card trick I was using, outlined above.) So far, I've run it about 5 times and the camera has been starting right up for me.
I'm sharing this with the hope that the ROM developers, who are far more skilled than I, might use this information. I attached my apk, and I'll give you the code. I hope you can use it to confirm or reject my findings or even do a better job integrating it into your ROM then I did with my boot-up hack.
Thanks!
Code:
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.os.Bundle;
import android.app.Activity;
import android.view.TextureView;
import android.view.TextureView.SurfaceTextureListener;
public class MainActivity extends Activity implements SurfaceTextureListener{
private Camera mCamera;
private TextureView mTextureView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);
setContentView(mTextureView);
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
mCamera = Camera.open();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
mCamera.release();
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Ignored, the Camera does all the work for us
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mCamera.stopPreview();
mCamera.release();
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// Update your view here!
}
}
Click to expand...
Click to collapse
Sounds good. A nice and simple solution actually.
But one question: why does your workaround waits for five seconds? Is it possible to decrease the time?
peddarson said:
Sounds good. A nice and simple solution actually.
But one question: why does your workaround waits for five seconds? Is it possible to decrease the time?
Click to expand...
Click to collapse
Probably. I just arbitrarily chose that based on my estimate of the time the camera would freeze when starting.
I got ur app and Tasker app but dont knw how to use Tasker to set ur app to run on boot..
Can someone help me with Tasker??
Sent from my Micromax A110Q using Tapatalk
Make a task to open the app, then make a profile to run that task on device boot.
Works fine with PAC rom. Thanks!!
Cheers!
Sent from my Xperia Z1
Great find. Would there be a way to implement an option to load a certain camera app too in the meantime? Have an "options" for the APK to choose say Google Camera, Camera2, or other camera app. Then use the main APK you made, to launch the non-preview then load the actual camera app?
I don't use Tasker, and figured this way, I could hide my Camera app from the app drawer, and just use this as a standalone.
1. Tap the "Fixed" apk
2. Launches non-preview and exits
3. Launches chosen camera app.
Juzman said:
Great find. Would there be a way to implement an option to load a certain camera app too in the meantime? Have an "options" for the APK to choose say Google Camera, Camera2, or other camera app. Then use the main APK you made, to launch the non-preview then load the actual camera app?
I don't use Tasker, and figured this way, I could hide my Camera app from the app drawer, and just use this as a standalone.
1. Tap the "Fixed" apk
2. Launches non-preview and exits
3. Launches chosen camera app.
Click to expand...
Click to collapse
This is possible but the application only needs to be ran once. If it can be ran at boot in the background for example you won't notice a thing plus you won't have to wait 5 seconds before you open the actual camera application. A thing you might be concerned about is a performance impact at boot, I think this will be very minimal though since the Z1 is a very powerful device.
It's a very interesting workaround for sure and until a real fix has been found it would be nice to have a better way of implementing this. For now, it seems to work great! So good work OP!
Juzman said:
Great find. Would there be a way to implement an option to load a certain camera app too in the meantime? Have an "options" for the APK to choose say Google Camera, Camera2, or other camera app. Then use the main APK you made, to launch the non-preview then load the actual camera app?
I don't use Tasker, and figured this way, I could hide my Camera app from the app drawer, and just use this as a standalone.
1. Tap the "Fixed" apk
2. Launches non-preview and exits
3. Launches chosen camera app.
Click to expand...
Click to collapse
Ya it will do but u ll have to do this by ur own on as soon as ur device boots up because if u don't do it and opens camera app and if it showed Can't connect the Camera Error and then after that if u press this app then it won't be able to help u.. It will crash, happened with me.
Sent from my Xperia Z1 using XDA Premium 4 mobile app
abbychauhan said:
Ya it will do but u ll have to do this by ur own on as soon as ur device boots up because if u don't do it and opens camera app and if it showed Can't connect the Camera Error and then after that if u press this app then it won't be able to help u.. It will crash, happened with me.
Sent from my Xperia Z1 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Yes. This workaround is designed to prevent the camera from breaking when opening for the first time since reboot. It doesn't fix it once it's broken. I doubt anything could do that.
Is there a init.d script that can execute the app in the background?
ikenley said:
Is there a init.d script that can execute the app in the background?
Click to expand...
Click to collapse
Looks like it's possible:
http://stackoverflow.com/questions/5494764/how-to-run-a-specific-android-app-using-terminal
Does your fix also work if the cam is doing normal directly after booting, but not after a day of running? In my case I started it random 3 times during the day without a reboot. But at the 4th try it froze.
drklaw said:
Yes. This workaround is designed to prevent the camera from breaking when opening for the first time since reboot. It doesn't fix it once it's broken. I doubt anything could do that.
Click to expand...
Click to collapse
Just a suggestion.. Can u make something like "Restart Camera App" or something like that as if Camera broken after a day or two so we didn't have to reboot the phone as ur app doesn't fix it once it's broken and v ll have to reboot. By this we just use Restart Camera App and then use ur App and have a perfect camera without a Reboot.
Thanks in Advance
Sent from my Micromax A110Q using Tapatalk
->--- said:
Does your fix also work if the cam is doing normal directly after booting, but not after a day of running? In my case I started it random 3 times during the day without a reboot. But at the 4th try it froze.
Click to expand...
Click to collapse
No. It won't fix it if it breaks later. I've never seen the camera break after it's been working but my uptimes are typically less than 1 day since I notice a bit of sluggishness after that time. I reboot every morning.
drklaw said:
This is basically a call for a bit of dev help for a potential workaround I think I may have stumbled upon for fixing the annoying hanging camera issue we seem to have on a bunch of the CM/AOSP based roms. The symptoms of the issue are:
1. Reboot phone
2. Open any camera app - there's a frozen frame for a moment then it either
a. works normally
b. freezes and camera apps then "cannot connect to camera" until you reboot and try again.
Click to expand...
Click to collapse
Want to point out that this issue affects not only AOSP roms, but stock too. Had this issue on .757 and experienced it few times now on .761.
drklaw said:
No. It won't fix it if it breaks later. I've never seen the camera break after it's been working but my uptimes are typically less than 1 day since I notice a bit of sluggishness after that time. I reboot every morning.
Click to expand...
Click to collapse
In my case the cam is working without any fix, for about a day. Yes, there is the issue that the first activation takes some time and the first frame is frozen. But it is starting and the frozen frame is just at first start and disappears after some seconds. But if I run my phone longer than a day it has the bug. No matter which one of the 3 or more fixes that you can find in the forum, I am using.
My opinion is, that such a device should run without reboot for as long as possible. Normally I have to recharge after 3-4 days and I do not reboot just because I am charging. But if I start the cam, it is like russian roulette, after some time there is no other way. The cam is just working for an undefined period of time without issues. Could be a day, can be 2 days, but then..peng..stuck at activation. Today it froze my whole device while I was playing music with walkman app.
Maybe it is necessary to use the "fix" every time before using the cam. I haven't tried that for now. If that has to be done I have a request. Maybe it is possible to include a setting into your app, where I can define my favourite camera app. So that every time I start your fix, it is activating my cam app after it has done its fixing. Would that be possible?
You could use Tasker to make a task that starts the app and then opens the camera. You could then make a shortcut to run that task. I'm a big fan of Tasker.
Sent from my Xperia Z1 using Tapatalk
Related
I know I'm not the first one to post all of these things, but I wanted to make a concise and easy place for people to find ICS fixes. If you think you came up with something, I will be glad to give you credit.
Fix Chrome Beta
Are you getting a message saying that Chrome isn't working because you don't have Android 4.0 or above on your ICS ROM? Well, there's an easy fix. I originally found this on RootzWiki, but I wanted to make a detailed guide for you guys.
1) Download root file manager of your choosing (I recommend Root Explorer).
2) Navigate to System.
3) Long press on the build.prop file.
4) Select Open With, then Text Editor.
5) Find the line that starts with "ro.build.id" (It should be the 2nd or 3rd line)
6) Change whatever it says after the = sign to "IML74K"
7) Hit menu, then save changes.
8) Reboot.
Enjoy your working Chrome Browser!
Fix YouTube Streaming Over 3G
Simply start playing the YouTube video, then click HQ in the bottom left corner. The video will take time to load and use more data, but will work fine!
Fix Minus Not Showing Files on Your Phone
Scroll all the way down to the bottom of the screen and select "Full Site." You can now see all the files.
Fix Camera Starting on Black Screen
*This may break front camera on Aeroevan's build*
Download this and either push it to system/app with adb. Or, use root explorer to copy it there, then set permissions to rw--r-r--. Then, reboot.
Fix Front Camera Taking Messed up Pics in Aeroevan's Latest Beta
This has worked for me in the past, but it is a huge pain. Every time you want to take a picture with the front facing camera, clear the data for the camera app in manage applications.
Fix Soft Keys not Lighting Up
Toggle Auto Brightness in Display Settings.
If there are any other things people want added, I will do my best to add them.
Big update to the OP and thread title change.
Fix Front Camera Taking Messed up Pics in Aeroevan's Latest Beta
This has worked for me in the past, but it is a huge pain. Every time you want to take a picture with the front facing camera, clear the data for the camera app in manage applications.
Click to expand...
Click to collapse
Please excuse this question if it's a bit noobish, but how exactly do I do this in the ICS rom? There's no clear "Manage Applications", and when I go to Apps in the settings, Camera doesn't show up on any of those lists. Any tips?
You go to system settings, apps, scroll the list of categories to the right, and select all, then find camera, click on it, and click clear data.
A big thanks to all!
Thanks very much.
Anyway to make touch responsiveness as well as gb? I know ics has the hardware acceleration and they way you flick or slide matters.. but I really don't like swiping 5 times to go to another screen and until we have an official kernel I know it won't be perfect
Sent from my Incredible 2 using xda premium
Use Aeroevan's kernel with Smartass v2 gov.
Amphibliam said:
Use Aeroevan's kernel with Smartass v2 gov.
Click to expand...
Click to collapse
That's what I always use for aosp... Still touchy
Sent from my Incredible 2 using xda premium
My ICS is perfectly smooth when I run it with that setup
Sent from my ADR6350 using xda premium
Ah! thank you very much for the soft key tip!
Got this phone just recently as a replacement deal from Virgin/Bell (in Canada), LG-D852 running on stock 5.0.1 fresh rooted.
Couple days ago SU and TitaniumBackup, cleaned some vendor’s (Bell, Virgin) garbage also I like the XCam LG features and wanted to install no matter what.
So I finished the cleanup with TitaniumBackup then ran into a problem the XCam won’t save the image files to SD….
Spent some time reading on the net and came across the NextUp SDfix
Also bought the XCam Settings and grab the QuickPic for the album, ES FileExplorer to brows all the way to the root….
Finally somehow managed the rear facing camera clicks (sound) and saves the picture (and I can watch it in QuickPic), but the front facing camera clicks (sound) only and can’t find any track of pictures.
Q:
What is a XCam default install location, maybe the front camera saves somewhere else then the rear, or is it a not finished project?
Do you know for any other known issues with this XCam, I spent a decent time with my basic level of understanding to get to this stage and this app still not fully cooperating with me, I may go back to stock camera if this not moving further.
I have the vs985 with xcam installed. Under settings (gear wheel on main screen in xcam) you can choose storage location, mine is set to sd card. My front facing camera saves pictures to :
/storage/external_SD/DCIM/Camera/
Hope this helps
tmord1 said:
I have the vs985 with xcam installed. Under settings (gear wheel on main screen in xcam) you can choose storage location, mine is set to sd card. My front facing camera saves pictures to :
/storage/external_SD/DCIM/Camera/
Hope this helps
Click to expand...
Click to collapse
THX, this what you saying is a default.
I believe something to do with android.
Something to do with interaction between OS and XCam
attilab said:
THX, this what you saying is a default.
I believe something to do with android.
Click to expand...
Click to collapse
The XCam was working fine then I installed 2-3-4 other apps (preparing my entertainment for a several weeks road trip), only then the XCam started behaving different.
I have now uninstalled this program (w/TitaniumBackup) and installed a fresh copy and the same but new copy of XCam is all working fine. But, this is important, it is now a latest installed app.
I don't want to troubleshoot in the last moment but I believe some of the apps altering the system variables in some way that the XCam looses an important link and certain features start miss-behaving.
I am not a programmer by any means only a tinkering leads me to this standpoint. I may be wrong but the OS is too much modular so some apps connecting one way some the other and some the third....this android OS shall be a single engine with predefined open ports where-only the apps can connect to....
I have PIN security setup, which is a requirement for work. I took some pics using the stock G4 camera, without having logged in (slid camera icon to the left). I expect to be able to review only the photos that I took with bypassing security be clicking on the circle for the gallery link. However, when I click on the gallery link, it still requires me to login to see photos.
Is that normal behavior? I'm coming from another phone/ROM (CM 12.1), where you could see just the pics you took in that security bypassed session.
Thanks!
Yes, that is normal behaviour and it makes sense. Most people would consider photos private and without actually unlocking the phone, it wouldn't make sense to grant access.
goofball2k said:
Yes, that is normal behaviour and it makes sense. Most people would consider photos private and without actually unlocking the phone, it wouldn't make sense to grant access.
Click to expand...
Click to collapse
Odd. If I took a picture quickly w/o security, then I can't review the picture I just had security access to take? I should be able to review just those that I've taken.
I would suggest you try some other phones - they allow this, and this is more normal to me. In any case, thanks for the answer.
I've had other phones that would let you view all the pictures you took while locked, but just those pics and that camera session. Not the entire album. I wish LG would do the same.
Now, you can view the last picture and even delete it by a long press of the gallery button on the camera
Sent from my LG-H811 using Tapatalk
Hey XDA,
I have a problem regarding the gallery app on the LG G4. I recently discovered that when I try to edit a picture, I can add all the filters, crop an Image and fine tune the colors but once I hit the check mark to save/apply these changes, the phone returns to the gallery without any changes to the original picture.
This is not the "unable to save changes" error, I do not get any message from the system at all (though the first time I tried to edit a picture, the app froze and displayed an empty pop up. I was forced to close it from the app overview then. Ever since, I see such a white pop up blink for a split-second when entering edit mode, though no text is displayed. I am not sure if this is relevant).
Anyway, I only found this post on reddit dealing with the same error, but since it is archived, one cannot reply there. I would be really thankful if you could point me into the direction of a fix for this.
Best,
morw
It could be a bug in the software a sort of compatibility issue download for the latest version of the apk or wait for anothr version or try using another apk...
jinderation said:
It could be a bug in the software a sort of compatibility issue download for the latest version of the apk or wait for anothr version or try using another apk...
Click to expand...
Click to collapse
Got the same.. "Use another app" is not a solution. I want to use the builtin app as did it in G3..
Hi,
I recently moved to the google camera (using the modded apk, containing HDR+ and 60fps video), however one issue I have found is that the pictures do not show up in any of the Instagram categories other than Other... However, Gallery and other apps like Facebook see them normally.
Oneplus 3
Android 7.1.1 OOS
Rooted with Magisk
Any help would be great,
Thanks
Just check your gallery already!
Different camera apps have different picture saving indexes thus something it doesn't show up .
Just check gallery app
Here's the 'Camera' selection, the ones in the red box are taken with stock. The other ones are with the Google camera.
Remove [X] new user, sorry
htt[X]p://i.imgur.com/KDUS101.png
Here's the Camera collection in Instagram:
htt[X]p://i.imgur.com/Xo3JPac.png
It is not showing any of the Google camera pictures.
I have same problem. Photo taken from google camera doesn't appear on instagram.
Same problem on my Redmi Note 4 running LOS with the HDR+ Google Camera.
Scroll all the way down. It's on the bottom for some reason.
Puddi_Puddin said:
Scroll all the way down. It's on the bottom for some reason.
Click to expand...
Click to collapse
Bingo! Found all mine at the bottom, maybe we can work out why from that, mAybe their timestamp is different?
JoshSH said:
Bingo! Found all mine at the bottom, maybe we can work out why from that, mAybe their timestamp is different?
Click to expand...
Click to collapse
No clue haha could be..
So after a huge amount of digging through file details and such, I believe I have found the reason why this happens and how I can show it easily.
The cause is down to the "Profile date/time" within the EXIF of the Google camera photos. It is not correctly set, so apps read it incorrectly. This can be shown in Snapchat, where the date of a photo is from the year 49429 etc. I assume this is because Snapchat does not expect the date to include the day, and therefore it funks up all it's formatting: ht tp://i.imgur.com/CVaV1lc.png (remove space)
F-Stop was the only app I could use to actually find this attribute, and as shown, it displays the incorrect profile date/time. I compared this to my OnePlus 3s stock camera EXIF which did not report any profile/date time, which I assume Snapchat then read the normal date time and passed it correctly htt p://i.imgur.com/xj0sK4N.png
So from here, I believe the APK will need to be changed to correctly report the correct date time in the correct format OR report no "Profile date/time" so that the default date time is read instead. This should then fix all the ordering issues happening with WhatsApp, Snapchat and Instagram.
I've just noted that this version seems to have fixed this issue ht tps://github.com/gladiac1337/gcam
JoshSH said:
I've just noted that this version seems to have fixed this issue ht tps://github.com/gladiac1337/gcam
Click to expand...
Click to collapse
Nope still doesn't work. I tried installing different versions still the same.
gcam_hdr+_60fps_noburst
gcam_hdr+_60fps_manual_icon
highdiver_2000 said:
Nope still doesn't work. I tried installing different versions still the same.
gcam_hdr+_60fps_noburst
gcam_hdr+_60fps_manual_icon
Click to expand...
Click to collapse
Just scroll all the way down. It's on the bottom for some reason.
Puddi_Puddin said:
Just scroll all the way down. It's on the bottom for some reason.
Click to expand...
Click to collapse
Yes, under Others, but Instagram doesn't recognize them, so I am stuck with only 1 photo. Multi photos is not possible/
highdiver_2000 said:
Yes, under Others, but Instagram doesn't recognize them, so I am stuck with only 1 photo. Multi photos is not possible/
Click to expand...
Click to collapse
Then something is wrong since it works fine in my end and others.
I have the same problem. Had to go to "others" under Instagram to visualize the pictures, and it is still cumbersome to choose as it jumps back to gallery when you go back.
lennymeow said:
I have the same problem. Had to go to "others" under Instagram to visualize the pictures, and it is still cumbersome to choose as it jumps back to gallery when you go back.
Click to expand...
Click to collapse
How many pictures can you post simultaneously? Posting from the Others folder, I can't do multi photos
Sent from my ONEPLUS A3010 using XDA Free mobile app
highdiver_2000 said:
How many pictures can you post simultaneously? Posting from the Others folder, I can't do multi photos
Sent from my ONEPLUS A3010 using XDA Free mobile app
Click to expand...
Click to collapse
just one, unfortunately. frustrating, but oh well