Converting LauncherAppState to Dagger
Bug: 361850561 Test: Presubmit Flag: EXEMPT dagger Change-Id: I336a233d2703c23a7e9065474bde471786886144
This commit is contained in:
1 parent
91547eb4d2
commit
c9f697aeb5
30 files changed
+332
-357
No files matched your search
@@ -21,8 +21,8 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat
|
||||
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
import static com.android.launcher3.util.TestUtil.runOnExecutorSync;
|
||||
import static com.android.launcher3.util.TestUtil.grantWriteSecurePermission;
|
||||
import static com.android.launcher3.util.TestUtil.runOnExecutorSync;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@@ -51,6 +51,7 @@ import androidx.test.core.app.ApplicationProvider;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherModel;
|
||||
import com.android.launcher3.dagger.LauncherBaseAppComponent;
|
||||
import com.android.launcher3.model.BgDataModel;
|
||||
import com.android.launcher3.model.BgDataModel.Callbacks;
|
||||
import com.android.launcher3.model.ModelDbController;
|
||||
@@ -266,14 +267,6 @@ public class LauncherModelHelper {
|
||||
mDbDir = new File(getCacheDir(), UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends SafeCloseable> T createObject(MainThreadInitializedObject<T> object) {
|
||||
if (object == LauncherAppState.INSTANCE) {
|
||||
return (T) new LauncherAppState(this, null /* iconCacheFileName */);
|
||||
}
|
||||
return super.createObject(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDatabasePath(String name) {
|
||||
if (!mDbDir.exists()) {
|
||||
@@ -342,5 +335,10 @@ public class LauncherModelHelper {
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initDaggerComponent(LauncherBaseAppComponent.Builder componentBuilder) {
|
||||
super.initDaggerComponent(componentBuilder.iconsDbName(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user