Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginManager.java +1 −8 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class PluginManager extends BroadcastReceiver { private boolean mListening; private boolean mHasOneShot; private PluginManager(Context context) { public PluginManager(Context context) { this(context, new PluginInstanceManagerFactory(), Build.IS_DEBUGGABLE, Thread.getDefaultUncaughtExceptionHandler()); } Loading Loading @@ -252,13 +252,6 @@ public class PluginManager extends BroadcastReceiver { return new PluginContextWrapper(mContext.createApplicationContext(info, 0), classLoader); } public static PluginManager getInstance(Context context) { if (sInstance == null) { sInstance = new PluginManager(context.getApplicationContext()); } return sInstance; } private class AllPluginClassLoader extends ClassLoader { public AllPluginClassLoader(ClassLoader classLoader) { super(classLoader); Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/phone/NavGesture.java +2 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ public interface NavGesture extends Plugin { public boolean onInterceptTouchEvent(MotionEvent event); public void setBarState(boolean vertical, boolean isRtl); public default void destroy() { } } } packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +2 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class BatteryMeterView extends ImageView implements mDrawable.setBatteryController(mBatteryController); mBatteryController.addCallback(this); mDrawable.startListening(); TunerService.get(getContext()).addTunable(this, StatusBarIconController.ICON_BLACKLIST); Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); } @Override Loading @@ -84,7 +84,7 @@ public class BatteryMeterView extends ImageView implements super.onDetachedFromWindow(); mBatteryController.removeCallback(this); mDrawable.stopListening(); TunerService.get(getContext()).removeTunable(this); Dependency.get(TunerService.class).removeTunable(this); } @Override Loading packages/SystemUI/src/com/android/systemui/Dependency.java +21 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ package com.android.systemui; import android.content.Context; import android.content.res.Configuration; import android.os.Handler; import android.os.HandlerThread; Loading @@ -23,6 +24,7 @@ import android.util.ArrayMap; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.assist.AssistManager; import com.android.systemui.plugins.PluginManager; import com.android.systemui.statusbar.phone.ManagedProfileController; import com.android.systemui.statusbar.phone.ManagedProfileControllerImpl; import com.android.systemui.statusbar.policy.AccessibilityController; Loading Loading @@ -56,9 +58,11 @@ import com.android.systemui.statusbar.policy.UserInfoControllerImpl; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.policy.ZenModeControllerImpl; import com.android.systemui.tuner.TunerService; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.HashMap; /** * Class to handle ugly dependencies throughout sysui until we determine the Loading Loading @@ -167,12 +171,18 @@ public class Dependency extends SystemUI { mProviders.put(DeviceProvisionedController.class.getName(), () -> new DeviceProvisionedControllerImpl(mContext)); mProviders.put(PluginManager.class.getName(), () -> new PluginManager(mContext)); mProviders.put(AssistManager.class.getName(), () -> new AssistManager(getDependency(DeviceProvisionedController.class), mContext)); mProviders.put(SecurityController.class.getName(), () -> new SecurityControllerImpl(mContext)); mProviders.put(TunerService.class.getName(), () -> new TunerService(mContext)); // Put all dependencies above here so the factory can override them if it wants. SystemUIFactory.getInstance().injectDependencies(mProviders, mContext); } Loading Loading @@ -220,6 +230,17 @@ public class Dependency extends SystemUI { T createDependency(); } /** * Used in separate processes (like tuner settings) to init the dependencies. */ public static void initDependencies(Context context) { if (sDependency != null) return; Dependency d = new Dependency(); d.mContext = context.getApplicationContext(); d.mComponents = new HashMap<>(); d.start(); } public static <T> T get(Class<T> cls) { return sDependency.getDependency(cls.getName()); } Loading packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java +2 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class PluginInflateContainer extends AutoReinflateContainer protected void onAttachedToWindow() { super.onAttachedToWindow(); if (mAction != null) { PluginManager.getInstance(getContext()).addPluginListener(mAction, this, mVersion); Dependency.get(PluginManager.class).addPluginListener(mAction, this, mVersion); } } Loading @@ -84,7 +84,7 @@ public class PluginInflateContainer extends AutoReinflateContainer protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (mAction != null) { PluginManager.getInstance(getContext()).removePluginListener(this); Dependency.get(PluginManager.class).removePluginListener(this); } } Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginManager.java +1 −8 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class PluginManager extends BroadcastReceiver { private boolean mListening; private boolean mHasOneShot; private PluginManager(Context context) { public PluginManager(Context context) { this(context, new PluginInstanceManagerFactory(), Build.IS_DEBUGGABLE, Thread.getDefaultUncaughtExceptionHandler()); } Loading Loading @@ -252,13 +252,6 @@ public class PluginManager extends BroadcastReceiver { return new PluginContextWrapper(mContext.createApplicationContext(info, 0), classLoader); } public static PluginManager getInstance(Context context) { if (sInstance == null) { sInstance = new PluginManager(context.getApplicationContext()); } return sInstance; } private class AllPluginClassLoader extends ClassLoader { public AllPluginClassLoader(ClassLoader classLoader) { super(classLoader); Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/phone/NavGesture.java +2 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ public interface NavGesture extends Plugin { public boolean onInterceptTouchEvent(MotionEvent event); public void setBarState(boolean vertical, boolean isRtl); public default void destroy() { } } }
packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +2 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class BatteryMeterView extends ImageView implements mDrawable.setBatteryController(mBatteryController); mBatteryController.addCallback(this); mDrawable.startListening(); TunerService.get(getContext()).addTunable(this, StatusBarIconController.ICON_BLACKLIST); Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST); } @Override Loading @@ -84,7 +84,7 @@ public class BatteryMeterView extends ImageView implements super.onDetachedFromWindow(); mBatteryController.removeCallback(this); mDrawable.stopListening(); TunerService.get(getContext()).removeTunable(this); Dependency.get(TunerService.class).removeTunable(this); } @Override Loading
packages/SystemUI/src/com/android/systemui/Dependency.java +21 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ package com.android.systemui; import android.content.Context; import android.content.res.Configuration; import android.os.Handler; import android.os.HandlerThread; Loading @@ -23,6 +24,7 @@ import android.util.ArrayMap; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.assist.AssistManager; import com.android.systemui.plugins.PluginManager; import com.android.systemui.statusbar.phone.ManagedProfileController; import com.android.systemui.statusbar.phone.ManagedProfileControllerImpl; import com.android.systemui.statusbar.policy.AccessibilityController; Loading Loading @@ -56,9 +58,11 @@ import com.android.systemui.statusbar.policy.UserInfoControllerImpl; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.policy.ZenModeControllerImpl; import com.android.systemui.tuner.TunerService; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.HashMap; /** * Class to handle ugly dependencies throughout sysui until we determine the Loading Loading @@ -167,12 +171,18 @@ public class Dependency extends SystemUI { mProviders.put(DeviceProvisionedController.class.getName(), () -> new DeviceProvisionedControllerImpl(mContext)); mProviders.put(PluginManager.class.getName(), () -> new PluginManager(mContext)); mProviders.put(AssistManager.class.getName(), () -> new AssistManager(getDependency(DeviceProvisionedController.class), mContext)); mProviders.put(SecurityController.class.getName(), () -> new SecurityControllerImpl(mContext)); mProviders.put(TunerService.class.getName(), () -> new TunerService(mContext)); // Put all dependencies above here so the factory can override them if it wants. SystemUIFactory.getInstance().injectDependencies(mProviders, mContext); } Loading Loading @@ -220,6 +230,17 @@ public class Dependency extends SystemUI { T createDependency(); } /** * Used in separate processes (like tuner settings) to init the dependencies. */ public static void initDependencies(Context context) { if (sDependency != null) return; Dependency d = new Dependency(); d.mContext = context.getApplicationContext(); d.mComponents = new HashMap<>(); d.start(); } public static <T> T get(Class<T> cls) { return sDependency.getDependency(cls.getName()); } Loading
packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java +2 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class PluginInflateContainer extends AutoReinflateContainer protected void onAttachedToWindow() { super.onAttachedToWindow(); if (mAction != null) { PluginManager.getInstance(getContext()).addPluginListener(mAction, this, mVersion); Dependency.get(PluginManager.class).addPluginListener(mAction, this, mVersion); } } Loading @@ -84,7 +84,7 @@ public class PluginInflateContainer extends AutoReinflateContainer protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (mAction != null) { PluginManager.getInstance(getContext()).removePluginListener(this); Dependency.get(PluginManager.class).removePluginListener(this); } } Loading