Fix crash when launching about phone v2 through intent
Change-Id: Ife6c24a7127fc9821760f9f5b58a33437711bc25
Fixes: 73971752
Test: atest
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 63214d5..0f50d71 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -702,16 +702,16 @@
|| somethingChanged;
// Enable/disable the Me Card page.
- final boolean isMeCardEnabled = featureFactory
+ final boolean aboutPhoneV2Enabled = featureFactory
.getAccountFeatureProvider()
- .isMeCardEnabled(this);
+ .isAboutPhoneV2Enabled(this);
somethingChanged = setTileEnabled(new ComponentName(packageName,
Settings.MyDeviceInfoActivity.class.getName()),
- isMeCardEnabled, isAdmin)
+ aboutPhoneV2Enabled, isAdmin)
|| somethingChanged;
somethingChanged = setTileEnabled(new ComponentName(packageName,
Settings.DeviceInfoSettingsActivity.class.getName()),
- !isMeCardEnabled, isAdmin)
+ !aboutPhoneV2Enabled, isAdmin)
|| somethingChanged;
if (UserHandle.MU_ENABLED && !isAdmin) {
diff --git a/src/com/android/settings/accounts/AccountFeatureProvider.java b/src/com/android/settings/accounts/AccountFeatureProvider.java
index bbfc48a..ecde8fe 100644
--- a/src/com/android/settings/accounts/AccountFeatureProvider.java
+++ b/src/com/android/settings/accounts/AccountFeatureProvider.java
@@ -28,7 +28,7 @@
/**
* Checks whether or not to display the new About Phone page.
*/
- default boolean isMeCardEnabled(Context context) {
+ default boolean isAboutPhoneV2Enabled(Context context) {
return FeatureFlagUtils.isEnabled(context, FeatureFlags.ABOUT_PHONE_V2);
}
}
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 468bd3d..51e151e 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -28,6 +28,7 @@
import com.android.settings.TestingSettings;
import com.android.settings.TetherSettings;
import com.android.settings.TrustedCredentialsSettings;
+import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
import com.android.settings.wifi.calling.WifiCallingSettings;
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.accessibility.AccessibilitySettingsForSetupWizard;
@@ -154,6 +155,7 @@
UserDictionarySettings.class.getName(),
DisplaySettings.class.getName(),
DeviceInfoSettings.class.getName(),
+ MyDeviceInfoFragment.class.getName(),
ManageApplications.class.getName(),
ManageAssist.class.getName(),
ProcessStatsUi.class.getName(),
diff --git a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
index 05fe326..8a2d5e3 100644
--- a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
+++ b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
@@ -62,7 +62,7 @@
import java.util.List;
public class MyDeviceInfoFragment extends DashboardFragment {
- private static final String LOG_TAG = "MeCardFragment";
+ private static final String LOG_TAG = "MyDeviceInfoFragment";
private static final String KEY_MY_DEVICE_INFO_HEADER = "my_device_info_header";
private static final String KEY_LEGAL_CONTAINER = "legal_container";
diff --git a/tests/uitests/src/com/android/settings/ui/AboutPhoneSettingsTests.java b/tests/uitests/src/com/android/settings/ui/AboutPhoneSettingsTests.java
index b92a707..738d710 100644
--- a/tests/uitests/src/com/android/settings/ui/AboutPhoneSettingsTests.java
+++ b/tests/uitests/src/com/android/settings/ui/AboutPhoneSettingsTests.java
@@ -52,10 +52,8 @@
// TODO: retrieve using name/ids from com.android.settings package
private static final String[] sResourceTexts = {
"Phone number",
- "SIM status",
- "Model & hardware",
- "MEID",
- "Android version"
+ "Legal information",
+ "Regulatory labels"
};
private UiDevice mDevice;
@@ -94,11 +92,11 @@
}
@Test
- public void testAllMenuEntriesExist() throws Exception {
+ public void testAllMenuEntriesExist() {
searchForItemsAndTakeAction(mDevice, sResourceTexts);
}
- private void launchAboutPhoneSettings(String aboutSetting) throws Exception {
+ private void launchAboutPhoneSettings(String aboutSetting) {
Intent aboutIntent = new Intent(aboutSetting);
aboutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
InstrumentationRegistry.getTargetContext().startActivity(aboutIntent);
@@ -107,8 +105,7 @@
/**
* Removes items found in the view and optionally takes some action.
*/
- private void removeItemsAndTakeAction(UiDevice device, ArrayList<String> itemsLeftToFind)
- throws Exception {
+ private void removeItemsAndTakeAction(UiDevice device, ArrayList<String> itemsLeftToFind) {
for (Iterator<String> iterator = itemsLeftToFind.iterator(); iterator.hasNext(); ) {
String itemText = iterator.next();
UiObject2 item = device.wait(Until.findObject(By.text(itemText)), TIMEOUT);
@@ -124,8 +121,7 @@
* <p>Will scroll down the screen until it has found all elements or reached the bottom.
* This allows elements to be found and acted on even if they change order.
*/
- private void searchForItemsAndTakeAction(UiDevice device, String[] itemsToFind)
- throws Exception {
+ private void searchForItemsAndTakeAction(UiDevice device, String[] itemsToFind) {
ArrayList<String> itemsLeftToFind = new ArrayList<>(Arrays.asList(itemsToFind));
assertWithMessage("There must be at least one item to search for on the screen!")