summaryrefslogtreecommitdiff
path: root/services/robotests
diff options
context:
space:
mode:
authorkholoud mohamed <kholoudm@google.com>2020-03-18 12:49:32 +0000
committerKholoud Mohamed <kholoudm@google.com>2020-03-23 17:23:17 +0000
commit2459a08f86b6d4794a8e95a08b77c4984f9a080a (patch)
tree96e90428ddba50098bbfb93dbb6cd3846afca4fd /services/robotests
parent8c6b17b1ad1c1d2d6687b95d71cf85639d99e0fb (diff)
Add new hidden API in CrossProfileApps and other minor changes
* Added a new hidden API canUserAttemptToConfigureInteractAcrossProfiles to be used in settings. * Changed canRequestToInteractAcrossProfiles to return true when app is not whitelisted by the admin or installed in the other profile, this enables the app to navigate the user to the cross profile settings page were more information about why they can't grant the permission will be provided. Bug: 149742043 Test: atest CrossProfileAppsServiceImplRoboTest Test: atest CrossProfileAppsPermissionHostSideTest Test: CrossProfileAppsTest Change-Id: I9c7734d7ab0c7436d84a27604146ff539e1cb26a
Diffstat (limited to 'services/robotests')
-rw-r--r--services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java b/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java
index fa0febd7f20f..acdb68142178 100644
--- a/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java
+++ b/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java
@@ -419,6 +419,38 @@ public class CrossProfileAppsServiceImplRoboTest {
.isTrue();
}
+ @Test
+ public void canUserAttemptToConfigureInteractAcrossProfiles_packageNotInstalledInProfile_returnsTrue() {
+ mockUninstallCrossProfileAppFromWorkProfile();
+ assertThat(mCrossProfileAppsServiceImpl
+ .canUserAttemptToConfigureInteractAcrossProfiles(CROSS_PROFILE_APP_PACKAGE_NAME))
+ .isTrue();
+ }
+
+ @Test
+ public void canUserAttemptToConfigureInteractAcrossProfiles_packageDoesNotRequestInteractAcrossProfiles_returnsFalse()
+ throws Exception {
+ mockCrossProfileAppDoesNotRequestInteractAcrossProfiles();
+ assertThat(mCrossProfileAppsServiceImpl
+ .canUserAttemptToConfigureInteractAcrossProfiles(CROSS_PROFILE_APP_PACKAGE_NAME))
+ .isFalse();
+ }
+
+ @Test
+ public void canUserAttemptToConfigureInteractAcrossProfiles_packageNotWhitelisted_returnsTrue() {
+ mockCrossProfileAppNotWhitelisted();
+ assertThat(mCrossProfileAppsServiceImpl
+ .canUserAttemptToConfigureInteractAcrossProfiles(CROSS_PROFILE_APP_PACKAGE_NAME))
+ .isTrue();
+ }
+
+ @Test
+ public void canUserAttemptToConfigureInteractAcrossProfiles_returnsTrue() {
+ assertThat(mCrossProfileAppsServiceImpl
+ .canUserAttemptToConfigureInteractAcrossProfiles(CROSS_PROFILE_APP_PACKAGE_NAME))
+ .isTrue();
+ }
+
private void explicitlySetInteractAcrossProfilesAppOp(@Mode int mode) {
explicitlySetInteractAcrossProfilesAppOp(PERSONAL_PROFILE_UID, mode);
}