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

 

你可能感兴趣的:(framework)