summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rwxr-xr-xservices/java/com/android/server/NotificationManagerService.java21
-rw-r--r--services/java/com/android/server/PowerManagerService.java12
-rw-r--r--services/java/com/android/server/RingerSwitchObserver.java27
-rwxr-xr-xservices/java/com/android/server/am/ActivityManagerService.java33
-rw-r--r--services/java/com/android/server/connectivity/Tethering.java18
5 files changed, 98 insertions, 13 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index a2bfe78..2ac2a96 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -70,6 +70,8 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;
+import com.android.internal.app.ThemeUtils;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -102,6 +104,7 @@ public class NotificationManagerService extends INotificationManager.Stub
private static final int DEFAULT_STREAM_TYPE = AudioManager.STREAM_NOTIFICATION;
final Context mContext;
+ Context mUiContext;
final IActivityManager mAm;
final IBinder mForegroundToken = new Binder();
@@ -422,6 +425,13 @@ public class NotificationManagerService extends INotificationManager.Stub
}
};
+ private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mUiContext = null;
+ }
+ };
+
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -809,6 +819,8 @@ public class NotificationManagerService extends INotificationManager.Stub
IntentFilter ledFilter = new IntentFilter(ACTION_UPDATE_LED);
mContext.registerReceiver(mIntentReceiver, ledFilter);
+ ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
+
SettingsObserver observer = new SettingsObserver(mHandler);
observer.observe();
@@ -1819,7 +1831,7 @@ public class NotificationManagerService extends INotificationManager.Stub
PendingIntent pi = PendingIntent.getActivity(mContext, 0,
intent, 0);
- mAdbNotification.setLatestEventInfo(mContext, title, message, pi);
+ mAdbNotification.setLatestEventInfo(getUiContext(), title, message, pi);
mAdbNotificationShown = true;
mAdbNotificationIsUsb = !networkEnabled;
@@ -1837,6 +1849,13 @@ public class NotificationManagerService extends INotificationManager.Stub
}
}
+ private Context getUiContext() {
+ if (mUiContext == null) {
+ mUiContext = ThemeUtils.createUiContext(mContext);
+ }
+ return mUiContext != null ? mUiContext : mContext;
+ }
+
private void updateNotificationPulse() {
synchronized (mNotificationList) {
updateLightsLocked();
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index d1f8216..44eb228 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -73,6 +73,8 @@ import static android.provider.Settings.System.WINDOW_ANIMATION_SCALE;
import static android.provider.Settings.System.TRANSITION_ANIMATION_SCALE;
import static android.provider.Settings.System.TORCH_STATE;
+import com.android.internal.app.ThemeUtils;
+
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
@@ -201,6 +203,7 @@ class PowerManagerService extends IPowerManager.Stub
private Intent mScreenOnIntent;
private LightsService mLightsService;
private Context mContext;
+ private Context mUiContext;
private LightsService.Light mLcdLight;
private LightsService.Light mButtonLight;
private LightsService.Light mKeyboardLight;
@@ -2698,7 +2701,7 @@ class PowerManagerService extends IPowerManager.Stub
Runnable runnable = new Runnable() {
public void run() {
synchronized (this) {
- ShutdownThread.reboot(mContext, finalReason, false);
+ ShutdownThread.reboot(getUiContext(), finalReason, false);
}
}
@@ -2735,6 +2738,13 @@ class PowerManagerService extends IPowerManager.Stub
}
}
+ private Context getUiContext() {
+ if (mUiContext == null) {
+ mUiContext = ThemeUtils.createUiContext(mContext);
+ }
+ return mUiContext != null ? mUiContext : mContext;
+ }
+
private void goToSleepLocked(long time, int reason) {
if (mLastEventTime <= time) {
diff --git a/services/java/com/android/server/RingerSwitchObserver.java b/services/java/com/android/server/RingerSwitchObserver.java
index 54a6526..c1ea64c 100644
--- a/services/java/com/android/server/RingerSwitchObserver.java
+++ b/services/java/com/android/server/RingerSwitchObserver.java
@@ -17,7 +17,9 @@
package com.android.server;
import android.app.ActivityManagerNative;
+import android.content.BroadcastReceiver;
import android.content.Context;
+import android.content.Intent;
import android.os.UEventObserver;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
@@ -32,6 +34,8 @@ import android.media.AudioService;
import android.media.IAudioService;
import android.media.AudioManager;
+import com.android.internal.app.ThemeUtils;
+
import java.io.FileReader;
import java.io.FileNotFoundException;
@@ -50,6 +54,7 @@ class RingerSwitchObserver extends UEventObserver {
private String mRingerswitchName;
private IAudioService mAudioService;
private Context mContext;
+ private Context mUiContext;
private VolumePanel mVolumePanel;
private final WakeLock mWakeLock; // held while there is a pending route change
@@ -58,6 +63,13 @@ class RingerSwitchObserver extends UEventObserver {
mContext = context;
+ ThemeUtils.registerThemeChangeReceiver(context, new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mUiContext = null;
+ }
+ });
+
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "RingerSwitchObserver");
mWakeLock.setReferenceCounted(false);
@@ -100,7 +112,18 @@ class RingerSwitchObserver extends UEventObserver {
}
mAudioService = IAudioService.Stub.asInterface(ServiceManager.checkService(Context.AUDIO_SERVICE));
- mVolumePanel = new VolumePanel(mContext, (AudioService) mAudioService);
+ }
+
+ private synchronized final VolumePanel getVolumePanel() {
+ if (mUiContext == null || mVolumePanel == null) {
+ if (mUiContext == null) {
+ mUiContext = ThemeUtils.createUiContext(mContext);
+ }
+ final Context context = mUiContext != null ? mUiContext : mContext;
+ mVolumePanel = new VolumePanel(mContext, (AudioService) mAudioService);
+ }
+
+ return mVolumePanel;
}
private synchronized final void update(String newName, int newState) {
@@ -130,7 +153,7 @@ class RingerSwitchObserver extends UEventObserver {
}
// Raise UI
- mVolumePanel.postVolumeChanged(AudioManager.STREAM_RING,AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_VIBRATE);
+ getVolumePanel().postVolumeChanged(AudioManager.STREAM_RING,AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_VIBRATE);
} catch (RemoteException e) {
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 17f9214..96ffea2 100755
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -18,6 +18,7 @@
package com.android.server.am;
import com.android.internal.R;
+import com.android.internal.app.ThemeUtils;
import com.android.internal.os.BatteryStatsImpl;
import com.android.server.AttributeCache;
import com.android.server.IntentResolver;
@@ -790,6 +791,7 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean mLaunchWarningShown = false;
Context mContext;
+ Context mUiContext;
int mFactoryTest;
@@ -1006,7 +1008,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
}
- Dialog d = new AppErrorDialog(mContext, res, proc, hasRevoked);
+ Dialog d = new AppErrorDialog(getUiContext(), res, proc, hasRevoked);
d.show();
proc.crashDialog = d;
} else {
@@ -1036,7 +1038,7 @@ public final class ActivityManagerService extends ActivityManagerNative
false, false, MY_PID, Process.SYSTEM_UID);
Dialog d = new AppNotRespondingDialog(ActivityManagerService.this,
- mContext, proc, (ActivityRecord)data.get("activity"));
+ getUiContext(), proc, (ActivityRecord)data.get("activity"));
d.show();
proc.anrDialog = d;
}
@@ -1057,7 +1059,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
AppErrorResult res = (AppErrorResult) data.get("result");
if (!mSleeping && !mShuttingDown) {
- Dialog d = new StrictModeViolationDialog(mContext, res, proc);
+ Dialog d = new StrictModeViolationDialog(getUiContext(), res, proc);
d.show();
proc.crashDialog = d;
} else {
@@ -1070,7 +1072,7 @@ public final class ActivityManagerService extends ActivityManagerNative
} break;
case SHOW_FACTORY_ERROR_MSG: {
Dialog d = new FactoryErrorDialog(
- mContext, msg.getData().getCharSequence("msg"));
+ getUiContext(), msg.getData().getCharSequence("msg"));
d.show();
ensureBootCompleted();
} break;
@@ -1090,7 +1092,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (!app.waitedForDebugger) {
Dialog d = new AppWaitingForDebuggerDialog(
ActivityManagerService.this,
- mContext, app);
+ getUiContext(), app);
app.waitDialog = d;
app.waitedForDebugger = true;
d.show();
@@ -1139,7 +1141,7 @@ public final class ActivityManagerService extends ActivityManagerNative
} break;
case SHOW_UID_ERROR_MSG: {
// XXX This is a temporary dialog, no need to localize.
- AlertDialog d = new BaseErrorDialog(mContext);
+ AlertDialog d = new BaseErrorDialog(getUiContext());
d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
d.setCancelable(false);
d.setTitle("System UIDs Inconsistent");
@@ -1208,7 +1210,7 @@ public final class ActivityManagerService extends ActivityManagerNative
notification.defaults = 0; // please be quiet
notification.sound = null;
notification.vibrate = null;
- notification.setLatestEventInfo(context, text,
+ notification.setLatestEventInfo(getUiContext(), text,
mContext.getText(R.string.heavy_weight_notification_detail),
PendingIntent.getActivity(mContext, 0, root.intent,
PendingIntent.FLAG_CANCEL_CURRENT));
@@ -1619,6 +1621,15 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
+ private Context getUiContext() {
+ synchronized (this) {
+ if (mUiContext == null && mBooted) {
+ mUiContext = ThemeUtils.createUiContext(mContext);
+ }
+ return mUiContext != null ? mUiContext : mContext;
+ }
+ }
+
/**
* Initialize the application bind args. These are passed to each
* process when the bindApplication() IPC is sent to the process. They're
@@ -3009,7 +3020,7 @@ public final class ActivityManagerService extends ActivityManagerNative
@Override
public void run() {
synchronized (ActivityManagerService.this) {
- final Dialog d = new LaunchWarningWindow(mContext, cur, next);
+ final Dialog d = new LaunchWarningWindow(getUiContext(), cur, next);
d.show();
mHandler.postDelayed(new Runnable() {
@Override
@@ -3721,6 +3732,12 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
}, pkgFilter);
+ ThemeUtils.registerThemeChangeReceiver(mContext, new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mUiContext = null;
+ }
+ });
synchronized (this) {
// Ensure that any processes we had put on hold are now started
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index 4239e55..db19cfd 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -47,6 +47,7 @@ import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Log;
+import com.android.internal.app.ThemeUtils;
import com.android.internal.telephony.Phone;
import com.android.internal.util.HierarchicalState;
import com.android.internal.util.HierarchicalStateMachine;
@@ -69,6 +70,7 @@ import java.util.Set;
public class Tethering extends INetworkManagementEventObserver.Stub {
private Context mContext;
+ private Context mUiContext;
private final String TAG = "Tethering";
private boolean mBooted = false;
@@ -148,6 +150,13 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
filter.addAction(Intent.ACTION_BOOT_COMPLETED);
mContext.registerReceiver(mStateReceiver, filter);
+ ThemeUtils.registerThemeChangeReceiver(mContext, new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context content, Intent intent) {
+ mUiContext = null;
+ }
+ });
+
filter = new IntentFilter();
filter.addAction(Intent.ACTION_MEDIA_SHARED);
filter.addAction(Intent.ACTION_MEDIA_UNSHARED);
@@ -422,11 +431,18 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
mTetheredNotification.defaults &= ~Notification.DEFAULT_SOUND;
mTetheredNotification.flags = Notification.FLAG_ONGOING_EVENT;
mTetheredNotification.tickerText = title;
- mTetheredNotification.setLatestEventInfo(mContext, title, message, pi);
+ mTetheredNotification.setLatestEventInfo(getUiContext(), title, message, pi);
notificationManager.notify(mTetheredNotification.icon, mTetheredNotification);
}
+ private Context getUiContext() {
+ if (mUiContext == null) {
+ mUiContext = ThemeUtils.createUiContext(mContext);
+ }
+ return mUiContext != null ? mUiContext : mContext;
+ }
+
private void clearTetheredNotification() {
NotificationManager notificationManager =
(NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE);