Given a View, how can I determine if that View is being shown in a Window that has FLAG_SECURE?
In the simple case, where the View is shown directly in the window for an Activity, we can get that Window, then call getAttributes().flags and see if those flags include FLAG_SECURE.
However:
That may not be accurate if the
Viewis being shown in some child window of the activity (the activity might have a secure window but the child window might not be secure)It will not work for non-activity windows (e.g., a
ServiceandSYSTEM_ALERT_WINDOW)
Is there a technique that can handle those edge cases as well?