Fix browser Privacy and Security settings for screen rotation

Fixed following issues
- Display reverts to browser's main settings panel from Privacy
  and Security panel on screen rotation
- Crash when screen shows Clear Stored Data popup and device is
  rotated

Change-Id: Iaf0c3aea2e8b8e77b449b540bc62f522040179ef
diff --git a/res/xml/general_preferences.xml b/res/xml/general_preferences.xml
index 6cdd04c..a1f2d25 100644
--- a/res/xml/general_preferences.xml
+++ b/res/xml/general_preferences.xml
@@ -51,8 +51,10 @@
     <PreferenceCategory android:title="@string/pref_extras_title"
         android:key="advanced">
 
-        <PreferenceScreen android:title="@string/pref_privacy_security_title">
-            <PreferenceScreen android:title="@string/webstorage_clear_data_title">
+        <PreferenceScreen android:title="@string/pref_privacy_security_title"
+            android:key="privacy_security">
+            <PreferenceScreen android:title="@string/webstorage_clear_data_title"
+                android:key="clear_data">
                 <com.android.browser.BrowserYesNoPreference
                     android:dialogIcon="@android:drawable/ic_dialog_alert"
                     android:dialogMessage="@string/pref_privacy_clear_selected_dlg"
diff --git a/src/com/android/browser/BrowserYesNoPreference.java b/src/com/android/browser/BrowserYesNoPreference.java
index 966d968..6fdde2c 100644
--- a/src/com/android/browser/BrowserYesNoPreference.java
+++ b/src/com/android/browser/BrowserYesNoPreference.java
@@ -89,9 +89,10 @@
     protected void onDialogClosed(boolean positiveResult) {
         super.onDialogClosed(positiveResult);
 
+        if (!positiveResult)
+            return;
+
         if (callChangeListener(positiveResult)) {
-            if (!positiveResult)
-                return;
             setEnabled(false);
             BrowserSettings settings = BrowserSettings.getInstance();
             if (PreferenceKeys.PREF_CLEAR_SELECTED_DATA.equals(getKey())) {