public static final String USER_SETUP_COMPLETE = "user_setup_complete";
public static final String DEVICE_PROVISIONED = "device_provisioned";
-
public class DefaultActivity extends Activity {
-
-
@Override
-
protected void onCreate(Bundle icicle) {
-
super.onCreate(icicle);
-
-
// Add a persistent setting to allow other apps to know the device has been provisioned.
-
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
-
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
-
-
// remove this activity from the package manager.
-
PackageManager pm = getPackageManager();
-
ComponentName name = new ComponentName(this, DefaultActivity.class);
-
pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
-
PackageManager.DONT_KILL_APP);
-
-
// terminate the activity.
-
finish();
-
}
-
}
复制代码
同时发现,只要将data/system/users/0/package-restrictions.xml 文件删除
adb shell stop /start 就可以重新唤醒开机向导
<pkg name="com.android.provision" ceDataInode="2996">
<disabled-components>
<item name="com.android.provision.DefaultActivity" />
</disabled-components>