-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Reproduction steps:
- log into Owner
- Block a number
- switch to secondary
- call from the blocked number <= the phone will ring
I've investigated this issue and found that numbers blocked by the owner are not used in the in the secondary (once the ui is exposed, this is clear to see).
I have made a collection of changes to fix this, however I need some changes by Graphene first:
Fork this repo:
https://android.googlesource.com/platform/packages/providers/BlockedNumberProvider
and add to the androidManfest.xml
I then intend to add a new restriction to the secondary profile :
DISALLOW_BLOCK_CALLS
This will then be checked in the BlockedNumberProvider:
` private boolean canCurrentUserBlockUsers() {
int currentUserId = getContext().getUserId();
if (!android.multiuser.Flags.allowMainUserToAccessBlockedNumberProvider()) {
UserManager userManager = getContext().getSystemService(UserManager.class);
// Allow USER_SYSTEM and managed profile to block users
return (
currentUserId == UserHandle.USER_SYSTEM
|| (userManager != null && userManager.isManagedProfile(currentUserId))
);
} else {
// Allow SYSTEM user and users with messaging support to block users
UserManager userManager = getContext().getSystemService(UserManager.class);
return (
currentUserId == UserHandle.USER_SYSTEM
|| isMainUserOrManagedProfile(currentUserId)
|| isAuthorisedToBlockCallsSecondaryAccount(currentUserId)
);
}
}
private boolean isAuthorisedToBlockCallsSecondaryAccount(int currentUserId){
UserManager userManager = getContext().getSystemService(UserManager.class);
return userManager != null &&
!userManager.hasUserRestrictionForUser(UserManager.DISALLOW_BLOCK_CALLS, UserHandle.of(currentUserId));
}`