importandroid.os.Build;/** * Created by mballan on 15.09.2015. */publicclassNavBarManager{publicstaticvoidhideTaskBar(){newThread(newRunnable(){@Overridepublicvoidrun(){inttryCounter=5;// for max try times, which is gonna be reached only if device is not// rootedbooleanchanged=false;while(!changed&&tryCounter>=0){try{// REQUIRES ROOTThread.sleep(800);Build.VERSION_CODESvc=newBuild.VERSION_CODES();Build.VERSIONvr=newBuild.VERSION();StringProcID="79";// HONEYCOMB AND OLDER// v.RELEASE //4.0.3if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.ICE_CREAM_SANDWICH){ProcID="42";// ICS AND NEWER}// REQUIRES ROOTProcessproc=Runtime.getRuntime().exec(newString[]{"su","-c","service call activity "+ProcID+" s16 com.android.systemui"});// WAS 79proc.waitFor();changed=true;}catch(Exceptionex){ex.printStackTrace();changed=false;}finally{tryCounter--;try{Thread.sleep(800);}catch(InterruptedExceptione){e.printStackTrace();}}}}}).start();}publicstaticvoidshowTaskBar(){newThread(newRunnable(){@Overridepublicvoidrun(){booleanchanged=false;inttryCounter=5;// for max try times, which is gonna be reached only if device is not// rootedwhile(!changed&&tryCounter>=0){try{// REQUIRES ROOTBuild.VERSION_CODESvc=newBuild.VERSION_CODES();Build.VERSIONvr=newBuild.VERSION();StringProcID="79";// HONEYCOMB AND OLDER// v.RELEASE //4.0.3if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.ICE_CREAM_SANDWICH){ProcID="42";// ICS AND NEWER}// REQUIRES ROOTProcessproc=Runtime.getRuntime().exec(newString[]{"su","-c","am startservice -n com.android.systemui/.SystemUIService"});// WAS// 79proc.waitFor();changed=true;}catch(Exceptionex){ex.printStackTrace();changed=false;}finally{tryCounter--;try{Thread.sleep(800);}catch(InterruptedExceptione){e.printStackTrace();}}}}}).start();}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.