android6.0设置USB选项自动连接,不用手动点击选择按钮框

alps/frameworks/base/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java 
old mode 100644
new mode 100755
index f5447a2..921dca3
@@ -38,6 +38,8 @@ import com.android.internal.app.AlertActivity;
 import com.android.internal.app.AlertController;
 import com.android.systemui.R;
 
+import com.pgm.PgmDefineSystemProperties;
+
 public class UsbDebuggingActivity extends AlertActivity
                                   implements DialogInterface.OnClickListener {
     private static final String TAG = "UsbDebuggingActivity";
@@ -79,6 +81,21 @@ public class UsbDebuggingActivity extends AlertActivity
         ap.mView = checkbox;
 
         setupAlert();
+        //by lwz 自动同意USB连接       
+        if(DefineSystemProperties.MMI_BOOL_NO_USBDEBUG_DIALOG){
+
+	        boolean alwaysAllow = true;
+	        try {
+	            IBinder b = ServiceManager.getService(USB_SERVICE);
+	            IUsbManager service = IUsbManager.Stub.asInterface(b);
+
+	                service.allowUsbDebugging(alwaysAllow, mKey);
+
+	        } catch (Exception e) {
+	            Log.e(TAG, "Unable to notify Usb service", e);
+	        }
+	        finish();
+       }
     }
 
     private class UsbDisconnectedReceiver extends BroadcastReceiver {
[Description] 
如何开关默认USB调试功能

[Keyword] 
USB 调试 debugging Eng Usr

[Solution]

\build\core\main.mk

两个都=1,默认打开,=0,默认关闭

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1

ICS =1 -> 打开,=0 -> 关闭 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1

ifeq 代表Eng版本

else 代表Usr版本

Details

GB

ifeq (true,(strip(strip(enable_target_debugging)))

Target is more debuggable and adbd is on by default

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1

Include the debugging/testing OTA keys in this build.

INCLUDE_TEST_OTA_KEYS := true

else # !enable_target_debugging

Target is less debuggable and adbd is off by default

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0

endif # !enable_target_debugging

ICS

ifeq (true,(strip(strip(enable_target_debugging)))

Target is more debuggable and adbd is on by default

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 
Include the debugging/testing OTA keys in this build.

INCLUDE_TEST_OTA_KEYS := true

else # !enable_target_debugging

Target is less debuggable and adbd is off by default

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0

endif # !enable_target_debugging

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值