视频聊天软件源码Android 8.1user版本默认开启开发者模式

近期项目(MTK Android 8.1)需求,user版本系统默认开启开发者模式,这边做个记录。

--- build/make/core/main.mk     (版本 48)
+++ build/make/core/main.mk     (工作副本)
 
@@ -275,7 +275,7 @@
   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
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
 endif # !enable_target_debugging
--- vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java   (版本 48)
+++ vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java   (工作副本)
@@ -126,10 +126,20 @@
             if (!UsbManager.ACTION_USB_STATE.equals(action)) {
                 return;
             }
-            boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
+            //boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
+            boolean connected = false;
             if (!connected) {
                 mActivity.finish();
             }
+             try {
+                IBinder b = ServiceManager.getService(USB_SERVICE);
+                IUsbManager service = IUsbManager.Stub.asInterface(b);
+                service.allowUsbDebugging(true, mKey);                 
+             } catch (Exception e) {
+                Log.e(TAG, "Unable to notify Usb service", e);
+             }     
+
         }
     }

以上就是User版本默认打开开发者模式的方法。

你可能感兴趣的:(技术类,java,spring,android,移动开发,linux)