diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-05-22 03:01:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-22 03:01:27 +0000 |
commit | e10f20f6b8e568d89ab36d26df05282a0c4512b3 (patch) | |
tree | e67463f8bd281f2f196346d79d3313fe5d177d30 /java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java | |
parent | 4950fd587f2588e7958a84c5fcd814058bd2e1a3 (diff) | |
parent | fec2920572350518f9600ac1820abd76fb449a1c (diff) |
Merge "Don't show "Add contact" and/or "Message" in the bottom sheet if corresponding permissions are not granted."
Diffstat (limited to 'java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java')
-rw-r--r-- | java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java index a09f6e10b..0e78d70f5 100644 --- a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java +++ b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java @@ -32,6 +32,7 @@ import com.android.dialer.duo.DuoComponent; import com.android.dialer.logging.ReportingLocation; import com.android.dialer.spam.Spam; import com.android.dialer.util.CallUtil; +import com.android.dialer.util.PermissionsUtil; import com.android.dialer.util.UriUtils; import java.util.ArrayList; import java.util.List; @@ -179,6 +180,7 @@ public final class HistoryItemActionModulesBuilder { * <p>The method is a no-op if * * <ul> + * <li>the permission to send SMS is not granted, * <li>the call is one made to/received from an emergency number, * <li>the call is one made to a voicemail box, * <li>the number is blocked, or @@ -188,7 +190,8 @@ public final class HistoryItemActionModulesBuilder { public HistoryItemActionModulesBuilder addModuleForSendingTextMessage() { // TODO(zachh): There are other conditions where this module should not be shown // (e.g., business numbers). - if (moduleInfo.getIsEmergencyNumber() + if (!PermissionsUtil.hasSendSmsPermissions(context) + || moduleInfo.getIsEmergencyNumber() || moduleInfo.getIsVoicemailCall() || moduleInfo.getIsBlocked() || TextUtils.isEmpty(moduleInfo.getNormalizedNumber())) { @@ -220,6 +223,7 @@ public final class HistoryItemActionModulesBuilder { * <p>The method is a no-op if * * <ul> + * <li>the permission to write contacts is not granted, * <li>the call is one made to/received from an emergency number, * <li>the call is one made to a voicemail box, * <li>the call should be shown as spam, @@ -229,7 +233,8 @@ public final class HistoryItemActionModulesBuilder { * </ul> */ public HistoryItemActionModulesBuilder addModuleForAddingToContacts() { - if (moduleInfo.getIsEmergencyNumber() + if (!PermissionsUtil.hasContactsWritePermissions(context) + || moduleInfo.getIsEmergencyNumber() || moduleInfo.getIsVoicemailCall() || Spam.shouldShowAsSpam(moduleInfo.getIsSpam(), moduleInfo.getCallType()) || moduleInfo.getIsBlocked() |