android usb 调试关闭后,重启后,usb调试又被系统打开了

90 篇文章 3 订阅
protected boolean mBootAdbEnabled;

mAdbEnabled = UsbHandlerLegacy.containsFunction(getSystemProperty(
        USB_PERSISTENT_CONFIG_PROPERTY, ""), UsbManager.USB_FUNCTION_ADB);
/*jicong.wang modify for bug 2517 start {@*/
mBootAdbEnabled = (Settings.Global.getInt(mContentResolver,
        Settings.Global.ADB_ENABLED, 1) > 0);
/*jicong.wang modify for bug 2517 end @}*/
mSettings = getPinnedSharedPrefs(mContext);

protected void finishBoot() {
    if (mBootCompleted && mCurrentUsbFunctionsReceived && mSystemReady) {
        if (mPendingBootBroadcast) {
            updateUsbStateBroadcastIfNeeded(getAppliedFunctions(mCurrentFunctions));
            mPendingBootBroadcast = false;
        }
        if (!mScreenLocked
                && mScreenUnlockedFunctions != UsbManager.FUNCTION_NONE) {
            setScreenUnlockedFunctions();
        } else {
            setEnabledFunctions(UsbManager.FUNCTION_NONE, false);
        }
        if (mCurrentAccessory != null) {
            mUsbDeviceManager.getCurrentSettings().accessoryAttached(mCurrentAccessory);
        }
        if (mDebuggingManager != null) {
            mDebuggingManager.setAdbEnabled(mAdbEnabled);
        }

        // make sure the ADB_ENABLED setting value matches the current state
        try {
            putGlobalSettings(mContentResolver, Settings.Global.ADB_ENABLED,
                    mAdbEnabled ? 1 : 0);
        } catch (SecurityException e) {
            // If UserManager.DISALLOW_DEBUGGING_FEATURES is on, that this setting can't
            // be changed.
            Slog.d(TAG, "ADB_ENABLED is restricted.");
        }

        updateUsbNotification(false);
        updateAdbNotification(false);
        updateUsbFunctions();
        /*jicong.wang modify for bug 2517 start {@*/
        if (!mBootAdbEnabled){
            putGlobalSettings(mContentResolver, Settings.Global.ADB_ENABLED, 0);
        }
        /*jicong.wangjicong modify for bug 2517 end @}*/
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值