Add ability to switch between support versions
Creates a trampoline activity and adds functionality to the SupportFeatureProvider interface so that we can conditionally launch support V1 or V2. Test: Test in ag/2144016 Bug: 37306241 Change-Id: I6d24e65cad91692e457ea216713e90239845b4f5
This commit is contained in:
@@ -2957,6 +2957,11 @@
|
|||||||
android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" />
|
android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" />
|
||||||
</activity>
|
</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 -->
|
<!-- Information architecture host activities -->
|
||||||
|
|
||||||
<!-- Alias for battery settings in new IA. Remove and merge metadata into TargetActivity -->
|
<!-- Alias for battery settings in new IA. Remove and merge metadata into TargetActivity -->
|
||||||
@@ -3006,17 +3011,16 @@
|
|||||||
android:resource="@string/system_dashboard_summary"/>
|
android:resource="@string/system_dashboard_summary"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".Settings$SupportDashboardActivity"
|
<activity android:name=".dashboard.SupportDashboardActivity"
|
||||||
android:label="@string/page_tab_title_support"
|
android:label="@string/page_tab_title_support"
|
||||||
android:icon="@drawable/ic_help"
|
android:icon="@drawable/ic_help"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay"
|
||||||
android:enabled="@bool/config_support_enabled">
|
android:enabled="@bool/config_support_enabled">
|
||||||
<intent-filter android:priority="-2">
|
<intent-filter android:priority="-2">
|
||||||
<action android:name="com.android.settings.action.SETTINGS"/>
|
<action android:name="com.android.settings.action.SETTINGS"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.category"
|
<meta-data android:name="com.android.settings.category"
|
||||||
android:value="com.android.settings.category.ia.homepage"/>
|
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"
|
<meta-data android:name="com.android.settings.summary"
|
||||||
android:resource="@string/support_summary"/>
|
android:resource="@string/support_summary"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
@@ -168,6 +168,7 @@ public class Settings extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class WebViewAppPickerActivity extends SettingsActivity { /* empty */ }
|
public static class WebViewAppPickerActivity extends SettingsActivity { /* empty */ }
|
||||||
|
public static class LegacySupportActivity extends SettingsActivity{ /* empty */ }
|
||||||
|
|
||||||
// Top level categories for new IA
|
// Top level categories for new IA
|
||||||
public static class NetworkDashboardActivity extends SettingsActivity {}
|
public static class NetworkDashboardActivity extends SettingsActivity {}
|
||||||
@@ -176,6 +177,5 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class StorageDashboardActivity extends SettingsActivity {}
|
public static class StorageDashboardActivity extends SettingsActivity {}
|
||||||
public static class UserAndAccountDashboardActivity extends SettingsActivity {}
|
public static class UserAndAccountDashboardActivity extends SettingsActivity {}
|
||||||
public static class SystemDashboardActivity extends SettingsActivity {}
|
public static class SystemDashboardActivity extends SettingsActivity {}
|
||||||
public static class SupportDashboardActivity extends SettingsActivity {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -260,7 +260,6 @@ public class SettingsGateway {
|
|||||||
Settings.SecuritySettingsActivity.class.getName(),
|
Settings.SecuritySettingsActivity.class.getName(),
|
||||||
Settings.AccessibilitySettingsActivity.class.getName(),
|
Settings.AccessibilitySettingsActivity.class.getName(),
|
||||||
Settings.SystemDashboardActivity.class.getName(),
|
Settings.SystemDashboardActivity.class.getName(),
|
||||||
Settings.SupportDashboardActivity.class.getName(),
|
|
||||||
// Home page > Network & Internet
|
// Home page > Network & Internet
|
||||||
Settings.WifiSettingsActivity.class.getName(),
|
Settings.WifiSettingsActivity.class.getName(),
|
||||||
Settings.DataUsageSummaryActivity.class.getName(),
|
Settings.DataUsageSummaryActivity.class.getName(),
|
||||||
|
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
@@ -128,6 +128,19 @@ public interface SupportFeatureProvider {
|
|||||||
*/
|
*/
|
||||||
void startSupport(Activity activity, Account account, @SupportType int type);
|
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.
|
* Returns an {@link Intent} that opens help and allow user get help on sign in.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user