diff options
author | Brandon Maxwell <maxwelb@google.com> | 2016-03-17 16:01:57 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2016-03-18 19:55:28 -0700 |
commit | 3ec5d25470379acbbf3bb2bcc83e5e897a22a59d (patch) | |
tree | f41f9286374543fd5dbfb2c8a342025128ca9935 /src/com/android/dialer/CallDetailActivity.java | |
parent | f804a91865c7916369e1ab119dfb13d35ca5f033 (diff) |
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
Diffstat (limited to 'src/com/android/dialer/CallDetailActivity.java')
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 15 |
1 files changed, 11 insertions, 4 deletions
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() { |