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

Commit 22f0df39 authored by Andrew Sapperstein's avatar Andrew Sapperstein Committed by Android (Google) Code Review
Browse files

Merge "Add ability to switch between support versions"

parents 82c039bc 9f629d69
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -2952,6 +2952,11 @@
                       android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" />
        </activity>

        <activity android:name="Settings$LegacySupportActivity">
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
            android:value="com.android.settings.dashboard.SupportFragment"/>
        </activity>

        <!-- Information architecture host activities -->

        <!-- Alias for battery settings in new IA. Remove and merge metadata into TargetActivity -->
@@ -3001,17 +3006,16 @@
                       android:resource="@string/system_dashboard_summary"/>
        </activity>

        <activity android:name=".Settings$SupportDashboardActivity"
        <activity android:name=".dashboard.SupportDashboardActivity"
                  android:label="@string/page_tab_title_support"
                  android:icon="@drawable/ic_help"
                  android:theme="@android:style/Theme.NoDisplay"
                  android:enabled="@bool/config_support_enabled">
            <intent-filter android:priority="-2">
                <action android:name="com.android.settings.action.SETTINGS"/>
            </intent-filter>
            <meta-data android:name="com.android.settings.category"
                       android:value="com.android.settings.category.ia.homepage"/>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.dashboard.SupportFragment"/>
            <meta-data android:name="com.android.settings.summary"
                       android:resource="@string/support_summary"/>
        </activity>
+1 −1
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ public class Settings extends SettingsActivity {
        }
    }
    public static class WebViewAppPickerActivity extends SettingsActivity { /* empty */ }
    public static class LegacySupportActivity extends SettingsActivity{ /* empty */ }

    // Top level categories for new IA
    public static class NetworkDashboardActivity extends SettingsActivity {}
@@ -177,6 +178,5 @@ public class Settings extends SettingsActivity {
    public static class StorageDashboardActivity extends SettingsActivity {}
    public static class UserAndAccountDashboardActivity extends SettingsActivity {}
    public static class SystemDashboardActivity extends SettingsActivity {}
    public static class SupportDashboardActivity extends SettingsActivity {}

}
+0 −1
Original line number Diff line number Diff line
@@ -262,7 +262,6 @@ public class SettingsGateway {
            Settings.SecuritySettingsActivity.class.getName(),
            Settings.AccessibilitySettingsActivity.class.getName(),
            Settings.SystemDashboardActivity.class.getName(),
            Settings.SupportDashboardActivity.class.getName(),
            // Home page > Network & Internet
            Settings.WifiSettingsActivity.class.getName(),
            Settings.DataUsageSummaryActivity.class.getName(),
+46 −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.dashboard;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.android.settings.Settings.LegacySupportActivity;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.overlay.SupportFeatureProvider;

/**
 * Trampoline activity that decides which version of support should be shown to the user.
 */
public class SupportDashboardActivity extends Activity {

    public SupportDashboardActivity() {}

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SupportFeatureProvider supportFeatureProvider = FeatureFactory.getFactory(this)
                .getSupportFeatureProvider(this);

        // try to launch support v2 if we have the feature provider
        if (supportFeatureProvider != null && supportFeatureProvider.isSupportV2Enabled()) {
            supportFeatureProvider.startSupportV2(this);
        } else {
            startActivity(new Intent(this, LegacySupportActivity.class));
        }
        finish();
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -128,6 +128,19 @@ public interface SupportFeatureProvider {
     */
    void startSupport(Activity activity, Account account, @SupportType int type);

    /**
     * Starts support v2, invokes the support home page. Will no-op if support v2 is not enabled.
     *
     * @param activity Calling activity.
     */
    void startSupportV2(Activity activity);

    /**
     * Checks if support v2 is enabled for this device.
     * @return a boolean indicating if support v2 is enabled.
     */
    boolean isSupportV2Enabled();

    /**
     * Returns an {@link Intent} that opens help and allow user get help on sign in.
     */