diff options
author | Sailesh Nepal <sail@google.com> | 2014-03-25 13:16:40 -0700 |
---|---|---|
committer | Sailesh Nepal <sail@google.com> | 2014-03-25 13:16:40 -0700 |
commit | fb48c1c722f1eff661a1f5e37cebb856b3e952cf (patch) | |
tree | 824ff7fe677abfe5ddd8f3b9b3e94e24036d3d8f /telephony | |
parent | 8121d6211b8c3cb7a3bf28d0c459a73a42e673b6 (diff) | |
parent | 5e44cadfd69c210c11f80cfe599718617a0e6676 (diff) | |
download | frameworks_base-fb48c1c722f1eff661a1f5e37cebb856b3e952cf.zip frameworks_base-fb48c1c722f1eff661a1f5e37cebb856b3e952cf.tar.gz frameworks_base-fb48c1c722f1eff661a1f5e37cebb856b3e952cf.tar.bz2 |
resolved conflicts for merge of 5e44cadf to master-nova
Change-Id: Ieacfbba60109a60b268c116a40e598c0745e8a3b
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 341 |
1 files changed, 136 insertions, 205 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 48e4b2e..af91fe3 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.PrivateApi; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.content.ComponentName; @@ -26,6 +27,7 @@ import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; +import android.telephony.Rlog; import android.util.Log; import com.android.internal.telephony.IPhoneSubInfo; @@ -65,7 +67,6 @@ public class TelephonyManager { private static final String TAG = "TelephonyManager"; private static ITelephonyRegistry sRegistry; - private final Context mContext; /** * The allowed states of Wi-Fi calling. @@ -81,29 +82,9 @@ public class TelephonyManager { static final int NEVER_USE = 2; } - /** @hide */ - public TelephonyManager(Context context) { - Context appContext = context.getApplicationContext(); - if (appContext != null) { - mContext = appContext; - } else { - mContext = context; - } - - if (sRegistry == null) { - sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( - "telephony.registry")); - } - } - - /** @hide */ - private TelephonyManager() { - mContext = null; - } - - private static TelephonyManager sInstance = new TelephonyManager(); - private HashMap<CallStateListener, Listener> mListeners - = new HashMap<CallStateListener, Listener>(); + private final HashMap<CallStateListener,Listener> mListeners + = new HashMap<CallStateListener,Listener>(); + private final Context mContext; private static class Listener extends ITelephonyListener.Stub { final CallStateListener mListener; @@ -112,7 +93,7 @@ public class TelephonyManager { private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { - mListener.onCallStateChanged(msg.arg1, msg.arg2, (String) msg.obj); + mListener.onCallStateChanged(msg.arg1, msg.arg2, (String)msg.obj); } }; @@ -135,6 +116,28 @@ public class TelephonyManager { } } + /** @hide */ + public TelephonyManager(Context context) { + Context appContext = context.getApplicationContext(); + if (appContext != null) { + mContext = appContext; + } else { + mContext = context; + } + + if (sRegistry == null) { + sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( + "telephony.registry")); + } + } + + /** @hide */ + private TelephonyManager() { + mContext = null; + } + + private static TelephonyManager sInstance = new TelephonyManager(); + /** @hide /* @deprecated - use getSystemService as described above */ public static TelephonyManager getDefault() { @@ -2011,439 +2014,369 @@ public class TelephonyManager { * Expose the rest of ITelephony to @PrivateApi */ - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void dial(String number) { try { getITelephony().dial(number); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#dial"); + Log.e(TAG, "Error calling ITelephony#dial", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void call(String callingPackage, String number) { try { getITelephony().call(callingPackage, number); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#call"); + Log.e(TAG, "Error calling ITelephony#call", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean showCallScreen() { try { return getITelephony().showCallScreen(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#showCallScreen"); + Log.e(TAG, "Error calling ITelephony#showCallScreen", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean showCallScreenWithDialpad(boolean showDialpad) { try { return getITelephony().showCallScreenWithDialpad(showDialpad); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#showCallScreenWithDialpad"); + Log.e(TAG, "Error calling ITelephony#showCallScreenWithDialpad", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean endCall() { try { return getITelephony().endCall(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#endCall"); + Log.e(TAG, "Error calling ITelephony#endCall", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void answerRingingCall() { try { getITelephony().answerRingingCall(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#answerRingingCall"); + Log.e(TAG, "Error calling ITelephony#answerRingingCall", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void toggleHold() { try { getITelephony().toggleHold(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#toggleHold"); + Log.e(TAG, "Error calling ITelephony#toggleHold", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void merge() { try { getITelephony().merge(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#merge"); + Log.e(TAG, "Error calling ITelephony#merge", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void swap() { try { getITelephony().swap(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#swap"); + Log.e(TAG, "Error calling ITelephony#swap", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void mute(boolean mute) { try { getITelephony().mute(mute); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#mute"); + Log.e(TAG, "Error calling ITelephony#mute", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void silenceRinger() { try { getITelephony().silenceRinger(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#silenceRinger"); + Log.e(TAG, "Error calling ITelephony#silenceRinger", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean isOffhook() { try { return getITelephony().isOffhook(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#isOffhook"); + Log.e(TAG, "Error calling ITelephony#isOffhook", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean isRinging() { try { return getITelephony().isRinging(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#isRinging"); + Log.e(TAG, "Error calling ITelephony#isRinging", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean isIdle() { try { return getITelephony().isIdle(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#isIdle"); + Log.e(TAG, "Error calling ITelephony#isIdle", e); } return true; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean isRadioOn() { try { return getITelephony().isRadioOn(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#isRadioOn"); + Log.e(TAG, "Error calling ITelephony#isRadioOn", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean isSimPinEnabled() { try { return getITelephony().isSimPinEnabled(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#isSimPinEnabled"); + Log.e(TAG, "Error calling ITelephony#isSimPinEnabled", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void cancelMissedCallsNotification() { try { getITelephony().cancelMissedCallsNotification(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#cancelMissedCallsNotification"); + Log.e(TAG, "Error calling ITelephony#cancelMissedCallsNotification", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean supplyPin(String pin) { try { return getITelephony().supplyPin(pin); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#supplyPin"); + Log.e(TAG, "Error calling ITelephony#supplyPin", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean supplyPuk(String puk, String pin) { try { return getITelephony().supplyPuk(puk, pin); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#supplyPuk"); + Log.e(TAG, "Error calling ITelephony#supplyPuk", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public int[] supplyPinReportResult(String pin) { try { return getITelephony().supplyPinReportResult(pin); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#supplyPinReportResult"); + Log.e(TAG, "Error calling ITelephony#supplyPinReportResult", e); } return new int[0]; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public int[] supplyPukReportResult(String puk, String pin) { try { return getITelephony().supplyPukReportResult(puk, pin); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#]"); + Log.e(TAG, "Error calling ITelephony#]", e); } return new int[0]; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean handlePinMmi(String dialString) { try { return getITelephony().handlePinMmi(dialString); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#handlePinMmi"); + Log.e(TAG, "Error calling ITelephony#handlePinMmi", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void toggleRadioOnOff() { try { getITelephony().toggleRadioOnOff(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#toggleRadioOnOff"); + Log.e(TAG, "Error calling ITelephony#toggleRadioOnOff", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean setRadio(boolean turnOn) { try { return getITelephony().setRadio(turnOn); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#setRadio"); + Log.e(TAG, "Error calling ITelephony#setRadio", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean setRadioPower(boolean turnOn) { try { return getITelephony().setRadioPower(turnOn); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#setRadioPower"); + Log.e(TAG, "Error calling ITelephony#setRadioPower", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void updateServiceLocation() { try { getITelephony().updateServiceLocation(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#updateServiceLocation"); + Log.e(TAG, "Error calling ITelephony#updateServiceLocation", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public int enableApnType(String type) { try { return getITelephony().enableApnType(type); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#enableApnType"); + Log.e(TAG, "Error calling ITelephony#enableApnType", e); } return PhoneConstants.APN_REQUEST_FAILED; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public int disableApnType(String type) { try { return getITelephony().disableApnType(type); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#disableApnType"); + Log.e(TAG, "Error calling ITelephony#disableApnType", e); } return PhoneConstants.APN_REQUEST_FAILED; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean enableDataConnectivity() { try { return getITelephony().enableDataConnectivity(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#enableDataConnectivity"); + Log.e(TAG, "Error calling ITelephony#enableDataConnectivity", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean disableDataConnectivity() { try { return getITelephony().disableDataConnectivity(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#disableDataConnectivity"); + Log.e(TAG, "Error calling ITelephony#disableDataConnectivity", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean isDataConnectivityPossible() { try { return getITelephony().isDataConnectivityPossible(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#isDataConnectivityPossible"); + Log.e(TAG, "Error calling ITelephony#isDataConnectivityPossible", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public boolean needsOtaServiceProvisioning() { try { return getITelephony().needsOtaServiceProvisioning(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#needsOtaServiceProvisioning"); + Log.e(TAG, "Error calling ITelephony#needsOtaServiceProvisioning", e); } return false; } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void playDtmfTone(char digit, boolean timedShortCode) { try { getITelephony().playDtmfTone(digit, timedShortCode); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#playDtmfTone"); + Log.e(TAG, "Error calling ITelephony#playDtmfTone", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void stopDtmfTone() { try { getITelephony().stopDtmfTone(); } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#stopDtmfTone"); + Log.e(TAG, "Error calling ITelephony#stopDtmfTone", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void addCallStateListener(CallStateListener listener) { try { if (listener == null) { @@ -2455,14 +2388,12 @@ public class TelephonyManager { getITelephony().addListener(l); } } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#addListener"); + Log.e(TAG, "Error calling ITelephony#addListener", e); } } - /** - * @hide - * @PrivateApi - */ + /** @hide */ + @PrivateApi public void removeCallStateListener(CallStateListener listener) { try { final Listener l = mListeners.remove(listener); @@ -2472,7 +2403,7 @@ public class TelephonyManager { getITelephony().removeListener(l); } } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#removeListener"); + Log.e(TAG, "Error calling ITelephony#removeListener", e); } } } |