这里主要是USB 默认不要打开,如果要打开就设置成1就行了。
首次开机生效,后面重启不影响
代码如下,测试10.0是OK 的。
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/SystemBars.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/SystemBars.java
old mode 100644
new mode 100755
index 4285af0..af72e86
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/SystemBars.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/SystemBars.java
@@ -21,6 +21,12 @@ import com.android.systemui.statusbar.phone.StatusBar;
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import android.provider.Settings;
+
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
+import android.os.ServiceManager;
+import android.os.Build;
/**
* Ensure a single status bar service implementation is running at all times, using the in-process
* implementation according to the product config.
@@ -29,6 +35,8 @@ public class SystemBars extends SystemUI {
private static final String TAG = "SystemBars";
private static final boolean DEBUG = false;
private static final int WAIT_FOR_BARS_TO_DIE = 500;
+ // private final PackageManager mPm;
+ private IPackageManager mIPm;
// in-process fallback implementation, per the product config
private SystemUI mStatusBar;
@@ -37,6 +45,16 @@ public class SystemBars extends SystemUI {
public void start() {
if (DEBUG) Log.d(TAG, "start");
createStatusBarFromConfig();
+
+ // mPm = context.getPackageManager();
+ mIPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
+ try{
+ if(mIPm.isFirstBoot() && Build.TYPE.equals("user") ){
+ Log.d(TAG, "isFirstBoot true");
+ Settings.Global.putInt(mContext.getContentResolver(),Settings.Global.ADB_ENABLED, 0);
+ }
+ }catch( Exception e){
+ }
}