SetupWizard: Don't disable packages on main thread

Issue-id: YAM-69

Change-Id: I81ea039a7444d3db5d97b1d798bffe9a6b8ec498
This commit is contained in:
cretin45 2016-01-12 14:43:36 -08:00
parent 3e68503d9e
commit 1141611f91
2 changed files with 31 additions and 8 deletions

View File

@ -26,6 +26,7 @@ import android.content.res.Resources;
/*import android.content.res.ThemeManager;*/
import android.graphics.Bitmap;
import android.graphics.Point;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
@ -425,18 +426,40 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
tm.removeClient(SetupWizardActivity.this);*/
SetupStats.sendEvents(SetupWizardActivity.this);
SetupWizardUtils.disableGMSSetupWizard(SetupWizardActivity.this);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
final WallpaperManager wallpaperManager =
WallpaperManager.getInstance(SetupWizardActivity.this);
wallpaperManager.forgetLoadedWallpaper();
}
});
for (Runnable runnable : mFinishRunnables) {
runnable.run();
new FinishTask(this, mFinishRunnables).execute();
}
private static class FinishTask extends AsyncTask<Void, Void, Boolean> {
private final SetupWizardActivity mActivity;
private final ArrayList<Runnable> mFinishRunnables;
public FinishTask(SetupWizardActivity activity,
ArrayList<Runnable> finishRunnables) {
mActivity = activity;
mFinishRunnables = finishRunnables;
}
@Override
protected Boolean doInBackground(Void... params) {
for (Runnable runnable : mFinishRunnables) {
runnable.run();
}
SetupWizardUtils.disableSetupWizard(mActivity);
return Boolean.TRUE;
}
@Override
protected void onPostExecute(Boolean aBoolean) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
mActivity.startActivity(intent);
mActivity.finish();
}
finish();
SetupWizardUtils.disableSetupWizard(SetupWizardActivity.this);
}
}

View File

@ -261,7 +261,7 @@ public class SetupWizardUtils {
private static void disableComponent(Context context, ComponentName component) {
context.getPackageManager().setComponentEnabledSetting(component,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
private static void enableComponentArray(Context context, ComponentInfo[] components) {