OSDN Git Service

More robust check around TelephonyManager init.
authorJeff Sharkey <jsharkey@android.com>
Wed, 31 Aug 2011 18:15:34 +0000 (11:15 -0700)
committerJeff Sharkey <jsharkey@android.com>
Wed, 31 Aug 2011 18:15:34 +0000 (11:15 -0700)
Only complain when Context radically changed.

Bug: 4676714
Change-Id: Ia183f9ba51056c857e634d901c618a73e45d2d05

telephony/java/android/telephony/TelephonyManager.java

index 1954172..c59dd3c 100644 (file)
@@ -60,12 +60,13 @@ public class TelephonyManager {
 
     /** @hide */
     public TelephonyManager(Context context) {
+        context = context.getApplicationContext();
         if (sContext == null) {
-            sContext = context.getApplicationContext();
+            sContext = context;
 
             sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
                     "telephony.registry"));
-        } else {
+        } else if (sContext != context) {
             Log.e(TAG, "Hidden constructor called more than once per process!");
             Log.e(TAG, "Original: " + sContext.getPackageName() + ", new: " +
                     context.getPackageName());