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

Commit 68d207ec authored by Andrew Lee's avatar Andrew Lee Committed by Android (Google) Code Review
Browse files

Merge "Add functions for setting/getting phone accounts." into lmp-dev

parents 9a61f948 59cac3a8
Loading
Loading
Loading
Loading
+64 −1
Original line number Diff line number Diff line
@@ -284,6 +284,20 @@ public class TelecommManager {
        return null;
    }

    /**
     * Sets the default account for making outgoing phone calls.
     * @hide
     */
    public void setDefaultOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
        try {
            if (isServiceConnected()) {
                getTelecommService().setDefaultOutgoingPhoneAccount(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecommService#setDefaultOutgoingPhoneAccount");
        }
    }

    /**
     * Return a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
     * calls.
@@ -302,6 +316,55 @@ public class TelecommManager {
        return new ArrayList<>();
    }

    /**
     * Returns the current SIM call manager. Apps must be prepared for this method to return
     * {@code null}, indicating that there currently exists no user-chosen default
     * {@code PhoneAccount}.
     * @return The phone account handle of the current sim call manager.
     * @hide
     */
    public PhoneAccountHandle getSimCallManager() {
        try {
            if (isServiceConnected()) {
                return getTelecommService().getSimCallManager();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecommService#getSimCallManager");
        }
        return null;
    }

    /**
     * Sets the SIM call manager to the specified phone account.
     * @param accountHandle The phone account handle of the account to set as the sim call manager.
     * @hide
     */
    public void setSimCallManager(PhoneAccountHandle accountHandle) {
        try {
            if (isServiceConnected()) {
                getTelecommService().setSimCallManager(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecommService#setSimCallManager");
        }
    }

    /**
     * Returns the list of registered SIM call managers.
     * @return List of registered SIM call managers.
     * @hide
     */
    public List<PhoneAccountHandle> getSimCallManagers() {
        try {
            if (isServiceConnected()) {
                return getTelecommService().getSimCallManagers();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecommService#getSimCallManagers");
        }
        return new ArrayList<>();
    }

    /**
     * Determine whether the device has more than one account registered and enabled.
     *
+37 −17
Original line number Diff line number Diff line
@@ -35,37 +35,57 @@ interface ITelecommService {
    void showInCallScreen(boolean showDialpad);

    /**
     * @see TelecommManager#getDefaultOutgoingPhoneAccount
     * @see TelecommServiceImpl#getDefaultOutgoingPhoneAccount
     */
    PhoneAccountHandle getDefaultOutgoingPhoneAccount();

    /**
     * @see TelecommManager#getOutgoingPhoneAccounts
     * @see TelecommServiceImpl#setDefaultOutgoingPhoneAccount
     */
    void setDefaultOutgoingPhoneAccount(in PhoneAccountHandle account);

    /**
     * @see TelecommServiceImpl#getOutgoingPhoneAccounts
     */
    List<PhoneAccountHandle> getOutgoingPhoneAccounts();

    /**
     * @see TelecommManager#getPhoneAccount
     * @see TelecommServiceImpl#getPhoneAccount
     */
    PhoneAccount getPhoneAccount(in PhoneAccountHandle account);

    /**
     * @see TelecommManager#registerPhoneAccount
     * @see TelecommServiceImpl#getSimCallManager
     */
    PhoneAccountHandle getSimCallManager();

    /**
     * @see TelecommServiceImpl#setSimCallManager
     */
    void setSimCallManager(in PhoneAccountHandle account);

    /**
     * @see TelecommServiceImpl#getSimCallManagers
     */
    List<PhoneAccountHandle> getSimCallManagers();

    /**
     * @see TelecommServiceImpl#registerPhoneAccount
     */
    void registerPhoneAccount(in PhoneAccount metadata);

    /**
     * @see TelecommManager#unregisterPhoneAccount
     * @see TelecommServiceImpl#unregisterPhoneAccount
     */
    void unregisterPhoneAccount(in PhoneAccountHandle account);

    /**
     * @see TelecommManager#clearAccounts
     * @see TelecommServiceImpl#clearAccounts
     */
    void clearAccounts(String packageName);

    /**
     * @see TelecommManager#getDefaultPhoneApp
     * @see TelecommServiceImpl#getDefaultPhoneApp
     */
    ComponentName getDefaultPhoneApp();

@@ -74,52 +94,52 @@ interface ITelecommService {
    //

    /**
     * @see TelecommManager#silenceRinger
     * @see TelecommServiceImpl#silenceRinger
     */
    void silenceRinger();

    /**
     * @see TelecommManager#isInCall
     * @see TelecommServiceImpl#isInCall
     */
    boolean isInCall();

    /**
     * @see TelecomManager#isRinging
     * @see TelecommServiceImpl#isRinging
     */
    boolean isRinging();

    /**
     * @see TelecommManager#endCall
     * @see TelecommServiceImpl#endCall
     */
    boolean endCall();

    /**
     * @see TelecommManager#acceptRingingCall
     * @see TelecommServiceImpl#acceptRingingCall
     */
    void acceptRingingCall();

    /**
     * @see TelecommManager#cancelMissedCallsNotification
     * @see TelecommServiceImpl#cancelMissedCallsNotification
     */
    void cancelMissedCallsNotification();

    /**
     * @see TelecommManager#handleMmi
     * @see TelecommServiceImpl#handleMmi
     */
    boolean handlePinMmi(String dialString);

    /**
     * @see TelecomManager#isTtySupported
     * @see TelecommServiceImpl#isTtySupported
     */
    boolean isTtySupported();

    /**
     * @see TelecomManager#getCurrentTtyMode
     * @see TelecommServiceImpl#getCurrentTtyMode
     */
    int getCurrentTtyMode();

    /**
     * @see TelecommManager#addNewIncomingCall
     * @see TelecommServiceImpl#addNewIncomingCall
     */
    void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras);
}