Merge cherrypicks of [12620612, 12620613, 12620936, 12620457, 12616684, 12621005, 12620883, 12620884, 12620846, 12620847, 12620869, 12620848, 12620849, 12620961, 12620962, 12620827, 12620614, 12620197, 12620885, 12620198, 12621039, 12621040, 12621041, 12620937, 12620615, 12620886] into rvc-release
Change-Id: I4f296a0c6ad2a517c923728b53e484797fe7c44e
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index 62e0f3f..9ccae9a 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -279,6 +279,23 @@
@Override
public List<PhoneAccountHandle> getPhoneAccountsForPackage(String packageName) {
+ //TODO: Deprecate this in S
+ try {
+ enforceCallingPackage(packageName);
+ } catch (SecurityException se1) {
+ EventLog.writeEvent(0x534e4554, "153995334", Binder.getCallingUid(),
+ "getPhoneAccountsForPackage: invalid calling package");
+ throw se1;
+ }
+
+ try {
+ enforcePermission(READ_PRIVILEGED_PHONE_STATE);
+ } catch (SecurityException se2) {
+ EventLog.writeEvent(0x534e4554, "153995334", Binder.getCallingUid(),
+ "getPhoneAccountsForPackage: no permission");
+ throw se2;
+ }
+
synchronized (mLock) {
final UserHandle callingUserHandle = Binder.getCallingUserHandle();
long token = Binder.clearCallingIdentity();