gpt4 book ai didi

android - 在 Jelly Bean Tablet 中隐藏系统栏(已 Root)

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:08:39 26 4
gpt4 key购买 nike

我有一个 Android Jelly Bean 平板电脑,它已经被 root 并试图运行一个应用程序,该应用程序具有隐藏系统栏的代码,但它没有被隐藏,任何人都可以帮助我解决这个问题。

在终端中获取输出:Result Parcel(00000000 '....')

public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button hide=(Button)findViewById(R.id.button1);
Button show=(Button)findViewById(R.id.button2);
hide.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.v("ds", "hideSystembar");
try {
Process proc = Runtime.getRuntime().exec(new String[]{
"su","-c","service call activity 79 s16 com.android.systemui"});
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
});
show.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.v("f", "showSystembar");
try {
Process proc = Runtime.getRuntime().exec(new String[]{
"am","startservice","-n","com.android.systemui/.SystemUIService"});
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}

虽然我得到了许可的 toast :enter image description here

super 用户日志截图: enter image description here

最佳答案

引入 ICS 后,SystemUI 类的进程 ID 从 79 更改为 42。
以下代码适用于您的应用可能运行的任何 Android 版本。

//HIDE TOOLBAR
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
}

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

}catch(Exception ex){
Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}

关于android - 在 Jelly Bean Tablet 中隐藏系统栏(已 Root),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13454528/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com