Loading src/com/android/server/telecom/PhoneAccountRegistrar.java +1 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ public class PhoneAccountRegistrar { int subId = getSubscriptionIdForPhoneAccount(accountHandle); mSubscriptionManager.setDefaultVoiceSubId(subId); } Log.i(this, "setUserSelectedOutgoingPhoneAccount: %s", accountHandle); mState.defaultOutgoingAccountHandles .put(userHandle, new DefaultPhoneAccountHandle(userHandle, accountHandle, account.getGroupId())); Loading src/com/android/server/telecom/TelecomServiceImpl.java +18 −1 Original line number Diff line number Diff line Loading @@ -137,10 +137,14 @@ public class TelecomServiceImpl { } @Override public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() { public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount(String callingPackage) { synchronized (mLock) { try { Log.startSession("TSI.gUSOPA"); if (!isDialerOrPrivileged(callingPackage, "getDefaultOutgoingPhoneAccount")) { throw new SecurityException("Only the default dialer, or caller with " + "READ_PRIVILEGED_PHONE_STATE can call this method."); } final UserHandle callingUserHandle = Binder.getCallingUserHandle(); return mPhoneAccountRegistrar.getUserSelectedOutgoingPhoneAccount( callingUserHandle); Loading Loading @@ -1909,6 +1913,19 @@ public class TelecomServiceImpl { } } private boolean isDialerOrPrivileged(String callingPackage, String message) { // The system/default dialer can always read phone state - so that emergency calls will // still work. if (isPrivilegedDialerCalling(callingPackage)) { return true; } mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE, message); // SKIP checking run-time OP_READ_PHONE_STATE since caller or self has PRIVILEGED // permission return true; } private boolean isSelfManagedConnectionService(PhoneAccountHandle phoneAccountHandle) { if (phoneAccountHandle != null) { PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccountUnchecked( Loading tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import static android.Manifest.permission.MODIFY_PHONE_STATE; import static android.Manifest.permission.READ_PHONE_STATE; import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE; import android.annotation.MainThread; import android.annotation.WorkerThread; import android.app.ActivityManager; import android.app.AppOpsManager; import android.content.ComponentName; Loading Loading @@ -271,7 +273,8 @@ public class TelecomServiceImplTest extends TelecomTestCase { makeMultiUserPhoneAccount(TEL_PA_HANDLE_16).build()); PhoneAccountHandle returnedHandle = mTSIBinder.getUserSelectedOutgoingPhoneAccount(); = mTSIBinder.getUserSelectedOutgoingPhoneAccount( TEL_PA_HANDLE_16.getComponentName().getPackageName()); assertEquals(TEL_PA_HANDLE_16, returnedHandle); } Loading Loading
src/com/android/server/telecom/PhoneAccountRegistrar.java +1 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ public class PhoneAccountRegistrar { int subId = getSubscriptionIdForPhoneAccount(accountHandle); mSubscriptionManager.setDefaultVoiceSubId(subId); } Log.i(this, "setUserSelectedOutgoingPhoneAccount: %s", accountHandle); mState.defaultOutgoingAccountHandles .put(userHandle, new DefaultPhoneAccountHandle(userHandle, accountHandle, account.getGroupId())); Loading
src/com/android/server/telecom/TelecomServiceImpl.java +18 −1 Original line number Diff line number Diff line Loading @@ -137,10 +137,14 @@ public class TelecomServiceImpl { } @Override public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() { public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount(String callingPackage) { synchronized (mLock) { try { Log.startSession("TSI.gUSOPA"); if (!isDialerOrPrivileged(callingPackage, "getDefaultOutgoingPhoneAccount")) { throw new SecurityException("Only the default dialer, or caller with " + "READ_PRIVILEGED_PHONE_STATE can call this method."); } final UserHandle callingUserHandle = Binder.getCallingUserHandle(); return mPhoneAccountRegistrar.getUserSelectedOutgoingPhoneAccount( callingUserHandle); Loading Loading @@ -1909,6 +1913,19 @@ public class TelecomServiceImpl { } } private boolean isDialerOrPrivileged(String callingPackage, String message) { // The system/default dialer can always read phone state - so that emergency calls will // still work. if (isPrivilegedDialerCalling(callingPackage)) { return true; } mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE, message); // SKIP checking run-time OP_READ_PHONE_STATE since caller or self has PRIVILEGED // permission return true; } private boolean isSelfManagedConnectionService(PhoneAccountHandle phoneAccountHandle) { if (phoneAccountHandle != null) { PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccountUnchecked( Loading
tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import static android.Manifest.permission.MODIFY_PHONE_STATE; import static android.Manifest.permission.READ_PHONE_STATE; import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE; import android.annotation.MainThread; import android.annotation.WorkerThread; import android.app.ActivityManager; import android.app.AppOpsManager; import android.content.ComponentName; Loading Loading @@ -271,7 +273,8 @@ public class TelecomServiceImplTest extends TelecomTestCase { makeMultiUserPhoneAccount(TEL_PA_HANDLE_16).build()); PhoneAccountHandle returnedHandle = mTSIBinder.getUserSelectedOutgoingPhoneAccount(); = mTSIBinder.getUserSelectedOutgoingPhoneAccount( TEL_PA_HANDLE_16.getComponentName().getPackageName()); assertEquals(TEL_PA_HANDLE_16, returnedHandle); } Loading