Snippets

Muhammed Ballan UtilsTaskbar To show and hide home task switcher buttons on the soft navigation bar Android

Created by Muhammed Ballan

import android.os.Build;


/**
 * Created by MBH on 11/2/2015.
 */
public class UtilsTaskBar {
    public static boolean removeTaskBar() {
        try {
            // REQUIRES ROOT
            String ProcID = "79"; // HONEYCOMB AND OLDER

            // v.RELEASE //4.0.3
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                ProcID = "42"; // ICS AND NEWER
            }

            // REQUIRES ROOT
            Process proc = Runtime.getRuntime().exec(
                    new String[]{
                            "su",
                            "-c",
                            "service call activity " + ProcID
                                    + " s16 com.android.systemui"}); // WAS 79
            proc.waitFor();
            return true;
        } catch (Exception ex) {
            return false;
        }
    }

    public static boolean addTaskBar() {
        // oncreate_addTaskBar
        try {
            // REQUIRES ROOT
            Build.VERSION_CODES vc = new Build.VERSION_CODES();
            Build.VERSION vr = new Build.VERSION();
            String ProcID = "79"; // HONEYCOMB AND OLDER

            // v.RELEASE //4.0.3
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                ProcID = "42"; // ICS AND NEWER
            }

            // REQUIRES ROOT
            Process proc = Runtime
                    .getRuntime()
                    .exec(new String[]{"su", "-c",
                            "am startservice -n com.android.systemui/.SystemUIService"}); // WAS
            // 79
            proc.waitFor();

            return true;
        } catch (Exception ex) {
            return false;
        }
    }
}

Comments (1)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.