Fix Calculator locale change log spam

Bug: 33075625

I was checking for string reference equality when I should have been
checking for equals(). This may not have mattered before the libcore
changes in N.

Avoid this issue by directly comparing locales instead of strings.

Minor comment and log cleanups in the same area.

Change-Id: If96b5636dad92c2dfccacedd9c387f4ca0398ca0
diff --git a/src/com/android/calculator2/KeyMaps.java b/src/com/android/calculator2/KeyMaps.java
index c78cf2e..cdfe4e4 100644
--- a/src/com/android/calculator2/KeyMaps.java
+++ b/src/com/android/calculator2/KeyMaps.java
@@ -480,10 +480,10 @@
     private static HashMap<Character, String> sOutputForResultChar;
 
     /**
-     * Locale string corresponding to preceding map and character constants.
+     * Locale corresponding to preceding map and character constants.
      * We recompute the map if this is not the current locale.
      */
-    private static String sLocaleForMaps = "none";
+    private static Locale sLocaleForMaps = null;
 
     /**
      * Activity to use for looking up buttons.
@@ -567,14 +567,14 @@
         sOutputForResultChar.put(c, button.getText().toString());
     }
 
-    // Ensure that the preceding map and character constants are
-    // initialized and correspond to the current locale.
-    // Called only by a single thread, namely the UI thread.
+    /**
+     * Ensure that the preceding map and character constants correspond to the current locale.
+     * Called only by UI thread.
+     */
     static void validateMaps() {
         Locale locale = Locale.getDefault();
-        String lname = locale.toString();
-        if (lname != sLocaleForMaps) {
-            Log.v ("Calculator", "Setting local to: " + lname);
+        if (!locale.equals(sLocaleForMaps)) {
+            Log.v ("Calculator", "Setting locale to: " + locale.toLanguageTag());
             sKeyValForFun = new HashMap<String, Integer>();
             sKeyValForFun.put("sin", R.id.fun_sin);
             sKeyValForFun.put("cos", R.id.fun_cos);
@@ -631,7 +631,7 @@
                 addButtonToOutputMap((char)('0' + i), keyForDigVal(i));
             }
 
-            sLocaleForMaps = lname;
+            sLocaleForMaps = locale;
 
         }
     }