隐藏状态栏辅助功能问题,Android浮动窗口 [英] Android floating window with hidden statusbar Accessibility problems

查看:1025
本文介绍了隐藏状态栏辅助功能问题,Android浮动窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作是Android 4.4.2建设有无障碍服务创建的系统覆盖/浮动窗口的应用程序。

编辑:我希望能够在全球范围内隐藏状态栏(在任何应用程序)(由下面的code成为可能),然而,当显示叠加我停止接收来自acessibilityEvents监听器和软件/硬件后退按钮
当浮视图注入到窗口管理器:


  1. AccessibilityEvent监听器没有收到更新

  2. 软/硬件返回键不登记(家庭/ [近期所做的)

为了隐藏状态栏都 FLAG_FULLSCREEN | FLAG_NOT_TOUCH_MODAL需要让触摸屏幕的其余部分和View.SYSTEM_UI_FLAG_FULLSCREEN可让

辅助服务(在连接方式):

  @覆盖
    公共无效onServiceConnected(){
        serviceInstance =这一点;
        窗口管理=(窗口管理器)getSystemService(WINDOW_SERVICE);        FloatingView =新的视图(本);        WindowManager.LayoutParams PARAMS =新WindowManager.LayoutParams(
                0,0,
                0,0,
                TYPE_PRIORITY_PHONE,
                FLAG_FULLSCREEN | FLAG_NOT_TOUCH_MODAL,PixelFormat.OPAQUE);
        params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
        params.windowAnimations = android.R.style.Animation_Toast;
        params.gravity = Gravity.BOTTOM | Gravity.RIGHT;            windowManager.addView(FloatingView,则params); INT uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
  FloatingView.setSystemUiVisibility(uiOptions);        }

辅助服务(在连接方式):

  @覆盖
公共无效onAccessibilityEvent(AccessibilityEvent accessibilityEvent){
    Log.i(,只需登录我一些垃圾);}

我的AccessibilitySetup.xml:

 <辅助服务的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:accessibilityEventTypes =typeAllMask
    机器人:accessibilityFeedbackType =feedbackAllMask
    机器人:notificationTimeout =0
    机器人:accessibilityFlags =flagDefault
    机器人:canRetrieveWindowContent =真
    机器人:说明=@字符串/ notification_description
    />


解决方案

长小时后和研究一个星期,我发现孤单没办法这两个做由于安全限制。我将在我的应用程序的根目录模式implmenet这些功能。

我现在用的解决方法是一个简单的按钮复兴的系统UI,并删除阻塞的辅助输入视图

I am working on android 4.4.2 building an application with a system overlay/floating window created by an accessibility service.

Edit:I want to be able to hide the status bar GLOBALLY (in any app) (made possible by the code below) however when the overlay is shown i stop receiving acessibilityEvents from the listener and the software/hardware back button When the floating view is injected into windowmanager:

  1. AccessibilityEvent listener does not receive updates
  2. Soft/hardware back key does not register (home/recents does)

in order to hide the status bar both 'FLAG_FULLSCREEN | FLAG_NOT_TOUCH_MODAL' are needed to allow touching the rest of the screen and 'View.SYSTEM_UI_FLAG_FULLSCREEN' allows

Accessibility Service (on connected method) :

  @Override
    public void onServiceConnected() {
        serviceInstance = this;
        windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);

        FloatingView = new View(this);

        WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                0, 0,
                0, 0,
                TYPE_PRIORITY_PHONE,
                FLAG_FULLSCREEN | FLAG_NOT_TOUCH_MODAL, PixelFormat.OPAQUE);
        params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
        params.windowAnimations = android.R.style.Animation_Toast;
        params.gravity = Gravity.BOTTOM | Gravity.RIGHT;

            windowManager.addView(FloatingView, params);

 int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
  FloatingView.setSystemUiVisibility(uiOptions);

        }

Accessibility Service (on connected method) :

@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
    Log.i("","Just log me some rubbish");

}

My AccessibilitySetup.xml:

<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:accessibilityEventTypes="typeAllMask"
    android:accessibilityFeedbackType="feedbackAllMask"
    android:notificationTimeout="0"
    android:accessibilityFlags="flagDefault"
    android:canRetrieveWindowContent="true"
    android:description="@string/notification_description"
    />

解决方案

After long hours and a week of research i found theres is no way to do both of these due to security restrictions. i will implmenet these features in the root mode of my app.

the workaround i am using is a simple button that revives the system ui and removes the view that is blocking the accessibility input

这篇关于隐藏状态栏辅助功能问题,Android浮动窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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