From 3ec5d25470379acbbf3bb2bcc83e5e897a22a59d Mon Sep 17 00:00:00 2001 From: Brandon Maxwell Date: Thu, 17 Mar 2016 16:01:57 -0700 Subject: Only allow primary users to block numbers + By design, only the primary user has the capability to block numbers. + This CL ensures that secondary users don't see the option to block numbers in the call log or call details. Change-Id: I576925510cfbef417c16910218014d9f7b7dd2a0 Fixes: 27366206 --- src/com/android/dialer/CallDetailActivity.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/com/android/dialer/CallDetailActivity.java') diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 6c8d7708a..42bee1edf 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -59,7 +59,6 @@ import com.android.dialer.database.FilteredNumberAsyncQueryHandler; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnCheckBlockedListener; import com.android.dialer.filterednumber.BlockNumberDialogFragment; import com.android.dialer.filterednumber.FilteredNumbersUtil; -import com.android.dialer.filterednumber.MigrateBlockedNumbersDialogFragment; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; import com.android.dialer.util.DialerUtils; @@ -156,7 +155,8 @@ public class CallDetailActivity extends AppCompatActivity PhoneNumberUtil.canPlaceCallsTo(mNumber, mDetails.numberPresentation); mCallButton.setVisibility(canPlaceCallsTo ? View.VISIBLE : View.GONE); mCopyNumberActionItem.setVisibility(canPlaceCallsTo ? View.VISIBLE : View.GONE); - mBlockNumberActionItem.setVisibility(canPlaceCallsTo ? View.VISIBLE : View.GONE); + + updateBlockActionItemVisibility(canPlaceCallsTo ? View.VISIBLE : View.GONE); final boolean isSipNumber = PhoneNumberUtil.isSipNumber(mNumber); final boolean isVoicemailNumber = @@ -277,7 +277,9 @@ public class CallDetailActivity extends AppCompatActivity } }); + mBlockNumberActionItem = (TextView) findViewById(R.id.call_detail_action_block); + updateBlockActionItemVisibility(View.VISIBLE); mBlockNumberActionItem.setOnClickListener(this); mEditBeforeCallActionItem = findViewById(R.id.call_detail_action_edit_before_call); mEditBeforeCallActionItem.setOnClickListener(this); @@ -292,6 +294,13 @@ public class CallDetailActivity extends AppCompatActivity } } + private void updateBlockActionItemVisibility(int visibility) { + if (!FilteredNumberCompat.canAttemptBlockOperations(mContext)) { + visibility = View.GONE; + } + mBlockNumberActionItem.setVisibility(visibility); + } + @Override public void onResume() { super.onResume(); @@ -468,8 +477,6 @@ public class CallDetailActivity extends AppCompatActivity mBlockNumberActionItem.setCompoundDrawablesRelativeWithIntrinsicBounds( R.drawable.ic_call_detail_unblock, 0, 0, 0); } - - mBlockNumberActionItem.setVisibility(View.VISIBLE); } private void closeSystemDialogs() { -- cgit v1.2.3