Loading core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -3725,7 +3725,7 @@ public final class ActivityThread { // We removed the old resources object from the mActiveResources // cache, now we need to trigger an update for each application. if ((diff & ActivityInfo.CONFIG_THEME_RESOURCE) != 0) { if (cb instanceof Activity || cb instanceof Application) { if (cb instanceof ContextWrapper) { Context context = ((ContextWrapper)cb).getBaseContext(); if (context instanceof ContextImpl) { ((ContextImpl)context).refreshResourcesIfNecessary(); Loading core/java/android/content/SyncManager.java +18 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.content; import com.android.internal.R; import com.android.internal.app.ThemeUtils; import com.android.internal.util.ArrayUtils; import com.google.android.collect.Lists; import com.google.android.collect.Maps; Loading Loading @@ -131,6 +132,7 @@ public class SyncManager implements OnAccountsUpdateListener { private static final int MAX_SIMULTANEOUS_INITIALIZATION_SYNCS; private Context mContext; private Context mUiContext; private volatile Account[] mAccounts = INITIAL_ACCOUNTS_ARRAY; Loading Loading @@ -183,6 +185,12 @@ public class SyncManager implements OnAccountsUpdateListener { } }; private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { mUiContext = null; } }; private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { if (getConnectivityManager().getBackgroundDataSetting()) { Loading Loading @@ -337,6 +345,8 @@ public class SyncManager implements OnAccountsUpdateListener { intentFilter.setPriority(100); context.registerReceiver(mShutdownIntentReceiver, intentFilter); ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver); if (!factoryTest) { mNotificationMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Loading Loading @@ -891,6 +901,13 @@ public class SyncManager implements OnAccountsUpdateListener { } } private Context getUiContext() { if (mUiContext == null) { mUiContext = ThemeUtils.createUiContext(mContext); } return mUiContext != null ? mUiContext : mContext; } /** * @hide */ Loading Loading @@ -2402,7 +2419,7 @@ public class SyncManager implements OnAccountsUpdateListener { new Notification(R.drawable.stat_notify_sync_error, mContext.getString(R.string.contentServiceSync), System.currentTimeMillis()); notification.setLatestEventInfo(mContext, notification.setLatestEventInfo(getUiContext(), mContext.getString(R.string.contentServiceSyncNotificationTitle), String.format(tooManyDeletesDescFormat.toString(), authorityName), pendingIntent); Loading core/java/com/android/internal/app/ThemeUtils.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.app; import android.content.Context; import android.content.BroadcastReceiver; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.util.Log; /** * @hide */ public class ThemeUtils { private static final String TAG = "ThemeUtils"; private static final String DATA_TYPE_TMOBILE_STYLE = "vnd.tmobile.cursor.item/style"; private static final String DATA_TYPE_TMOBILE_THEME = "vnd.tmobile.cursor.item/theme"; private static final String ACTION_TMOBILE_THEME_CHANGED = "com.tmobile.intent.action.THEME_CHANGED"; public static Context createUiContext(final Context context) { try { return context.createPackageContext("com.android.systemui", Context.CONTEXT_RESTRICTED); } catch (PackageManager.NameNotFoundException e) { } return null; } public static void registerThemeChangeReceiver(final Context context, final BroadcastReceiver receiver) { IntentFilter filter = new IntentFilter(ACTION_TMOBILE_THEME_CHANGED); try { filter.addDataType(DATA_TYPE_TMOBILE_THEME); filter.addDataType(DATA_TYPE_TMOBILE_STYLE); } catch (IntentFilter.MalformedMimeTypeException e) { Log.e(TAG, "Could not add MIME types to filter", e); } context.registerReceiver(receiver, filter); } } media/java/android/media/AudioService.java +31 −3 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import android.util.Log; import android.view.KeyEvent; import android.view.VolumePanel; import com.android.internal.app.ThemeUtils; import com.android.internal.telephony.ITelephony; import java.io.FileDescriptor; Loading Loading @@ -101,6 +102,8 @@ public class AudioService extends IAudioService.Stub { /** The UI */ private VolumePanel mVolumePanel; private Context mUiContext; private Handler mHandler; // sendMsg() flags /** Used when a message should be shared across all stream types. */ Loading Loading @@ -350,6 +353,7 @@ public class AudioService extends IAudioService.Stub { public AudioService(Context context) { mContext = context; mContentResolver = context.getContentResolver(); mHandler = new Handler(); mVoiceCapable = mContext.getResources().getBoolean( com.android.internal.R.bool.config_voice_capable); Loading @@ -362,7 +366,6 @@ public class AudioService extends IAudioService.Stub { "ro.config.sound_fx_volume", SOUND_EFFECT_DEFAULT_VOLUME_DB); mVolumePanel = new VolumePanel(context, this); mForcedUseForComm = AudioSystem.FORCE_NONE; createAudioSystemThread(); readPersistedSettings(); Loading Loading @@ -401,6 +404,13 @@ public class AudioService extends IAudioService.Stub { pkgFilter.addDataScheme("package"); context.registerReceiver(mReceiver, pkgFilter); ThemeUtils.registerThemeChangeReceiver(context, new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mUiContext = null; } }); // Register for media button intent broadcasts. intentFilter = new IntentFilter(Intent.ACTION_MEDIA_BUTTON); // Workaround for bug on priority setting Loading Loading @@ -641,8 +651,7 @@ public class AudioService extends IAudioService.Stub { streamType = AudioSystem.STREAM_NOTIFICATION; } mVolumePanel.postVolumeChanged(streamType, flags); showVolumeChangeUi(streamType, flags); oldIndex = (oldIndex + 5) / 10; index = (index + 5) / 10; Intent intent = new Intent(AudioManager.VOLUME_CHANGED_ACTION); Loading Loading @@ -2774,6 +2783,25 @@ public class AudioService extends IAudioService.Stub { } } private void showVolumeChangeUi(final int streamType, final int flags) { if (mUiContext != null && mVolumePanel != null) { mVolumePanel.postVolumeChanged(streamType, flags); } else { mHandler.post(new Runnable() { @Override public void run() { if (mUiContext == null) { mUiContext = ThemeUtils.createUiContext(mContext); } final Context context = mUiContext != null ? mUiContext : mContext; mVolumePanel = new VolumePanel(context, AudioService.this); mVolumePanel.postVolumeChanged(streamType, flags); } }); } } //========================================================================================== // AudioFocus //========================================================================================== Loading policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java +23 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.policy.impl; import com.android.internal.R; import com.android.internal.app.ThemeUtils; import com.android.internal.widget.LockPatternUtils; import android.accounts.Account; Loading @@ -25,6 +26,7 @@ import android.accounts.OperationCanceledException; import android.accounts.AccountManagerFuture; import android.accounts.AuthenticatorException; import android.accounts.AccountManagerCallback; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; Loading Loading @@ -74,9 +76,18 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree /** * Shown while making asynchronous check of password. */ private Context mUiContext; private ProgressDialog mCheckingDialog; private KeyguardStatusViewManager mKeyguardStatusViewManager; private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mUiContext = null; mCheckingDialog = null; } }; /** * AccountUnlockScreen constructor. * @param configuration Loading Loading @@ -139,6 +150,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree /** {@inheritDoc} */ public void onPause() { mContext.unregisterReceiver(mThemeChangeReceiver); mKeyguardStatusViewManager.onPause(); } Loading @@ -148,6 +160,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree mLogin.setText(""); mPassword.setText(""); mLogin.requestFocus(); ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver); mKeyguardStatusViewManager.onResume(); } Loading Loading @@ -303,8 +316,17 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree } private Dialog getProgressDialog() { if (mUiContext == null && mCheckingDialog != null) { mCheckingDialog.dismiss(); mCheckingDialog = null; } if (mCheckingDialog == null) { mCheckingDialog = new ProgressDialog(mContext); mUiContext = ThemeUtils.createUiContext(mContext); final Context context = mUiContext != null ? mUiContext : mContext; mCheckingDialog = new ProgressDialog(context); mCheckingDialog.setMessage( mContext.getString(R.string.lockscreen_glogin_checking_password)); mCheckingDialog.setIndeterminate(true); Loading Loading
core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -3725,7 +3725,7 @@ public final class ActivityThread { // We removed the old resources object from the mActiveResources // cache, now we need to trigger an update for each application. if ((diff & ActivityInfo.CONFIG_THEME_RESOURCE) != 0) { if (cb instanceof Activity || cb instanceof Application) { if (cb instanceof ContextWrapper) { Context context = ((ContextWrapper)cb).getBaseContext(); if (context instanceof ContextImpl) { ((ContextImpl)context).refreshResourcesIfNecessary(); Loading
core/java/android/content/SyncManager.java +18 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.content; import com.android.internal.R; import com.android.internal.app.ThemeUtils; import com.android.internal.util.ArrayUtils; import com.google.android.collect.Lists; import com.google.android.collect.Maps; Loading Loading @@ -131,6 +132,7 @@ public class SyncManager implements OnAccountsUpdateListener { private static final int MAX_SIMULTANEOUS_INITIALIZATION_SYNCS; private Context mContext; private Context mUiContext; private volatile Account[] mAccounts = INITIAL_ACCOUNTS_ARRAY; Loading Loading @@ -183,6 +185,12 @@ public class SyncManager implements OnAccountsUpdateListener { } }; private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { mUiContext = null; } }; private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { if (getConnectivityManager().getBackgroundDataSetting()) { Loading Loading @@ -337,6 +345,8 @@ public class SyncManager implements OnAccountsUpdateListener { intentFilter.setPriority(100); context.registerReceiver(mShutdownIntentReceiver, intentFilter); ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver); if (!factoryTest) { mNotificationMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Loading Loading @@ -891,6 +901,13 @@ public class SyncManager implements OnAccountsUpdateListener { } } private Context getUiContext() { if (mUiContext == null) { mUiContext = ThemeUtils.createUiContext(mContext); } return mUiContext != null ? mUiContext : mContext; } /** * @hide */ Loading Loading @@ -2402,7 +2419,7 @@ public class SyncManager implements OnAccountsUpdateListener { new Notification(R.drawable.stat_notify_sync_error, mContext.getString(R.string.contentServiceSync), System.currentTimeMillis()); notification.setLatestEventInfo(mContext, notification.setLatestEventInfo(getUiContext(), mContext.getString(R.string.contentServiceSyncNotificationTitle), String.format(tooManyDeletesDescFormat.toString(), authorityName), pendingIntent); Loading
core/java/com/android/internal/app/ThemeUtils.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.app; import android.content.Context; import android.content.BroadcastReceiver; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.util.Log; /** * @hide */ public class ThemeUtils { private static final String TAG = "ThemeUtils"; private static final String DATA_TYPE_TMOBILE_STYLE = "vnd.tmobile.cursor.item/style"; private static final String DATA_TYPE_TMOBILE_THEME = "vnd.tmobile.cursor.item/theme"; private static final String ACTION_TMOBILE_THEME_CHANGED = "com.tmobile.intent.action.THEME_CHANGED"; public static Context createUiContext(final Context context) { try { return context.createPackageContext("com.android.systemui", Context.CONTEXT_RESTRICTED); } catch (PackageManager.NameNotFoundException e) { } return null; } public static void registerThemeChangeReceiver(final Context context, final BroadcastReceiver receiver) { IntentFilter filter = new IntentFilter(ACTION_TMOBILE_THEME_CHANGED); try { filter.addDataType(DATA_TYPE_TMOBILE_THEME); filter.addDataType(DATA_TYPE_TMOBILE_STYLE); } catch (IntentFilter.MalformedMimeTypeException e) { Log.e(TAG, "Could not add MIME types to filter", e); } context.registerReceiver(receiver, filter); } }
media/java/android/media/AudioService.java +31 −3 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import android.util.Log; import android.view.KeyEvent; import android.view.VolumePanel; import com.android.internal.app.ThemeUtils; import com.android.internal.telephony.ITelephony; import java.io.FileDescriptor; Loading Loading @@ -101,6 +102,8 @@ public class AudioService extends IAudioService.Stub { /** The UI */ private VolumePanel mVolumePanel; private Context mUiContext; private Handler mHandler; // sendMsg() flags /** Used when a message should be shared across all stream types. */ Loading Loading @@ -350,6 +353,7 @@ public class AudioService extends IAudioService.Stub { public AudioService(Context context) { mContext = context; mContentResolver = context.getContentResolver(); mHandler = new Handler(); mVoiceCapable = mContext.getResources().getBoolean( com.android.internal.R.bool.config_voice_capable); Loading @@ -362,7 +366,6 @@ public class AudioService extends IAudioService.Stub { "ro.config.sound_fx_volume", SOUND_EFFECT_DEFAULT_VOLUME_DB); mVolumePanel = new VolumePanel(context, this); mForcedUseForComm = AudioSystem.FORCE_NONE; createAudioSystemThread(); readPersistedSettings(); Loading Loading @@ -401,6 +404,13 @@ public class AudioService extends IAudioService.Stub { pkgFilter.addDataScheme("package"); context.registerReceiver(mReceiver, pkgFilter); ThemeUtils.registerThemeChangeReceiver(context, new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mUiContext = null; } }); // Register for media button intent broadcasts. intentFilter = new IntentFilter(Intent.ACTION_MEDIA_BUTTON); // Workaround for bug on priority setting Loading Loading @@ -641,8 +651,7 @@ public class AudioService extends IAudioService.Stub { streamType = AudioSystem.STREAM_NOTIFICATION; } mVolumePanel.postVolumeChanged(streamType, flags); showVolumeChangeUi(streamType, flags); oldIndex = (oldIndex + 5) / 10; index = (index + 5) / 10; Intent intent = new Intent(AudioManager.VOLUME_CHANGED_ACTION); Loading Loading @@ -2774,6 +2783,25 @@ public class AudioService extends IAudioService.Stub { } } private void showVolumeChangeUi(final int streamType, final int flags) { if (mUiContext != null && mVolumePanel != null) { mVolumePanel.postVolumeChanged(streamType, flags); } else { mHandler.post(new Runnable() { @Override public void run() { if (mUiContext == null) { mUiContext = ThemeUtils.createUiContext(mContext); } final Context context = mUiContext != null ? mUiContext : mContext; mVolumePanel = new VolumePanel(context, AudioService.this); mVolumePanel.postVolumeChanged(streamType, flags); } }); } } //========================================================================================== // AudioFocus //========================================================================================== Loading
policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java +23 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.policy.impl; import com.android.internal.R; import com.android.internal.app.ThemeUtils; import com.android.internal.widget.LockPatternUtils; import android.accounts.Account; Loading @@ -25,6 +26,7 @@ import android.accounts.OperationCanceledException; import android.accounts.AccountManagerFuture; import android.accounts.AuthenticatorException; import android.accounts.AccountManagerCallback; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; Loading Loading @@ -74,9 +76,18 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree /** * Shown while making asynchronous check of password. */ private Context mUiContext; private ProgressDialog mCheckingDialog; private KeyguardStatusViewManager mKeyguardStatusViewManager; private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mUiContext = null; mCheckingDialog = null; } }; /** * AccountUnlockScreen constructor. * @param configuration Loading Loading @@ -139,6 +150,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree /** {@inheritDoc} */ public void onPause() { mContext.unregisterReceiver(mThemeChangeReceiver); mKeyguardStatusViewManager.onPause(); } Loading @@ -148,6 +160,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree mLogin.setText(""); mPassword.setText(""); mLogin.requestFocus(); ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver); mKeyguardStatusViewManager.onResume(); } Loading Loading @@ -303,8 +316,17 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree } private Dialog getProgressDialog() { if (mUiContext == null && mCheckingDialog != null) { mCheckingDialog.dismiss(); mCheckingDialog = null; } if (mCheckingDialog == null) { mCheckingDialog = new ProgressDialog(mContext); mUiContext = ThemeUtils.createUiContext(mContext); final Context context = mUiContext != null ? mUiContext : mContext; mCheckingDialog = new ProgressDialog(context); mCheckingDialog.setMessage( mContext.getString(R.string.lockscreen_glogin_checking_password)); mCheckingDialog.setIndeterminate(true); Loading