Im trying to overlay a TextView on top of the LockScreen (Similar to how Android Overlays the time).
Note: I dont want to by-pass the lockscreen, but just draw on top of it (without interfering with any of the touch events).
I've tried using the following flags (in onCreate):
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getWindow().addFlags(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
getWindow().addFlags(PixelFormat.TRANSLUCENT);
And applying the following Theme (to the specific activity):
<style name="Transparent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowActionBar">false</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowIsFloating">true</item>
</style>
But this draws on TOP of the lockscreen hiding the lockscreen and disabling all touch events.
Edit: activity_overlay.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.coco.MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:layout_alignParentBottom="true"
android:text="TextView" />
</RelativeLayout>
Manifest declaration of Activity (which inflates overlay_activity.xml)
<activity
android:name=".DisplayActivity"
android:label="@string/app_name"
android:theme="@style/Transparent" />