Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc6fc606 authored by Fan Zhang's avatar Fan Zhang
Browse files

Hide default phone preference when there is no phone app.

Bug: 29859821
Change-Id: Ia6de0de04d74f4f947243f38ac2bd190ae586401
parent d599f43a
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -82,9 +82,13 @@ public class DefaultPhonePreference extends AppListPreference implements SelfAva
            return false;
        }

        final UserManager um =
                (UserManager) context.getSystemService(Context.USER_SERVICE);
        return !um.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS);
        final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
        final boolean hasUserRestriction =
                um.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS);
        final CharSequence[] entries = getEntries();
        return !hasUserRestriction
                && entries != null
                && entries.length > 0;
    }

    public static boolean hasPhonePreference(String pkg, Context context) {