Entering the camera to take pictures, taking pictures of the animation and taking pictures of the sound will be probabilistic.
This problem occurs because of the probability that only one CPU is opened during the photo shoot, and the loading will be heavier when taking a picture, resulting in a CPU not being processed, so there will be problems with photo animation and photo lag.
Workaround: Force two CPUs on the photo, enough to handle the loading when taking pictures.
The KK version can be modified as follows.
In the Photoactor.java
1. Add the following code
Import Com.mediatek.common.MediatekClassFactory;
Import Com.mediatek.common.perfservice.IPerfServiceWrapper;
2. Add the following variables
Iperfservicewrapper mperfservice = null;
int mperfservicehandle =-1;
3. Make the following changes in public Photoactor (Camera context)
if (Mwfdmanager! = null) {
Mwfdmanager.addlistener (Mwfdlistener);
}
Add start
Mperfservice = Mediatekclassfactory.createinstance (iperfservicewrapper.class, context);
LOG.D (TAG, "mperfservice =" + Mperfservice);
if (mperfservice! = null && Mperfservicehandle = =-1)
Mperfservicehandle = Mperfservice.userreg (2, 0);
Add End
Mcamerasound = new Mediaactionsound ();
4. Make the following changes in public boolean capture ()
if (mcontinuousshotperformed) {
Mstreamid = 0;
}
Add start
if (mperfservicehandle! =-1 && mperfservice! = null)
{
LOG.D (TAG, "mperfservice.userenabletimeout");
Mperfservice.userenabletimeout (Mperfservicehandle, 10);
}
LOG.D (TAG, "mperfservicehandle =" + Mperfservicehandle);
Add End
Synchronized (Sfacedetectionsync) {
if (!mcameracategory.applyspecialcapture ()) {
Mcontext.getcameradevice (). Takepicture (Getshuttercallback (), Mrawpicturecallback,
Mpostviewpicturecallback, Mcameracategory.getjpegpicturecallback ());
}
sfacedetectionstarted = false;
}
Force two CPU on Android when taking a photo