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 v4.0.5.2 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.

  • Quick thought: Boot the device and attach adb logcat as soon as possible, copying its content to a file. Once the lock screen is visible, cancel logcat. Check the file for where the lock screen was launched, that's your end-point. Now scroll backwards to check what was launched.
    – Izzy
    Commented May 21, 2016 at 20:27
  • @Izzy Thanks, but I've no problem in finding out what is causing to show something before the lock screen. I'm interested in which installed apps are in position to potentially show something before lock screen.
    – Firelord
    Commented May 21, 2016 at 20:29
  • 2
    Just for the sake of completeness, FLAG_SHOW_WHEN_LOCKED is the culprit (I know you have noticed that, but this is to give a hint to others, if it can be utilized without reverse-engineering)
    – Andrew T.
    Commented May 21, 2016 at 20:30
  • Argh, sorry – misunderstood your intention (too bold :) To avoid a second one (and someone coming up with boot_completed etc): with "before the lock screen" you don't mean in tempora, but in locatio (i.e. not "it shows even before the lock screen is loaded", but "it places itself in front of the lock screen")?
    – Izzy
    Commented May 21, 2016 at 20:33


You must log in to answer this question.

Browse other questions tagged .