Loading packages/SystemUI/src/com/android/systemui/CoreStartable.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import java.io.PrintWriter; * If your CoreStartable depends on different CoreStartables starting before it, use a * {@link com.android.systemui.startable.Dependencies} annotation to list out those dependencies. * * @see SystemUIApplication#startServicesIfNeeded() * @see SystemUIApplication#startSystemUserServicesIfNeeded() */ public interface CoreStartable extends Dumpable { Loading packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +12 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ 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.process.ProcessWrapper; import com.android.systemui.res.R; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.policy.ConfigurationController; Loading Loading @@ -77,6 +78,7 @@ public class SystemUIApplication extends Application implements private SystemUIAppComponentFactoryBase.ContextAvailableCallback mContextAvailableCallback; private SysUIComponent mSysUIComponent; private SystemUIInitializer mInitializer; private ProcessWrapper mProcessWrapper; public SystemUIApplication() { super(); Loading Loading @@ -115,6 +117,7 @@ public class SystemUIApplication extends Application implements // Enable Looper trace points. // This allows us to see Handler callbacks on traces. rootComponent.getMainLooper().setTraceTag(Trace.TRACE_TAG_APP); mProcessWrapper = rootComponent.getProcessWrapper(); // 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 Loading @@ -132,7 +135,7 @@ public class SystemUIApplication extends Application implements View.setTraceLayoutSteps(true); } if (rootComponent.getProcessWrapper().isSystemUser()) { if (mProcessWrapper.isSystemUser()) { IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_LOCKED_BOOT_COMPLETED); bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); Loading Loading @@ -199,7 +202,11 @@ public class SystemUIApplication extends Application implements * <p>This method must only be called from the main thread.</p> */ public void startServicesIfNeeded() { public void startSystemUserServicesIfNeeded() { if (!mProcessWrapper.isSystemUser()) { Log.wtf(TAG, "Tried starting SystemUser services on non-SystemUser"); return; // Per-user startables are handled in #startSystemUserServicesIfNeeded. } final String vendorComponent = mInitializer.getVendorComponent(getResources()); // Sort the startables so that we get a deterministic ordering. Loading @@ -219,6 +226,9 @@ public class SystemUIApplication extends Application implements * <p>This method must only be called from the main thread.</p> */ void startSecondaryUserServicesIfNeeded() { if (mProcessWrapper.isSystemUser()) { return; // Per-user startables are handled in #startSystemUserServicesIfNeeded. } // Sort the startables so that we get a deterministic ordering. Map<Class<?>, Provider<CoreStartable>> sortedStartables = new TreeMap<>( Comparator.comparing(Class::getName)); Loading packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,12 +19,31 @@ package com.android.systemui; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; import com.android.systemui.process.ProcessWrapper; import javax.inject.Inject; public class SystemUISecondaryUserService extends Service { private static final String TAG = "SysUISecondaryService"; private final ProcessWrapper mProcessWrapper; @Inject SystemUISecondaryUserService(ProcessWrapper processWrapper) { mProcessWrapper = processWrapper; } @Override public void onCreate() { super.onCreate(); if (mProcessWrapper.isSystemUser()) { Log.w(TAG, "SecondaryServices started for System User. Stopping it."); stopSelf(); return; } ((SystemUIApplication) getApplication()).startSecondaryUserServicesIfNeeded(); } Loading packages/SystemUI/src/com/android/systemui/SystemUIService.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class SystemUIService extends Service { super.onCreate(); // Start all of SystemUI ((SystemUIApplication) getApplication()).startServicesIfNeeded(); ((SystemUIApplication) getApplication()).startSystemUserServicesIfNeeded(); // Finish initializing dump logic mLogBufferFreezer.attach(mBroadcastDispatcher); Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.dagger; import android.app.INotificationManager; import android.app.Service; import android.content.Context; import android.service.dreams.IDreamManager; Loading @@ -28,6 +29,7 @@ import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.BootCompleteCache; import com.android.systemui.BootCompleteCacheImpl; import com.android.systemui.CameraProtectionModule; import com.android.systemui.SystemUISecondaryUserService; import com.android.systemui.accessibility.AccessibilityModule; import com.android.systemui.accessibility.data.repository.AccessibilityRepositoryModule; import com.android.systemui.appops.dagger.AppOpsModule; Loading Loading @@ -150,6 +152,8 @@ import dagger.Binds; import dagger.BindsOptionalOf; import dagger.Module; import dagger.Provides; import dagger.multibindings.ClassKey; import dagger.multibindings.IntoMap; import java.util.Collections; import java.util.Optional; Loading Loading @@ -384,4 +388,9 @@ public abstract class SystemUIModule { @Binds abstract LargeScreenShadeInterpolator largeScreensShadeInterpolator( LargeScreenShadeInterpolatorImpl impl); @Binds @IntoMap @ClassKey(SystemUISecondaryUserService.class) abstract Service bindsSystemUISecondaryUserService(SystemUISecondaryUserService service); } Loading
packages/SystemUI/src/com/android/systemui/CoreStartable.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import java.io.PrintWriter; * If your CoreStartable depends on different CoreStartables starting before it, use a * {@link com.android.systemui.startable.Dependencies} annotation to list out those dependencies. * * @see SystemUIApplication#startServicesIfNeeded() * @see SystemUIApplication#startSystemUserServicesIfNeeded() */ public interface CoreStartable extends Dumpable { Loading
packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +12 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ 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.process.ProcessWrapper; import com.android.systemui.res.R; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.policy.ConfigurationController; Loading Loading @@ -77,6 +78,7 @@ public class SystemUIApplication extends Application implements private SystemUIAppComponentFactoryBase.ContextAvailableCallback mContextAvailableCallback; private SysUIComponent mSysUIComponent; private SystemUIInitializer mInitializer; private ProcessWrapper mProcessWrapper; public SystemUIApplication() { super(); Loading Loading @@ -115,6 +117,7 @@ public class SystemUIApplication extends Application implements // Enable Looper trace points. // This allows us to see Handler callbacks on traces. rootComponent.getMainLooper().setTraceTag(Trace.TRACE_TAG_APP); mProcessWrapper = rootComponent.getProcessWrapper(); // 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 Loading @@ -132,7 +135,7 @@ public class SystemUIApplication extends Application implements View.setTraceLayoutSteps(true); } if (rootComponent.getProcessWrapper().isSystemUser()) { if (mProcessWrapper.isSystemUser()) { IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_LOCKED_BOOT_COMPLETED); bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); Loading Loading @@ -199,7 +202,11 @@ public class SystemUIApplication extends Application implements * <p>This method must only be called from the main thread.</p> */ public void startServicesIfNeeded() { public void startSystemUserServicesIfNeeded() { if (!mProcessWrapper.isSystemUser()) { Log.wtf(TAG, "Tried starting SystemUser services on non-SystemUser"); return; // Per-user startables are handled in #startSystemUserServicesIfNeeded. } final String vendorComponent = mInitializer.getVendorComponent(getResources()); // Sort the startables so that we get a deterministic ordering. Loading @@ -219,6 +226,9 @@ public class SystemUIApplication extends Application implements * <p>This method must only be called from the main thread.</p> */ void startSecondaryUserServicesIfNeeded() { if (mProcessWrapper.isSystemUser()) { return; // Per-user startables are handled in #startSystemUserServicesIfNeeded. } // Sort the startables so that we get a deterministic ordering. Map<Class<?>, Provider<CoreStartable>> sortedStartables = new TreeMap<>( Comparator.comparing(Class::getName)); Loading
packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,12 +19,31 @@ package com.android.systemui; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; import com.android.systemui.process.ProcessWrapper; import javax.inject.Inject; public class SystemUISecondaryUserService extends Service { private static final String TAG = "SysUISecondaryService"; private final ProcessWrapper mProcessWrapper; @Inject SystemUISecondaryUserService(ProcessWrapper processWrapper) { mProcessWrapper = processWrapper; } @Override public void onCreate() { super.onCreate(); if (mProcessWrapper.isSystemUser()) { Log.w(TAG, "SecondaryServices started for System User. Stopping it."); stopSelf(); return; } ((SystemUIApplication) getApplication()).startSecondaryUserServicesIfNeeded(); } Loading
packages/SystemUI/src/com/android/systemui/SystemUIService.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class SystemUIService extends Service { super.onCreate(); // Start all of SystemUI ((SystemUIApplication) getApplication()).startServicesIfNeeded(); ((SystemUIApplication) getApplication()).startSystemUserServicesIfNeeded(); // Finish initializing dump logic mLogBufferFreezer.attach(mBroadcastDispatcher); Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.dagger; import android.app.INotificationManager; import android.app.Service; import android.content.Context; import android.service.dreams.IDreamManager; Loading @@ -28,6 +29,7 @@ import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.BootCompleteCache; import com.android.systemui.BootCompleteCacheImpl; import com.android.systemui.CameraProtectionModule; import com.android.systemui.SystemUISecondaryUserService; import com.android.systemui.accessibility.AccessibilityModule; import com.android.systemui.accessibility.data.repository.AccessibilityRepositoryModule; import com.android.systemui.appops.dagger.AppOpsModule; Loading Loading @@ -150,6 +152,8 @@ import dagger.Binds; import dagger.BindsOptionalOf; import dagger.Module; import dagger.Provides; import dagger.multibindings.ClassKey; import dagger.multibindings.IntoMap; import java.util.Collections; import java.util.Optional; Loading Loading @@ -384,4 +388,9 @@ public abstract class SystemUIModule { @Binds abstract LargeScreenShadeInterpolator largeScreensShadeInterpolator( LargeScreenShadeInterpolatorImpl impl); @Binds @IntoMap @ClassKey(SystemUISecondaryUserService.class) abstract Service bindsSystemUISecondaryUserService(SystemUISecondaryUserService service); }