Merge "StateMachine: check for null curState in dump()"
diff --git a/api/current.txt b/api/current.txt
index fea1f2f..f1338f0 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -45143,7 +45143,7 @@
   public abstract class CellLocation {
     ctor public CellLocation();
     method public static android.telephony.CellLocation getEmpty();
-    method public static void requestLocationUpdate();
+    method @Deprecated public static void requestLocationUpdate();
   }
 
   public abstract class CellSignalStrength {
diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt
index 3ad076f..a285692 100644
--- a/non-updatable-api/current.txt
+++ b/non-updatable-api/current.txt
@@ -44999,7 +44999,7 @@
   public abstract class CellLocation {
     ctor public CellLocation();
     method public static android.telephony.CellLocation getEmpty();
-    method public static void requestLocationUpdate();
+    method @Deprecated public static void requestLocationUpdate();
   }
 
   public abstract class CellSignalStrength {
diff --git a/telephony/java/android/telephony/CellLocation.java b/telephony/java/android/telephony/CellLocation.java
index b32f4565..61f68ce 100644
--- a/telephony/java/android/telephony/CellLocation.java
+++ b/telephony/java/android/telephony/CellLocation.java
@@ -47,7 +47,14 @@
      *
      * Callers wishing to request a single location update should use
      * {@link TelephonyManager#requestCellInfoUpdate}.
+     *
+     * @deprecated this method has undesirable side-effects, and it calls into the OS without
+     * access to a {@link android.content.Context Context}, meaning that certain safety checks and
+     * attribution are error-prone. Given that this method has numerous downsides, and given that
+     * there are long-available superior alternatives, callers are strongly discouraged from using
+     * this method.
      */
+    @Deprecated
     public static void requestLocationUpdate() {
         // Since this object doesn't have a context, this is the best we can do.
         final Context appContext = ActivityThread.currentApplication();
diff --git a/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java b/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
index 3bd8cdd..f8ab87d 100644
--- a/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
+++ b/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
@@ -65,13 +65,7 @@
             return "";
         }
 
-        if (!mIs7BitTranslationTableLoaded) {
-            mTranslationTableCommon = new SparseIntArray();
-            mTranslationTableGSM = new SparseIntArray();
-            mTranslationTableCDMA = new SparseIntArray();
-            load7BitTranslationTableFromXml();
-            mIs7BitTranslationTableLoaded = true;
-        }
+        ensure7BitTranslationTableLoaded();
 
         if ((mTranslationTableCommon != null && mTranslationTableCommon.size() > 0) ||
                 (mTranslationTableGSM != null && mTranslationTableGSM.size() > 0) ||
@@ -115,6 +109,8 @@
          */
         int translation = -1;
 
+        ensure7BitTranslationTableLoaded();
+
         if (mTranslationTableCommon != null) {
             translation = mTranslationTableCommon.get(c, -1);
         }
@@ -155,6 +151,18 @@
         }
     }
 
+    private static void ensure7BitTranslationTableLoaded() {
+        synchronized (Sms7BitEncodingTranslator.class) {
+            if (!mIs7BitTranslationTableLoaded) {
+                mTranslationTableCommon = new SparseIntArray();
+                mTranslationTableGSM = new SparseIntArray();
+                mTranslationTableCDMA = new SparseIntArray();
+                load7BitTranslationTableFromXml();
+                mIs7BitTranslationTableLoaded = true;
+            }
+        }
+    }
+
     /**
      * Load the whole translation table file from the framework resource
      * encoded in XML.