diff --git a/app/src/main/java/foundation/e/blisslauncher/core/migrate/Migration.java b/app/src/main/java/foundation/e/blisslauncher/core/migrate/Migration.java index 9e65e5ba9e8ec15f87f37bf5d4a81fff42f897c2..937799abfe1682bb90f3ef20ba4e391bca67c68e 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/migrate/Migration.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/migrate/Migration.java @@ -8,6 +8,7 @@ import com.google.gson.Gson; import java.io.IOException; import java.io.InputStream; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -35,15 +36,23 @@ public class Migration { } if (Build.VERSION.SDK_INT > 28) { - String oldComponent = "com.android.dialer/com.android.dialer.app.DialtactsActivity"; - String newComponent = "com.android.dialer/com.android.dialer.main.impl.MainActivity"; - String dialerComponent = LauncherDB.getDatabase(context).launcherDao().getComponentName("com.android.dialer"); + List dialerComponentList = Arrays.asList( + "com.android.dialer/com.android.dialer.main.impl.MainActivity", + "com.android.dialer/com.android.dialer.app.DialtactsActivity", + "com.android.dialer/com.android.dialer.DialtactsActivity" + ); - if (dialerComponent != null && dialerComponent.equals(oldComponent)) { + String currentComponent = dialerComponentList.get(0); + String dialerComponent = LauncherDB + .getDatabase(context) + .launcherDao() + .getComponentName("com.android.dialer"); + + if (dialerComponent != null && dialerComponentList.contains(dialerComponent) + && !dialerComponent.equals(currentComponent)) { Log.d(TAG, "migrateSafely: Migrating dialer component!"); DatabaseManager.getManager(context).migrateComponent( - oldComponent, newComponent - ); + dialerComponent, currentComponent); } }