diff options
| author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-11-20 21:17:17 +0000 |
|---|---|---|
| committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-11-24 14:09:39 +0000 |
| commit | ad3c9416092f09213d32eee8b59287766eae5d19 (patch) | |
| tree | 0bc1e318ca15560299c662e37c6c4fedf0bcf1e6 /services/java/com/android/server/UiModeManagerService.java | |
| parent | 7d114fb838017d86ece76e18a7e1b0d8534595fa (diff) | |
| download | frameworks_base-ad3c9416092f09213d32eee8b59287766eae5d19.zip frameworks_base-ad3c9416092f09213d32eee8b59287766eae5d19.tar.gz frameworks_base-ad3c9416092f09213d32eee8b59287766eae5d19.tar.bz2 | |
Squashed commit of the theme engine support.
Updated 4.2 support for the old T-Mobile theme engine, as usual
needs the provider and switcher apps installed as well.
I'm finally dropping the 400+ commit history on this, since everybody
else keeps picking it up from CM as a single patch anyway... But
for the record, nothing of this would be possible without Josh, Ed,
and the rest of the TMo guys who wrote and maintained it until 2.2:
amit chabra <amit.chabra@t-mobile.com>
Amit Kohli <amit.kohli@t-mobile.com>
Chris Cogar <chriscogar@t-mobile.com>
Dirk Sigurdson <dirk.sigurdson@t-mobile.com>
Ed Carrigan <edward.carrigan@t-mobile.com>
Gaurav Sharma <gaurav.sharma3@t-mobile.com>
Hui Feng <hui.feng@t-mobile.com>
John Ritz <john.ritz1@t-mobile.com>
Josh Guilfoyle <josh.guilfoyle@t-mobile.com>
Mark Roberts <mark.roberts48@t-mobile.com>
Pankaj Kumar <Pankaj.kumar6@t-mobile.com>
Samuel Cheung <samuel.cheung@t-mobile.com>
Sergey Ten <sergey.ten6@t-mobile.com>
Change-Id: I7148d51be48f28a2dc4bdf9ec9018f04b268ffc4
Diffstat (limited to 'services/java/com/android/server/UiModeManagerService.java')
| -rw-r--r-- | services/java/com/android/server/UiModeManagerService.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/services/java/com/android/server/UiModeManagerService.java b/services/java/com/android/server/UiModeManagerService.java index 0e456f1..797990e 100644 --- a/services/java/com/android/server/UiModeManagerService.java +++ b/services/java/com/android/server/UiModeManagerService.java @@ -48,6 +48,7 @@ import java.io.PrintWriter; import com.android.internal.R; import com.android.internal.app.DisableCarModeActivity; import com.android.server.TwilightService.TwilightState; +import com.android.internal.app.ThemeUtils; final class UiModeManagerService extends IUiModeManager.Stub { private static final String TAG = UiModeManager.class.getSimpleName(); @@ -60,6 +61,7 @@ final class UiModeManagerService extends IUiModeManager.Stub { private final Context mContext; private final TwilightService mTwilightService; private final Handler mHandler = new Handler(); + private Context mUiContext; final Object mLock = new Object(); @@ -142,6 +144,13 @@ final class UiModeManagerService extends IUiModeManager.Stub { } }; + private final BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + mUiContext = null; + } + }; + private final TwilightService.TwilightListener mTwilightListener = new TwilightService.TwilightListener() { @Override @@ -161,6 +170,8 @@ final class UiModeManagerService extends IUiModeManager.Stub { mContext.registerReceiver(mBatteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); + ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver); + mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE); mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG); @@ -549,7 +560,7 @@ final class UiModeManagerService extends IUiModeManager.Stub { n.flags = Notification.FLAG_ONGOING_EVENT; n.when = 0; n.setLatestEventInfo( - mContext, + getUiContext(), mContext.getString(R.string.car_mode_disable_notification_title), mContext.getString(R.string.car_mode_disable_notification_message), PendingIntent.getActivityAsUser(mContext, 0, carModeOffIntent, 0, @@ -579,6 +590,13 @@ final class UiModeManagerService extends IUiModeManager.Stub { } } + private Context getUiContext() { + if (mUiContext == null) { + mUiContext = ThemeUtils.createUiContext(mContext); + } + return mUiContext != null ? mUiContext : mContext; + } + @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) |
