Hide default phone preference when there is no phone app. am: dc1e04035b

am: 0ae351771e

Change-Id: I8751c22c53b66b69f1a8a4d20f4997bb40316764
This commit is contained in:
Fan Zhang
2016-08-22 20:06:26 +00:00
committed by android-build-merger

View File

@@ -82,9 +82,13 @@ public class DefaultPhonePreference extends AppListPreference implements SelfAva
return false; return false;
} }
final UserManager um = final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
(UserManager) context.getSystemService(Context.USER_SERVICE); final boolean hasUserRestriction =
return !um.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS); 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) { public static boolean hasPhonePreference(String pkg, Context context) {