Loading src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesDetails.java +3 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,9 @@ public class InteractAcrossProfilesDetails extends AppInfoBase Context context, String packageName) { UserManager userManager = context.getSystemService(UserManager.class); UserHandle workProfile = InteractAcrossProfilesSettings.getWorkProfile(userManager); if (workProfile == null) { return false; } UserHandle personalProfile = userManager.getProfileParent(workProfile); return context.getSystemService( CrossProfileApps.class).canConfigureInteractAcrossProfiles(packageName) Loading tests/robotests/src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesDetailsTest.java +16 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class InteractAcrossProfilesDetailsTest { assertThat(InteractAcrossProfilesDetails.getPreferenceSummary( mContext, CROSS_PROFILE_PACKAGE_NAME)) .isEqualTo(mContext.getString(R.string.app_permission_summary_allowed)); .isEqualTo(mContext.getString(R.string.interact_across_profiles_summary_allowed)); } @Test Loading @@ -98,7 +98,21 @@ public class InteractAcrossProfilesDetailsTest { assertThat(InteractAcrossProfilesDetails.getPreferenceSummary( mContext, CROSS_PROFILE_PACKAGE_NAME)) .isEqualTo(mContext.getString(R.string.app_permission_summary_not_allowed)); .isEqualTo(mContext.getString( R.string.interact_across_profiles_summary_not_allowed)); } @Test public void getPreferenceSummary_noWorkProfile_returnsNotAllowed() { shadowOf(mUserManager).addUser( PERSONAL_PROFILE_ID, "personal-profile"/* name */, 0/* flags */); shadowOf(mPackageManager).setInstalledPackagesForUserId( PERSONAL_PROFILE_ID, ImmutableList.of(CROSS_PROFILE_PACKAGE_NAME)); assertThat(InteractAcrossProfilesDetails.getPreferenceSummary( mContext, CROSS_PROFILE_PACKAGE_NAME)) .isEqualTo(mContext.getString( R.string.interact_across_profiles_summary_not_allowed)); } private PermissionInfo createCrossProfilesPermissionInfo() { Loading Loading
src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesDetails.java +3 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,9 @@ public class InteractAcrossProfilesDetails extends AppInfoBase Context context, String packageName) { UserManager userManager = context.getSystemService(UserManager.class); UserHandle workProfile = InteractAcrossProfilesSettings.getWorkProfile(userManager); if (workProfile == null) { return false; } UserHandle personalProfile = userManager.getProfileParent(workProfile); return context.getSystemService( CrossProfileApps.class).canConfigureInteractAcrossProfiles(packageName) Loading
tests/robotests/src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesDetailsTest.java +16 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class InteractAcrossProfilesDetailsTest { assertThat(InteractAcrossProfilesDetails.getPreferenceSummary( mContext, CROSS_PROFILE_PACKAGE_NAME)) .isEqualTo(mContext.getString(R.string.app_permission_summary_allowed)); .isEqualTo(mContext.getString(R.string.interact_across_profiles_summary_allowed)); } @Test Loading @@ -98,7 +98,21 @@ public class InteractAcrossProfilesDetailsTest { assertThat(InteractAcrossProfilesDetails.getPreferenceSummary( mContext, CROSS_PROFILE_PACKAGE_NAME)) .isEqualTo(mContext.getString(R.string.app_permission_summary_not_allowed)); .isEqualTo(mContext.getString( R.string.interact_across_profiles_summary_not_allowed)); } @Test public void getPreferenceSummary_noWorkProfile_returnsNotAllowed() { shadowOf(mUserManager).addUser( PERSONAL_PROFILE_ID, "personal-profile"/* name */, 0/* flags */); shadowOf(mPackageManager).setInstalledPackagesForUserId( PERSONAL_PROFILE_ID, ImmutableList.of(CROSS_PROFILE_PACKAGE_NAME)); assertThat(InteractAcrossProfilesDetails.getPreferenceSummary( mContext, CROSS_PROFILE_PACKAGE_NAME)) .isEqualTo(mContext.getString( R.string.interact_across_profiles_summary_not_allowed)); } private PermissionInfo createCrossProfilesPermissionInfo() { Loading