Hi,

Yes, I realize it's a dirty hack, since Android doesn't provide any
APIs at the app layer to accomplish this. The way it works is exactly
like you think - it monitors the system log to detect app launches.
However, I don't think it's possible to kill the launched app, since
Android specifically disallows one app from killing another (you can
only kill yourself), unless maybe the app has root access and can
issue a kill command.

My problem is that monitoring the log the way I'm doing it is not a
reliable way of detecting whether an app is running in the foreground.
It certainly detects the 1st instance of the app being launched and
its initial activity. However, the scenario I described in my original
post cannot be detected by the "Starting activity" pattern. However,
it clearly can be accomplished by some other means since other app
protector apps that I've tried don't have the same problem. I'm trying
to find out how it is they solve this problem.

I'm aware that users can uninstall the app. Thank you.

On Jan 5, 10:01 am, Kristopher Micinski <[email protected]>
wrote:
> Sorry, I didn't look into this yet.
>
> In general this seems like a dirty hack:  you should have to intercept
> the intents and react to them at a system level, requiring you to go
> in and modify the package manager.  It seems -- in my opinion -- like
> a security hole that an app could stop other apps when they are
> launched.  I guess the way you do this is listen to logs and then
> react by killing the apps when they are started unless you say yes?
> (Obviously it's not that simple, but I think that's the gist of it.)
>
> One thing you should be aware of:  even if this hack works, people can
> always uninstall your 'security' app and then you're back to square
> one.
>
> kris
>
>
>
>
>
>
>
> On Wed, Jan 4, 2012 at 7:15 PM, galapogos <[email protected]> wrote:
> > Thanks Kris - would appreciate your insights.
>
> > On Jan 3, 8:43 pm, Kristopher Micinski <[email protected]> wrote:
> >> On Fri, Dec 30, 2011 at 4:44 AM,galapogos<[email protected]> wrote:
> >> > I'm writing an app similar to app protector - it prompts the user to
> >> > authenticate himself when a protected app is launched. Since Android
> >> > doesn't provide a way to use BroadcastReceiver on explicit intents,
> >> > I'm detecting app launches by monitoring logcat. For most apps, I'm
> >> > listening for something like "Starting activity..." and then throwing
> >> > an intent to my own authentication activity.
>
> >> > However, there seems to be a loophole in this when a protected app A
> >> > is launched via another App B. App A is only launched once(and hence
> >> > will only have one "Starting activity..." entry in logcat, and if I
> >> > switch to App B from my activity, it will re-route to App A, and this
> >> > time, I won't be able to detect it since logcat doesn't show its
> >> > launch.
>
> >> > An example would be package installer being a protected app, and a
> >> > file manager launching package installer upon tapping an apk file.
> >> > While my authentication activity is called up the first time, if I
> >> > switch to the file manager again, it will automatically display
> >> > package installer, and this time my app doesn't detect it.
>
> >> > I've tried a few app protector apps such as App Protector Lite and
> >> > Smart App Protector, and they don't seem to have this problem. They
> >> > have similar permissions as well - GET_TASKS, READ_LOGS,
> >> > RECEIVE_BOOT_COMPLETED, and SYSTEM_ALERT_WINDOW. Does anyone know what
> >> > can be done to solve my problem?
>
> >> > Thanks.
>
> >> Wow, you really shouldn't be able to do this without modifying the 
> >> firmware!
>
> >> I'll look through the apps you mentioned and find out where they are
> >> using those permissions, which might provide insight into what they're
> >> doing, as I would also like to know...
>
> >> It seems pretty twisted that an app would have this capability: to get
> >> this end result you should be rewriting the package manager or
> >> providing a similar systems level service.
>
> >> Kris
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to