I have built my AOSP custom ROM using Android 4.4.4 sources. I want to do a kiosk mode app (always full screen - impossible for the user to leave it or to switch to another app).
In order to have a full immersive mode, I followed this SO post Enabling KioskMode in Android 4.4.2 with Root
I dit exactly as they say but it's not working. System UI is not disabled and I have no error.
So I decided to create a .sh file that I run from Android SDK code:
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "/etc/stop-ui.sh" });
It works perfectly. But when I want to start the System UI again :
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "/etc/start-ui.sh" });
it returns error 1.
When I run /etc/start-ui.sh from adb shell it works.
Here is my stop.sh (with permission 555) file :
#!/system/bin/sh
service call activity 42 s16 com.android.systemui
Here is my start.sh (with permission 555) file :
#!/system/bin/sh
am startservice -n com.android.systemui/.SystemUIService
My app is a system app (I signed it with the platform signature)
Conclusion: I can restart system UI from shell but not from app programmatically