Merge "Update strings for Wi-Fi DPP handshake running state"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e01ab3b..51c4019 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2153,6 +2153,10 @@
     <string name="wifi_dpp_could_not_add_device">Couldn\u2019t add device</string>
     <!-- Title for the fragment to show that device found but naming known [CHAR LIMIT=50]  -->
     <string name="wifi_dpp_device_found">Device found</string>
+    <!-- Hint for Wi-Fi DPP handshake running [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_sharing_wifi_with_this_device">Sharing Wi\u2011Fi with this device\u2026</string>
+    <!-- Hint for Wi-Fi DPP handshake running [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_connecting">Connecting\u2026</string>
      <!-- Label for the try again button [CHAR LIMIT=20]-->
     <string name="retry">Retry</string>
     <!-- Label for the check box to share a network with other users on the same device -->
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 97b2ebe..9e731ba 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -172,6 +172,9 @@
             mLatestStatusCode = code;
         }
 
+        if (isGoingInitiator()) {
+            mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
+        }
         mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
         mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
     }
@@ -255,7 +258,7 @@
             mTitle.setText(information);
         }
 
-        mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid()));
+        updateSummary();
         mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
 
         mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
@@ -273,6 +276,7 @@
             mProgressBar.setVisibility(View.VISIBLE);
             mButtonRight.setVisibility(View.INVISIBLE);
             startWifiDppConfiguratorInitiator();
+            updateSummary();
         });
 
         if (savedInstanceState != null) {
@@ -342,4 +346,12 @@
 
         return model.isGoingInitiator();
     }
+
+    private void updateSummary() {
+        if (isGoingInitiator()) {
+            mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
+        } else {
+            mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid()));
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index a438ecb..a19069b 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -229,13 +229,7 @@
         } else {
             mTitle.setText(R.string.wifi_dpp_scan_qr_code);
 
-            String description;
-            if (TextUtils.isEmpty(mSsid)) {
-                description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
-            } else {
-                description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
-            }
-            mSummary.setText(description);
+            updateEnrolleeSummary();
         }
 
         mErrorMessage = view.findViewById(R.id.error_message);
@@ -415,6 +409,7 @@
                     if (!mIsConfiguratorMode) {
                         mProgressBar.setVisibility(View.VISIBLE);
                         startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj);
+                        updateEnrolleeSummary();
                     }
                     break;
 
@@ -461,6 +456,7 @@
 
             Log.e(TAG, "Invalid networkId " + newNetworkId);
             mLatestStatusCode = EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC;
+            updateEnrolleeSummary();
             mProgressBar.setVisibility(View.INVISIBLE);
             showErrorMessage(getString(R.string.wifi_dpp_check_connection_try_again));
             restartCamera();
@@ -528,6 +524,7 @@
             }
 
             mLatestStatusCode = code;
+            updateEnrolleeSummary();
             mProgressBar.setVisibility(View.INVISIBLE);
             restartCamera();
         }
@@ -588,4 +585,18 @@
 
         mCamera.start(surfaceTexture);
     }
+
+    private void updateEnrolleeSummary() {
+        if (isGoingInitiator()) {
+            mSummary.setText(R.string.wifi_dpp_connecting);
+        } else {
+            String description;
+            if (TextUtils.isEmpty(mSsid)) {
+                description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
+            } else {
+                description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
+            }
+            mSummary.setText(description);
+        }
+    }
 }