I have a service which (in onCreate()
) inflates a layout which is fullscreen (kind of a custom lockscreen). I would like to disable (hide) soft keys (return, home, recents) and possibly also status bar.
I know about immersive mode but that works in an Activity while I only have a Service. I designed it as a service so the previous app still runs below uninterrupted. The service looks like this:
public void onCreate() {
super.onCreate();
LayoutInflater li = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.TYPE_TOAST,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.RIGHT | Gravity.TOP;
View vLockscreen = li.inflate(R.layout.layout_lock, null);
wm.addView(vLockscreen, params);
}
How could I achieve full lockscreen functionality?