2015년 10월 22일 목요일

[Android] SystemBar Disappeard


http://masashi-k.blogspot.kr/2013/09/hide-show-system-bar-of-android.html

시스템바를 없앨 수 있다.

public class MainActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
   
    RootTools.debugMode = true; // debug mode
   
    hideSystemBar();
  }
  private void showSystemBar() {
    String commandStr = "am startservice -n com.android.systemui/.SystemUIService";
    runAsRoot(commandStr);
  }
 
  private void hideSystemBar() {
    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 (vr.SDK_INT >= vc.ICE_CREAM_SANDWICH) {
          ProcID = "42"; //ICS AND NEWER
      }
     
      String commandStr = "service call activity " + ProcID + " s16 com.android.systemui";
      runAsRoot(commandStr);
    } catch (Exception e) {
      // something went wrong, deal with it here
    }
  }
 

  private void runAsRoot(String commandStr) {
    try {
      CommandCapture command = new CommandCapture(0, commandStr);
      RootTools.getShell(true).add(command).waitForFinish();
    } catch (Exception e) {
      // something went wrong, deal with it here
    }
  }

}

댓글 없음:

댓글 쓰기