Loading src/com/android/server/telecom/TelecomServiceImpl.java +100 −32 Original line number Original line Diff line number Diff line Loading @@ -204,10 +204,16 @@ public class TelecomServiceImpl { String callingPackage) { String callingPackage) { try { try { Log.startSession("TSI.gPASS"); Log.startSession("TSI.gPASS"); synchronized (mLock) { try { if (!canReadPhoneState(callingPackage, "getPhoneAccountsSupportingScheme")) { enforceModifyPermission( "getPhoneAccountsSupportingScheme requires MODIFY_PHONE_STATE"); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getPhoneAccountsSupportingScheme: " + callingPackage); return Collections.emptyList(); return Collections.emptyList(); } } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { Loading Loading @@ -270,33 +276,57 @@ public class TelecomServiceImpl { @Override @Override public int getAllPhoneAccountsCount() { public int getAllPhoneAccountsCount() { synchronized (mLock) { try { try { Log.startSession("TSI.gAPAC"); Log.startSession("TSI.gAPAC"); try { enforceModifyPermission( "getAllPhoneAccountsCount requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getAllPhoneAccountsCount"); throw e; } synchronized (mLock) { try { // This list is pre-filtered for the calling user. // This list is pre-filtered for the calling user. return getAllPhoneAccounts().size(); return getAllPhoneAccounts().size(); } catch (Exception e) { } catch (Exception e) { Log.e(this, e, "getAllPhoneAccountsCount"); Log.e(this, e, "getAllPhoneAccountsCount"); throw e; throw e; } } } finally { } finally { Log.endSession(); Log.endSession(); } } } } } @Override @Override public List<PhoneAccount> getAllPhoneAccounts() { public List<PhoneAccount> getAllPhoneAccounts() { synchronized (mLock) { synchronized (mLock) { try { Log.startSession("TSI.gAPA"); try { enforceModifyPermission( "getAllPhoneAccounts requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getAllPhoneAccounts"); throw e; } final UserHandle callingUserHandle = Binder.getCallingUserHandle(); final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { Log.startSession("TSI.gAPA"); return mPhoneAccountRegistrar.getAllPhoneAccounts(callingUserHandle); return mPhoneAccountRegistrar.getAllPhoneAccounts(callingUserHandle); } catch (Exception e) { } catch (Exception e) { Log.e(this, e, "getAllPhoneAccounts"); Log.e(this, e, "getAllPhoneAccounts"); throw e; throw e; } finally { } finally { Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); Log.endSession(); } } } } Loading @@ -304,20 +334,32 @@ public class TelecomServiceImpl { @Override @Override public List<PhoneAccountHandle> getAllPhoneAccountHandles() { public List<PhoneAccountHandle> getAllPhoneAccountHandles() { try { Log.startSession("TSI.gAPAH"); try { enforceModifyPermission( "getAllPhoneAccountHandles requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getAllPhoneAccountHandles"); throw e; } synchronized (mLock) { synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { Log.startSession("TSI.gAPAH"); return mPhoneAccountRegistrar.getAllPhoneAccountHandles(callingUserHandle); return mPhoneAccountRegistrar.getAllPhoneAccountHandles(callingUserHandle); } catch (Exception e) { } catch (Exception e) { Log.e(this, e, "getAllPhoneAccounts"); Log.e(this, e, "getAllPhoneAccounts"); throw e; throw e; } finally { } finally { Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token); Log.endSession(); } } } } } finally { Log.endSession(); } } } @Override @Override Loading Loading @@ -682,8 +724,14 @@ public class TelecomServiceImpl { public boolean isRinging(String callingPackage) { public boolean isRinging(String callingPackage) { try { try { Log.startSession("TSI.iR"); Log.startSession("TSI.iR"); if (!canReadPhoneState(callingPackage, "isRinging")) { if (!isPrivilegedDialerCalling(callingPackage)) { return false; try { enforceModifyPermission( "isRinging requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", "isRinging: " + callingPackage); throw e; } } } synchronized (mLock) { synchronized (mLock) { Loading Loading @@ -932,8 +980,15 @@ public class TelecomServiceImpl { public boolean isTtySupported(String callingPackage) { public boolean isTtySupported(String callingPackage) { try { try { Log.startSession("TSI.iTS"); Log.startSession("TSI.iTS"); if (!canReadPhoneState(callingPackage, "hasVoiceMailNumber")) { if (!isPrivilegedDialerCalling(callingPackage)) { return false; try { enforceModifyPermission( "isTtySupported requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", "isTtySupported: " + callingPackage); throw e; } } } synchronized (mLock) { synchronized (mLock) { Loading Loading @@ -1033,6 +1088,15 @@ public class TelecomServiceImpl { public void addNewUnknownCall(PhoneAccountHandle phoneAccountHandle, Bundle extras) { public void addNewUnknownCall(PhoneAccountHandle phoneAccountHandle, Bundle extras) { try { try { Log.startSession("TSI.aNUC"); Log.startSession("TSI.aNUC"); try { enforceModifyPermission( "addNewUnknownCall requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "addNewUnknownCall"); throw e; } synchronized (mLock) { synchronized (mLock) { if (phoneAccountHandle != null && if (phoneAccountHandle != null && phoneAccountHandle.getComponentName() != null) { phoneAccountHandle.getComponentName() != null) { Loading Loading @@ -1516,6 +1580,10 @@ public class TelecomServiceImpl { enforcePermission(MODIFY_PHONE_STATE); enforcePermission(MODIFY_PHONE_STATE); } } private void enforceModifyPermission(String message) { mContext.enforceCallingOrSelfPermission(MODIFY_PHONE_STATE, message); } private void enforcePermission(String permission) { private void enforcePermission(String permission) { mContext.enforceCallingOrSelfPermission(permission, null); mContext.enforceCallingOrSelfPermission(permission, null); } } Loading Loading
src/com/android/server/telecom/TelecomServiceImpl.java +100 −32 Original line number Original line Diff line number Diff line Loading @@ -204,10 +204,16 @@ public class TelecomServiceImpl { String callingPackage) { String callingPackage) { try { try { Log.startSession("TSI.gPASS"); Log.startSession("TSI.gPASS"); synchronized (mLock) { try { if (!canReadPhoneState(callingPackage, "getPhoneAccountsSupportingScheme")) { enforceModifyPermission( "getPhoneAccountsSupportingScheme requires MODIFY_PHONE_STATE"); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getPhoneAccountsSupportingScheme: " + callingPackage); return Collections.emptyList(); return Collections.emptyList(); } } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { Loading Loading @@ -270,33 +276,57 @@ public class TelecomServiceImpl { @Override @Override public int getAllPhoneAccountsCount() { public int getAllPhoneAccountsCount() { synchronized (mLock) { try { try { Log.startSession("TSI.gAPAC"); Log.startSession("TSI.gAPAC"); try { enforceModifyPermission( "getAllPhoneAccountsCount requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getAllPhoneAccountsCount"); throw e; } synchronized (mLock) { try { // This list is pre-filtered for the calling user. // This list is pre-filtered for the calling user. return getAllPhoneAccounts().size(); return getAllPhoneAccounts().size(); } catch (Exception e) { } catch (Exception e) { Log.e(this, e, "getAllPhoneAccountsCount"); Log.e(this, e, "getAllPhoneAccountsCount"); throw e; throw e; } } } finally { } finally { Log.endSession(); Log.endSession(); } } } } } @Override @Override public List<PhoneAccount> getAllPhoneAccounts() { public List<PhoneAccount> getAllPhoneAccounts() { synchronized (mLock) { synchronized (mLock) { try { Log.startSession("TSI.gAPA"); try { enforceModifyPermission( "getAllPhoneAccounts requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getAllPhoneAccounts"); throw e; } final UserHandle callingUserHandle = Binder.getCallingUserHandle(); final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { Log.startSession("TSI.gAPA"); return mPhoneAccountRegistrar.getAllPhoneAccounts(callingUserHandle); return mPhoneAccountRegistrar.getAllPhoneAccounts(callingUserHandle); } catch (Exception e) { } catch (Exception e) { Log.e(this, e, "getAllPhoneAccounts"); Log.e(this, e, "getAllPhoneAccounts"); throw e; throw e; } finally { } finally { Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); Log.endSession(); } } } } Loading @@ -304,20 +334,32 @@ public class TelecomServiceImpl { @Override @Override public List<PhoneAccountHandle> getAllPhoneAccountHandles() { public List<PhoneAccountHandle> getAllPhoneAccountHandles() { try { Log.startSession("TSI.gAPAH"); try { enforceModifyPermission( "getAllPhoneAccountHandles requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getAllPhoneAccountHandles"); throw e; } synchronized (mLock) { synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { Log.startSession("TSI.gAPAH"); return mPhoneAccountRegistrar.getAllPhoneAccountHandles(callingUserHandle); return mPhoneAccountRegistrar.getAllPhoneAccountHandles(callingUserHandle); } catch (Exception e) { } catch (Exception e) { Log.e(this, e, "getAllPhoneAccounts"); Log.e(this, e, "getAllPhoneAccounts"); throw e; throw e; } finally { } finally { Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token); Log.endSession(); } } } } } finally { Log.endSession(); } } } @Override @Override Loading Loading @@ -682,8 +724,14 @@ public class TelecomServiceImpl { public boolean isRinging(String callingPackage) { public boolean isRinging(String callingPackage) { try { try { Log.startSession("TSI.iR"); Log.startSession("TSI.iR"); if (!canReadPhoneState(callingPackage, "isRinging")) { if (!isPrivilegedDialerCalling(callingPackage)) { return false; try { enforceModifyPermission( "isRinging requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", "isRinging: " + callingPackage); throw e; } } } synchronized (mLock) { synchronized (mLock) { Loading Loading @@ -932,8 +980,15 @@ public class TelecomServiceImpl { public boolean isTtySupported(String callingPackage) { public boolean isTtySupported(String callingPackage) { try { try { Log.startSession("TSI.iTS"); Log.startSession("TSI.iTS"); if (!canReadPhoneState(callingPackage, "hasVoiceMailNumber")) { if (!isPrivilegedDialerCalling(callingPackage)) { return false; try { enforceModifyPermission( "isTtySupported requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", "isTtySupported: " + callingPackage); throw e; } } } synchronized (mLock) { synchronized (mLock) { Loading Loading @@ -1033,6 +1088,15 @@ public class TelecomServiceImpl { public void addNewUnknownCall(PhoneAccountHandle phoneAccountHandle, Bundle extras) { public void addNewUnknownCall(PhoneAccountHandle phoneAccountHandle, Bundle extras) { try { try { Log.startSession("TSI.aNUC"); Log.startSession("TSI.aNUC"); try { enforceModifyPermission( "addNewUnknownCall requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "addNewUnknownCall"); throw e; } synchronized (mLock) { synchronized (mLock) { if (phoneAccountHandle != null && if (phoneAccountHandle != null && phoneAccountHandle.getComponentName() != null) { phoneAccountHandle.getComponentName() != null) { Loading Loading @@ -1516,6 +1580,10 @@ public class TelecomServiceImpl { enforcePermission(MODIFY_PHONE_STATE); enforcePermission(MODIFY_PHONE_STATE); } } private void enforceModifyPermission(String message) { mContext.enforceCallingOrSelfPermission(MODIFY_PHONE_STATE, message); } private void enforcePermission(String permission) { private void enforcePermission(String permission) { mContext.enforceCallingOrSelfPermission(permission, null); mContext.enforceCallingOrSelfPermission(permission, null); } } Loading