diff options
author | Eric Erfanian <erfanian@google.com> | 2017-06-08 00:54:45 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-08 00:54:45 +0000 |
commit | 274b6d320edb3c33e7b3a95c43a811829486a777 (patch) | |
tree | b9bbc285430ffb5363a70eb27e382c38f5a85b7a /java/com/android/dialer/callcomposer/CameraComposerFragment.java | |
parent | 75233ff03785f24789b32039ac2c208805b7e506 (diff) | |
parent | 91ce7d2a476bd04fe525049a37a2f8b2824e9724 (diff) |
Update AOSP Dialer source from internal google3 repository at cl/158012278.
am: 91ce7d2a47
Change-Id: I1744a8bfca09eae5e9c0d7aac122515eca75bb8b
Diffstat (limited to 'java/com/android/dialer/callcomposer/CameraComposerFragment.java')
-rw-r--r-- | java/com/android/dialer/callcomposer/CameraComposerFragment.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/java/com/android/dialer/callcomposer/CameraComposerFragment.java b/java/com/android/dialer/callcomposer/CameraComposerFragment.java index f65207fa3..ecdc25822 100644 --- a/java/com/android/dialer/callcomposer/CameraComposerFragment.java +++ b/java/com/android/dialer/callcomposer/CameraComposerFragment.java @@ -17,13 +17,14 @@ package com.android.dialer.callcomposer; import android.Manifest; -import android.Manifest.permission; 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; @@ -56,6 +57,7 @@ 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"; @@ -107,7 +109,8 @@ public class CameraComposerFragment extends CallComposerFragment capture.setOnClickListener(this); cancel.setOnClickListener(this); - if (!PermissionsUtil.hasPermission(getContext(), permission.CAMERA)) { + + if (!PermissionsUtil.hasCameraPermissions(getContext())) { LogUtil.i("CameraComposerFragment.onCreateView", "Permission view shown."); Logger.get(getContext()).logImpression(DialerImpression.Type.CAMERA_PERMISSION_DISPLAYED); ImageView permissionImage = (ImageView) permissionView.findViewById(R.id.permission_icon); @@ -131,6 +134,12 @@ 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(); + } CameraManager.get().setListener(this); preview.setShown(); CameraManager.get().setRenderOverlay(focus); |