Merge "2nd attempt to fix crash when getting unavailable service"
am: ec4e0d3008
Change-Id: I05ace64e5d8979611df37a8618812910a6e905fa
This commit is contained in:
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.ContentObserver;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.hardware.display.WifiDisplay;
|
||||
@@ -213,13 +214,9 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
|
||||
}
|
||||
|
||||
public static boolean isAvailable(Context context) {
|
||||
try {
|
||||
return context.getSystemService(Context.DISPLAY_SERVICE) != null
|
||||
&& context.getSystemService(Context.WIFI_P2P_SERVICE) != null;
|
||||
} catch (Exception e) {
|
||||
// Service is not registered, so this is definitely not available.
|
||||
return false;
|
||||
}
|
||||
return context.getSystemService(Context.DISPLAY_SERVICE) != null
|
||||
&& context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_DIRECT)
|
||||
&& context.getSystemService(Context.WIFI_P2P_SERVICE) != null;
|
||||
}
|
||||
|
||||
private void scheduleUpdate(int changes) {
|
||||
|
Reference in New Issue
Block a user