use of android.telecom.PhoneAccountHandle in project platform_frameworks_base by android.
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 platform_frameworks_base by android.
the class Telecom method runUnregisterPhoneAccount.
private void runUnregisterPhoneAccount() throws RemoteException {
final PhoneAccountHandle handle = getPhoneAccountHandleFromArgs();
mTelecomService.unregisterPhoneAccount(handle);
System.out.println("Success - " + handle + " unregistered.");
}
use of android.telecom.PhoneAccountHandle in project platform_frameworks_base by android.
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 platform_frameworks_base by android.
the class TelecomLoaderService method registerDefaultAppProviders.
private void registerDefaultAppProviders() {
final PackageManagerInternal packageManagerInternal = LocalServices.getService(PackageManagerInternal.class);
// Set a callback for the package manager to query the default sms app.
packageManagerInternal.setSmsAppPackagesProvider(new PackageManagerInternal.PackagesProvider() {
@Override
public String[] getPackages(int userId) {
synchronized (mLock) {
if (mServiceConnection == null) {
if (mDefaultSmsAppRequests == null) {
mDefaultSmsAppRequests = new IntArray();
}
mDefaultSmsAppRequests.add(userId);
return null;
}
}
ComponentName smsComponent = SmsApplication.getDefaultSmsApplication(mContext, true);
if (smsComponent != null) {
return new String[] { smsComponent.getPackageName() };
}
return null;
}
});
// Set a callback for the package manager to query the default dialer app.
packageManagerInternal.setDialerAppPackagesProvider(new PackageManagerInternal.PackagesProvider() {
@Override
public String[] getPackages(int userId) {
synchronized (mLock) {
if (mServiceConnection == null) {
if (mDefaultDialerAppRequests == null) {
mDefaultDialerAppRequests = new IntArray();
}
mDefaultDialerAppRequests.add(userId);
return null;
}
}
String packageName = DefaultDialerManager.getDefaultDialerApplication(mContext);
if (packageName != null) {
return new String[] { packageName };
}
return null;
}
});
// Set a callback for the package manager to query the default sim call manager.
packageManagerInternal.setSimCallManagerPackagesProvider(new PackageManagerInternal.PackagesProvider() {
@Override
public String[] getPackages(int userId) {
synchronized (mLock) {
if (mServiceConnection == null) {
if (mDefaultSimCallManagerRequests == null) {
mDefaultSimCallManagerRequests = new IntArray();
}
mDefaultSimCallManagerRequests.add(userId);
return null;
}
}
TelecomManager telecomManager = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
PhoneAccountHandle phoneAccount = telecomManager.getSimCallManager(userId);
if (phoneAccount != null) {
return new String[] { phoneAccount.getComponentName().getPackageName() };
}
return null;
}
});
}
use of android.telecom.PhoneAccountHandle in project android_frameworks_base by DirtyUnicorns.
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);
}
Aggregations