Protect against more Telecom privileged operations

Make sure that all invocations of TelecomManager methods that
could possibly require a permission are protected by a permission
check.

Some of these are overcautious - for example, the UI should never
show the option to return to a call (READ_PHONE_STATE) if we didn't
detect an active call (READ_PHONE_STATE) in the first place, so
it is not strictly necessary to protect against the former. But not
crashing is the most preferable of all options.

Bug: 20266292

Change-Id: Id91dd16e34320a5e607f91dbce9a4296025eeaaf
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index f8fb17f..fe828a3 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -34,7 +34,6 @@
 import android.support.v4.view.ViewPager;
 import android.support.v7.app.ActionBar;
 import android.telecom.PhoneAccount;
-import android.telecom.TelecomManager;
 import android.text.Editable;
 import android.text.TextUtils;
 import android.text.TextWatcher;
@@ -370,7 +369,6 @@
             TouchPointManager.getInstance().setPoint((int) ev.getRawX(), (int) ev.getRawY());
         }
         return super.dispatchTouchEvent(ev);
-
     }
 
     @Override
@@ -929,7 +927,7 @@
         final boolean callKey = Intent.ACTION_CALL_BUTTON.equals(intent.getAction());
 
         if (callKey) {
-            getTelecomManager().showInCallScreen(false);
+            TelecomUtil.showInCallScreen(this, false);
             return true;
         }
 
@@ -1340,10 +1338,6 @@
     public void onPageScrollStateChanged(int state) {
     }
 
-    private TelecomManager getTelecomManager() {
-        return (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
-    }
-
     @Override
     public boolean isActionBarShowing() {
         return mActionBarController.isActionBarShowing();