use of android.telecom.PhoneAccountHandle in project platform_frameworks_base by android.
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 robolectric by robolectric.
the class ShadowTelecomManager method getPhoneAccountsForPackage.
@Implementation
public List<PhoneAccountHandle> getPhoneAccountsForPackage() {
Context context = ReflectionHelpers.getField(realObject, "mContext");
List<PhoneAccountHandle> results = new LinkedList<>();
for (PhoneAccountHandle handle : accounts.keySet()) {
if (handle.getComponentName().getPackageName().equals(context.getPackageName())) {
results.add(handle);
}
}
return results;
}
use of android.telecom.PhoneAccountHandle in project robolectric by robolectric.
the class ShadowTelecomManager method getCallCapablePhoneAccounts.
@Implementation(minSdk = M)
public List<PhoneAccountHandle> getCallCapablePhoneAccounts(boolean includeDisabledAccounts) {
List<PhoneAccountHandle> result = new LinkedList<>();
for (PhoneAccountHandle handle : accounts.keySet()) {
PhoneAccount phoneAccount = accounts.get(handle);
if (!phoneAccount.isEnabled() && !includeDisabledAccounts) {
continue;
}
result.add(handle);
}
return result;
}
use of android.telecom.PhoneAccountHandle in project robolectric by robolectric.
the class ShadowTelecomManagerTest method getCallCapablePhoneAccounts.
@Test
@Config(minSdk = M)
public void getCallCapablePhoneAccounts() {
PhoneAccountHandle callCapableHandle = createHandle("id1");
telecomService.registerPhoneAccount(PhoneAccount.builder(callCapableHandle, "enabled").setIsEnabled(true).build());
PhoneAccountHandle notCallCapableHandler = createHandle("id2");
telecomService.registerPhoneAccount(PhoneAccount.builder(notCallCapableHandler, "disabled").setIsEnabled(false).build());
List<PhoneAccountHandle> callCapablePhoneAccounts = telecomService.getCallCapablePhoneAccounts();
assertThat(callCapablePhoneAccounts).contains(callCapableHandle);
assertThat(callCapablePhoneAccounts).doesNotContain(notCallCapableHandler);
}
use of android.telecom.PhoneAccountHandle in project robolectric by robolectric.
the class ShadowTelecomManagerTest method clearAccountsForPackage.
@Test
@Config(minSdk = LOLLIPOP_MR1)
public void clearAccountsForPackage() {
PhoneAccountHandle accountHandle1 = createHandle("a.package", "id1");
telecomService.registerPhoneAccount(PhoneAccount.builder(accountHandle1, "another_package").build());
PhoneAccountHandle accountHandle2 = createHandle("some.other.package", "id2");
telecomService.registerPhoneAccount(PhoneAccount.builder(accountHandle2, "another_package").build());
telecomService.clearAccountsForPackage(accountHandle1.getComponentName().getPackageName());
assertThat(telecomService.getPhoneAccount(accountHandle1)).isNull();
assertThat(telecomService.getPhoneAccount(accountHandle2)).isNotNull();
}
Aggregations