Don't show afw default app pref if there is no candidate.
Change-Id: I25f077662264406a8a4d819db7b4713be753a33b Fix: 22564285 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -42,7 +42,11 @@ public class DefaultPhonePreferenceController extends DefaultAppPreferenceContro
|
||||
final boolean hasUserRestriction =
|
||||
um.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS);
|
||||
|
||||
return !hasUserRestriction;
|
||||
if (hasUserRestriction) {
|
||||
return false;
|
||||
}
|
||||
final List<String> candidates = getCandidates();
|
||||
return candidates != null && !candidates.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,6 +64,10 @@ public class DefaultPhonePreferenceController extends DefaultAppPreferenceContro
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getCandidates() {
|
||||
return DefaultDialerManager.getInstalledDialerApplications(mContext, mUserId);
|
||||
}
|
||||
|
||||
public static boolean hasPhonePreference(String pkg, Context context) {
|
||||
List<String> dialerPackages =
|
||||
DefaultDialerManager.getInstalledDialerApplications(context, UserHandle.myUserId());
|
||||
|
Reference in New Issue
Block a user