Loading src/com/android/server/telecom/TelecomServiceImpl.java +48 −49 Original line number Diff line number Diff line Loading @@ -226,11 +226,11 @@ public class TelecomServiceImpl { public List<PhoneAccountHandle> getSelfManagedPhoneAccounts(String callingPackage, String callingFeatureId) { try { Log.startSession("TSI.gSMPA", Log.getPackageAbbreviation(callingPackage)); try { if (canReadPhoneState(callingPackage, callingFeatureId, Log.startSession("TSI.gSMPA", Log.getPackageAbbreviation(callingPackage)); if (!canReadPhoneState(callingPackage, callingFeatureId, "Requires READ_PHONE_STATE permission.")) { throw new SecurityException("Requires READ_PHONE_STATE permission."); } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); Loading @@ -244,13 +244,19 @@ public class TelecomServiceImpl { Binder.restoreCallingIdentity(token); } } } finally { Log.endSession(); } } catch (SecurityException e) { // SecurityException thrown from canReadPhoneState(...) due to READ_PHONE_STATE // permission. check MANAGE_OWN_CALLS permission next. } if (canReadMangeOwnCalls("Requires MANAGE_OWN_CALLS permission")) { @Override public List<PhoneAccountHandle> getOwnSelfManagedPhoneAccounts(String callingPackage, String callingFeatureId) { try { Log.startSession("TSI.gOSMPA", Log.getPackageAbbreviation(callingPackage)); if (!canReadMangeOwnCalls("Requires MANAGE_OWN_CALLS permission.")) { throw new SecurityException("Requires MANAGE_OWN_CALLS permission."); } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); Loading @@ -266,27 +272,11 @@ public class TelecomServiceImpl { Binder.restoreCallingIdentity(token); } } } else { throw new SecurityException( "Requires caller to be the default dialer app or at least one of the " + "following permissions READ_PRIVILEGED_PHONE_STATE, " + "READ_PHONE_STATE, or MANAGE_OWN_CALLS for the calling " + "package: " + callingPackage); } } finally { Log.endSession(); } } private boolean canReadMangeOwnCalls(String message) { try { mContext.enforceCallingOrSelfPermission(MANAGE_OWN_CALLS, message); return true; } catch (SecurityException e) { return false; } } @Override public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme, String callingPackage) { Loading Loading @@ -2464,6 +2454,15 @@ public class TelecomServiceImpl { } } private boolean canReadMangeOwnCalls(String message) { try { mContext.enforceCallingOrSelfPermission(MANAGE_OWN_CALLS, message); return true; } catch (SecurityException e) { return false; } } private boolean canReadPhoneNumbers(String callingPackage, String callingFeatureId, String message) { boolean targetSdkPreR = false; Loading Loading
src/com/android/server/telecom/TelecomServiceImpl.java +48 −49 Original line number Diff line number Diff line Loading @@ -226,11 +226,11 @@ public class TelecomServiceImpl { public List<PhoneAccountHandle> getSelfManagedPhoneAccounts(String callingPackage, String callingFeatureId) { try { Log.startSession("TSI.gSMPA", Log.getPackageAbbreviation(callingPackage)); try { if (canReadPhoneState(callingPackage, callingFeatureId, Log.startSession("TSI.gSMPA", Log.getPackageAbbreviation(callingPackage)); if (!canReadPhoneState(callingPackage, callingFeatureId, "Requires READ_PHONE_STATE permission.")) { throw new SecurityException("Requires READ_PHONE_STATE permission."); } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); Loading @@ -244,13 +244,19 @@ public class TelecomServiceImpl { Binder.restoreCallingIdentity(token); } } } finally { Log.endSession(); } } catch (SecurityException e) { // SecurityException thrown from canReadPhoneState(...) due to READ_PHONE_STATE // permission. check MANAGE_OWN_CALLS permission next. } if (canReadMangeOwnCalls("Requires MANAGE_OWN_CALLS permission")) { @Override public List<PhoneAccountHandle> getOwnSelfManagedPhoneAccounts(String callingPackage, String callingFeatureId) { try { Log.startSession("TSI.gOSMPA", Log.getPackageAbbreviation(callingPackage)); if (!canReadMangeOwnCalls("Requires MANAGE_OWN_CALLS permission.")) { throw new SecurityException("Requires MANAGE_OWN_CALLS permission."); } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); Loading @@ -266,27 +272,11 @@ public class TelecomServiceImpl { Binder.restoreCallingIdentity(token); } } } else { throw new SecurityException( "Requires caller to be the default dialer app or at least one of the " + "following permissions READ_PRIVILEGED_PHONE_STATE, " + "READ_PHONE_STATE, or MANAGE_OWN_CALLS for the calling " + "package: " + callingPackage); } } finally { Log.endSession(); } } private boolean canReadMangeOwnCalls(String message) { try { mContext.enforceCallingOrSelfPermission(MANAGE_OWN_CALLS, message); return true; } catch (SecurityException e) { return false; } } @Override public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme, String callingPackage) { Loading Loading @@ -2464,6 +2454,15 @@ public class TelecomServiceImpl { } } private boolean canReadMangeOwnCalls(String message) { try { mContext.enforceCallingOrSelfPermission(MANAGE_OWN_CALLS, message); return true; } catch (SecurityException e) { return false; } } private boolean canReadPhoneNumbers(String callingPackage, String callingFeatureId, String message) { boolean targetSdkPreR = false; Loading