Merge "Watch for profile events and reload" into ub-now-nova
This commit is contained in:
committed by
Android (Google) Code Review
commit
2c4fad14fc
@@ -1568,6 +1568,9 @@ 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();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1580,6 +1583,9 @@ public class Launcher extends Activity
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
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);
|
||||
|
||||
@@ -1256,7 +1256,7 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
}
|
||||
|
||||
private void forceReload() {
|
||||
void forceReload() {
|
||||
resetLoadedState(true, true);
|
||||
|
||||
// Do this here because if the launcher activity is running it will be restarted.
|
||||
|
||||
@@ -34,6 +34,11 @@ import java.util.Map;
|
||||
|
||||
public abstract class LauncherAppsCompat {
|
||||
|
||||
public static final String ACTION_MANAGED_PROFILE_ADDED =
|
||||
"android.intent.action.MANAGED_PROFILE_ADDED";
|
||||
public static final String ACTION_MANAGED_PROFILE_REMOVED =
|
||||
"android.intent.action.MANAGED_PROFILE_REMOVED";
|
||||
|
||||
public interface OnAppsChangedListenerCompat {
|
||||
void onPackageRemoved(UserHandleCompat user, String packageName);
|
||||
void onPackageAdded(UserHandleCompat user, String packageName);
|
||||
|
||||
Reference in New Issue
Block a user