Merge "Fix crash when showing error dialog in NetworkRequestDialogActivity" am: d791f7b967
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2255618 Change-Id: I34ec41a3b0cd28029595e70164501dd1350e96b1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -27,12 +27,14 @@ import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.wifi.NetworkRequestErrorDialogFragment.ERROR_DIALOG_TYPE;
|
||||
@@ -143,7 +145,7 @@ public class NetworkRequestDialogActivity extends FragmentActivity implements
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
private final Handler mHandler = new Handler() {
|
||||
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
@@ -162,13 +164,17 @@ public class NetworkRequestDialogActivity extends FragmentActivity implements
|
||||
dismissDialogs();
|
||||
|
||||
// Throws error dialog.
|
||||
final FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) {
|
||||
return;
|
||||
}
|
||||
final NetworkRequestErrorDialogFragment dialogFragment =
|
||||
NetworkRequestErrorDialogFragment.newInstance();
|
||||
dialogFragment.setRejectCallback(mUserSelectionCallback);
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(NetworkRequestErrorDialogFragment.DIALOG_TYPE, type);
|
||||
dialogFragment.setArguments(bundle);
|
||||
dialogFragment.show(getSupportFragmentManager(), TAG);
|
||||
dialogFragment.show(fragmentManager, TAG);
|
||||
mShowingErrorDialog = true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user