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

Commit ba162aa7 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Adding logic to pull in workspace data from another Launcher3 based...

Merge "Adding logic to pull in workspace data from another Launcher3 based provider. This allows OEMs to keep the user's homescreen intact while changing the default home app package." into ub-launcher3-calgary
parents c6e5fdb7 a5c8a9eb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
    private static final String TAG_FAVORITES = "favorites";
    protected static final String TAG_FAVORITE = "favorite";
    private static final String TAG_APPWIDGET = "appwidget";
    private static final String TAG_SHORTCUT = "shortcut";
    protected static final String TAG_SHORTCUT = "shortcut";
    private static final String TAG_FOLDER = "folder";
    private static final String TAG_PARTNER_FOLDER = "partner-folder";

@@ -89,7 +89,7 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
    /**
     * AppShortcutParser which also supports adding URI based intents
     */
    @Thunk class AppShortcutWithUriParser extends AppShortcutParser {
    public class AppShortcutWithUriParser extends AppShortcutParser {

        @Override
        protected long invalidPackageOrClass(XmlResourceParser parser) {
@@ -179,7 +179,7 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
    /**
     * Shortcut parser which allows any uri and not just web urls.
     */
    private class UriShortcutParser extends ShortcutParser {
    public class UriShortcutParser extends ShortcutParser {

        public UriShortcutParser(Resources iconRes) {
            super(iconRes);
@@ -201,7 +201,7 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
    /**
     * Contains a list of <favorite> nodes, and accepts the first successfully parsed node.
     */
    protected class ResolveParser implements TagParser {
    public class ResolveParser implements TagParser {

        private final AppShortcutWithUriParser mChildParser = new AppShortcutWithUriParser();

+2 −2
Original line number Diff line number Diff line
@@ -62,8 +62,8 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
        mLongPressHelper = new CheckLongPressHelper(this);
        mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mDragLayer = ((Launcher) context).getDragLayer();
        setAccessibilityDelegate(((Launcher) context).getAccessibilityDelegate());
        mDragLayer = Launcher.getLauncher(context).getDragLayer();
        setAccessibilityDelegate(Launcher.getLauncher(context).getAccessibilityDelegate());

        setBackgroundResource(R.drawable.widget_internal_focus_bg);
    }
+3 −16
Original line number Diff line number Diff line
@@ -14,33 +14,20 @@ public class LauncherFiles {

    private static final String XML = ".xml";

    public static final String DEFAULT_WALLPAPER_THUMBNAIL = "default_thumb2.jpg";
    public static final String DEFAULT_WALLPAPER_THUMBNAIL_OLD = "default_thumb.jpg";
    public static final String LAUNCHER_DB = "launcher.db";
    public static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs";
    public static final String WALLPAPER_CROP_PREFERENCES_KEY =
            "com.android.launcher3.WallpaperCropActivity";
    public static final String MANAGED_USER_PREFERENCES_KEY = "com.android.launcher3.managedusers.prefs";
    // This preference file is not backed up to cloud.
    public static final String DEVICE_PREFERENCES_KEY = "com.android.launcher3.device.prefs";

    public static final String WALLPAPER_IMAGES_DB = "saved_wallpaper_images.db";
    public static final String WIDGET_PREVIEWS_DB = "widgetpreviews.db";
    public static final String APP_ICONS_DB = "app_icons.db";

    public static final List<String> ALL_FILES = Collections.unmodifiableList(Arrays.asList(
            DEFAULT_WALLPAPER_THUMBNAIL,
            DEFAULT_WALLPAPER_THUMBNAIL_OLD,
            LAUNCHER_DB,
            SHARED_PREFERENCES_KEY + XML,
            WALLPAPER_CROP_PREFERENCES_KEY + XML,
            WALLPAPER_IMAGES_DB,
            WIDGET_PREVIEWS_DB,
            MANAGED_USER_PREFERENCES_KEY + XML,
            DEVICE_PREFERENCES_KEY + XML,
            APP_ICONS_DB));

    // TODO: Delete these files on upgrade
    public static final List<String> OBSOLETE_FILES = Collections.unmodifiableList(Arrays.asList(
            "launches.logTap",
            "stats.logTap",
            "launcher.preferences",
            "com.android.launcher3.compat.PackageInstallerCompatV16.queue"));
}
+9 −1
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.model.GridSizeMigrationTask;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.provider.ImportDataTask;
import com.android.launcher3.provider.LauncherDbUtils;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
@@ -1648,7 +1649,14 @@ public class LauncherModel extends BroadcastReceiver
            int countY = profile.numRows;

            boolean clearDb = false;
            if (GridSizeMigrationTask.ENABLED &&
            try {
                ImportDataTask.performImportIfPossible(context);
            } catch (Exception e) {
                // Migration failed. Clear workspace.
                clearDb = true;
            }

            if (!clearDb && GridSizeMigrationTask.ENABLED &&
                    !GridSizeMigrationTask.migrateGridIfNeeded(mContext)) {
                // Migration failed. Clear workspace.
                clearDb = true;
+6 −0
Original line number Diff line number Diff line
@@ -359,6 +359,12 @@ public class LauncherProvider extends ContentProvider {
                clearFlagEmptyDbCreated();
                return null;
            }
            case LauncherSettings.Settings.METHOD_WAS_EMPTY_DB_CREATED : {
                Bundle result = new Bundle();
                result.putBoolean(LauncherSettings.Settings.EXTRA_VALUE,
                        Utilities.getPrefs(getContext()).getBoolean(EMPTY_DATABASE_CREATED, false));
                return result;
            }
            case LauncherSettings.Settings.METHOD_DELETE_EMPTY_FOLDERS: {
                Bundle result = new Bundle();
                result.putSerializable(LauncherSettings.Settings.EXTRA_VALUE, deleteEmptyFolders());
Loading