How to programmatically remove/hide the system bar in Honeycomb (requires root)

Without the system bar it is almost impossible to control your Honeycomb tablet. Since no hardware control buttons are enforced for the tablet the system bar is the only way to control your slate.

However, if your application incorporates a way of removing the bar and on leaving restarting the bar there is no reason why not to support such a feature.

The easy part: Restarting the bar

Restarting the bar is pretty simple, drop to a shell and start the service using the “am” command:
# am startservice -n com.android.systemui/.SystemUIService

The difficult part is to shut it permanently down. One way is to navigate to the application settings and shut it down with the “force close” button. However, attempting to kill the process with

# killall com.android.systemui

will remove the bar for a few seconds. Sadly, it will return eventually since in the applications manifest file the “persistent” parameter enforces the system to restart the service unless it is shut down properly by the “system” user itself.

The following magic line will shut down the bar permanently if executed as root:

# service call activity 79 s16 com.android.systemui

What it does is sending the Activitymanager a shutdown signal for the systemui service.
This method was tested on an Iconia A500 with Android 3.01; although it should work with other devices as well (since the source code that we use is common).

Putting it together

To remove the system bar from your application create and execute a process:

Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});
proc.waitFor();

To restore the system bar use the following code snippet:

Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"});
proc.waitFor();

26 thoughts on “How to programmatically remove/hide the system bar in Honeycomb (requires root)”

  1. Thank you for pointing out this security flaw in Android. This will be repaired in a future release.

    1. Sadly there are no sources of honeycomb available yet. It will get released when Ice Cream Sandwich is out and we are pretty confident to see a build after the release.

  2. @Mark Murphy: I see your point there, but I also doubt this is a bug. I just wish Android had a way to put devices in some kind of “Kiosk Mode” without having to jump so many hoops, especially when the source code for Honeycomb is not available yet, otherwise I would be happy to build a custom version of Android just for kiosks.

  3. Awesome job guys!
    The only thing I wonder about: If there is a method to know if the service is already running?

    Thanks

  4. Oh, and as a heads up the method to restore the status bar does not work in Android 2.3.4 Gingerbread, but the one to remove it does. Instead I changed “com.android.systemui/.SystemUIService” to “com.android.systemui/com.android.systemui.statusbar.StatusBarService” and things worked great on my rooted Motorola Droid 3.

  5. Hey,

    I want in my app two buttons: One for showing, one for hiding the system bar.
    So I copied the code from above to the button, added a try catch block but nothing happens. Any hints?

    thx B770

  6. This method does NOT work on Android 4.0 Ice Cream Sandwich. The problem is that the StatusBarService is wed to SystemUI, but moreover that the launcher and a few other components are also interconnected. If you kill the SystemUI process then you will just get FC after FC until your device hot-reboots.

  7. Hi, Thomas Barrasso!

    I did as you suggested (see quoted below), but still, it was not able to restore the status. Any idea? Thanks in advance!

    >> Oh, and as a heads up the method to restore the status bar does not work in Android 2.3.4 Gingerbread, but the one to remove it does. Instead I changed “com.android.systemui/.SystemUIService” to “com.android.systemui/com.android.systemui.statusbar.StatusBarService” and things worked great on my rooted Motorola Droid 3.

  8. Hi,
    I’d like to release only touches the buttons back, home and menu in our application, but without using the root, for warranty issues. Does anyone have any idea how to do it?

  9. I noticed that to make this work, you need to keep the USB Debugging checkbox checked. If I disable it, my app hangs…

  10. Hi Manuel, great post!

    I’ve detected the same problem. I need to keep the USB Debugging enabled. My application hangs after restart the toolbar. Hide process works perfect.

    It is possible to fix it?

    Thank you
    Kriyeng

  11. Hi all, maybe I have a method to disable the system bar in ICS. We can move the file ‘SystemUI.apk’ & ‘SystemUI.odex’ to other folder, then restart our device and it works. If u want to enable it, u move these two files back and restart. It’s the only way I found in last two month.

  12. Hey, thanks Manuel Di Cerbo for that bit of code, and also thanks Thomas Barrasso! that extra bit worked for me to reveal the notification bar…on cyanogenmod 7.1 (gb 2.3)

    awesome, thanks guys!

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>