summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2011-11-16 11:19:50 -0800
committerRobert Greenwalt <rgreenwalt@google.com>2011-11-16 11:36:08 -0800
commit8f4f814beb03400e9143b7c88307b2fd68abd77c (patch)
treea578b6c37b05300f7c5993b435b9f7ac569ce892 /telephony/java
parent258576a82c2293c3a988bf2dc6744fd8082421f9 (diff)
downloadframeworks_base-8f4f814beb03400e9143b7c88307b2fd68abd77c.zip
frameworks_base-8f4f814beb03400e9143b7c88307b2fd68abd77c.tar.gz
frameworks_base-8f4f814beb03400e9143b7c88307b2fd68abd77c.tar.bz2
Fix TelephonyManager to grab the best context
It may not be called from an app so the app context may not exist. Check and grab the best one. Also remove the log that nobody paid attention to if the constructor is called again from the same process. One context seems to be as useful as another. bug:5572369 bug:5622514 Change-Id: Iad23b30c7c8fe5b8d1f81a1e060eaf0cd0e3019d
Diffstat (limited to 'telephony/java')
-rwxr-xr-xtelephony/java/android/telephony/TelephonyManager.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 8ead45e..db78e2e 100755
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -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());
}
}