diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-01-31 15:00:51 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-02-01 15:14:29 -0800 |
commit | f265ea9d8307282ff1da3915978625a94fc2859e (patch) | |
tree | 4e92b5de30239c1808a395cb49c9b17fe28ccffb /telephony/java/android | |
parent | 7a4ecc957d437ad4914988edc7593570f1e43f79 (diff) | |
download | frameworks_base-f265ea9d8307282ff1da3915978625a94fc2859e.zip frameworks_base-f265ea9d8307282ff1da3915978625a94fc2859e.tar.gz frameworks_base-f265ea9d8307282ff1da3915978625a94fc2859e.tar.bz2 |
App ops: vibration, neighboring cells, dialing, etc.
Improve handling of vibration op, so that apps are
better blamed (there is now a hidden vibrator API that
supplies the app to blame, and the system now uses this
when vibrating on behalf of an app).
Add operation for retrieving neighboring cell information.
Add a new op for calling a phone number. This required
plumbing information about the launching package name through
the activity manager, which required changing the internal
startActivity class, which required hitting a ton of code that
uses those internal APIs.
Change-Id: I3f8015634fdb296558f07fe654fb8d53e5c94d07
Diffstat (limited to 'telephony/java/android')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 6241a49..cd2a600 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -59,19 +59,19 @@ import java.util.regex.Pattern; public class TelephonyManager { private static final String TAG = "TelephonyManager"; - private static Context sContext; private static ITelephonyRegistry sRegistry; + private final Context mContext; /** @hide */ public TelephonyManager(Context context) { - if (sContext == null) { - Context appContext = context.getApplicationContext(); - if (appContext != null) { - sContext = appContext; - } else { - sContext = context; - } + Context appContext = context.getApplicationContext(); + if (appContext != null) { + mContext = appContext; + } else { + mContext = context; + } + if (sRegistry == null) { sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( "telephony.registry")); } @@ -79,6 +79,7 @@ public class TelephonyManager { /** @hide */ private TelephonyManager() { + mContext = null; } private static TelephonyManager sInstance = new TelephonyManager(); @@ -276,7 +277,7 @@ public class TelephonyManager { */ public List<NeighboringCellInfo> getNeighboringCellInfo() { try { - return getITelephony().getNeighboringCellInfo(); + return getITelephony().getNeighboringCellInfo(mContext.getBasePackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -361,7 +362,7 @@ public class TelephonyManager { * This function returns the type of the phone, depending * on the network mode. * - * @param network mode + * @param networkMode * @return Phone Type * * @hide @@ -1199,7 +1200,7 @@ public class TelephonyManager { * LISTEN_ flags. */ public void listen(PhoneStateListener listener, int events) { - String pkgForDebug = sContext != null ? sContext.getPackageName() : "<unknown>"; + String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>"; try { Boolean notifyNow = (getITelephony() != null); sRegistry.listen(pkgForDebug, listener.callback, events, notifyNow); @@ -1277,8 +1278,8 @@ public class TelephonyManager { * @hide pending API review */ public boolean isVoiceCapable() { - if (sContext == null) return true; - return sContext.getResources().getBoolean( + if (mContext == null) return true; + return mContext.getResources().getBoolean( com.android.internal.R.bool.config_voice_capable); } @@ -1294,8 +1295,8 @@ public class TelephonyManager { * @hide pending API review */ public boolean isSmsCapable() { - if (sContext == null) return true; - return sContext.getResources().getBoolean( + if (mContext == null) return true; + return mContext.getResources().getBoolean( com.android.internal.R.bool.config_sms_capable); } |