Hide default phone preference when there is no phone app.

am: dc1e04035b

Change-Id: I2b588c9a31f405f66c1603aacbe67798ac637dee
This commit is contained in:
Fan Zhang
2016-08-22 20:05:30 +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) {