Camera Lock

272 vues
Accéder directement au premier message non lu

perumal316

non lue,
15 août 2010, 21:10:1715/08/2010
à android-ndk
Hi All,

I am writing an app, that upon starting will lock the camera (Meaning
other applications can't use the camera while this app is running)
untill the app is closed.

I have tried various methods but could not be able to do this (Like
LKM and using SDK).

I am a newbie in NDK so not sure how thid can be done. But is this
possible using NDK? Or it is not possible to access the hardware
through the NDK?

Thanks In Advance,
Perumal

Onur Cinar

non lue,
16 août 2010, 12:55:2716/08/2010
à andro...@googlegroups.com

Hi,

There is no official way of doing this through the NDK through the public API. However, when you do an open(), it should actually lock the camera device, until you do an unlock() or release().   Can you tell us a little more about it?

Regards,

-onur



--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


perumal316

non lue,
16 août 2010, 21:10:3516/08/2010
à android-ndk
Hi Onur,

Yes, it is possible to do it this way but the problem is I want this
application to be running in the background and while it is running
other applications cannot access the camera until this application is
exited (probably by entering a pin).

Therefore if the app is not exited, even if the phone is restarted,
the camera cannot be used.

I have tried by doing a open() and leaving it in that stage, the
camera will continually be active and the battery will drain fast.

Now I am trying to figure out is there a way to lock the camera
hardware using a PIN and to keep it running even if the phone is
restarted without exiting the app. Any ideas how to do it? I couldn't
find any explanation online regarding this.

Thanks and Regards,
Perumal
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr­oups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-ndk?hl=en.- Hide quoted text -
>
> - Show quoted text -

Onur Cinar

non lue,
17 août 2010, 13:02:2717/08/2010
à andro...@googlegroups.com

Hi Perumal,

As far as I recall, the CameraService is responsible for locking the camera device. It keeps the calling process's id, and uses that as the locking mechanism by rejecting other processes that are trying to connect.   This internal field is not accessible through the NDK or the Java directly.  So I can't think of a generic solution.

However, if you only open() the Camera, it shouldn't start using the actual hardware until you do a startPreview() or startRecording(). It will still be locked by your process, but it shouldn't be using any power I believe.

I'll try to check this during the day.

Regards,

-onur

To unsubscribe from this group, send email to android-ndk...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


---
www.zdo.com

perumal316

non lue,
17 août 2010, 21:49:5417/08/2010
à android-ndk
Thanks Onur,

I am also trying that. Yes by doing open(), as long as this
application is running, other applications cannot access or use the
camera.

But I not sure how to continue running my app in the background which
can only be killed by a pin. Even though I can do it now, a way to
bypass it is to simply kill the application or restart the phone and
the camera will be released.

Any idea how to prevent the above scenario?

Thanks and Regards,
Perumal
> > > >http://groups.google.com/group/android-ndk?hl=en.-Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to andro...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr­oups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-ndk?hl=en.
>
> ---www.zdo.com- Hide quoted text -

Chris Stratton

non lue,
18 août 2010, 10:59:1918/08/2010
à android-ndk
You cannot effectively lock out the camera from an app because the
user can kill or could simply uninstall your app.

You would have to have to monkey around in the internals of android
itself, making a nonstandard platform.

But someone in physical posession of the device can probably reinstall
an official, uncrippled, android release in place of yours, unless you
(as the carrier or wharever) get the manufacturer to sell you devices
which will only flash builds signed with a key that only you hold.

You may have more luck learning to destroy the lens in some way that
doesn't harm the rest of the device.

Onur Cinar

non lue,
18 août 2010, 14:49:4618/08/2010
à andro...@googlegroups.com

Hi Perumal,

Yes, you are right, the user can always terminate your application. Based on your description, it looks more like an administrative application. In that case, I'm not sure if you can achieve that without running your application in super user mode (root).  So looks like you can't really have a market application, since there is no official way of doing these.

But assuming that you actually own these phones, then through fastboot oem unlock and few other steps, you may get your application into the phone with root privileges, then it can achieve the task. Not sure.

Regards,

-onur



To unsubscribe from this group, send email to android-ndk...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


---
www.zdo.com

perumal316

non lue,
18 août 2010, 21:16:2518/08/2010
à android-ndk
Okay Thanks for the info! But I have realised that by using
Camera.open(), it will be battery draining. Trying to find another way
to acheive the lock. Not sure how to use CameraService() thing, will
look around.

Regards,
Perumal

On Aug 19, 2:49 am, Onur Cinar <onur.ci...@gmail.com> wrote:
> Hi Perumal,
>
> > > > > >http://groups.google.com/group/android-ndk?hl=en.-Hidequoted text
> > -
>
> > > > > - Show quoted text -
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "android-ndk" group.
> > > > To post to this group, send email to andro...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr­oups.com>
> > <android-ndk%2Bunsubscribe@googlegr­oups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-ndk?hl=en.
>
> > > ---www.zdo.com-Hide quoted text -
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message