Android fullscreen app - prevent access to status bar - android

I am creating a fullscreen app which will run in "kiosk" mode, so the user will not be able to exit. The app is defined as a launcher (home screen).
The Activity in the manifest is defined with:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
Additionally, the Activity ensures full screen mode with the following in its onCreate():
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
However, it seems that the status bar is still accessible. It's hidden by default, but it can still be shown by touching and pulling down the top of the screen (where it shows with a translucent background instead of the usual solid black).
I already know I can prevent this by adding a transparent 10px system overlay window at the top of the screen which will absorb the touch events. But I removed this hack because I didn't think it was necessary.
I am sure this was all working fine and prevented the status bar from showing without resorting to the hackery. But something has changed somewhere. I have updated to the latest stock firmware and system software - perhaps that has changed this?
The device is currently running Android 4.4.4. I believe it may have been on 4.4.1 before.
Has this ever been possible? Is it more likely that something has changed in Android or I have broken something, or has this been broken all along and I've only just noticed?
Please note that this is for a specialised industrial device (a Honeywell Dolphin 75e) which cannot be rooted.

However, it seems that the status bar is still accessible.
Yes, because the com.android.systemui package is running which is responsible for the status bar and software navigation bar. The following is a couple of solutions on disabling the package. Note that in order to make use of the solutions the extended privileges (ideally root) are needed.
Reboot persistent solution
Rename the apk extension of /system/app/SystemUI.apk or delete the file completely. You have to remount the /system partition as it is read-only by default. After renaming/deleting the system likely uninstall the /data/data/com.android.systemui package. If not, do it manually, then reboot.
Reboot impermanent solution
Disable/enable the framework service at runtime (e.g. on your app start up) with the calls (valid prior to KitKat at least) to:
service call activity 42 s16 com.android.systemui // disable status bar
and
am startservice -n com.android.systemui/.SystemUIService // enable status bar
Note, the solution is not persistent on reboot.

put this code in oncreate method
int myflag= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(myflag);
for more details
https://developer.android.com/training/system-ui/immersive.html

Related

Preventing SystemUI from automatically restarting

I am developing an app that requires that the SystemUI to be completely gone, no Navigation Bar and no Status Bar. Immersive Mode is not enough, since the Navigation Bar will still pop up if the user swipes up at the bottom of the screen.
After a lot of research, I have found some snippets that don't work anymore since they're from ~2011. What I have managed to do is kill the SystemUI through pkill -9 com.android.systemui but it restarts by itself a few seconds later. So the perfect solution seems to be to prevent the UI from restarting, then manually restarting it when needed. All of this just so the device doesn't need a reboot. Is that possible at all?
Another solution would be to "freeze" the SystemUI, in such a way that it does not respond to the user trying to pull the Navigation Bar back up, but I have found absolutely nothing on that matter.
Obviously, the device is rooted.
Thanks in advance.

Block any full screen App Android (ROOT)

I need to block full screen mode for any App started in Android. That mean App can be opened, but status bar must be visible. I tried to search a lot of info, but still not luck.
I found App that always showing status bar - but issue is, status bar have transparent color and full screen app is not attached screen, with that status bar.
I have root phone and can modify any settings, but can't update firmware. Also i tried to make overlay over screen, but still no luck, all app just ignore my overlay
Thanks
You can do it in Xposed framework in App Settings module:
http://repo.xposed.info/module/de.robv.android.xposed.mods.appsettings
Just set Fullscreen to never for every application that uses it.

Android - Permanently hide navigation bar

I need to hide the navigation bar on a tablet with 4.0 completely. No user interaction should change this behavior. Right now I'm running the default Fullscreen View from Android Studio, but user interaction brings up the navigation bar.
Is there a way to do that without root?
Unless phone is rooted - you cannot override the standard behavior or Android OS.
In fullscreen mode i will be hidden, but can be still brought down when required.
You could set the app like a Launcher, hide the navigation bar, and root the phone, in order to set always run that.
The other option is root the phone, and make your own android version without the navigation bar.

Android disable notification bar [root]

I need to enable this on 4.2.2 android tablet.
I've successfull'y done that using this terminal command:
"settings put global device_provisioned 1"
The problem is, that this command also disables HOME button, so I cannot use it. Seems like system stops sending intents.
I've found ways to disable whole system bar at the top and bottom of the screen, but then I loose my navigation buttons.
I've tried disabling notifications one by one, but I still see searching for GPS and Android active hotspot icons in notification bar.
It seems I've tried everything I could, but am unable to get required functionality.
What else could I try?

Easy way to hide system bar on Android ICS

