Themes: Check theme api level in onBootPhase

This check should be done once the system has reached the
PHASE_ACTIVITY_MANAGER_READY otherwise we can end up getting
a boot failure within the ThemeManagerService

Change-Id: If3e9c8885d8718224cf7d8fed0c0fb82ebe0fcab
TICKET: CYNGNOS-2230
This commit is contained in:
d34d 2016-03-11 14:30:19 -08:00 committed by Gerrit Code Review
parent 948e399b5d
commit b05ce12eab
1 changed files with 11 additions and 7 deletions

View File

@ -245,19 +245,18 @@ public class ThemeManagerService extends SystemService {
mContext.registerReceiver(mUserChangeReceiver, filter);
mPM = mContext.getPackageManager();
if (!isThemeApiUpToDate()) {
Log.d(TAG, "The system has been upgraded to a theme new api, " +
"checking if currently set theme is compatible");
removeObsoleteThemeOverlayIfExists();
updateThemeApi();
}
}
@Override
public void onBootPhase(int phase) {
super.onBootPhase(phase);
if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
if (!isThemeApiUpToDate()) {
Log.d(TAG, "The system has been upgraded to a theme new api, " +
"checking if currently set theme is compatible");
removeObsoleteThemeOverlayIfExists();
updateThemeApi();
}
registerAppsFailureReceiver();
processInstalledThemes();
}
@ -304,6 +303,11 @@ public class ThemeManagerService extends SystemService {
String pkgName = entry.getValue();
String defaultPkg = defaults.get(component);
if (defaultPkg == null) {
Log.d(TAG, "Default package is null, skipping " + component);
continue;
}
// Check that the default overlay theme is not currently set
if (defaultPkg.equals(pkgName)) {
Log.d(TAG, "Current overlay theme is same as default. " +