summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/callcomposer
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2017-07-17 13:17:21 -0700
committerEric Erfanian <erfanian@google.com>2017-07-25 09:03:04 -0700
commit758e559760fad15661635854c85116366bc091a4 (patch)
tree9947967b9d71a555c6957a444891449e95ddf347 /java/com/android/dialer/callcomposer
parent55e2443f1aa9619a3330d2d7496ea5272e5266d9 (diff)
Replaced video calling/camera permission dialog with a toast.
Since we are given the camera permission by default for video calling, we don't need to request it from the framework. But, for privacy reasons, we still need to tell the user that we have it. Since we're changing the preference for call composer, v10.1 users will see this this toast again if they've never made a video call. The toast is shown in the following situations: 1. If a user receives a video call 2. If a user makes a video call 3. If the user opens call composer The toast doesn't show: 1. If the user has already seen the toast anywhere before 2. If the user has revoked the system permission and grants it with a system dialog Bug: 36608790,63405063 Test: manual PiperOrigin-RevId: 162258610 Change-Id: Ie93413c9c2e1f083919e7183eb920100b06fd4a4
Diffstat (limited to 'java/com/android/dialer/callcomposer')
-rw-r--r--java/com/android/dialer/callcomposer/CameraComposerFragment.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/java/com/android/dialer/callcomposer/CameraComposerFragment.java b/java/com/android/dialer/callcomposer/CameraComposerFragment.java
index d55f3222c..a5c65fd9d 100644
--- a/java/com/android/dialer/callcomposer/CameraComposerFragment.java
+++ b/java/com/android/dialer/callcomposer/CameraComposerFragment.java
@@ -18,13 +18,11 @@ package com.android.dialer.callcomposer;
import android.Manifest;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.drawable.Animatable;
import android.hardware.Camera.CameraInfo;
import android.net.Uri;
import android.os.Bundle;
-import android.preference.PreferenceManager;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@@ -57,7 +55,6 @@ import com.android.dialer.util.PermissionsUtil;
public class CameraComposerFragment extends CallComposerFragment
implements CameraManagerListener, OnClickListener, CameraManager.MediaCallback {
- private static final String CAMERA_PRIVACY_PREF = "camera_privacy_permission";
private static final String CAMERA_DIRECTION_KEY = "camera_direction";
private static final String CAMERA_URI_KEY = "camera_key";
@@ -134,11 +131,8 @@ public class CameraComposerFragment extends CallComposerFragment
}
private void setupCamera() {
- SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
- if (!preferences.getBoolean(CAMERA_PRIVACY_PREF, false)) {
- Toast.makeText(getContext(), getString(R.string.camera_privacy_text), Toast.LENGTH_LONG)
- .show();
- preferences.edit().putBoolean(CAMERA_PRIVACY_PREF, true).apply();
+ if (!PermissionsUtil.hasCameraPrivacyToastShown(getContext())) {
+ PermissionsUtil.showCameraPermissionToast(getContext());
}
CameraManager.get().setListener(this);
preview.setShown();
@@ -403,6 +397,7 @@ public class CameraComposerFragment extends CallComposerFragment
Logger.get(getContext()).logImpression(DialerImpression.Type.CAMERA_PERMISSION_GRANTED);
LogUtil.i("CameraComposerFragment.onRequestPermissionsResult", "Permission granted.");
permissionView.setVisibility(View.GONE);
+ PermissionsUtil.setCameraPrivacyToastShown(getContext());
setupCamera();
} else if (requestCode == CAMERA_PERMISSION) {
Logger.get(getContext()).logImpression(DialerImpression.Type.CAMERA_PERMISSION_DENIED);