diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/SystemUIApplication.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/SystemUIApplication.java | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java index 9138b2346ab8..191ac76753bb 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java @@ -45,10 +45,9 @@ import com.android.internal.protolog.common.ProtoLog; import com.android.systemui.dagger.GlobalRootComponent; import com.android.systemui.dagger.SysUIComponent; import com.android.systemui.dump.DumpManager; +import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.util.NotificationChannels; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.Comparator; import java.util.Map; import java.util.TreeMap; @@ -116,7 +115,8 @@ public class SystemUIApplication extends Application implements setTheme(R.style.Theme_SystemUI); if (Process.myUserHandle().equals(UserHandle.SYSTEM)) { - IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED); + IntentFilter bootCompletedFilter = new + IntentFilter(Intent.ACTION_LOCKED_BOOT_COMPLETED); bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); // If SF GPU context priority is set to realtime, then SysUI should run at high. @@ -148,7 +148,7 @@ public class SystemUIApplication extends Application implements if (mServicesStarted) { final int N = mServices.length; for (int i = 0; i < N; i++) { - mServices[i].onBootCompleted(); + notifyBootCompleted(mServices[i]); } } } @@ -267,7 +267,7 @@ public class SystemUIApplication extends Application implements for (i = 0; i < mServices.length; i++) { if (mBootCompleteCache.isBootComplete()) { - mServices[i].onBootCompleted(); + notifyBootCompleted(mServices[i]); } mDumpManager.registerDumpable(mServices[i].getClass().getName(), mServices[i]); @@ -278,7 +278,17 @@ public class SystemUIApplication extends Application implements mServicesStarted = true; } - private void timeInitialization(String clsName, Runnable init, TimingsTraceLog log, + private static void notifyBootCompleted(CoreStartable coreStartable) { + if (Trace.isEnabled()) { + Trace.traceBegin( + Trace.TRACE_TAG_APP, + coreStartable.getClass().getSimpleName() + ".onBootCompleted()"); + } + coreStartable.onBootCompleted(); + Trace.endSection(); + } + + private static void timeInitialization(String clsName, Runnable init, TimingsTraceLog log, String metricsPrefix) { long ti = System.currentTimeMillis(); log.traceBegin(metricsPrefix + " " + clsName); @@ -292,32 +302,45 @@ public class SystemUIApplication extends Application implements } } - private CoreStartable startAdditionalStartable(String clsName) { + private static CoreStartable startAdditionalStartable(String clsName) { CoreStartable startable; if (DEBUG) Log.d(TAG, "loading: " + clsName); + if (Trace.isEnabled()) { + Trace.traceBegin( + Trace.TRACE_TAG_APP, clsName + ".newInstance()"); + } try { - Constructor<?> constructor = Class.forName(clsName).getConstructor( - Context.class); - startable = (CoreStartable) constructor.newInstance(this); + startable = (CoreStartable) Class.forName(clsName).newInstance(); } catch (ClassNotFoundException - | NoSuchMethodException | IllegalAccessException - | InstantiationException - | InvocationTargetException ex) { + | InstantiationException ex) { throw new RuntimeException(ex); + } finally { + Trace.endSection(); } return startStartable(startable); } - private CoreStartable startStartable(String clsName, Provider<CoreStartable> provider) { + private static CoreStartable startStartable(String clsName, Provider<CoreStartable> provider) { if (DEBUG) Log.d(TAG, "loading: " + clsName); - return startStartable(provider.get()); + if (Trace.isEnabled()) { + Trace.traceBegin( + Trace.TRACE_TAG_APP, "Provider<" + clsName + ">.get()"); + } + CoreStartable startable = provider.get(); + Trace.endSection(); + return startStartable(startable); } - private CoreStartable startStartable(CoreStartable startable) { + private static CoreStartable startStartable(CoreStartable startable) { if (DEBUG) Log.d(TAG, "running: " + startable); + if (Trace.isEnabled()) { + Trace.traceBegin( + Trace.TRACE_TAG_APP, startable.getClass().getSimpleName() + ".start()"); + } startable.start(); + Trace.endSection(); return startable; } @@ -355,11 +378,25 @@ public class SystemUIApplication extends Application implements @Override public void onConfigurationChanged(Configuration newConfig) { if (mServicesStarted) { - mSysUIComponent.getConfigurationController().onConfigurationChanged(newConfig); + ConfigurationController configController = mSysUIComponent.getConfigurationController(); + if (Trace.isEnabled()) { + Trace.traceBegin( + Trace.TRACE_TAG_APP, + configController.getClass().getSimpleName() + ".onConfigurationChanged()"); + } + configController.onConfigurationChanged(newConfig); + Trace.endSection(); int len = mServices.length; for (int i = 0; i < len; i++) { if (mServices[i] != null) { + if (Trace.isEnabled()) { + Trace.traceBegin( + Trace.TRACE_TAG_APP, + mServices[i].getClass().getSimpleName() + + ".onConfigurationChanged()"); + } mServices[i].onConfigurationChanged(newConfig); + Trace.endSection(); } } } |