diff options
Diffstat (limited to 'services/java/com/android/server/ThrottleService.java')
| -rw-r--r-- | services/java/com/android/server/ThrottleService.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java index 75eb3c4..9bc3a91 100644 --- a/services/java/com/android/server/ThrottleService.java +++ b/services/java/com/android/server/ThrottleService.java @@ -53,6 +53,7 @@ import android.util.Slog; import android.util.TrustedTime; import com.android.internal.R; +import com.android.internal.app.ThemeUtils; import com.android.internal.telephony.TelephonyProperties; import java.io.BufferedWriter; @@ -80,6 +81,7 @@ public class ThrottleService extends IThrottleManager.Stub { private HandlerThread mThread; private Context mContext; + private Context mUiContext; private static final int INITIAL_POLL_DELAY_SEC = 90; private static final int TESTING_POLLING_PERIOD_SEC = 60 * 1; @@ -339,6 +341,13 @@ public class ThrottleService extends IThrottleManager.Stub { } }, new IntentFilter(ACTION_RESET)); + ThemeUtils.registerThemeChangeReceiver(mContext, new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + mUiContext = null; + } + }); + // use a new thread as we don't want to stall the system for file writes mThread = new HandlerThread(TAG); mThread.start(); @@ -685,12 +694,18 @@ public class ThrottleService extends IThrottleManager.Stub { } mThrottlingNotification.flags = flags; mThrottlingNotification.tickerText = title; - mThrottlingNotification.setLatestEventInfo(mContext, title, message, pi); + mThrottlingNotification.setLatestEventInfo(getUiContext(), title, message, pi); mNotificationManager.notifyAsUser(null, mThrottlingNotification.icon, mThrottlingNotification, UserHandle.ALL); } + private Context getUiContext() { + if (mUiContext == null) { + mUiContext = ThemeUtils.createUiContext(mContext); + } + return mUiContext != null ? mUiContext : mContext; + } private void clearThrottleAndNotification() { if (mThrottleIndex.get() != THROTTLE_INDEX_UNTHROTTLED) { |
