am 33fe4a36: Merge "Fix TelephonyManager to grab the best context" into ics-mr1
* commit '33fe4a36b7d1ef84b13447f2a765db465ef96e56': Fix TelephonyManager to grab the best context
This commit is contained in:
@@ -60,16 +60,16 @@ public class TelephonyManager {
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public TelephonyManager(Context context) {
|
public TelephonyManager(Context context) {
|
||||||
context = context.getApplicationContext();
|
|
||||||
if (sContext == null) {
|
if (sContext == null) {
|
||||||
sContext = context;
|
Context appContext = context.getApplicationContext();
|
||||||
|
if (appContext != null) {
|
||||||
|
sContext = appContext;
|
||||||
|
} else {
|
||||||
|
sContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
|
sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
|
||||||
"telephony.registry"));
|
"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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user