Android全屏应用-禁止访问状态栏 [英] Android fullscreen app - prevent access to status bar

查看:781
本文介绍了Android全屏应用-禁止访问状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个全屏应用程序,它将以信息亭模式运行,因此用户将无法退出。该应用程序被定义为启动器(主屏幕)。



清单中的活动定义为:

  android:theme = @ android:style / Theme.NoTitleBar.Fullscreen 

此外,活动确保全屏模式,并且其中包含以下内容onCreate()

  getWindow()。clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); 
getWindow()。addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

但是,状态栏似乎仍然可以访问。默认情况下它是隐藏的,但是仍然可以通过触摸并下拉屏幕顶部来显示它(它以半透明背景而不是通常的纯黑色显示)。



我已经知道我可以通过在屏幕顶部添加一个透明的10 px 系统覆盖窗口来避免这种情况,该窗口将吸收触摸事件。但是我删除了这个黑客,因为我认为没有必要。



我确信这一切都很好,并且阻止了状态栏的显示而不求助于黑客。但是某些地方发生了变化。我已经更新到最新的库存固件和系统软件-也许这已经改变了吗?



设备当前正在运行 Android 4.4.4。我相信以前可能是4.4.1。



这曾经有可能吗? c $ b $ b $ b

请注意,这是针对无法植根的专用工业设备(霍尼韦尔海豚75e)。

解决方案


但是,状态栏似乎仍然可以访问。


是的,因为 com.android.systemui 程序包正在运行,它负责状态栏和软件导航栏。以下是禁用程序包的几种解决方案。 注意 为了使用解决方案,需要扩展权限(理想情况下为 root



重新启动持久解决方案



重命名 apk /system/app/SystemUI.apk 的$ c>扩展名或完全删除文件。您必须重新挂载 / system 分区,因为默认情况下它是只读的。重命名/删除系统后,可能会卸载 /data/data/com.android.systemui 软件包。如果不是,请手动执行,然后重新启动。



重新启动非永久性解决方案



在以下位置禁用/启用框架服务调用(至少在 KitKat之前有效的 之前有效)的运行时(例如在应用程序启动时):

 服务呼叫活动42 s16 com.android.systemui //禁用状态栏

  am startservice -n com.android.systemui / .SystemUIService //启用状态栏

请注意,解决方案在重新启动后并不持久。


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.

这篇关于Android全屏应用-禁止访问状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