From f15085f9ff240b5f0bc33da02a8d8cb239458de3 Mon Sep 17 00:00:00 2001 From: roldenburg Date: Mon, 6 Nov 2017 12:02:06 -0800 Subject: Disable "Switch Camera" button when not transmitting Author: Ravi Paluri Bug: 68677786 Test: CallButtonPresenterTest PiperOrigin-RevId: 174740252 Change-Id: If20e9fb92c4d729a75edf8ac6d088a88d4d319d8 --- java/com/android/dialer/util/PermissionsUtil.java | 5 ++++- java/com/android/incallui/CallButtonPresenter.java | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/java/com/android/dialer/util/PermissionsUtil.java b/java/com/android/dialer/util/PermissionsUtil.java index 012b83ff1..6684f954b 100644 --- a/java/com/android/dialer/util/PermissionsUtil.java +++ b/java/com/android/dialer/util/PermissionsUtil.java @@ -36,6 +36,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.support.annotation.NonNull; +import android.support.annotation.VisibleForTesting; import android.support.v4.content.ContextCompat; import android.support.v4.content.LocalBroadcastManager; import android.widget.Toast; @@ -49,7 +50,9 @@ import java.util.List; /** Utility class to help with runtime permissions. */ public class PermissionsUtil { - private static final String PREFERENCE_CAMERA_ALLOWED_BY_USER = "camera_allowed_by_user"; + @VisibleForTesting + public static final String PREFERENCE_CAMERA_ALLOWED_BY_USER = "camera_allowed_by_user"; + private static final String PERMISSION_PREFERENCE = "dialer_permissions"; private static final String CEQUINT_PERMISSION = "com.cequint.ecid.CALLER_ID_LOOKUP"; diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java index cc95f7b84..6b7eb9b4c 100644 --- a/java/com/android/incallui/CallButtonPresenter.java +++ b/java/com/android/incallui/CallButtonPresenter.java @@ -477,7 +477,8 @@ public class CallButtonPresenter mInCallButtonUi.showButton(InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo); mInCallButtonUi.showButton(InCallButtonIds.BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio); mInCallButtonUi.showButton( - InCallButtonIds.BUTTON_SWITCH_CAMERA, isVideo && hasCameraPermission); + InCallButtonIds.BUTTON_SWITCH_CAMERA, + isVideo && hasCameraPermission && call.getVideoTech().isTransmitting()); mInCallButtonUi.showButton(InCallButtonIds.BUTTON_PAUSE_VIDEO, showPauseVideo); if (isVideo) { mInCallButtonUi.setVideoPaused(!call.getVideoTech().isTransmitting() || !hasCameraPermission); -- cgit v1.2.3