Loading services/java/com/android/server/ThemeService.java +26 −4 Original line number Diff line number Diff line Loading @@ -20,10 +20,12 @@ import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.IActivityManager; import android.app.WallpaperManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; Loading Loading @@ -79,6 +81,7 @@ public class ThemeService extends IThemeService.Stub { private Context mContext; private String mPkgName; private int mProgress; private boolean mWallpaperChangedByUs = false; private final RemoteCallbackList<IThemeChangeListener> mClients = new RemoteCallbackList<IThemeChangeListener>(); Loading Loading @@ -135,6 +138,9 @@ public class ThemeService extends IThemeService.Stub { } public void systemRunning() { // listen for wallpaper changes IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED); mContext.registerReceiver(mWallpaperChangeReceiver, filter); } private void doApplyTheme(String pkgName, List<String> components) { Loading @@ -153,7 +159,7 @@ public class ThemeService extends IThemeService.Stub { // TODO: provide progress updates that reflect the time needed for each component final int progressIncrement = 75 / components.size(); updateProvider(components); updateProvider(components, mPkgName); if (components.contains(ThemesContract.ThemesColumns.MODIFIES_ICONS)) { updateIcons(); Loading @@ -161,7 +167,9 @@ public class ThemeService extends IThemeService.Stub { } if (components.contains(ThemesContract.ThemesColumns.MODIFIES_LAUNCHER)) { updateWallpaper(); if (updateWallpaper()) { mWallpaperChangedByUs = true; } incrementProgress(progressIncrement, pkgName); } Loading Loading @@ -245,9 +253,9 @@ public class ThemeService extends IThemeService.Stub { } } private void updateProvider(List<String> components) { private void updateProvider(List<String> components, String pkgName) { ContentValues values = new ContentValues(); values.put(ThemesContract.MixnMatchColumns.COL_VALUE, mPkgName); values.put(ThemesContract.MixnMatchColumns.COL_VALUE, pkgName); for (String component : components) { String where = ThemesContract.MixnMatchColumns.COL_KEY + "=?"; Loading Loading @@ -709,4 +717,18 @@ public class ThemeService extends IThemeService.Stub { if (anim.exists()) anim.delete(); } private BroadcastReceiver mWallpaperChangeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (!mWallpaperChangedByUs) { // In case the mixnmatch table has a mods_launcher entry, we'll clear it List<String> components = new ArrayList<String>(1); components.add(ThemesContract.ThemesColumns.MODIFIES_LAUNCHER); updateProvider(components, ""); } else { mWallpaperChangedByUs = false; } } }; } Loading
services/java/com/android/server/ThemeService.java +26 −4 Original line number Diff line number Diff line Loading @@ -20,10 +20,12 @@ import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.IActivityManager; import android.app.WallpaperManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; Loading Loading @@ -79,6 +81,7 @@ public class ThemeService extends IThemeService.Stub { private Context mContext; private String mPkgName; private int mProgress; private boolean mWallpaperChangedByUs = false; private final RemoteCallbackList<IThemeChangeListener> mClients = new RemoteCallbackList<IThemeChangeListener>(); Loading Loading @@ -135,6 +138,9 @@ public class ThemeService extends IThemeService.Stub { } public void systemRunning() { // listen for wallpaper changes IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED); mContext.registerReceiver(mWallpaperChangeReceiver, filter); } private void doApplyTheme(String pkgName, List<String> components) { Loading @@ -153,7 +159,7 @@ public class ThemeService extends IThemeService.Stub { // TODO: provide progress updates that reflect the time needed for each component final int progressIncrement = 75 / components.size(); updateProvider(components); updateProvider(components, mPkgName); if (components.contains(ThemesContract.ThemesColumns.MODIFIES_ICONS)) { updateIcons(); Loading @@ -161,7 +167,9 @@ public class ThemeService extends IThemeService.Stub { } if (components.contains(ThemesContract.ThemesColumns.MODIFIES_LAUNCHER)) { updateWallpaper(); if (updateWallpaper()) { mWallpaperChangedByUs = true; } incrementProgress(progressIncrement, pkgName); } Loading Loading @@ -245,9 +253,9 @@ public class ThemeService extends IThemeService.Stub { } } private void updateProvider(List<String> components) { private void updateProvider(List<String> components, String pkgName) { ContentValues values = new ContentValues(); values.put(ThemesContract.MixnMatchColumns.COL_VALUE, mPkgName); values.put(ThemesContract.MixnMatchColumns.COL_VALUE, pkgName); for (String component : components) { String where = ThemesContract.MixnMatchColumns.COL_KEY + "=?"; Loading Loading @@ -709,4 +717,18 @@ public class ThemeService extends IThemeService.Stub { if (anim.exists()) anim.delete(); } private BroadcastReceiver mWallpaperChangeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (!mWallpaperChangedByUs) { // In case the mixnmatch table has a mods_launcher entry, we'll clear it List<String> components = new ArrayList<String>(1); components.add(ThemesContract.ThemesColumns.MODIFIES_LAUNCHER); updateProvider(components, ""); } else { mWallpaperChangedByUs = false; } } }; }