0

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

NoWar
  • 36,338
  • 80
  • 323
  • 498
  • Do you want to disable notification bar ? – Aditya Jan 31 '18 at 05:51
  • 1
    You will need to write/create a custom ROM for that – Akshay Jan 31 '18 at 05:52
  • @Heisen-Berg Well... If will help then yes but actually I need to disable the whole tile with icons like `settings` and all buttons because user is not gonna setup ANY settings only Administrator of the company will do. – NoWar Jan 31 '18 at 05:53
  • Have you ever heard about MACROS? Implement it for the users which you want to disable it. I think you cannot hide the Android system UI till you don't implement your custom OS, but doing some tricks you can get a success. – Ready Android Jan 31 '18 at 05:56
  • @Akshay Is it possible to catch `Open Settings event` and provide Password Dialog at least? We are tired that our users destroy all settings so we need to protect by blocking user to open `Settings` screen. – NoWar Jan 31 '18 at 05:56
  • @ReadyAndroid No i dit not. Please provide more info and if it will be like a final answer than like an answer. Thanks! – NoWar Jan 31 '18 at 05:57
  • 1
    If you want to hide the statusbar, this may help you: https://stackoverflow.com/questions/32984476/hide-status-bar-in-android-4-4-or-kitkat-with-fullscreen – Rino Jan 31 '18 at 05:57
  • You have to access `root` permissions on your device, then you can disable notification bar. – Aditya Jan 31 '18 at 05:59
  • @Rino the link you provided is app specific..Here the OP wants the device's main status bar to be disabled – Akshay Jan 31 '18 at 06:01
  • 1
    @AcademyofProgrammer, yeah I have done some kind of things for one IPTV app, if you really want then I can do a POC for you. Message me @rahul.androidnewsletter@gmail.com for the further discussion. – Ready Android Jan 31 '18 at 06:03
  • 1
    Or you can block user to pull down notification bar, while using your application. But as user disable your app, he or she can access notification bar. Or if you want to disable pull down of notification bar for like always, then you just have to set permission like `Apps that can draw over other apps`, after this your app with disabled bar run over on top of every app and user can't access bar. – Aditya Jan 31 '18 at 06:05
  • @Heisen-Berg It seems your idea is good. Please explain it with more detail slike an answer and I will accept it. Well.. Users will not have any access to `Settings` because oul launcher will not provide this posibility for them. – NoWar Jan 31 '18 at 06:07
  • @ReadyAndroid Hey! Thanks, bro. But I have no finance to firm any contracts like this. Sorry man! – NoWar Jan 31 '18 at 06:08
  • I am working on your question, I just wanna to ask what's your minimum SDK ? – Aditya Jan 31 '18 at 06:48
  • @Heisen-Berg Thanks! It is API 23: Android 6.0 (Marshmallow) – NoWar Jan 31 '18 at 06:58

4 Answers4

1

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"
  ....
>
fab
  • 1,189
  • 12
  • 21
  • Thanks. Well... I did it like ` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Full screen mode requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); ` and as says manual here https://developer.android.com/training/system-ui/dim.html#dim we cannot hide it absolutly. – NoWar Jan 31 '18 at 06:43
1

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.

Suresh S
  • 41
  • 10
0

It seems is impossible to do at all.

That is the answer.

NoWar
  • 36,338
  • 80
  • 323
  • 498
0

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

Chirag Dave
  • 786
  • 6
  • 5