Merge "Fix TelephonyManager to grab the best context" into ics-mr1

This commit is contained in:
Robert Greenwalt
2011-11-16 12:06:53 -08:00
committed by Android (Google) Code Review

View File

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