use of android.telecom.TelecomManager in project android_frameworks_base by DirtyUnicorns.
the class ActivityManagerService method stopLockTaskMode.
@Override
public void stopLockTaskMode() {
final TaskRecord lockTask = mStackSupervisor.getLockedTaskLocked();
if (lockTask == null) {
// Our work here is done.
return;
}
final int callingUid = Binder.getCallingUid();
final int lockTaskUid = lockTask.mLockTaskUid;
final int lockTaskModeState = mStackSupervisor.getLockTaskModeState();
if (lockTaskModeState == ActivityManager.LOCK_TASK_MODE_NONE) {
// Done.
return;
} else {
// {@link MANAGE_ACTIVITY_STACKS} can stop any lock task.
if (checkCallingPermission(MANAGE_ACTIVITY_STACKS) != PERMISSION_GRANTED && callingUid != lockTaskUid && (lockTaskUid != 0 || callingUid != lockTask.effectiveUid)) {
throw new SecurityException("Invalid uid, expected " + lockTaskUid + " callingUid=" + callingUid + " effectiveUid=" + lockTask.effectiveUid);
}
}
long ident = Binder.clearCallingIdentity();
try {
Log.d(TAG, "stopLockTaskMode");
// Stop lock task
synchronized (this) {
mStackSupervisor.setLockTaskModeLocked(null, ActivityManager.LOCK_TASK_MODE_NONE, "stopLockTask", true);
}
TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
if (tm != null) {
tm.showInCallScreen(false);
}
} finally {
Binder.restoreCallingIdentity(ident);
}
}
use of android.telecom.TelecomManager in project android_frameworks_base by DirtyUnicorns.
the class ZenModeFiltering method isDefaultPhoneApp.
private boolean isDefaultPhoneApp(String pkg) {
if (mDefaultPhoneApp == null) {
final TelecomManager telecomm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
mDefaultPhoneApp = telecomm != null ? telecomm.getDefaultPhoneApp() : null;
if (DEBUG)
Slog.d(TAG, "Default phone app: " + mDefaultPhoneApp);
}
return pkg != null && mDefaultPhoneApp != null && pkg.equals(mDefaultPhoneApp.getPackageName());
}
use of android.telecom.TelecomManager in project android_frameworks_base by DirtyUnicorns.
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.TelecomManager in project android_frameworks_base by AOSPA.
the class SimSwitchController method setVoicePref.
private void setVoicePref(int slotId) {
final TelecomManager telecomManager = TelecomManager.from(mContext);
int subId = -1;
logd("Setting voice pref slotId " + slotId);
if (mSubInfoList != null) {
int subInfoLength = mSubInfoList.size();
for (int i = 0; i < subInfoLength; ++i) {
final SubscriptionInfo sir = mSubInfoList.get(i);
if (sir != null && sir.getSimSlotIndex() == slotId) {
subId = sir.getSubscriptionId();
logd("Setting voice pref slotId " + slotId + " subId " + subId);
PhoneAccountHandle phoneAccountHandle = subscriptionIdToPhoneAccountHandle(subId);
telecomManager.setUserSelectedOutgoingPhoneAccount(phoneAccountHandle);
break;
}
}
}
updateViews(slotId);
}
use of android.telecom.TelecomManager in project android_frameworks_base by AOSPA.
the class SimSwitchController method getVoicePrefSlot.
private int getVoicePrefSlot() {
final TelecomManager telecomManager = TelecomManager.from(mContext);
final PhoneAccountHandle phoneAccount = telecomManager.getUserSelectedOutgoingPhoneAccount();
final TelephonyManager telephonyManager = TelephonyManager.from(mContext);
int slotId = -1;
if (phoneAccount == null) {
logd("Get voice pref slotId " + slotId);
return slotId;
}
PhoneAccount phoneaccount = telecomManager.getPhoneAccount(phoneAccount);
if (phoneaccount != null && (mSubInfoList != null)) {
int subId = telephonyManager.getSubIdForPhoneAccount(phoneaccount);
int subInfoLength = mSubInfoList.size();
for (int i = 0; i < subInfoLength; ++i) {
final SubscriptionInfo sir = mSubInfoList.get(i);
if (sir != null && sir.getSubscriptionId() == subId) {
slotId = sir.getSimSlotIndex();
break;
}
}
}
logd("Get voice pref slotId " + slotId);
return slotId;
}
Aggregations