Switch to use ThreadUtils.postOnMainThread
Change-Id: I344d25a1a667de9c0b23d6d528d905b4da3a4c40 Fixes: 63896139 Test: rerun tests
This commit is contained in:
@@ -61,6 +61,7 @@ import android.widget.TextView;
|
||||
import com.android.settings.ProxySelector;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
import com.android.settingslib.wifi.AccessPoint;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
@@ -116,8 +117,6 @@ public class WifiConfigController implements TextWatcher,
|
||||
/* Full list of phase2 methods */
|
||||
private final ArrayAdapter<String> mPhase2FullAdapter;
|
||||
|
||||
private final Handler mTextViewChangedHandler;
|
||||
|
||||
// e.g. AccessPoint.SECURITY_NONE
|
||||
private int mAccessPointSecurity;
|
||||
private TextView mPasswordView;
|
||||
@@ -175,7 +174,6 @@ public class WifiConfigController implements TextWatcher,
|
||||
accessPoint.getSecurity();
|
||||
mMode = mode;
|
||||
|
||||
mTextViewChangedHandler = new Handler();
|
||||
mContext = mConfigUi.getContext();
|
||||
final Resources res = mContext.getResources();
|
||||
|
||||
@@ -1258,12 +1256,10 @@ public class WifiConfigController implements TextWatcher,
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
mTextViewChangedHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
showWarningMessagesIfAppropriate();
|
||||
enableSubmitIfAppropriate();
|
||||
}
|
||||
});
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
showWarningMessagesIfAppropriate();
|
||||
enableSubmitIfAppropriate();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -63,7 +63,6 @@ class WriteWifiConfigToNfcDialog extends AlertDialog
|
||||
private View mView;
|
||||
private Button mSubmitButton;
|
||||
private Button mCancelButton;
|
||||
private Handler mOnTextChangedHandler;
|
||||
private TextView mPasswordView;
|
||||
private TextView mLabelView;
|
||||
private CheckBox mPasswordCheckBox;
|
||||
@@ -79,7 +78,6 @@ class WriteWifiConfigToNfcDialog extends AlertDialog
|
||||
mContext = context;
|
||||
mWakeLock = ((PowerManager) context.getSystemService(Context.POWER_SERVICE))
|
||||
.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WriteWifiConfigToNfcDialog:wakeLock");
|
||||
mOnTextChangedHandler = new Handler();
|
||||
mSecurity = security;
|
||||
mWifiManager = wifiManager;
|
||||
}
|
||||
@@ -90,7 +88,6 @@ class WriteWifiConfigToNfcDialog extends AlertDialog
|
||||
mContext = context;
|
||||
mWakeLock = ((PowerManager) context.getSystemService(Context.POWER_SERVICE))
|
||||
.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WriteWifiConfigToNfcDialog:wakeLock");
|
||||
mOnTextChangedHandler = new Handler();
|
||||
mSecurity = savedState.getInt(SECURITY);
|
||||
mWifiManager = wifiManager;
|
||||
}
|
||||
@@ -226,12 +223,7 @@ class WriteWifiConfigToNfcDialog extends AlertDialog
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
mOnTextChangedHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
enableSubmitIfAppropriate();
|
||||
}
|
||||
});
|
||||
enableSubmitIfAppropriate();
|
||||
}
|
||||
|
||||
private void enableSubmitIfAppropriate() {
|
||||
|
Reference in New Issue
Block a user