隐藏Android第一次开机向导(提示气泡)

第一次开机后,Android系统会显示开机提示,其实是Launcher2中的行为,分为workspace的确定,allapp的确定和文件夹的确定,要使得android第一次开机不显示“确定”气泡提示页面,需要将下面这3行的默认值改为true,则不会显示开机提示的气泡:

mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, true)

mSharedPrefs.getBoolean(Cling.Cling.ALLAPPS_CLING_DISMISSED_KEY, true)

mSharedPrefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY , true)


源码位置在:
android/packages/apps/Launcher2/src/com/android/launcher2/Cling.java
 38 public class Cling extends FrameLayout {
 40     static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed";
 41     static final String ALLAPPS_CLING_DISMISSED_KEY = "cling.allapps.dismissed";
 42     static final String FOLDER_CLING_DISMISSED_KEY = "cling.folder.dismissed";

android/packages/apps/Launcher2/src/com/android/launcher2/Launcher.java
4137     public void showFirstRunWorkspaceCling() {
4140         synchronized(mSharedPrefsLock) {
4141             if (mSharedPrefs != null) {
4142                 if (isClingsEnabled() && !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false) && !skipCustomClingIfNoAccounts() ) {
4159                     initCling(R.id.workspace_cling, null, false, 0);
4160                 } else {
4161                     removeCling(R.id.workspace_cling);
4162                 }
4163             }
4164         }
4165     }

4166     public void showFirstRunAllAppsCling(int[] position) {
4169         synchronized(mSharedPrefsLock) {
4170             if (mSharedPrefs != null) {
4171                 if (isClingsEnabled() && !mSharedPrefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
4173                     initCling(R.id.all_apps_cling, position, true, 0);
4174                 } else {
4175                     removeCling(R.id.all_apps_cling);
4176                 }
4177             }
4178         }
4179     }

4194     public Cling showFirstRunFoldersCling() {
4197         synchronized(mSharedPrefsLock) {
4198             if (mSharedPrefs != null) {
4199                 if (isClingsEnabled() && !mSharedPrefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
4201                     return initCling(R.id.folder_cling, null, true, 0);
4202                 } else {
4203                     removeCling(R.id.folder_cling);
4204                     return null;
4205                 }
4206             }
4207         }
4208         return null;
4209     }


发现有更简单的办法:修改配置项 ro.launcher.config.cling的值为disable则不显示开机向导气泡;

该配置在样机运行后的/system/build.prop文件中,如果是在编译之前修改,一般需要修改板型目录中的该配置项的值,然后编译即可。




你可能感兴趣的:(android系统)