Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6adcf928 authored by Hui Wang's avatar Hui Wang Committed by Android (Google) Code Review
Browse files

Merge "Update phone account APIs for work profile split mode" into main

parents f2874b20 65d91e86
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42801,6 +42801,7 @@ package android.telecom {
    method @Deprecated @RequiresPermission(android.Manifest.permission.ANSWER_PHONE_CALLS) public boolean endCall();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.net.Uri getAdnUriForPhoneAccount(android.telecom.PhoneAccountHandle);
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts();
    method @FlaggedApi("com.android.internal.telephony.flags.work_profile_api_split") @NonNull @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.INTERACT_ACROSS_PROFILES}) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccountsAcrossProfiles();
    method public String getDefaultDialerPackage();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(String);
    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}, conditional=true) public String getLine1Number(android.telecom.PhoneAccountHandle);
+1 −0
Original line number Diff line number Diff line
@@ -13516,6 +13516,7 @@ package android.telecom {
    method public java.util.List<android.telecom.PhoneAccount> getAllPhoneAccounts();
    method public int getAllPhoneAccountsCount();
    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts(boolean);
    method @FlaggedApi("com.android.internal.telephony.flags.work_profile_api_split") @NonNull @RequiresPermission(allOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.INTERACT_ACROSS_PROFILES}) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccountsAcrossProfiles(boolean);
    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}, conditional=true) public int getCallState();
    method public android.telecom.PhoneAccountHandle getConnectionManager();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCurrentTtyMode();
+50 −1
Original line number Diff line number Diff line
@@ -1348,6 +1348,24 @@ public class TelecomManager {
        return getCallCapablePhoneAccounts(false);
    }

    /**
     * Returns a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
     * calls. The returned list includes those accounts which have been explicitly enabled by
     * the user or other users visible to the user.
     *
     * @see #EXTRA_PHONE_ACCOUNT_HANDLE
     * @return A list of {@code PhoneAccountHandle} objects.
     *
     * @throws IllegalStateException if telecom service is null.
     */
    @FlaggedApi(com.android.internal.telephony.flags.Flags.FLAG_WORK_PROFILE_API_SPLIT)
    @RequiresPermission(allOf = {android.Manifest.permission.READ_PHONE_STATE,
            android.Manifest.permission.INTERACT_ACROSS_PROFILES})
    public @NonNull List<PhoneAccountHandle> getCallCapablePhoneAccountsAcrossProfiles() {
        return getCallCapablePhoneAccountsAcrossProfiles(false);
    }


    /**
     * Returns a list of {@link PhoneAccountHandle}s for all self-managed
     * {@link ConnectionService}s owned by the calling {@link UserHandle}.
@@ -1423,7 +1441,7 @@ public class TelecomManager {
        if (service != null) {
            try {
                return service.getCallCapablePhoneAccounts(includeDisabledAccounts,
                        mContext.getOpPackageName(), mContext.getAttributionTag()).getList();
                        mContext.getOpPackageName(), mContext.getAttributionTag(), false).getList();
            } catch (RemoteException e) {
                Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts("
                        + includeDisabledAccounts + ")", e);
@@ -1432,6 +1450,37 @@ public class TelecomManager {
        return new ArrayList<>();
    }

    /**
     * Returns a list of {@link PhoneAccountHandle}s visible to current user including those which
     * have not been enabled by the user.
     *
     * @param includeDisabledAccounts When {@code true}, disabled phone accounts will be included,
     *                                when {@code false}, only enabled phone accounts will be
     *                                included.
     * @return A list of {@code PhoneAccountHandle} objects.
     *
     * @throws IllegalStateException if telecom service is null.
     * @hide
     */
    @SystemApi
    @FlaggedApi(com.android.internal.telephony.flags.Flags.FLAG_WORK_PROFILE_API_SPLIT)
    @RequiresPermission(allOf = {android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
            android.Manifest.permission.INTERACT_ACROSS_PROFILES})
    public @NonNull List<PhoneAccountHandle> getCallCapablePhoneAccountsAcrossProfiles(
            boolean includeDisabledAccounts) {
        ITelecomService service = getTelecomService();
        if (service == null) {
            throw new IllegalStateException("telecom service is null.");
        }

        try {
            return service.getCallCapablePhoneAccounts(includeDisabledAccounts,
                    mContext.getOpPackageName(), mContext.getAttributionTag(), true).getList();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    /**
     *  Returns a list of all {@link PhoneAccount}s registered for the calling package.
     *
+2 −1
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ interface ITelecomService {
     * @see TelecomServiceImpl#getCallCapablePhoneAccounts
     */
    ParceledListSlice<PhoneAccountHandle> getCallCapablePhoneAccounts(
            boolean includeDisabledAccounts, String callingPackage, String callingFeatureId);
            boolean includeDisabledAccounts, String callingPackage,
            String callingFeatureId, boolean acrossProfiles);

    /**
     * @see TelecomServiceImpl#getSelfManagedPhoneAccounts