summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/SystemUIApplication.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIApplication.java32
1 files changed, 28 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
index e89e6cb269f8..48127a75b86e 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
@@ -60,17 +60,30 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
private boolean mServicesStarted;
private boolean mBootCompleted;
private final Map<Class<?>, Object> mComponents = new HashMap<>();
+ private ContextAvailableCallback mContextAvailableCallback;
+
+ public SystemUIApplication() {
+ super();
+ Log.v(TAG, "SystemUIApplication constructed.");
+ }
@Override
public void onCreate() {
super.onCreate();
+ Log.v(TAG, "SystemUIApplication created.");
+ // This line is used to setup Dagger's dependency injection and should be kept at the
+ // top of this method.
+ TimingsTraceLog log = new TimingsTraceLog("SystemUIBootTiming",
+ Trace.TRACE_TAG_APP);
+ log.traceBegin("DependencyInjection");
+ mContextAvailableCallback.onContextAvailable(this);
+ log.traceEnd();
+
// Set the application theme that is inherited by all services. Note that setting the
// application theme in the manifest does only work for activities. Keep this in sync with
// the theme set there.
setTheme(R.style.Theme_SystemUI);
- SystemUIFactory.createFromConfig(this);
-
if (Process.myUserHandle().equals(UserHandle.SYSTEM)) {
IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
@@ -134,7 +147,7 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
/**
* Ensures that all the Secondary user SystemUI services are running. If they are already
- * running, this is a no-op. This is needed to conditinally start all the services, as we only
+ * running, this is a no-op. This is needed to conditionally start all the services, as we only
* need to have it in the main process.
* <p>This method must only be called from the main thread.</p>
*/
@@ -155,7 +168,9 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
// see ActivityManagerService.finishBooting()
if ("1".equals(SystemProperties.get("sys.boot_completed"))) {
mBootCompleted = true;
- if (DEBUG) Log.v(TAG, "BOOT_COMPLETED was already sent");
+ if (DEBUG) {
+ Log.v(TAG, "BOOT_COMPLETED was already sent");
+ }
}
}
@@ -269,6 +284,7 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
@Override
public void onConfigurationChanged(Configuration newConfig) {
if (mServicesStarted) {
+ Dependency.staticOnConfigurationChanged(newConfig);
int len = mServices.length;
for (int i = 0; i < len; i++) {
if (mServices[i] != null) {
@@ -286,4 +302,12 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
public SystemUI[] getServices() {
return mServices;
}
+
+ void setContextAvailableCallback(ContextAvailableCallback callback) {
+ mContextAvailableCallback = callback;
+ }
+
+ interface ContextAvailableCallback {
+ void onContextAvailable(Context context);
+ }
}