Search in sources :

Example 16 with PhoneAccountHandle

use of android.telecom.PhoneAccountHandle in project android_frameworks_base by AOSPA.

the class Telecom method runRegisterPhoneAccount.

private void runRegisterPhoneAccount() throws RemoteException {
    final PhoneAccountHandle handle = getPhoneAccountHandleFromArgs();
    final String label = nextArgRequired();
    PhoneAccount account = PhoneAccount.builder(handle, label).setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER).build();
    mTelecomService.registerPhoneAccount(account);
    System.out.println("Success - " + handle + " registered.");
}
Also used : PhoneAccount(android.telecom.PhoneAccount) PhoneAccountHandle(android.telecom.PhoneAccountHandle)

Example 17 with PhoneAccountHandle

use of android.telecom.PhoneAccountHandle in project android_frameworks_base by AOSPA.

the class Telecom method getPhoneAccountHandleFromArgs.

private PhoneAccountHandle getPhoneAccountHandleFromArgs() throws RemoteException {
    final ComponentName component = parseComponentName(nextArgRequired());
    final String accountId = nextArgRequired();
    final String userSnInStr = nextArgRequired();
    UserHandle userHandle;
    try {
        final int userSn = Integer.parseInt(userSnInStr);
        userHandle = UserHandle.of(mUserManager.getUserHandle(userSn));
    } catch (NumberFormatException ex) {
        throw new IllegalArgumentException("Invalid user serial number " + userSnInStr);
    }
    return new PhoneAccountHandle(component, accountId, userHandle);
}
Also used : PhoneAccountHandle(android.telecom.PhoneAccountHandle) UserHandle(android.os.UserHandle) ComponentName(android.content.ComponentName)

Example 18 with PhoneAccountHandle

use of android.telecom.PhoneAccountHandle in project android_frameworks_base by ResurrectionRemix.

the class TelecomLoaderService method updateSimCallManagerPermissions.

private void updateSimCallManagerPermissions(PackageManagerInternal packageManagerInternal, int userId) {
    TelecomManager telecomManager = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
    PhoneAccountHandle phoneAccount = telecomManager.getSimCallManager(userId);
    if (phoneAccount != null) {
        Slog.i(TAG, "updating sim call manager permissions for userId:" + userId);
        String packageName = phoneAccount.getComponentName().getPackageName();
        packageManagerInternal.grantDefaultPermissionsToDefaultSimCallManager(packageName, userId);
    }
}
Also used : PhoneAccountHandle(android.telecom.PhoneAccountHandle) TelecomManager(android.telecom.TelecomManager)

Example 19 with PhoneAccountHandle

use of android.telecom.PhoneAccountHandle in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SimSettings method updateCallValues.

private void updateCallValues() {
    final Preference simPref = findPreference(KEY_CALLS);
    final TelecomManager telecomManager = TelecomManager.from(mContext);
    final PhoneAccountHandle phoneAccountHandle = telecomManager.getUserSelectedOutgoingPhoneAccount();
    final List<PhoneAccountHandle> allPhoneAccounts = telecomManager.getCallCapablePhoneAccounts();
    simPref.setTitle(R.string.calls_title);
    PhoneAccount phoneAccount = null;
    if (phoneAccountHandle != null) {
        phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle);
    }
    simPref.setSummary(phoneAccount == null ? mContext.getResources().getString(R.string.sim_calls_ask_first_prefs_title) : (String) phoneAccount.getLabel());
    simPref.setEnabled(allPhoneAccounts.size() > 1);
}
Also used : PhoneAccount(android.telecom.PhoneAccount) PhoneAccountHandle(android.telecom.PhoneAccountHandle) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) TelecomManager(android.telecom.TelecomManager)

Example 20 with PhoneAccountHandle

use of android.telecom.PhoneAccountHandle in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SimDialogActivity method displayPreferredDialog.

private void displayPreferredDialog(final int slotId) {
    final Resources res = getResources();
    final Context context = getApplicationContext();
    final SubscriptionInfo sir = SubscriptionManager.from(context).getActiveSubscriptionInfoForSimSlotIndex(slotId);
    if (sir != null) {
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
        alertDialogBuilder.setTitle(R.string.sim_preferred_title);
        alertDialogBuilder.setMessage(res.getString(R.string.sim_preferred_message, sir.getDisplayName()));
        alertDialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int id) {
                final int subId = sir.getSubscriptionId();
                PhoneAccountHandle phoneAccountHandle = subscriptionIdToPhoneAccountHandle(subId);
                setDefaultDataSubId(context, subId);
                setDefaultSmsSubId(context, subId);
                setUserSelectedOutgoingPhoneAccount(phoneAccountHandle);
                finish();
            }
        });
        alertDialogBuilder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int id) {
                finish();
            }
        });
        alertDialogBuilder.create().show();
    } else {
        finish();
    }
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog) PhoneAccountHandle(android.telecom.PhoneAccountHandle) DialogInterface(android.content.DialogInterface) SubscriptionInfo(android.telephony.SubscriptionInfo) Resources(android.content.res.Resources)

Aggregations

PhoneAccountHandle (android.telecom.PhoneAccountHandle)49 PhoneAccount (android.telecom.PhoneAccount)17 TelecomManager (android.telecom.TelecomManager)14 ComponentName (android.content.ComponentName)9 Test (org.junit.Test)7 UserHandle (android.os.UserHandle)5 PackageManagerInternal (android.content.pm.PackageManagerInternal)4 SubscriptionInfo (android.telephony.SubscriptionInfo)4 TelephonyManager (android.telephony.TelephonyManager)4 IntArray (android.util.IntArray)4 Config (org.robolectric.annotation.Config)3 AlertDialog (android.app.AlertDialog)2 Context (android.content.Context)2 DialogInterface (android.content.DialogInterface)2 LinkedList (java.util.LinkedList)2 Implementation (org.robolectric.annotation.Implementation)2 Dialog (android.app.Dialog)1 Resources (android.content.res.Resources)1 SwitchPreference (android.support.v14.preference.SwitchPreference)1 Preference (android.support.v7.preference.Preference)1