问题
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