From 8b5f2b080d841fa44d970058dfb7d5c653c6deb6 Mon Sep 17 00:00:00 2001 From: Gabriel Peal Date: Wed, 19 Mar 2014 16:41:49 -0700 Subject: [PATCH] resolved conflicts for merge of c1edfc2c to master Change-Id: Ica42d8ac1552040f7ea2864ff529f5fc1470001b --- .../android/telephony/TelephonyManager.java | 355 +++++++----------- 1 file changed, 143 insertions(+), 212 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 9ec7defd58dfc..d5c7caad22f1f 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.Context; @@ -25,6 +26,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; @@ -64,8 +66,41 @@ public class TelephonyManager { private static final String TAG = "TelephonyManager"; private static ITelephonyRegistry sRegistry; + + private final HashMap mListeners + = new HashMap(); private final Context mContext; + private static class Listener extends ITelephonyListener.Stub { + final CallStateListener mListener; + private static final int WHAT = 1; + + private Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + mListener.onCallStateChanged(msg.arg1, msg.arg2, (String)msg.obj); + } + }; + + Listener(CallStateListener listener) { + mListener = listener; + } + + @Override + public void onUpdate(final int callId, final int state, final String number) { + if (mHandler != null) { + mHandler.sendMessage(mHandler.obtainMessage(WHAT, callId, state, number)); + } + } + + void clearQueue() { + mHandler.removeMessages(WHAT); + + // Don't accept more incoming binder calls either. + mHandler = null; + } + } + /** @hide */ public TelephonyManager(Context context) { Context appContext = context.getApplicationContext(); @@ -87,38 +122,6 @@ public class TelephonyManager { } private static TelephonyManager sInstance = new TelephonyManager(); - private HashMap mListeners - = new HashMap(); - - private static class Listener extends ITelephonyListener.Stub { - final CallStateListener mListener; - private static final int WHAT = 1; - - private Handler mHandler = new Handler() { - @Override - public void handleMessage(Message msg) { - mListener.onCallStateChanged(msg.arg1, msg.arg2, (String) msg.obj); - } - }; - - Listener(CallStateListener listener) { - mListener = listener; - } - - @Override - public void onUpdate(final int callId, final int state, final String number) { - if (mHandler != null) { - mHandler.sendMessage(mHandler.obtainMessage(WHAT, callId, state, number)); - } - } - - void clearQueue() { - mHandler.removeMessages(WHAT); - - // Don't accept more incoming binder calls either. - mHandler = null; - } - } /** @hide /* @deprecated - use getSystemService as described above */ @@ -1920,439 +1923,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) { @@ -2364,14 +2297,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); @@ -2381,7 +2312,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); } } }