SetupWizard: Handle register theme change listener crash

Issue-id: FEIJ-84

Change-Id: I8ffca77418702f04328ae7d0581ab8cc316a04e8
This commit is contained in:
cretin45 2016-04-26 11:14:38 -07:00
parent 2e75c4ee04
commit 941aa1e1e2

View File

@ -32,6 +32,7 @@ import android.os.UserHandle;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewAnimationUtils;
@ -355,7 +356,11 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
mFinishingProgressBar.setIndeterminate(true);
mFinishingProgressBar.startAnimation(fadeIn);
final ThemeManager tm = ThemeManager.getInstance(this);
tm.addClient(this);
try {
tm.registerThemeChangeListener(this);
} catch (Exception e) {
Log.w(TAG, "ThemeChangeListener already registered");
}
mSetupData.finishPages();
}
@ -473,7 +478,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
mEnableAccessibilityController.onDestroy();
}
final ThemeManager tm = ThemeManager.getInstance(SetupWizardActivity.this);
tm.removeClient(SetupWizardActivity.this);
tm.unregisterThemeChangeListener(SetupWizardActivity.this);
SetupStats.sendEvents(SetupWizardActivity.this);
SetupWizardUtils.disableGMSSetupWizard(SetupWizardActivity.this);
final WallpaperManager wallpaperManager =