Android L添加kk版的OOBE开机向导

应客户的需求,要在L版本上添加OOBE开机向导,本文参考了kk版本上的代码,移植过来的,加了设置语言和日期和时间设置。

部分代码如下:

diff --git a/alps/frameworks/base/core/java/android/provider/Settings.java b/alps/frameworks/base/core/java/android/provider/Settings.java
old mode 100644
new mode 100755
index bec6171..f5b1464
--- a/alps/frameworks/base/core/java/android/provider/Settings.java
+++ b/alps/frameworks/base/core/java/android/provider/Settings.java
@@ -3395,6 +3395,26 @@ public final class Settings {
          * @hide
          */
         public static final int DIALOG_SEQUENCE_STK = 2;
+		
+		/**
+         * whether oobe is display
+         * 
+         * @hide
+         */
+        public static final String OOBE_DISPLAY = "oobe_display";
+
+        /**
+         * oobe display default value
+         * 
+         * @hide
+         */
+        public static final int OOBE_DISPLAY_DEFAULT = 0;
+        /**
+         * OOBE is display
+         * 
+         * @hide
+         */
+        public static final int OOBE_DISPLAY_ON = 1;
 
         /**
          * Persistent store for the system-wide default voice call ringtone URI.
diff --git a/alps/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/alps/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
old mode 100644
new mode 100755
index 2eff638..6616562
--- a/alps/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/alps/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -490,6 +490,8 @@ public class SettingsProvider extends ContentProvider {
 
         /// M:
         initDialogSequenceValue(userHandle);
+		
+		// initOobeValue(userHandle);//oobe
 
         startAsyncCachePopulation(userHandle);
     }
@@ -626,6 +628,34 @@ public class SettingsProvider extends ContentProvider {
             c.close();
         }
     }
+	
+	/**
+     *  M: reset oobe display value
+     */
+    private boolean initOobeValue(int userHandle) {
+        final Cursor c = queryForUser(Settings.System.CONTENT_URI,
+                new String[] { Settings.NameValueTable.VALUE },
+                Settings.NameValueTable.NAME + "=?",
+                new String[] { Settings.System.OOBE_DISPLAY }, null,
+                userHandle);
+        try {
+            final String value = c.moveToNext() ? c.getString(0) : null;
+            if (value != null) {
+                //Xlog.d(TAG, "reset OOBE_DISPLAY to default");
+                final ContentValues values = new ContentValues();
+                values.put(Settings.NameValueTable.NAME, Settings.System.OOBE_DISPLAY);
+                values.put(Settings.NameValueTable.VALUE,Settings.System.OOBE_DISPLAY_DEFAULT);
+                final Uri uri = insertForUser(Settings.System.CONTENT_URI, values, userHandle);
+                if (uri == null) {
+                    return false;
+                }
+            }
+            return true;
+        } finally {
+            c.close();
+        }
+    }
+    /// @}

具体代码已上传 https://download.csdn.net/download/Evahuangchen/12300412

你可能感兴趣的:(Android,L)