Merge "Add ability to switch between support versions"

This commit is contained in:
Andrew Sapperstein
2017-05-01 22:37:28 +00:00
committed by Android (Google) Code Review
5 changed files with 67 additions and 5 deletions

View File

@@ -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 {}
}

View File

@@ -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(),

View File

@@ -0,0 +1,46 @@
/*
* 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();
}
}

View File

@@ -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.
*/