Remove default admin support message for an Enterprise device

Bug: 182195172
Test: m RunSettingsRoboTests ROBOTEST_FILTER=ActionDisabledByAdminDialogHelperTest

Change-Id: Ie844eee14ff0cc6a1c2f9dd0485c865f4e5e3e72
This commit is contained in:
Salud Lemus
2021-03-08 21:51:33 +00:00
parent 50527b1f63
commit 52565ad5e9
3 changed files with 21 additions and 25 deletions

View File

@@ -10487,8 +10487,6 @@
<string name="disabled_by_policy_title_suspend_packages">Cant open this app</string>
<!-- Dialog title. This dialog lets a user know that a specific setting is blocked by their credit provider. Since the user purchased the device from the credit provider, the credit provider controls what they can access. [CHAR LIMIT=50] -->
<string name="disabled_by_policy_title_financed_device">Blocked by your credit provider</string>
<!-- Shown when the user tries to change a settings locked by an admin [CHAR LIMIT=200] -->
<string name="default_admin_support_msg">If you have questions, contact your IT admin</string>
<!-- Shown in dialog to allow user to see more information about the device admin [CHAR LIMIT=30] -->
<string name="admin_support_more_info">More details</string>
<!-- Shown in admin details page to warn user about policies the admin can set in a work profile. [CHAR LIMIT=NONE] -->

View File

@@ -233,8 +233,6 @@ public class ActionDisabledByAdminDialogHelper {
final TextView textView = root.findViewById(R.id.admin_support_msg);
if (supportMessage != null) {
textView.setText(supportMessage);
} else if (!isFinancedDevice()) {
textView.setText(R.string.default_admin_support_msg);
}
}

View File

@@ -194,6 +194,27 @@ public class ActionDisabledByAdminDialogHelperTest {
assertEquals("some message", Shadows.shadowOf(textView).innerText());
}
@Test
public void testSetAdminSupportDetails_shortSupportMessageIsNull() {
final ShadowDevicePolicyManager dpmShadow = ShadowDevicePolicyManager.getShadow();
final UserManager userManager = RuntimeEnvironment.application.getSystemService(
UserManager.class);
final ShadowUserManager userManagerShadow = Shadow.extract(userManager);
final ViewGroup view = new FrameLayout(mActivity);
final ComponentName component = new ComponentName("some.package.name",
"some.package.name.SomeClass");
final EnforcedAdmin admin = new EnforcedAdmin(component, UserHandle.of(123));
final TextView textView = createAdminSupportTextView(view, mActivity);
dpmShadow.setShortSupportMessageForUser(component, 123, null);
dpmShadow.setIsAdminActiveAsUser(true);
createShadowWorkProfile(userManagerShadow);
mHelper.setAdminSupportDetails(mActivity, view, admin);
assertNotNull(admin.component);
assertEquals("", Shadows.shadowOf(textView).innerText());
}
@Test
public void testSetAdminSupportDetailsNotAdmin() {
final ShadowDevicePolicyManager dpmShadow = ShadowDevicePolicyManager.getShadow();
@@ -212,27 +233,6 @@ public class ActionDisabledByAdminDialogHelperTest {
mHelper.setAdminSupportDetails(mActivity, textView, admin);
assertNull(admin.component);
assertEquals(mActivity.getString(R.string.default_admin_support_msg),
Shadows.shadowOf(textView).innerText());
}
@Test
public void testSetAdminSupportDetailsForFinancedDevice_shortSupportMessageIsNull() {
final ShadowDevicePolicyManager dpmShadow = ShadowDevicePolicyManager.getShadow();
final UserManager userManager = RuntimeEnvironment.application.getSystemService(
UserManager.class);
final ShadowUserManager userManagerShadow = Shadow.extract(userManager);
final ViewGroup view = new FrameLayout(mActivity);
final ComponentName component = new ComponentName("some.package.name",
"some.package.name.SomeClass");
final EnforcedAdmin admin = new EnforcedAdmin(component, UserHandle.of(123));
final TextView textView = createAdminSupportTextView(view, mActivity);
setupFinancedDevice(dpmShadow);
createShadowWorkProfile(userManagerShadow);
mHelper.setAdminSupportDetails(mActivity, view, admin);
assertNotNull(admin.component);
assertEquals("", Shadows.shadowOf(textView).innerText());
}