I will give my ICS tablets for users to complete a survey so I would like the user to work with my app only. They should not be able to switch to the home screen, press back buttons etc., so I would like to hide the system bar completely.
My tablet is rooted and I know some application like
this can help me, but I don't need all the extra functions of this app.
I found this tutorial that could help me, but if I can add the code to do my own, it would be great.
After a lot of searching on the internet, I managed to get the System Bar to hide and appear in a 4.2 device using:
To Hide:
Runtime.getRuntime().exec("service call activity 42 s16 com.android.systemui");
Or use 79 instead of 42 for API less than 14. You may also need to include the SET_DEBUG_APP permission, in which case you need to have the application signed with the system key or installed in the /system/app/ directory.
To Show:
Runtime.getRuntime().exec("am startservice --user 0 -n com.android.systemui/.SystemUIService");
Alternatively some people have used the -a (instead of -n) option, though this was causing an error on my device:
Error: Not found; no service started.
For Android 4.4, there is a new feature called immersive mode which hides both the system and status bars. The system UI is toggled by the user through the use of an edge swipe from the top or bottom of the screen. For more details take a look at:
http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
Using new IMMERSIVE mode in android kitkat
For example:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE)
HideBar has a kiosk mode especially for this use case.
A free download is available at http://ppareit.github.com/HideBar/.
You can also find it in the market at https://play.google.com/store/apps/details?id=be.ppareit.hidebar.
If you want to incorporate it in your own test/survey application you can always contact the developer (see the links for an email). The code could be explained or an Intent to do the hiding could be provided.
check this link: (requires root)
http://android.serverbox.ch/?p=306
similar question was posted here also:
Is there a way to hide the system bar in Android 3.0? It's an internal device and I'm managing navigation
or try HideBar
http://ppareit.github.com/HideBar/
Actually you can simply put the system bar in "lights out" mode, the system bar buttons and notifications gets dimmed.
View v = findViewById(R.id.view_id);
v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
I want to add some information to the existing replies hoping it will be useful for someone.
To get a real full screen working on my low cost China tablets I need to edit a file located in
system/build.prop
replace the text
ro.property.tabletUI=true
with
#ro.property.tabletUI=true
(I comment the line). After that, I can get a full screen using
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
for each activity in the minfest.xml
This solution Is good only if you sell tablets with your application and needs root privileges to edit the system/build.prop. So it's not a solution for all, so please do not downvote this little contribute.
EDIT:
I noticed that my tablets have hardware buttons (Home, menĂ¹ and back) on the frames. So Android lets me to hide the system bar. I tryed with other tablets that haven't hardware buttons without success.
Google intends Android to be used for consumers only. They integrated the System UI bar more tightly into Android ICS (4.0) to prevent people from rooting the device and killing the bar that way. Attempting to delete the system bar process will prevent the OS from booting fully.
If you want to restrict users from accessing the home screen, then you are out of luck with Android ICS. I would suggest finding a tablet manufacture who will preload the device with Android 2.3. Either that, or use a rooted Android 3.x device.
If you intend to use Android for kiosk or locked down devices, then you would be better off targeting an OS that is a bit more open.
I found a solution that, in my use case, works like a charm by hiding the menu bar even on a NOT ROOTED device:
setting this flag
layoutparams.flags = 0x80000000 | layoutparams.flags;
to my window's layout parameters simply does the trick!
Here's the complete snippet i used:
Window window = getWindow();
android.view.WindowManager.LayoutParams layoutparams = window.getAttributes();
layoutparams.flags = 0x80000000 | layoutparams.flags;
window.setAttributes(layoutparams);
in my Activity onCreate.
To find out this I reverse engeneered a non-system Apk I found that was somehow able to do that.
According to the official documentation:
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
that "0x80000000" is the FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS introduced as a system constant in Api level 21, and it basically indicates that "this Window is responsible for drawing the background for the system bars." and since i'm not manually drawing any system bar, no menu bar is shown.
I only tested this on a pair of Moverio BT-200 running Android ICS 4.0.3 because that is the device i'm currently working on and also because right now i don't have other device running Api levels prior to 19 under my hands to test it.
There is a workaround to disable menu bar (not hide) in all most all tablets without rooting. But this is bit tricky, but it works clean. Several well known apps in the market at the moment using this strategy to achieve this disable menu bar feature for their apps.
Grant admin privilege (need one time user involvement to activate).
Set password & lock the device using device admin profile api programatically.
Then load what ever the UIs on top of the native lock screen. (Of course this will show background lock screen whenever a transition happens between activities. But if logic is organized well, then it will be smooth & less noticed by the user)
When need to enable back, reset password to "" using resetPassword("", 0) of device policy manager object.
To complement the answers already given, and in case it is useful for someone needing a similar behaviour, there is this tutorial for android devices 4.0 and higher, it tells you how to hide the navigation bar and the status bar (they will reappear when the screen is touched again):
https://developer.android.com/training/system-ui/navigation.html
I realize it is not what you need exactly, but might be useful for someone else looking at this problem.

Categories

Resources