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

Commit fa530cd2 authored by Ryan Lothian's avatar Ryan Lothian
Browse files

Make flags UI available on release build of launcher

The UI will only be shown on eng/userdebug platform builds.

Bug: 117223984
Change-Id: I27843f2d856a4a19f3fe53c4d306606eaa5714a2
parent cf771551
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -22,14 +22,10 @@ import android.content.Context;
 * Defines a set of flags used to control various launcher behaviors
 */
public final class FeatureFlags extends BaseFlags {
    private static FeatureFlags instance = new FeatureFlags();

    public static FeatureFlags getInstance(Context context) {
        return instance;
    private FeatureFlags() {
        // Prevent instantiation
    }

    private FeatureFlags() {}

    // Features to control Launcher3Go behavior
    public static final boolean GO_DISABLE_WIDGETS = true;
    public static final boolean LAUNCHER3_SPRING_ICONS = false;
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="feature_flags"
    android:persistent="false">

</PreferenceScreen>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -52,4 +52,10 @@
        android:defaultValue=""
        android:persistent="false" />

    <PreferenceScreen
        android:fragment="com.android.launcher3.config.FlagTogglerPreferenceFragment"
        android:key="flag_toggler"
        android:persistent="false"
        android:title="Feature flags"/>

</PreferenceScreen>
+3 −4
Original line number Diff line number Diff line
@@ -1753,12 +1753,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
    @Override
    public void bindScreens(IntArray orderedScreenIds) {
        // Make sure the first screen is always at the start.
        if (FeatureFlags.getInstance(this).isQsbOnFirstScreenEnabled() &&
        if (FeatureFlags.QSB_ON_FIRST_SCREEN.get() &&
                orderedScreenIds.indexOf(Workspace.FIRST_SCREEN_ID) != 0) {
            orderedScreenIds.removeValue(Workspace.FIRST_SCREEN_ID);
            orderedScreenIds.add(0, Workspace.FIRST_SCREEN_ID);
            LauncherModel.updateWorkspaceScreenOrder(this, orderedScreenIds);
        } else if (!FeatureFlags.getInstance(this).isQsbOnFirstScreenEnabled()
        } else if (!FeatureFlags.QSB_ON_FIRST_SCREEN.get()
                && orderedScreenIds.isEmpty()) {
            // If there are no screens, we need to have an empty screen
            mWorkspace.addExtraEmptyScreen();
@@ -1775,8 +1775,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        int count = orderedScreenIds.size();
        for (int i = 0; i < count; i++) {
            int screenId = orderedScreenIds.get(i);
            if (!FeatureFlags.getInstance(this).isQsbOnFirstScreenEnabled()
                    || screenId != Workspace.FIRST_SCREEN_ID) {
            if (!FeatureFlags.QSB_ON_FIRST_SCREEN.get() || screenId != Workspace.FIRST_SCREEN_ID) {
                // No need to bind the first screen, as its always bound.
                mWorkspace.insertNewWorkspaceScreenBeforeEmptyScreen(screenId);
            }
+1 −4
Original line number Diff line number Diff line
@@ -70,9 +70,6 @@ import java.io.PrintWriter;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;

public class LauncherProvider extends ContentProvider {
    private static final String TAG = "LauncherProvider";
@@ -793,7 +790,7 @@ public class LauncherProvider extends ContentProvider {
                    convertShortcutsToLauncherActivities(db);
                case 26:
                    // QSB was moved to the grid. Clear the first row on screen 0.
                    if (FeatureFlags.getInstance(mContext).isQsbOnFirstScreenEnabled() &&
                    if (FeatureFlags.QSB_ON_FIRST_SCREEN.get() &&
                            !LauncherDbUtils.prepareScreenZeroToHostQsb(mContext, db)) {
                        break;
                    }
Loading