Merge "Do not use hidden API Binder.withCleanCallingIdentity"
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
diff --git a/src/com/android/services/telephony/EmergencyTonePlayer.java b/src/com/android/services/telephony/EmergencyTonePlayer.java
index 8e26349..431f8d7 100644
--- a/src/com/android/services/telephony/EmergencyTonePlayer.java
+++ b/src/com/android/services/telephony/EmergencyTonePlayer.java
@@ -23,7 +23,6 @@
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.ToneGenerator;
-import android.os.SystemVibrator;
import android.os.Vibrator;
import android.provider.Settings;
@@ -49,11 +48,9 @@
.setUsage(AudioAttributes.USAGE_VOICE_COMMUNICATION)
.build();
- // We don't rely on getSystemService(Context.VIBRATOR_SERVICE) to make sure that this vibrator
- // object will be isolated from others.
- private final Vibrator mVibrator = new SystemVibrator();
private final Context mContext;
private final AudioManager mAudioManager;
+ private final Vibrator mVibrator;
private ToneGenerator mToneGenerator;
private int mSavedInCallVolume;
@@ -62,6 +59,7 @@
EmergencyTonePlayer(Context context) {
mContext = context;
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
}
public void start() {