WifiSetup: If an ethernet connection is active, skip wifi setup
Change-Id: I6dc08e5e7d07c3650449fcf4374a375827eb3743
This commit is contained in:
committed by
Abhisek Devkota
parent
356dcde83f
commit
aba4f6f13e
@@ -46,6 +46,7 @@ import android.hardware.fingerprint.FingerprintManager;
|
|||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
@@ -210,6 +211,14 @@ public class SetupWizardUtils {
|
|||||||
disableComponentSets(context, GET_RECEIVERS | GET_SERVICES);
|
disableComponentSets(context, GET_RECEIVERS | GET_SERVICES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isEthernetConnected(Context context) {
|
||||||
|
ConnectivityManager cm = (ConnectivityManager) context.
|
||||||
|
getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
|
||||||
|
return (cm.getActiveNetworkInfo() != null &&
|
||||||
|
cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_ETHERNET);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hasLeanback(Context context) {
|
public static boolean hasLeanback(Context context) {
|
||||||
PackageManager packageManager = context.getPackageManager();
|
PackageManager packageManager = context.getPackageManager();
|
||||||
return packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
return packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||||
@@ -243,7 +252,8 @@ public class SetupWizardUtils {
|
|||||||
disableComponent(context, MobileDataActivity.class);
|
disableComponent(context, MobileDataActivity.class);
|
||||||
disableComponent(context, ChooseDataSimActivity.class);
|
disableComponent(context, ChooseDataSimActivity.class);
|
||||||
}
|
}
|
||||||
if (!SetupWizardUtils.hasWifi(context)) {
|
if (!SetupWizardUtils.hasWifi(context) ||
|
||||||
|
isEthernetConnected(context)) {
|
||||||
disableComponent(context, WifiSetupActivity.class);
|
disableComponent(context, WifiSetupActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user