Skip to content Skip to sidebar Skip to footer

Android Floating Window With Hidden Statusbar Accessibility Problems

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 GLOB

Solution 1:

Hey i think this would work!!!!

You just need to set WindowManager.LayoutParams height width property correctly. By this you can able to receiving acessibilityEvents from the listener and the software/hardware back button.

Try this

WindowManager manager = ((WindowManager) context.getApplicationContext()
            .getSystemService(Context.WINDOW_SERVICE));
    WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
    localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
    localLayoutParams.gravity = Gravity.TOP;
    localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
            // this is to enable the notification to receive touch events
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
            // Draws over status bar
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
    localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    localLayoutParams.height = retrieveStatusBarHeight(context);
    localLayoutParams.format = PixelFormat.TRANSPARENT;
    StatusBarOverlayView view = new StatusBarOverlayView(context);
    manager.addView(view, localLayoutParams);

public static int retrieveStatusBarHeight(Context context) {
    int result = 0;
    int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        result = context.getResources().getDimensionPixelSize(resourceId);
    }
    return result;
}

Solution 2:

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


Post a Comment for "Android Floating Window With Hidden Statusbar Accessibility Problems"