add impl for getRegisteredPhoneAccounts
Bug: 307609763
Test: CTS coverage
Change-Id: I20106896ff1d03160ca1989f7975a1a9a034b2aa
diff --git a/flags/telecom_api_flags.aconfig b/flags/telecom_api_flags.aconfig
index f3a2b8a..c44bea4 100644
--- a/flags/telecom_api_flags.aconfig
+++ b/flags/telecom_api_flags.aconfig
@@ -30,6 +30,13 @@
}
flag{
+ name: "get_registered_phone_accounts"
+ namespace: "telecom"
+ description: "When set, self-managed clients can get their own phone accounts"
+ bug: "317132586"
+}
+
+flag{
name: "transactional_video_state"
namespace: "telecom"
description: "when set, clients using transactional implementations will be able to set & get the video state"
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index d4d395a..fab75cf 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -77,7 +77,6 @@
import com.android.internal.telecom.ICallControl;
import com.android.internal.telecom.ICallEventCallback;
import com.android.internal.telecom.ITelecomService;
-import com.android.internal.telephony.flags.Flags;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.telecom.components.UserCallIntentProcessorFactory;
import com.android.server.telecom.flags.FeatureFlags;
@@ -603,6 +602,53 @@
}
@Override
+ public ParceledListSlice<PhoneAccount> getRegisteredPhoneAccounts(String callingPackage,
+ String callingFeatureId) {
+ try {
+ Log.startSession("TSI.gRPA", Log.getPackageAbbreviation(callingPackage));
+ try {
+ enforceCallingPackage(callingPackage, "getRegisteredPhoneAccounts");
+ } catch (SecurityException se) {
+ EventLog.writeEvent(0x534e4554, "307609763", Binder.getCallingUid(),
+ "getRegisteredPhoneAccounts: invalid calling package");
+ throw se;
+ }
+
+ boolean hasCrossUserAccess = false;
+ try {
+ enforceInAppCrossUserPermission();
+ hasCrossUserAccess = true;
+ } catch (SecurityException e) {
+ // pass through
+ }
+
+ synchronized (mLock) {
+ final UserHandle callingUserHandle = Binder.getCallingUserHandle();
+ long token = Binder.clearCallingIdentity();
+ try {
+ return new ParceledListSlice<>(
+ mPhoneAccountRegistrar.getPhoneAccounts(
+ 0 /* capabilities */,
+ 0 /* excludedCapabilities */,
+ null /* UriScheme */,
+ callingPackage,
+ true /* includeDisabledAccounts */,
+ callingUserHandle,
+ hasCrossUserAccess /* crossUserAccess */,
+ false /* includeAll */));
+ } catch (Exception e) {
+ Log.e(this, e, "getRegisteredPhoneAccounts");
+ throw e;
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+ } finally {
+ Log.endSession();
+ }
+ }
+
+ @Override
public int getAllPhoneAccountsCount() {
try {
Log.startSession("TSI.gAPAC");
@@ -3120,7 +3166,6 @@
+ " does not meet the requirements to access the phone number");
}
-
private boolean canReadPrivilegedPhoneState(String callingPackage, String message) {
// The system/default dialer can always read phone state - so that emergency calls will
// still work.