Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isApplicationBroughtToBackground doesn't *always* report the right value #65

Open
h34tnet opened this issue Oct 25, 2011 · 0 comments
Open

Comments

@h34tnet
Copy link

h34tnet commented Oct 25, 2011

i use the isApplicationBroughtToBackground method (standalone, not the the whole doid-fu package) to implement a security feature that displays a locking screen if my app regains the focus after coming back from a different app.

now, the problem was that the security gesture sometimes showed twice. after digging around a bit i noticed that if the isApplicationBroughtToBackground method is called again directly after returning from the background (in my case because the launch of the security activity after coming back triggered the onPause method of the launching activity), the topActivity from ActivityManager.getRunningTasks(1) is sometimes still the activity you just returned from.

i suspect that maybe activities that do a lot of cleanup after being closed may linger on top of the RunningTasks stack for a short time, but if onPause is called again right after returning the short time might be enough to register as a second isApplicationBroughtToBackground, when this is not actually the case.

in my case, the offending lingering app was com.android.mms, but other apps triggered it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant