Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 957c13f0 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Handling managed profile creation in the model as the activity

can get killed in the background.

Change-Id: I95f62cf268fe642c9a2bb4975eb92bf8e12d23a9
parent 65832b62
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -1675,9 +1675,6 @@ public class Launcher extends Activity
                mModel.startLoader(false, PagedView.INVALID_RESTORE_PAGE,
                        LauncherModel.LOADER_FLAG_CLEAR_WORKSPACE
                                | LauncherModel.LOADER_FLAG_MIGRATE_SHORTCUTS);
            } else if (LauncherAppsCompat.ACTION_MANAGED_PROFILE_ADDED.equals(action)
                    || LauncherAppsCompat.ACTION_MANAGED_PROFILE_REMOVED.equals(action)) {
                getModel().forceReload();
            }
        }
    };
@@ -1691,8 +1688,6 @@ public class Launcher extends Activity
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        filter.addAction(Intent.ACTION_USER_PRESENT);
        // For handling managed profiles
        filter.addAction(LauncherAppsCompat.ACTION_MANAGED_PROFILE_ADDED);
        filter.addAction(LauncherAppsCompat.ACTION_MANAGED_PROFILE_REMOVED);
        if (ENABLE_DEBUG_INTENTS) {
            filter.addAction(DebugIntents.DELETE_DATABASE);
            filter.addAction(DebugIntents.MIGRATE_DATABASE);
+4 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
        filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
        filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED);
        filter.addAction(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED);
        // For handling managed profiles
        filter.addAction(LauncherAppsCompat.ACTION_MANAGED_PROFILE_ADDED);
        filter.addAction(LauncherAppsCompat.ACTION_MANAGED_PROFILE_REMOVED);

        sContext.registerReceiver(mModel, filter);
    }

+3 −0
Original line number Diff line number Diff line
@@ -1279,6 +1279,9 @@ public class LauncherModel extends BroadcastReceiver
            if (callbacks != null) {
                callbacks.bindSearchablesChanged();
            }
        } else if (LauncherAppsCompat.ACTION_MANAGED_PROFILE_ADDED.equals(action)
                || LauncherAppsCompat.ACTION_MANAGED_PROFILE_REMOVED.equals(action)) {
            forceReload();
        }
    }