Question: I am trying to come up with some ways of disabling the status bar without hiding it completely. This is an introlude attempt at disabling status bars in 3rd party apps. For now, I want to disable it in my own app, and then eventually create a background service to see if I can do so in other apps. The app I am creating is an operating system for children, and I am trying to develop a closed system.

Here is what I have tried. My initial idea was to monitor when status bar was accessed and then closing it. 

```
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    Log.i(TAG, "onWindowFocusChanged()");
    try {
        if (!hasFocus) {
            Log.d(TAG, "close status bar attempt");
            Object service = getSystemService("statusbar");
            Class<?> statusbarManager = Class
                    .forName("android.app.StatusBarManager");
            Method collapse = statusbarManager.getMethod("collapse");
            collapse.setAccessible(true);
            collapse.invoke(service);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

```

This is the method I used. It works for detecting when status bar is being accessed, however, it does not close the status bar once it has focus. What am I missing? Thanks in advance.

Answer: 
I am also working on the same thing. With Android 5.0 Lolipop they have released Screen Pinning mode (which is essentially Kiosk mode) which does a few things:

* The status bar is blank, and user notifications and status information are hidden.
* The Home and Recent Apps buttons are hidden.
* Other apps cannot launch new activities.
* The current app can start new activities, as long as doing so does not create new tasks.
* When screen pinning is invoked by a device owner, the user remains locked to your app until the app calls stopLockTask().
* If screen pinning is activity by another app that is not a device owner or by the user directly, the user can exit by holding both the Back and Recent buttons.

You can read about it further in the [Android 5.0 Lolipop release documentation](https://developer.android.com/about/versions/android-5.0.html).

However, if you are looking for a more controlable solution, then you may want to create a custom ROM. Here is a great overview on making Kiosk applications (which also require disabling status bar).

[Developing Kiosk Mode Applications in Android Tutorial](http://arnab.ch/blog/2013/11/developing-kiosk-mode-applications-in-android/)
Here's an updated answer if anyone is still looking for a solution to something like this: <https://developer.android.com/training/system-ui/immersive.html>

For me, I added the following in my onResume() method:

```
View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    decorView.setSystemUiVisibility(uiOptions);

```

This allows the status bar to stay hidden but the user can still access it by swiping the edge of the screen. Then after a few seconds of inactivity it will collapse and disappear again!