From 91ce7d2a476bd04fe525049a37a2f8b2824e9724 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 5 Jun 2017 13:35:02 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/158012278. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/152373142 (4/06/2017) to cl/158012278 (6/05/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: I4d3f14b5140e2e51bead9497bc118a205b3ebe76 --- .../android/dialer/callcomposer/CameraComposerFragment.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'java/com/android/dialer/callcomposer/CameraComposerFragment.java') 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); -- cgit v1.2.3