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.");
}
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);
}
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);
}
}
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);
}
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();
}
}
Aggregations