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

Commit 86febbc1 authored by Steve Kondik's avatar Steve Kondik
Browse files

Revert "Refactor to remove multiple in-loop Object[]->String[] castings"

This reverts commit 0b2d42aa.
parent 0b2d42aa
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import com.android.settings.wifi.WifiApEnabler;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.os.SystemProperties;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -32,6 +33,8 @@ import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.util.Log;
import android.webkit.WebView;

import java.io.InputStream;
@@ -64,6 +67,7 @@ public class TetherSettings extends PreferenceActivity {
    private BroadcastReceiver mTetherChangeReceiver;

    private String[] mUsbRegexs;
    private ArrayList mUsbIfaces;

    private String[] mWifiRegexs;

@@ -157,8 +161,7 @@ public class TetherSettings extends PreferenceActivity {
                        ConnectivityManager.EXTRA_ACTIVE_TETHER);
                ArrayList<String> errored = intent.getStringArrayListExtra(
                        ConnectivityManager.EXTRA_ERRORED_TETHER);
                updateState((String[]) available.toArray(), (String[]) active.toArray(),
                        (String[]) errored.toArray());
                updateState(available.toArray(), active.toArray(), errored.toArray());
            } else if (intent.getAction().equals(Intent.ACTION_MEDIA_SHARED) ||
                       intent.getAction().equals(Intent.ACTION_MEDIA_UNSHARED)) {
                updateState();
@@ -202,8 +205,8 @@ public class TetherSettings extends PreferenceActivity {
        updateState(available, tethered, errored);
    }

    private void updateState(String[] available, String[] tethered,
            String[] errored) {
    private void updateState(Object[] available, Object[] tethered,
            Object[] errored) {
        ConnectivityManager cm =
                (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
        boolean usbTethered = false;
@@ -212,7 +215,8 @@ public class TetherSettings extends PreferenceActivity {
        boolean usbErrored = false;
        boolean massStorageActive =
                Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
        for (String s : available) {
        for (Object o : available) {
            String s = (String)o;
            for (String regex : mUsbRegexs) {
                if (s.matches(regex)) {
                    usbAvailable = true;
@@ -222,12 +226,14 @@ public class TetherSettings extends PreferenceActivity {
                }
            }
        }
        for (String s : tethered) {
        for (Object o : tethered) {
            String s = (String)o;
            for (String regex : mUsbRegexs) {
                if (s.matches(regex)) usbTethered = true;
            }
        }
        for (String s: errored) {
        for (Object o: errored) {
            String s = (String)o;
            for (String regex : mUsbRegexs) {
                if (s.matches(regex)) usbErrored = true;
            }