Hide emergency app settings on non-voice deivces

Bug: 19841649
Change-Id: I30ba582f503514656c99f3aea2801a68dfd1a5fa
This commit is contained in:
Adrian Roos
2015-04-08 14:50:03 +02:00
parent e06c34464e
commit 4157d7fcbb
3 changed files with 40 additions and 3 deletions

View File

@@ -46,7 +46,10 @@ public class DefaultEmergencyPreference extends ListPreference {
public DefaultEmergencyPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContentResolver = context.getContentResolver();
load();
if (isAvailable(context)) {
load();
}
}
@Override
@@ -149,6 +152,11 @@ public class DefaultEmergencyPreference extends ListPreference {
return packages;
}
public static boolean isAvailable(Context context) {
return context.getResources().getBoolean(
com.android.internal.R.bool.config_voice_capable);
}
private static boolean isSystemApp(PackageInfo info) {
return info.applicationInfo != null
&& (info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;