diff options
Diffstat (limited to 'services/java/com/android/server/DeviceStorageMonitorService.java')
| -rw-r--r-- | services/java/com/android/server/DeviceStorageMonitorService.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/services/java/com/android/server/DeviceStorageMonitorService.java b/services/java/com/android/server/DeviceStorageMonitorService.java index 94a087a..cce5653 100644 --- a/services/java/com/android/server/DeviceStorageMonitorService.java +++ b/services/java/com/android/server/DeviceStorageMonitorService.java @@ -19,9 +19,11 @@ package com.android.server; import java.io.FileDescriptor; import java.io.PrintWriter; +import com.android.internal.app.ThemeUtils; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; +import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -84,6 +86,7 @@ public class DeviceStorageMonitorService extends Binder { private boolean mLowMemFlag=false; private boolean mMemFullFlag=false; private Context mContext; + private Context mUiContext; private ContentResolver mContentResolver; private long mTotalMemory; // on /data private StatFs mDataFileStats; @@ -345,6 +348,14 @@ public class DeviceStorageMonitorService extends Binder { mLastReportedFreeMemTime = 0; mContext = context; mContentResolver = mContext.getContentResolver(); + + ThemeUtils.registerThemeChangeReceiver(mContext, new BroadcastReceiver() { + @Override + public void onReceive(Context content, Intent intent) { + mUiContext = null; + } + }); + //create StatFs object mDataFileStats = new StatFs(DATA_PATH); mSystemFileStats = new StatFs(SYSTEM_PATH); @@ -402,7 +413,7 @@ public class DeviceStorageMonitorService extends Binder { notification.icon = com.android.internal.R.drawable.stat_notify_disk_full; notification.tickerText = title; notification.flags |= Notification.FLAG_NO_CLEAR; - notification.setLatestEventInfo(mContext, title, details, intent); + notification.setLatestEventInfo(getUiContext(), title, details, intent); mNotificationMgr.notifyAsUser(null, LOW_MEMORY_NOTIFICATION_ID, notification, UserHandle.ALL); mContext.sendStickyBroadcastAsUser(mStorageLowIntent, UserHandle.ALL); @@ -515,4 +526,11 @@ public class DeviceStorageMonitorService extends Binder { pw.print(" mMemCacheTrimToThreshold="); pw.println(Formatter.formatFileSize(mContext, mMemCacheTrimToThreshold)); } + + private Context getUiContext() { + if (mUiContext == null) { + mUiContext = ThemeUtils.createUiContext(mContext); + } + return mUiContext != null ? mUiContext : mContext; + } } |
