Themes: Apply themes to system_server safely
Creates a new UI Context for UI based operations.
This UI Context is wired up the same way a normal app
Context would be, and is subject to change when overlays
are enabled/disabled.
For this reason, only UI should be using this new Context.
All other operations should be using the original system Context
so that changing themes don't impact the regular operations of
system_server.
Also added some sanity checks at key places where we show UI
(ShutdownThread, BaseErrorDialog).
Bug: 36059431
Test: $ adb shell am crash com.android.settings
Test: Observe crash and power off dialogs are blue with PixelTheme
Change-Id: I87227ee2e0be1e72dcde8f482b37725cb687260b
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index da49eb3..412cf81 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -475,6 +475,9 @@
ActivityThread activityThread = ActivityThread.systemMain();
mSystemContext = activityThread.getSystemContext();
mSystemContext.setTheme(DEFAULT_SYSTEM_THEME);
+
+ final Context systemUiContext = activityThread.getSystemUiContext();
+ systemUiContext.setTheme(DEFAULT_SYSTEM_THEME);
}
/**