Android代码 禁用Adb、状态栏、导航栏

public void setAdbDisabled(boolean disabled) {
    try {
        if (disabled) {
            Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
        } else {
            Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ADB_ENABLED, 1);
        }
    } catch (Exception e) {
        Slog.e(TAG, "setAdbDisabled", e);
    }
}
public void setStatusBarExpandPanelDisabled(boolean disabled) {
        Settings.Secure.putInt(mContext.getContentResolver(), STATUSBAR_EXPAND_KEY, disabled ? 1 : 0);
    }
    public void disableNavigation(){
        IStatusBarService mISs = IStatusBarService.Stub.asInterface(ServiceManager.
                getService(Context.STATUS_BAR_SERVICE));
        try {
            mISs.disable(StatusBarManager.DISABLE_NAVIGATION, new Binder(), getApplicationContext().getPackageName());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

 

posted @ 2022-04-06 15:19  小汀  阅读(944)  评论(0编辑  收藏  举报