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

Commit 29b14a70 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I3ac6506a,I3fc80505

* changes:
  Add intent-filter to SearchResultTrampoline
  Create a feature flag for Search v2.
parents e8338dc3 8068fda0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -223,6 +223,10 @@
                  android:theme="@android:style/Theme.NoDisplay"
                  android:excludeFromRecents="true"
                  android:exported="true">
            <intent-filter>
                <action android:name="com.android.settings.SEARCH_RESULT_TRAMPOLINE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- Top-level settings -->
+4 −4
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings;

import static com.android.settings.core.FeatureFlags.DEVICE_INFO_V2;

import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
@@ -56,8 +58,6 @@ import java.util.List;

public class DeviceInfoSettings extends DashboardFragment implements Indexable {

    public static final String DEVICE_INFO_V2_FEATURE_FLAG = "device_info_v2";

    private static final String LOG_TAG = "DeviceInfoSettings";

    private static final String KEY_LEGAL_CONTAINER = "legal_container";
@@ -89,7 +89,7 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {

    @Override
    protected int getPreferenceScreenResId() {
        return FeatureFlagUtils.isEnabled(DEVICE_INFO_V2_FEATURE_FLAG)
        return FeatureFlagUtils.isEnabled(DEVICE_INFO_V2)
                ? R.xml.device_info_settings_v2 : R.xml.device_info_settings;
    }

@@ -126,7 +126,7 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {

    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
            Activity activity, Fragment fragment, Lifecycle lifecycle) {
        if (FeatureFlagUtils.isEnabled(DEVICE_INFO_V2_FEATURE_FLAG)) {
        if (FeatureFlagUtils.isEnabled(DEVICE_INFO_V2)) {
            final List<AbstractPreferenceController> controllers = new ArrayList<>();
            // Device name

+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings;

import static com.android.settings.core.FeatureFlags.DEV_OPTION_V1;

import android.os.Bundle;
import android.util.FeatureFlagUtils;

@@ -65,7 +67,7 @@ public class Settings extends SettingsActivity {
    @Deprecated
    public static class DevelopmentSettingsActivity extends SettingsActivity {
        public static final boolean isEnabled() {
            return FeatureFlagUtils.isEnabled("dev_option_v1");
            return FeatureFlagUtils.isEnabled(DEV_OPTION_V1);
        }
    }
    public static class DevelopmentSettingsDashboardActivity extends SettingsActivity { /* empty */ }
+4 −10
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import com.android.settings.core.instrumentation.SharedPreferencesLogger;
import com.android.settings.dashboard.DashboardFeatureProvider;
import com.android.settings.dashboard.DashboardSummary;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.SearchActivity;
import com.android.settings.wfd.WifiDisplaySettings;
import com.android.settings.widget.SwitchBar;
import com.android.settingslib.development.DevelopmentSettingsEnabler;
@@ -76,7 +75,7 @@ import java.util.Set;
public class SettingsActivity extends SettingsDrawerActivity
        implements PreferenceManager.OnPreferenceTreeClickListener,
        PreferenceFragment.OnPreferenceStartFragmentCallback,
        ButtonBarHandler, FragmentManager.OnBackStackChangedListener, OnClickListener {
        ButtonBarHandler, FragmentManager.OnBackStackChangedListener {

    private static final String LOG_TAG = "Settings";

@@ -329,8 +328,9 @@ public class SettingsActivity extends SettingsDrawerActivity
        if (mIsShowingDashboard) {
            findViewById(R.id.search_bar).setVisibility(View.VISIBLE);
            findViewById(R.id.action_bar).setVisibility(View.GONE);
            Toolbar toolbar = findViewById(R.id.search_action_bar);
            toolbar.setOnClickListener(this);
            final Toolbar toolbar = findViewById(R.id.search_action_bar);
            FeatureFactory.getFactory(this).getSearchFeatureProvider()
                    .initSearchToolbar(this, toolbar);
            setActionBar(toolbar);

            // Please forgive me for what I am about to do.
@@ -959,10 +959,4 @@ public class SettingsActivity extends SettingsDrawerActivity

        return bitmap;
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(this, SearchActivity.class);
        startActivity(intent);
    }
}
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.
 */

package com.android.settings.core;

/**
 * This class keeps track of all feature flags in Settings.
 */
public class FeatureFlags {
    public static final String DEVICE_INFO_V2 = "device_info_v2";
    public static final String DEV_OPTION_V1 = "dev_option_v1";
    public static final String SEARCH_V2 = "settings_search_v2";
    public static final String SUGGESTIONS_V2 = "new_settings_suggestion";
    public static final String USE_PREFERENCE_SCREEN_TITLE = "settings_use_preference_screen_title";
}
Loading