diff options
author | Yorke Lee <yorkelee@google.com> | 2015-09-17 18:10:58 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-09-17 18:10:58 -0700 |
commit | 827a90fb309fd26f5b155c1ad612512011d58437 (patch) | |
tree | 20156206a53e8cf3359e79919ff91d24f06223fc /src/com/android/dialer/dialpad/DialpadFragment.java | |
parent | b2802803d90ff355a04109cc570bf69346d4102a (diff) |
Wrap some privileged Telecom operations with permission checks
If the Dialer is not the default dialer and does not have the
CALL_PHONE permission, don't call TelecomManager methods that
will cause SecurityExceptions.
Bug: 20266292
Change-Id: I229dd045269a262632c4a911e2321203443de684
Diffstat (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java')
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index d2628da5e..54e4b8946 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -81,6 +81,7 @@ import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.DialerUtils; +import com.android.dialer.util.TelecomUtil; import com.android.dialer.util.IntentUtil.CallIntentBuilder; import com.android.incallui.Call.LogState; import com.android.phone.common.CallLogAsync; @@ -1478,8 +1479,12 @@ public class DialpadFragment extends Fragment * @return true if the phone is "in use", meaning that at least one line * is active (ie. off hook or ringing or dialing, or on hold). */ - public boolean isPhoneInUse() { - return getTelecomManager().isInCall(); + private boolean isPhoneInUse() { + final Context context = getActivity(); + if (context != null) { + return TelecomUtil.isInCall(context); + } + return false; } /** |