Enabling KioskMode in Android 4.4.2 with Root

[亡魂溺海] 提交于 2019-12-05 00:03:53

问题


I was able to enable kiosk mode in pre-KitKat-releases by killing the com.android.systemui process. Anyhow, this seems not to work in KitKat-releases: After killing the process the whole screen got stuck and I am not able to press any buttons.

After inspecting similar apps from the Play Store I saw recent updates providing a compatibility for KitKat (e.g. Sure lock demo link). Can somebody explain this KitKat-compatibility?

Can somebody name a new way to hide the navigation and status bar in KitKat-releases with root priviledges?

Best regards in advance, Greeny


回答1:


May be you can give a try with the below code snippet to show/hide status bar on rooted android devices.I'v tested this on 4.2.2 , 4.4.2 with success.Good luck :)

To hide:

        Process proc = null;

        String ProcID = "79"; //HONEYCOMB AND OLDER

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

        try {
            proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "service call activity "+ProcID+" s16 com.android.systemui" });
        } catch (Exception e) {
            Log.w("Main","Failed to kill task bar (1).");
            e.printStackTrace();
        }
        try {
            proc.waitFor();
        } catch (Exception e) {
            Log.w("Main","Failed to kill task bar (2).");
            e.printStackTrace();
        }

To show:

        Process proc = null;
        try {
            proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "am startservice -n com.android.systemui/.SystemUIService" });
        } catch (Exception e) {
            Log.w("Main","Failed to kill task bar (1).");
            e.printStackTrace();
        }
        try {
            proc.waitFor();
        } catch (Exception e) {
            Log.w("Main","Failed to kill task bar (2).");
            e.printStackTrace();
        }


来源:https://stackoverflow.com/questions/21363132/enabling-kioskmode-in-android-4-4-2-with-root

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!