NoWar
NoWar

Reputation: 37633

Disable quick settings tile in Android

I cannot find a way to disable quick settings tile in Android programmatically that is a requirement for our enterprise launcher.

Are there any clues beyond the How to disable the notification bar pull-down in Android? and https://e2e.ti.com/support/embedded/android/f/509/t/283260

Is it possible to do? Thanks!

enter image description here

Upvotes: 0

Views: 6239

Answers (4)

Suresh S
Suresh S

Reputation: 51

Yes you can do it. I had used the following snippet to disable quick settings.

public static void preventStatusBarExpansion(Context context) {
        WindowManager manager = ((WindowManager) context.getApplicationContext()
                .getSystemService(Context.WINDOW_SERVICE));



        Activity activity = (Activity)context;
        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 recieve touch events
                WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |

                // Draws over status bar
                WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;

        localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
        int resId = activity.getResources().getIdentifier("status_bar_height", "dimen", "android");
        int result = 0;
        if (resId > 0) {
            result = activity.getResources().getDimensionPixelSize(resId);
        }

        localLayoutParams.height = result;

        localLayoutParams.format = PixelFormat.TRANSPARENT;

        customViewGroup view = new customViewGroup(context);

        manager.addView(view, localLayoutParams);
    }

Call this method where ever you need. Before calling this method make sure you has screen overlay permission. However this permission is deprecated in Oreo.

Upvotes: 1

Chirag Dave
Chirag Dave

Reputation: 1166

No, not impossible. Use ACTION_CLOSE_SYSTEM_DIALOGS to prevent it be pulled down when the screen is locked.

Upvotes: 0

NoWar
NoWar

Reputation: 37633

It seems is impossible to do at all.

That is the answer.

Upvotes: 0

fab
fab

Reputation: 1249

May you start your app in the full screen mode? like explained here: https://stackoverflow.com/a/8470893/2801860

<activity
  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
  ....
>

Upvotes: 1

Related Questions