Loading src/com/android/server/telecom/CallsManager.java +16 −14 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom; import android.app.ActivityManager; import android.app.KeyguardManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.pm.UserInfo; Loading Loading @@ -516,20 +517,6 @@ public class CallsManager extends Call.ListenerBase return; } // Check DISALLOW_OUTGOING_CALLS restriction. // Only ecbm calls are allowed through when users with the DISALLOW_OUTGOING_CALLS // restriction are the current user. final UserManager userManager = (UserManager) mContext.getSystemService( Context.USER_SERVICE); if (userManager.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS, mCurrentUserHandle)) { Log.w(this, "Rejecting non-ecbm phone call due to DISALLOW_INCOMING_CALLS " + "restriction"); incomingCall.reject(false, null); mCallLogManager.logCall(incomingCall, Calls.MISSED_TYPE, false /* showNotification */); return; } List<IncomingCallFilter.CallFilter> filters = new ArrayList<>(); filters.add(new DirectToVoicemailCallFilter(mCallerInfoLookupHelper)); filters.add(new AsyncBlockCheckFilter(mContext, new BlockCheckerAdapter(), Loading Loading @@ -3170,6 +3157,21 @@ public class CallsManager extends Call.ListenerBase } } public boolean isReplyWithSmsAllowed(int uid) { UserHandle callingUser = UserHandle.of(UserHandle.getUserId(uid)); UserManager userManager = mContext.getSystemService(UserManager.class); KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class); boolean isUserRestricted = userManager != null && userManager.hasUserRestriction(UserManager.DISALLOW_SMS, callingUser); boolean isLockscreenRestricted = keyguardManager != null && keyguardManager.isDeviceLocked(); Log.d(this, "isReplyWithSmsAllowed: isUserRestricted: %s, isLockscreenRestricted: %s", isUserRestricted, isLockscreenRestricted); // TODO(hallliu): actually check the lockscreen once b/77731473 is fixed return !isUserRestricted; } /** * Blocks execution until all Telecom handlers have completed their current work. */ Loading src/com/android/server/telecom/InCallAdapter.java +3 −13 Original line number Diff line number Diff line Loading @@ -16,12 +16,9 @@ package com.android.server.telecom; import android.content.Context; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.telecom.Log; import android.telecom.PhoneAccountHandle; Loading @@ -35,16 +32,14 @@ import java.util.List; * binding to it. This adapter can receive commands and updates until the in-call app is unbound. */ class InCallAdapter extends IInCallAdapter.Stub { private final Context mContext; private final CallsManager mCallsManager; private final CallIdMapper mCallIdMapper; private final TelecomSystem.SyncRoot mLock; private final String mOwnerComponentName; /** Persists the specified parameters. */ public InCallAdapter(Context context, CallsManager callsManager, CallIdMapper callIdMapper, public InCallAdapter(CallsManager callsManager, CallIdMapper callIdMapper, TelecomSystem.SyncRoot lock, String ownerComponentName) { mContext = context; mCallsManager = callsManager; mCallIdMapper = callIdMapper; mLock = lock; Loading Loading @@ -101,17 +96,12 @@ class InCallAdapter extends IInCallAdapter.Stub { public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) { try { Log.startSession(LogUtils.Sessions.ICA_REJECT_CALL, mOwnerComponentName); UserHandle callingUser = UserHandle.of(UserHandle.getUserId(Binder.getCallingUid())); UserManager userManager = mContext.getSystemService(UserManager.class); // Check to make sure the in-call app's user isn't restricted from sending SMS. If so, // silently drop the outgoing message. if (rejectWithMessage && userManager.hasUserRestriction( UserManager.DISALLOW_SMS, callingUser)) { // silently drop the outgoing message. Also drop message if the screen is locked. if (!mCallsManager.isReplyWithSmsAllowed(Binder.getCallingUid())) { rejectWithMessage = false; textMessage = null; } long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Loading src/com/android/server/telecom/InCallController.java +0 −1 Original line number Diff line number Diff line Loading @@ -1309,7 +1309,6 @@ public class InCallController extends CallsManagerListenerBase { try { inCallService.setInCallAdapter( new InCallAdapter( mContext, mCallsManager, mCallIdMapper, mLock, Loading Loading
src/com/android/server/telecom/CallsManager.java +16 −14 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom; import android.app.ActivityManager; import android.app.KeyguardManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.pm.UserInfo; Loading Loading @@ -516,20 +517,6 @@ public class CallsManager extends Call.ListenerBase return; } // Check DISALLOW_OUTGOING_CALLS restriction. // Only ecbm calls are allowed through when users with the DISALLOW_OUTGOING_CALLS // restriction are the current user. final UserManager userManager = (UserManager) mContext.getSystemService( Context.USER_SERVICE); if (userManager.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS, mCurrentUserHandle)) { Log.w(this, "Rejecting non-ecbm phone call due to DISALLOW_INCOMING_CALLS " + "restriction"); incomingCall.reject(false, null); mCallLogManager.logCall(incomingCall, Calls.MISSED_TYPE, false /* showNotification */); return; } List<IncomingCallFilter.CallFilter> filters = new ArrayList<>(); filters.add(new DirectToVoicemailCallFilter(mCallerInfoLookupHelper)); filters.add(new AsyncBlockCheckFilter(mContext, new BlockCheckerAdapter(), Loading Loading @@ -3170,6 +3157,21 @@ public class CallsManager extends Call.ListenerBase } } public boolean isReplyWithSmsAllowed(int uid) { UserHandle callingUser = UserHandle.of(UserHandle.getUserId(uid)); UserManager userManager = mContext.getSystemService(UserManager.class); KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class); boolean isUserRestricted = userManager != null && userManager.hasUserRestriction(UserManager.DISALLOW_SMS, callingUser); boolean isLockscreenRestricted = keyguardManager != null && keyguardManager.isDeviceLocked(); Log.d(this, "isReplyWithSmsAllowed: isUserRestricted: %s, isLockscreenRestricted: %s", isUserRestricted, isLockscreenRestricted); // TODO(hallliu): actually check the lockscreen once b/77731473 is fixed return !isUserRestricted; } /** * Blocks execution until all Telecom handlers have completed their current work. */ Loading
src/com/android/server/telecom/InCallAdapter.java +3 −13 Original line number Diff line number Diff line Loading @@ -16,12 +16,9 @@ package com.android.server.telecom; import android.content.Context; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.telecom.Log; import android.telecom.PhoneAccountHandle; Loading @@ -35,16 +32,14 @@ import java.util.List; * binding to it. This adapter can receive commands and updates until the in-call app is unbound. */ class InCallAdapter extends IInCallAdapter.Stub { private final Context mContext; private final CallsManager mCallsManager; private final CallIdMapper mCallIdMapper; private final TelecomSystem.SyncRoot mLock; private final String mOwnerComponentName; /** Persists the specified parameters. */ public InCallAdapter(Context context, CallsManager callsManager, CallIdMapper callIdMapper, public InCallAdapter(CallsManager callsManager, CallIdMapper callIdMapper, TelecomSystem.SyncRoot lock, String ownerComponentName) { mContext = context; mCallsManager = callsManager; mCallIdMapper = callIdMapper; mLock = lock; Loading Loading @@ -101,17 +96,12 @@ class InCallAdapter extends IInCallAdapter.Stub { public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) { try { Log.startSession(LogUtils.Sessions.ICA_REJECT_CALL, mOwnerComponentName); UserHandle callingUser = UserHandle.of(UserHandle.getUserId(Binder.getCallingUid())); UserManager userManager = mContext.getSystemService(UserManager.class); // Check to make sure the in-call app's user isn't restricted from sending SMS. If so, // silently drop the outgoing message. if (rejectWithMessage && userManager.hasUserRestriction( UserManager.DISALLOW_SMS, callingUser)) { // silently drop the outgoing message. Also drop message if the screen is locked. if (!mCallsManager.isReplyWithSmsAllowed(Binder.getCallingUid())) { rejectWithMessage = false; textMessage = null; } long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Loading
src/com/android/server/telecom/InCallController.java +0 −1 Original line number Diff line number Diff line Loading @@ -1309,7 +1309,6 @@ public class InCallController extends CallsManagerListenerBase { try { inCallService.setInCallAdapter( new InCallAdapter( mContext, mCallsManager, mCallIdMapper, mLock, Loading