My question stems from this question about an app showing a custom view (with ads) before the lock screen. As of now none of the answers there provides a technical way to filter out the concerned app on your own, without relying on app reviews or a list somewhere on web - in short, a complete dependence on the experiences of others. In such cases even if the solution is one query away from web search engine I prefer to come up with a technique to hunt down the cause of the effect through means already available in Android.
Anyhow. Let's come to the point. How do I find out which installed apps are potentially capable of showing themselves before my lock screen?
With limited understanding I earlier speculated that an app would need the permission to draw over other apps to show before lock screen. However, my experiments with ES File Explorer v126.96.36.199 and with continuous monitoring of appsops service concludes that ES File Explorer didn't make use of SYSTEM_ALERT_WINDOW (I had appops deny that permission to the said app), yet, it displayed that famous quick charging screen. Swiping it away even dismissed my unsecured lock screen. That said, using
dumpsys activity activities and
dumpsys window windows I immediately found the activity
com.dianxinos.lockscreen.LockScreenContainer responsible for that screen.
I'm aware of certain window manager flags supposed to be used in source code and helps an app to show before lock screen and that's all is needed. No special permission or an attribute in manifest is needed so it becomes very difficult as well as inefficient to find potential apps until the effect comes into action, forget about symptoms.
True, that I can narrow down the hunt to apps which:
- can receive data from internet (to show ads);
- listens to ACTION_POWER_CONNECTED (not necessarily needed; may not be relevant in future);
- listens to ACTION_USER_PRESENT (not necessarily needed);
- requires SYSTEM_ALERT_WINDOW (may or may not be needed);
- requires android.permission.WAKE_LOCK (not necessarily needed);
- requires android.permission.DISABLE_KEYGUARD (not necessarily needed).
Yet, none of them, used as a parameter alone or combined, satisfactorily solves the original problem I have.
I would like to stress that I'm looking to filter out apps potentially capable of displaying something before my lock screen. I'm not asking for what is this lock screen with ads and how do I remove it?
Note: if it matters: I'm using stock and rooted Android 5.0, 5.1.1 and 6.0.1 on Nexus 6.
To avoid confusion: By before the lock screen I mean anything that is shown to user before the default lock screen is displayed whenever you attempt to wake up the device. As Izzy noted in a comment, "it places itself in front of the lock screen" might be a better phrase, but I avoided it since it appears to me to be corresponding to an overlay.