Search in sources :

Example 11 with TelecomManager

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

the class AudioService method isInCommunication.

private boolean isInCommunication() {
    boolean IsInCall = false;
    TelecomManager telecomManager = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
    final long ident = Binder.clearCallingIdentity();
    IsInCall = telecomManager.isInCall();
    Binder.restoreCallingIdentity(ident);
    return (IsInCall || getMode() == AudioManager.MODE_IN_COMMUNICATION);
}
Also used : TelecomManager(android.telecom.TelecomManager)

Example 12 with TelecomManager

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

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());
}
Also used : TelecomManager(android.telecom.TelecomManager)

Example 13 with TelecomManager

use of android.telecom.TelecomManager in project platform_frameworks_base by android.

the class AudioService method isInCommunication.

private boolean isInCommunication() {
    boolean IsInCall = false;
    TelecomManager telecomManager = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
    final long ident = Binder.clearCallingIdentity();
    IsInCall = telecomManager.isInCall();
    Binder.restoreCallingIdentity(ident);
    return (IsInCall || getMode() == AudioManager.MODE_IN_COMMUNICATION);
}
Also used : TelecomManager(android.telecom.TelecomManager)

Example 14 with TelecomManager

use of android.telecom.TelecomManager in project platform_frameworks_base by android.

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());
}
Also used : TelecomManager(android.telecom.TelecomManager)

Example 15 with TelecomManager

use of android.telecom.TelecomManager 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;
        }
    });
}
Also used : IntArray(android.util.IntArray) PhoneAccountHandle(android.telecom.PhoneAccountHandle) PackageManagerInternal(android.content.pm.PackageManagerInternal) ComponentName(android.content.ComponentName) TelecomManager(android.telecom.TelecomManager)

Aggregations

TelecomManager (android.telecom.TelecomManager)86 PhoneAccountHandle (android.telecom.PhoneAccountHandle)45 PhoneAccount (android.telecom.PhoneAccount)30 TelephonyManager (android.telephony.TelephonyManager)17 SubscriptionInfo (android.telephony.SubscriptionInfo)11 KeyEvent (android.view.KeyEvent)9 ArrayList (java.util.ArrayList)9 AlertDialog (android.app.AlertDialog)8 ActivityNotFoundException (android.content.ActivityNotFoundException)8 DialogInterface (android.content.DialogInterface)8 Message (android.os.Message)8 SubscriptionManager (android.telephony.SubscriptionManager)8 Dialog (android.app.Dialog)7 ListAdapter (android.widget.ListAdapter)7 Intent (android.content.Intent)6 Preference (android.support.v7.preference.Preference)6 ComponentName (android.content.ComponentName)4 PackageManagerInternal (android.content.pm.PackageManagerInternal)4 RemoteException (android.os.RemoteException)4 IntArray (android.util.IntArray)4