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 @}*/
}
}
android usb 调试关闭后,重启后,usb调试又被系统打开了
最新推荐文章于 2024-07-22 21:40:49 发布