Merge "Fix leaked windows exception in WifiDialogActivity"
This commit is contained in:
committed by
Android (Google) Code Review
commit
fbfca0428b
@@ -52,6 +52,8 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final String KEY_CONNECT_FOR_CALLER = "connect_for_caller";
|
static final String KEY_CONNECT_FOR_CALLER = "connect_for_caller";
|
||||||
|
|
||||||
|
private WifiDialog mDialog;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
final Intent intent = getIntent();
|
final Intent intent = getIntent();
|
||||||
@@ -67,10 +69,10 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo
|
|||||||
accessPoint = new AccessPoint(this, accessPointState);
|
accessPoint = new AccessPoint(this, accessPointState);
|
||||||
}
|
}
|
||||||
|
|
||||||
WifiDialog dialog = WifiDialog.createModal(
|
mDialog = WifiDialog.createModal(
|
||||||
this, this, accessPoint, WifiConfigUiBase.MODE_CONNECT);
|
this, this, accessPoint, WifiConfigUiBase.MODE_CONNECT);
|
||||||
dialog.show();
|
mDialog.show();
|
||||||
dialog.setOnDismissListener(this);
|
mDialog.setOnDismissListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,6 +81,15 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo
|
|||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (mDialog != null && mDialog.isShowing()) {
|
||||||
|
mDialog.dismiss();
|
||||||
|
mDialog = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onForget(WifiDialog dialog) {
|
public void onForget(WifiDialog dialog) {
|
||||||
final WifiManager wifiManager = getSystemService(WifiManager.class);
|
final WifiManager wifiManager = getSystemService(WifiManager.class);
|
||||||
@@ -147,6 +158,7 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(DialogInterface dialogInterface) {
|
public void onDismiss(DialogInterface dialogInterface) {
|
||||||
|
mDialog = null;
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user