Loading quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java +1 −2 Original line number Diff line number Diff line Loading @@ -111,12 +111,11 @@ public class QuickstepModelDelegate extends ModelDelegate { private final InvariantDeviceProfile mIDP; private final AppEventProducer mAppEventProducer; private final StatsManager mStatsManager; private final Context mContext; protected boolean mActive = false; public QuickstepModelDelegate(Context context) { mContext = context; super(context); mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent); mIDP = InvariantDeviceProfile.INSTANCE.get(context); Loading quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class StatsLogCompatManager extends StatsLogManager { new CopyOnWriteArrayList<>(); public StatsLogCompatManager(Context context) { mContext = context; super(context); } @Override Loading src/com/android/launcher3/logging/StatsLogManager.java +12 −7 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.slice.SliceItem; Loading Loading @@ -53,11 +54,18 @@ public class StatsLogManager implements ResourceBasedOverride { public static final int LAUNCHER_STATE_ALLAPPS = 4; public static final int LAUNCHER_STATE_UNCHANGED = 5; private InstanceId mInstanceId; @NonNull protected final Context mContext; @Nullable protected final ActivityContext mActivityContext; protected @Nullable ActivityContext mActivityContext = null; protected @Nullable Context mContext = null; private KeyboardStateManager mKeyboardStateManager; private InstanceId mInstanceId; public StatsLogManager(@NonNull Context context) { mContext = context; mActivityContext = ActivityContext.lookupContextNoThrow(context); } /** * Returns event enum based on the two state transition information when swipe Loading Loading @@ -1194,10 +1202,7 @@ public class StatsLogManager implements ResourceBasedOverride { * Creates a new instance of {@link StatsLogManager} based on provided context. */ public static StatsLogManager newInstance(Context context) { StatsLogManager manager = Overrides.getObject(StatsLogManager.class, return Overrides.getObject(StatsLogManager.class, context.getApplicationContext(), R.string.stats_log_manager_class); manager.mActivityContext = ActivityContext.lookupContextNoThrow(context); manager.mContext = context; return manager; } } src/com/android/launcher3/model/ModelDelegate.java +6 −5 Original line number Diff line number Diff line Loading @@ -45,28 +45,29 @@ public class ModelDelegate implements ResourceBasedOverride { boolean isPrimaryInstance) { ModelDelegate delegate = Overrides.getObject( ModelDelegate.class, context, R.string.model_delegate_class); delegate.init(context, app, appsList, dataModel, isPrimaryInstance); delegate.init(app, appsList, dataModel, isPrimaryInstance); return delegate; } protected Context mContext; protected final Context mContext; protected LauncherAppState mApp; protected AllAppsList mAppsList; protected BgDataModel mDataModel; protected boolean mIsPrimaryInstance; public ModelDelegate() { } public ModelDelegate(Context context) { mContext = context; } /** * Initializes the object with the given params. */ private void init(Context context, LauncherAppState app, AllAppsList appsList, private void init(LauncherAppState app, AllAppsList appsList, BgDataModel dataModel, boolean isPrimaryInstance) { this.mApp = app; this.mAppsList = appsList; this.mDataModel = dataModel; this.mIsPrimaryInstance = isPrimaryInstance; this.mContext = context; } /** Called periodically to validate and update any data */ Loading src/com/android/launcher3/util/ResourceBasedOverride.java +10 −6 Original line number Diff line number Diff line Loading @@ -34,16 +34,20 @@ public interface ResourceBasedOverride { public static <T extends ResourceBasedOverride> T getObject( Class<T> clazz, Context context, int resId) { String className = context.getString(resId); if (!TextUtils.isEmpty(className)) { boolean isOverridden = !TextUtils.isEmpty(className); // First try to load the class with "Context" param try { Class<?> cls = Class.forName(className); Class<?> cls = isOverridden ? Class.forName(className) : clazz; return (T) cls.getDeclaredConstructor(Context.class).newInstance(context); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | ClassCastException | NoSuchMethodException | InvocationTargetException e) { if (isOverridden) { Log.e(TAG, "Bad overriden class", e); } } // Load the base class with no parameter try { return clazz.newInstance(); } catch (InstantiationException|IllegalAccessException e) { Loading Loading
quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java +1 −2 Original line number Diff line number Diff line Loading @@ -111,12 +111,11 @@ public class QuickstepModelDelegate extends ModelDelegate { private final InvariantDeviceProfile mIDP; private final AppEventProducer mAppEventProducer; private final StatsManager mStatsManager; private final Context mContext; protected boolean mActive = false; public QuickstepModelDelegate(Context context) { mContext = context; super(context); mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent); mIDP = InvariantDeviceProfile.INSTANCE.get(context); Loading
quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class StatsLogCompatManager extends StatsLogManager { new CopyOnWriteArrayList<>(); public StatsLogCompatManager(Context context) { mContext = context; super(context); } @Override Loading
src/com/android/launcher3/logging/StatsLogManager.java +12 −7 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.slice.SliceItem; Loading Loading @@ -53,11 +54,18 @@ public class StatsLogManager implements ResourceBasedOverride { public static final int LAUNCHER_STATE_ALLAPPS = 4; public static final int LAUNCHER_STATE_UNCHANGED = 5; private InstanceId mInstanceId; @NonNull protected final Context mContext; @Nullable protected final ActivityContext mActivityContext; protected @Nullable ActivityContext mActivityContext = null; protected @Nullable Context mContext = null; private KeyboardStateManager mKeyboardStateManager; private InstanceId mInstanceId; public StatsLogManager(@NonNull Context context) { mContext = context; mActivityContext = ActivityContext.lookupContextNoThrow(context); } /** * Returns event enum based on the two state transition information when swipe Loading Loading @@ -1194,10 +1202,7 @@ public class StatsLogManager implements ResourceBasedOverride { * Creates a new instance of {@link StatsLogManager} based on provided context. */ public static StatsLogManager newInstance(Context context) { StatsLogManager manager = Overrides.getObject(StatsLogManager.class, return Overrides.getObject(StatsLogManager.class, context.getApplicationContext(), R.string.stats_log_manager_class); manager.mActivityContext = ActivityContext.lookupContextNoThrow(context); manager.mContext = context; return manager; } }
src/com/android/launcher3/model/ModelDelegate.java +6 −5 Original line number Diff line number Diff line Loading @@ -45,28 +45,29 @@ public class ModelDelegate implements ResourceBasedOverride { boolean isPrimaryInstance) { ModelDelegate delegate = Overrides.getObject( ModelDelegate.class, context, R.string.model_delegate_class); delegate.init(context, app, appsList, dataModel, isPrimaryInstance); delegate.init(app, appsList, dataModel, isPrimaryInstance); return delegate; } protected Context mContext; protected final Context mContext; protected LauncherAppState mApp; protected AllAppsList mAppsList; protected BgDataModel mDataModel; protected boolean mIsPrimaryInstance; public ModelDelegate() { } public ModelDelegate(Context context) { mContext = context; } /** * Initializes the object with the given params. */ private void init(Context context, LauncherAppState app, AllAppsList appsList, private void init(LauncherAppState app, AllAppsList appsList, BgDataModel dataModel, boolean isPrimaryInstance) { this.mApp = app; this.mAppsList = appsList; this.mDataModel = dataModel; this.mIsPrimaryInstance = isPrimaryInstance; this.mContext = context; } /** Called periodically to validate and update any data */ Loading
src/com/android/launcher3/util/ResourceBasedOverride.java +10 −6 Original line number Diff line number Diff line Loading @@ -34,16 +34,20 @@ public interface ResourceBasedOverride { public static <T extends ResourceBasedOverride> T getObject( Class<T> clazz, Context context, int resId) { String className = context.getString(resId); if (!TextUtils.isEmpty(className)) { boolean isOverridden = !TextUtils.isEmpty(className); // First try to load the class with "Context" param try { Class<?> cls = Class.forName(className); Class<?> cls = isOverridden ? Class.forName(className) : clazz; return (T) cls.getDeclaredConstructor(Context.class).newInstance(context); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | ClassCastException | NoSuchMethodException | InvocationTargetException e) { if (isOverridden) { Log.e(TAG, "Bad overriden class", e); } } // Load the base class with no parameter try { return clazz.newInstance(); } catch (InstantiationException|IllegalAccessException e) { Loading