diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2343ac29fb3..7abdf278a3b 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2952,6 +2952,11 @@ android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" /> + + + + @@ -3001,17 +3006,16 @@ android:resource="@string/system_dashboard_summary"/> - - diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index e2404ec8c24..2e6aed088f3 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -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 {} } diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java index 1973c4440ba..b8cf856eeae 100644 --- a/src/com/android/settings/core/gateway/SettingsGateway.java +++ b/src/com/android/settings/core/gateway/SettingsGateway.java @@ -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(), diff --git a/src/com/android/settings/dashboard/SupportDashboardActivity.java b/src/com/android/settings/dashboard/SupportDashboardActivity.java new file mode 100644 index 00000000000..6cd6612b9fc --- /dev/null +++ b/src/com/android/settings/dashboard/SupportDashboardActivity.java @@ -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(); + } +} diff --git a/src/com/android/settings/overlay/SupportFeatureProvider.java b/src/com/android/settings/overlay/SupportFeatureProvider.java index 0f8d42475e5..18314861bba 100644 --- a/src/com/android/settings/overlay/SupportFeatureProvider.java +++ b/src/com/android/settings/overlay/SupportFeatureProvider.java @@ -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. */