Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aba4f6f1 authored by Aaron Kling's avatar Aaron Kling Committed by Abhisek Devkota
Browse files

WifiSetup: If an ethernet connection is active, skip wifi setup

Change-Id: I6dc08e5e7d07c3650449fcf4374a375827eb3743
parent 356dcde8
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.hardware.fingerprint.FingerprintManager;
import android.os.Binder;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.net.ConnectivityManager;
import android.provider.Settings;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
@@ -210,6 +211,14 @@ public class SetupWizardUtils {
        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) {
        PackageManager packageManager = context.getPackageManager();
        return packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
@@ -243,7 +252,8 @@ public class SetupWizardUtils {
            disableComponent(context, MobileDataActivity.class);
            disableComponent(context, ChooseDataSimActivity.class);
        }
        if (!SetupWizardUtils.hasWifi(context)) {
        if (!SetupWizardUtils.hasWifi(context) ||
            isEthernetConnected(context)) {
            disableComponent(context, WifiSetupActivity.class);
        }