Remove usage of hidden UserManager api.
Test: basic sanity with secondary users allowing and disallowing
calls
Bug: 137202333
Merged-in: Iec05205bc85601e8ea09d859c57a2ed99933c95d
Change-Id: Iec05205bc85601e8ea09d859c57a2ed99933c95d
(cherry picked from commit 2f489b7fe37d2c42181fb48b1029306616c0265a)
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index bb1e293..475cc1f 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -379,7 +379,7 @@
for (int i = 0; i < users.size(); i++) {
final UserInfo user = users.get(i);
final UserHandle userHandle = user.getUserHandle();
- if (!mUserManager.hasUserRestriction(
+ if (!hasUserRestriction(
UserManager.DISALLOW_OUTGOING_CALLS, userHandle)
&& !user.isManagedProfile()) {
if (!maybeSendVoicemailNotificationUsingDefaultDialer(phone, vmCount, vmNumber,
@@ -397,7 +397,7 @@
for (int i = 0; i < users.size(); i++) {
final UserInfo user = users.get(i);
final UserHandle userHandle = user.getUserHandle();
- if (!mUserManager.hasUserRestriction(
+ if (!hasUserRestriction(
UserManager.DISALLOW_OUTGOING_CALLS, userHandle)
&& !user.isManagedProfile()) {
if (!maybeSendVoicemailNotificationUsingDefaultDialer(phone, 0, null, null,
@@ -412,6 +412,12 @@
}
}
+ private boolean hasUserRestriction(String restrictionKey, UserHandle userHandle) {
+ final List<UserManager.EnforcingUser> sources = mUserManager
+ .getUserRestrictionSources(restrictionKey, userHandle);
+ return (sources != null && !sources.isEmpty());
+ }
+
/**
* Sends a broadcast with the voicemail notification information to the default dialer. This
* method is also used to indicate to the default dialer when to clear the