Merge "Move StatsLogManager to Dagger" into main
This commit is contained in:
commit
77f22bf9cf
8 files changed
+62
-28
No files matched your search
@@ -18,6 +18,7 @@ package com.android.launcher3.dagger
|
||||
|
||||
import com.android.launcher3.icons.LauncherIconProvider
|
||||
import com.android.launcher3.icons.LauncherIconProviderImpl
|
||||
import com.android.launcher3.logging.StatsLogManager.StatsLogManagerFactory
|
||||
import com.android.launcher3.uioverrides.QuickstepWidgetHolder.QuickstepWidgetHolderFactory
|
||||
import com.android.launcher3.uioverrides.SystemApiWrapper
|
||||
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapperImpl
|
||||
@@ -28,6 +29,7 @@ import com.android.launcher3.util.window.RefreshRateTracker
|
||||
import com.android.launcher3.util.window.WindowManagerProxy
|
||||
import com.android.launcher3.widget.LauncherWidgetHolder.WidgetHolderFactory
|
||||
import com.android.quickstep.InstantAppResolverImpl
|
||||
import com.android.quickstep.logging.StatsLogCompatManager.StatsLogCompatManagerFactory
|
||||
import com.android.quickstep.util.ChoreographerFrameRateTracker
|
||||
import com.android.quickstep.util.GestureExclusionManager
|
||||
import com.android.quickstep.util.SystemWindowManagerProxy
|
||||
@@ -44,6 +46,11 @@ abstract class WindowManagerProxyModule {
|
||||
|
||||
@Module
|
||||
abstract class ApiWrapperModule {
|
||||
@Binds
|
||||
abstract fun bindStatsLogManagerFactory(
|
||||
impl: StatsLogCompatManagerFactory
|
||||
): StatsLogManagerFactory
|
||||
|
||||
@Binds abstract fun bindApiWrapper(systemApiWrapper: SystemApiWrapper): ApiWrapper
|
||||
|
||||
@Binds
|
||||
|
||||
@@ -107,19 +107,10 @@ public class SettingsChangeLogger implements
|
||||
SettingsChangeLogger(@ApplicationContext Context context,
|
||||
DaggerSingletonTracker tracker,
|
||||
DisplayController displayController,
|
||||
SettingsCache settingsCache) {
|
||||
this(context, StatsLogManager.newInstance(context), tracker, displayController,
|
||||
settingsCache);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
SettingsChangeLogger(@ApplicationContext Context context,
|
||||
StatsLogManager statsLogManager,
|
||||
DaggerSingletonTracker tracker,
|
||||
DisplayController displayController,
|
||||
SettingsCache settingsCache) {
|
||||
SettingsCache settingsCache,
|
||||
StatsLogManager.StatsLogManagerFactory factory) {
|
||||
mContext = context;
|
||||
mStatsLogManager = statsLogManager;
|
||||
mStatsLogManager = factory.create(context);
|
||||
mLoggablePrefs = loadPrefKeys(context);
|
||||
|
||||
displayController.addChangeListener(this);
|
||||
|
||||
@@ -82,6 +82,8 @@ import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* This class calls StatsLog compile time generated methods.
|
||||
*
|
||||
@@ -121,10 +123,27 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
public static final CopyOnWriteArrayList<StatsLogConsumer> LOGS_CONSUMER =
|
||||
new CopyOnWriteArrayList<>();
|
||||
|
||||
public StatsLogCompatManager(Context context) {
|
||||
private StatsLogCompatManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is purely used to support dagger bindings to be overridden in launcher variants.
|
||||
* Very similar to {@link dagger.assisted.AssistedFactory}. But
|
||||
* {@link dagger.assisted.AssistedFactory} cannot be overridden and this makes dagger binding
|
||||
* difficult.
|
||||
*/
|
||||
public static class StatsLogCompatManagerFactory extends StatsLogManagerFactory {
|
||||
@Inject
|
||||
StatsLogCompatManagerFactory() {
|
||||
super();
|
||||
}
|
||||
|
||||
public StatsLogManager create(Context context) {
|
||||
return new StatsLogCompatManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StatsLogger createLogger() {
|
||||
return new StatsCompatLogger(mContext, mActivityContext);
|
||||
|
||||
Reference in new issue
Block a user