am c538b651: Fix some UI flow issues when the keystore is locked in WiFi setting.

Merge commit 'c538b651a23287ab25584995c6c4b7a68ece027c'

* commit 'c538b651a23287ab25584995c6c4b7a68ece027c':
  Fix some UI flow issues when the keystore is locked in WiFi setting.
This commit is contained in:
Chung-yih Wang
2009-07-30 16:05:19 -07:00
committed by Android Git Automerger
2 changed files with 49 additions and 17 deletions

View File

@@ -217,6 +217,14 @@ public class AccessPointDialog extends AlertDialog implements DialogInterface.On
setTitle(getContext().getString(titleId)); setTitle(getContext().getString(titleId));
} }
public void enableEnterpriseFields() {
setEnterpriseFieldsVisible(true);
updateCertificateSelection();
setGenericPasswordVisible(true);
// Both WPA and WPA2 show the same caption, so either is ok
updatePasswordCaption(AccessPointState.WPA);
}
/** Called after flags are set, the dialog's layout/etc should be set up here */ /** Called after flags are set, the dialog's layout/etc should be set up here */
private void onLayout() { private void onLayout() {
final Context context = getContext(); final Context context = getContext();
@@ -318,6 +326,14 @@ public class AccessPointDialog extends AlertDialog implements DialogInterface.On
if (mMode == MODE_CONFIGURE || if (mMode == MODE_CONFIGURE ||
(mState.isEnterprise() && !mState.configured)) { (mState.isEnterprise() && !mState.configured)) {
setEnterpriseFields(view); setEnterpriseFields(view);
updateCertificateSelection();
}
}
private void updateCertificateSelection() {
setSpinnerAdapter(mClientCertSpinner, getAllUserCertificateKeys());
setSpinnerAdapter(mCaCertSpinner, getAllCaCertificateKeys());
mPhase2Spinner.setSelection(getSelectionIndex( mPhase2Spinner.setSelection(getSelectionIndex(
R.array.wifi_phase2_entries, mState.getPhase2())); R.array.wifi_phase2_entries, mState.getPhase2()));
mEapSpinner.setSelection(getSelectionIndex( mEapSpinner.setSelection(getSelectionIndex(
@@ -329,7 +345,6 @@ public class AccessPointDialog extends AlertDialog implements DialogInterface.On
getAllCaCertificateKeys(), mState.getEnterpriseField( getAllCaCertificateKeys(), mState.getEnterpriseField(
AccessPointState.CA_CERT))); AccessPointState.CA_CERT)));
} }
}
private String[] getAllCaCertificateKeys() { private String[] getAllCaCertificateKeys() {
return appendEmptyInSelection(mCertTool.getAllCaCertificateKeys()); return appendEmptyInSelection(mCertTool.getAllCaCertificateKeys());
@@ -788,13 +803,9 @@ public class AccessPointDialog extends AlertDialog implements DialogInterface.On
if (Keystore.getInstance().getState() != Keystore.UNLOCKED) { if (Keystore.getInstance().getState() != Keystore.UNLOCKED) {
getContext().startActivity(new Intent( getContext().startActivity(new Intent(
SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE)); SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
mSecuritySpinner.setSelection(0);
return; return;
} }
setEnterpriseFieldsVisible(true); enableEnterpriseFields();
setGenericPasswordVisible(true);
// Both WPA and WPA2 show the same caption, so either is ok
updatePasswordCaption(AccessPointState.WPA);
break; break;
} }
} }

View File

@@ -87,6 +87,9 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
private WeakHashMap<AccessPointState, AccessPointPreference> mAps; private WeakHashMap<AccessPointState, AccessPointPreference> mAps;
private AccessPointState mResumeState = null;
private int mResumeMode;
//============================ //============================
// Wifi member variables // Wifi member variables
//============================ //============================
@@ -152,6 +155,20 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
super.onResume(); super.onResume();
mWifiLayer.onResume(); mWifiLayer.onResume();
mWifiEnabler.resume(); mWifiEnabler.resume();
// do what we should have after keystore is unlocked.
if (mResumeState != null) {
if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
showAccessPointDialog(mResumeState, mResumeMode);
}
mResumeMode = -1;
mResumeState = null;
} else {
if (mResumeMode == AccessPointDialog.MODE_CONFIGURE) {
if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
((AccessPointDialog) mDialog).enableEnterpriseFields();
}
}
}
} }
@Override @Override
@@ -231,6 +248,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {
if (dialog == mDialog) { if (dialog == mDialog) {
mDialog = null; mDialog = null;
mResumeMode = -1;
} }
} }
@@ -350,6 +368,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
dialog.setMode(AccessPointDialog.MODE_CONFIGURE); dialog.setMode(AccessPointDialog.MODE_CONFIGURE);
dialog.setTitle(R.string.wifi_add_other_network); dialog.setTitle(R.string.wifi_add_other_network);
dialog.setAutoSecurityAllowed(false); dialog.setAutoSecurityAllowed(false);
mResumeMode = AccessPointDialog.MODE_CONFIGURE;
showDialog(dialog); showDialog(dialog);
} }
@@ -358,6 +377,8 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
Keystore.getInstance().getState() != Keystore.UNLOCKED) { Keystore.getInstance().getState() != Keystore.UNLOCKED) {
startActivity(new Intent( startActivity(new Intent(
SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE)); SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
mResumeState = state;
mResumeMode = mode;
return; return;
} }
AccessPointDialog dialog = new AccessPointDialog(this, mWifiLayer); AccessPointDialog dialog = new AccessPointDialog(this, mWifiLayer);