diff options
author | Yorke Lee <yorkelee@google.com> | 2014-07-25 14:53:13 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-07-25 14:53:13 -0700 |
commit | d5b908ee536eb33d80abc4b28110b10d18fe0a8e (patch) | |
tree | 96f49e0bb79819dcb2e2d422641e0debf37e35ef | |
parent | fbfad4618630b82331074197519aa93f25d8e312 (diff) |
Stop using private APIs in InCallUI
The following APIs/packages are private and should not be used
TelephonyManager.from(context) (use getSystemService(Context.TELEPHONY_SERVICE instead)
TelecommManager.from(context) (use getSystemService(Context.TELECOMM_SERVICE instead)
com.google.android.collect (use com.google.common.collect instead)
com.android.internal.util.Preconditions (use com.google.common.base.Preconditions instead)
Bug: 6948882
Change-Id: Ib939fdf704a340a51294eca8eabfda82022f6d9f
4 files changed, 12 insertions, 6 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 3d7371088..c4913b59d 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -232,7 +232,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> // number directly from the telephony layer). PhoneAccountHandle accountHandle = mPrimary.getAccountHandle(); if (accountHandle != null) { - TelecommManager mgr = TelecommManager.from(mContext); + TelecommManager mgr = + (TelecommManager) mContext.getSystemService(Context.TELECOMM_SERVICE); PhoneAccount account = mgr.getPhoneAccount(accountHandle); if (account != null) { return account.getSubscriptionNumber(); @@ -273,7 +274,9 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> return; } - String simNumber = TelephonyManager.from(mContext).getLine1Number(); + final TelephonyManager telephonyManager = + (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); + String simNumber = telephonyManager.getLine1Number(); if (!PhoneNumberUtils.compare(callbackNumber, simNumber) && !isEmergencyCall) { Log.d(this, "Numbers are the same; not showing the callback number"); return; @@ -630,7 +633,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> private TelecommManager getTelecommManager() { if (mTelecommManager == null) { - mTelecommManager = TelecommManager.from(mContext); + mTelecommManager = + (TelecommManager) mContext.getSystemService(Context.TELECOMM_SERVICE); } return mTelecommManager; } diff --git a/InCallUI/src/com/android/incallui/CallVideoClientNotifier.java b/InCallUI/src/com/android/incallui/CallVideoClientNotifier.java index 2c048997f..d1e7f4c14 100644 --- a/InCallUI/src/com/android/incallui/CallVideoClientNotifier.java +++ b/InCallUI/src/com/android/incallui/CallVideoClientNotifier.java @@ -16,8 +16,8 @@ package com.android.incallui; -import com.google.android.collect.Sets; import com.google.common.base.Preconditions; +import com.google.common.collect.Sets; import java.util.Set; diff --git a/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java b/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java index 08152429d..0bc97eda8 100644 --- a/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java +++ b/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java @@ -56,7 +56,8 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { mIsSelected = false; - mTelecommManager = TelecommManager.from(getActivity()); + mTelecommManager = + (TelecommManager) getActivity().getSystemService(Context.TELECOMM_SERVICE); mAccountHandles = mTelecommManager.getEnabledPhoneAccounts(); final DialogInterface.OnClickListener selectionListener = diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index 3f94995e0..12c95a3b9 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -16,12 +16,13 @@ package com.android.incallui; +import com.google.common.base.Preconditions; + import com.android.incallui.CallVideoClientNotifier.SurfaceChangeListener; import com.android.incallui.CallVideoClientNotifier.VideoEventListener; import com.android.incallui.InCallPresenter.InCallDetailsListener; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; -import com.android.internal.util.Preconditions; import android.content.Context; import android.telecomm.RemoteCallVideoProvider; |