1.跳过开机向导的命令:pm disable-user com.google.android.setupwizard
2.无法打开开机向导的log:
SettingsPreferenceFragment: Skip DevelopmentSettingsDashboardFragment before SUW completed.
报错地方:packages\apps\Settings\src\com\android\settings\SettingsPreferenceFragment.java
@Override public void onAttach(Context context) { if (shouldSkipForInitialSUW() && !WizardManagerHelper.isDeviceProvisioned(getContext())) { Log.w(TAG, "Skip " + getClass().getSimpleName() + " before SUW completed."); finish(); } super.onAttach(context); }
frameworks\opt\setupwizard\library\main\src\com\android\setupwizardlib\util\WizardManagerHelper.java
/** * Checks whether the device is provisioned. This means that the device has gone through Setup * Wizard at least once. Note that the user can still be in Setup Wizard even if this is true, for * a secondary user profile triggered through Settings > Add account. * * @param context The context to retrieve the settings. * @return true if the device is provisioned. * @see #isUserSetupComplete(android.content.Context) */ public static boolean isDeviceProvisioned(Context context) { if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) { return Settings.Global.getInt( context.getContentResolver(), SETTINGS_GLOBAL_DEVICE_PROVISIONED, 0) == 1; } else { return Settings.Secure.getInt( context.getContentResolver(), SETTINGS_GLOBAL_DEVICE_PROVISIONED, 0) == 1; } }
解决方法:不要跳过开机向导,或者修改系统的值:
settings put global device_provisioned 1