Adding dagger subcomponent for activity context scope
Bug: 361850561 Test: Presumit Flag: EXEMPT refactor Change-Id: I2d2e556fc1c81eaac74e2a1a2a1c5526505f7a56
This commit is contained in:
1 parent
f899589251
commit
182dbd609d
12 files changed
+161
-18
No files matched your search
@@ -43,6 +43,8 @@ import androidx.savedstate.SavedStateRegistry;
|
||||
import androidx.savedstate.SavedStateRegistryController;
|
||||
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.dagger.ActivityContextComponent;
|
||||
import com.android.launcher3.dagger.LauncherComponentProvider;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.testing.TestLogging;
|
||||
@@ -189,6 +191,8 @@ public abstract class BaseActivity extends Activity implements ActivityContext,
|
||||
|
||||
private ActionMode mCurrentActionMode;
|
||||
|
||||
private ActivityContextComponent mActivityComponent;
|
||||
|
||||
public BaseActivity() {
|
||||
mSavedStateRegistryController.performAttach();
|
||||
registerActivityLifecycleCallbacks(
|
||||
@@ -210,6 +214,15 @@ public abstract class BaseActivity extends Activity implements ActivityContext,
|
||||
return mDPChangeListeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityContextComponent getActivityComponent() {
|
||||
if (mActivityComponent == null) {
|
||||
mActivityComponent = (ActivityContextComponent) LauncherComponentProvider.get(this)
|
||||
.getActivityContextComponentBuilder().activityContext(this).build();
|
||||
}
|
||||
return mActivityComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link StatsLogManager} for user event logging.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user