How do android "app lock" applications work?
Asked Answered
G

3

32

I've tried googling, and looking on stackoverflow as well, but I can't seem to find any satisfying answer as to how the "App lock" applications(eg: ZDBox, App Lock, etc..) work. Is there a service that runs in the background continuously polling to see if the app is launched and tries to kill it? Or is there a way to intercept launch intents for new activities?

Gib answered 2/10, 2011 at 0:6 Comment(0)
G
23

there is a service running in the background to read the activity stack. if find new activity, will start the passwordActivity

Gunfire answered 15/12, 2011 at 7:54 Comment(3)
Where can I find more details on this? I wonder how much battery it would eat up if service constantly keeps running in background.Winthrop
@user930177, according to you, the service is running continuously in the background but can you tell me one thing; there are chances when android kills the serivces itself; in that case what is happenning..???Glacialist
Thanks for your answer. But I got another problem. After user enters correct password, locked app is open. But the service is running, so password activity starts again.Unpeopled
B
4

they are watching logcat output. whenever you start an activity, you can find specific logcat. like this,

I/ActivityManager(  585): Starting activity: Intent { action=android.intent.action...}

if this logcat printed by locked app, locker service starts password screen.

Braque answered 13/1, 2012 at 11:42 Comment(3)
is it possible method..... ??? can u explain this idea... how we can read the log cat of other application???Upstretched
Logs does not a secret, in Android Studio you can catch all logsKnoll
Might this be vulnerable to other apps that use the same tag logging the same data?Juarez
H
0

MORE MODERN ANSWER (Nov 2022):

This can be handled by the new app usage API

The system collects the usage data on a per-app basis, aggregating the data over daily, weekly, monthly, and yearly intervals. The maximum duration that the system keeps this data is as follows:

Daily data: 7 days Weekly data: 4 weeks Monthly data: 6 months Yearly data: 2 years For each app, the system records the following data:

The last time the app was used

The total length of time the app was in the foreground for that time interval (by > day, week, month, or year)

Timestamp capturing when a component (identified by a package and activity name) ?> moved to the foreground or background during a day

Timestamp capturing when a device configuration changed (such as when the device orientation changed because of rotation)

A background service can be used to constantly watch for updates to timestamps for specific apps regarding when they moved to the foreground with the API above.

note: It seems that starting from Android 5/6/7 and higher you cannot read info about other apps, including their status and logs. I believe this makes looking in logcat no longer work. If anyone can confirm this please comment below! Also, the getRunningTasks function to view active activities is now deprecated.

Houphouetboigny answered 7/11, 2022 at 22:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.