From 5f506939fafd724fe4cdb8ef478302c8590417ce Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 23 May 2016 15:12:49 -0700 Subject: [PATCH] SystemServer: cherry-pick p2p service start Cherry-pick change that only starts P2P service if p2p is supported for the device. Disable WiFi p2p service if it's not supported. b/26877020 Bug:34193861 Test: frameworks/base/wifi/tests/runtests.sh Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: manually verified wifi connection Test: manually checked for p2p peers Change-Id: I84b822fa57423711de75d2147effe73a1fc40eb4 Merged-In: I84b822fa57423711de75d2147effe73a1fc40eb4 --- services/java/com/android/server/SystemServer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 9e60f339fc030..2477e7152b00d 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -840,7 +840,11 @@ public final class SystemServer { } else { Slog.i(TAG, "No Wi-Fi Aware Service (Aware support Not Present)"); } - mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS); + + if (context.getPackageManager().hasSystemFeature( + PackageManager.FEATURE_WIFI_DIRECT)) { + mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS); + } mSystemServiceManager.startService(WIFI_SERVICE_CLASS); mSystemServiceManager.startService( "com.android.server.wifi.scanner.WifiScanningService");