summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/callcomposer/cameraui
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-02-22 16:32:36 -0800
committerEric Erfanian <erfanian@google.com>2017-03-01 09:56:52 -0800
commitccca31529c07970e89419fb85a9e8153a5396838 (patch)
treea7034c0a01672b97728c13282a2672771cd28baa /java/com/android/dialer/callcomposer/cameraui
parente7ae4624ba6f25cb8e648db74e0d64c0113a16ba (diff)
Update dialer sources.
Test: Built package and system image. This change clobbers the old source, and is an export from an internal Google repository. The internal repository was forked form Android in March, and this change includes modifications since then, to near the v8 release. Since the fork, we've moved code from monolithic to independent modules. In addition, we've switched to Blaze/Bazel as the build sysetm. This export, however, still uses make. New dependencies have been added: - Dagger - Auto-Value - Glide - Libshortcutbadger Going forward, development will still be in Google3, and the Gerrit release will become an automated export, with the next drop happening in ~ two weeks. Android.mk includes local modifications from ToT. Abridged changelog: Bug fixes ● Not able to mute, add a call when using Phone app in multiwindow mode ● Double tap on keypad triggering multiple key and tones ● Reported spam numbers not showing as spam in the call log ● Crash when user tries to block number while Phone app is not set as default ● Crash when user picks a number from search auto-complete list Visual Voicemail (VVM) improvements ● Share Voicemail audio via standard exporting mechanisms that support file attachment (email, MMS, etc.) ● Make phone number, email and web sites in VVM transcript clickable ● Set PIN before declining VVM Terms of Service {Carrier} ● Set client type for outbound visual voicemail SMS {Carrier} New incoming call and incall UI on older devices (Android M) ● Updated Phone app icon ● New incall UI (large buttons, button labels) ● New and animated Answer/Reject gestures Accessibility ● Add custom answer/decline call buttons on answer screen for touch exploration accessibility services ● Increase size of touch target ● Add verbal feedback when a Voicemail fails to load ● Fix pressing of Phone buttons while in a phone call using Switch Access ● Fix selecting and opening contacts in talkback mode ● Split focus for ‘Learn More’ link in caller id & spam to help distinguish similar text Other ● Backup & Restore for App Preferences ● Prompt user to enable Wi-Fi calling if the call ends due to out of service and Wi-Fi is connected ● Rename “Dialpad” to “Keypad” ● Show "Private number" for restricted calls ● Delete unused items (vcard, add contact, call history) from Phone menu Change-Id: I2a7e53532a24c21bf308bf0a6d178d7ddbca4958
Diffstat (limited to 'java/com/android/dialer/callcomposer/cameraui')
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/AndroidManifest.xml16
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/CameraMediaChooserView.java107
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/drawable-hdpi/ic_capture.pngbin0 -> 2690 bytes
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/drawable-mdpi/ic_capture.pngbin0 -> 1851 bytes
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/drawable-xhdpi/ic_capture.pngbin0 -> 3636 bytes
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/drawable-xxhdpi/ic_capture.pngbin0 -> 5449 bytes
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/drawable-xxxhdpi/ic_capture.pngbin0 -> 7354 bytes
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/drawable/transparent_button_background.xml26
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml121
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/values/colors.xml4
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/values/dimens.xml22
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/values/strings.xml17
12 files changed, 313 insertions, 0 deletions
diff --git a/java/com/android/dialer/callcomposer/cameraui/AndroidManifest.xml b/java/com/android/dialer/callcomposer/cameraui/AndroidManifest.xml
new file mode 100644
index 000000000..12694ee5f
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/AndroidManifest.xml
@@ -0,0 +1,16 @@
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<manifest package="com.android.dialer.callcomposer.cameraui"/> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/cameraui/CameraMediaChooserView.java b/java/com/android/dialer/callcomposer/cameraui/CameraMediaChooserView.java
new file mode 100644
index 000000000..85c64e477
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/CameraMediaChooserView.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dialer.callcomposer.cameraui;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.hardware.Camera;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.util.AttributeSet;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import com.android.dialer.callcomposer.camera.CameraManager;
+import com.android.dialer.callcomposer.camera.HardwareCameraPreview;
+import com.android.dialer.callcomposer.camera.SoftwareCameraPreview;
+import com.android.dialer.common.LogUtil;
+
+/** Used to display the view of the camera. */
+public class CameraMediaChooserView extends FrameLayout {
+ private static final String STATE_CAMERA_INDEX = "camera_index";
+ private static final String STATE_SUPER = "super";
+
+ // True if we have at least queued an update to the view tree to support software rendering
+ // fallback
+ private boolean mIsSoftwareFallbackActive;
+
+ public CameraMediaChooserView(final Context context, final AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ final Bundle bundle = new Bundle();
+ bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState());
+ final int cameraIndex = CameraManager.get().getCameraIndex();
+ LogUtil.i("CameraMediaChooserView.onSaveInstanceState", "saving camera index:" + cameraIndex);
+ bundle.putInt(STATE_CAMERA_INDEX, cameraIndex);
+ return bundle;
+ }
+
+ @Override
+ protected void onRestoreInstanceState(final Parcelable state) {
+ if (!(state instanceof Bundle)) {
+ return;
+ }
+
+ final Bundle bundle = (Bundle) state;
+ final int cameraIndex = bundle.getInt(STATE_CAMERA_INDEX);
+ super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER));
+
+ LogUtil.i(
+ "CameraMediaChooserView.onRestoreInstanceState", "restoring camera index:" + cameraIndex);
+ if (cameraIndex != -1) {
+ CameraManager.get().selectCameraByIndex(cameraIndex);
+ } else {
+ resetState();
+ }
+ }
+
+ public void resetState() {
+ CameraManager.get().selectCamera(Camera.CameraInfo.CAMERA_FACING_BACK);
+ }
+
+ @Override
+ protected void onDraw(final Canvas canvas) {
+ super.onDraw(canvas);
+ // If the canvas isn't hardware accelerated, we have to replace the HardwareCameraPreview
+ // with a SoftwareCameraPreview which supports software rendering
+ if (!canvas.isHardwareAccelerated() && !mIsSoftwareFallbackActive) {
+ mIsSoftwareFallbackActive = true;
+ // Post modifying the tree since we can't modify the view tree during a draw pass
+ post(
+ new Runnable() {
+ @Override
+ public void run() {
+ final HardwareCameraPreview cameraPreview =
+ (HardwareCameraPreview) findViewById(R.id.camera_preview);
+ if (cameraPreview == null) {
+ return;
+ }
+ final ViewGroup parent = ((ViewGroup) cameraPreview.getParent());
+ final int index = parent.indexOfChild(cameraPreview);
+ final SoftwareCameraPreview softwareCameraPreview =
+ new SoftwareCameraPreview(getContext());
+ // Be sure to remove the hardware view before adding the software view to
+ // prevent having 2 camera previews active at the same time
+ parent.removeView(cameraPreview);
+ parent.addView(softwareCameraPreview, index);
+ }
+ });
+ }
+ }
+}
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/drawable-hdpi/ic_capture.png b/java/com/android/dialer/callcomposer/cameraui/res/drawable-hdpi/ic_capture.png
new file mode 100644
index 000000000..b974c9f70
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/drawable-hdpi/ic_capture.png
Binary files differ
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/drawable-mdpi/ic_capture.png b/java/com/android/dialer/callcomposer/cameraui/res/drawable-mdpi/ic_capture.png
new file mode 100644
index 000000000..98427587b
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/drawable-mdpi/ic_capture.png
Binary files differ
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/drawable-xhdpi/ic_capture.png b/java/com/android/dialer/callcomposer/cameraui/res/drawable-xhdpi/ic_capture.png
new file mode 100644
index 000000000..4ec9f75e8
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/drawable-xhdpi/ic_capture.png
Binary files differ
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/drawable-xxhdpi/ic_capture.png b/java/com/android/dialer/callcomposer/cameraui/res/drawable-xxhdpi/ic_capture.png
new file mode 100644
index 000000000..e2345dc86
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/drawable-xxhdpi/ic_capture.png
Binary files differ
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/drawable-xxxhdpi/ic_capture.png b/java/com/android/dialer/callcomposer/cameraui/res/drawable-xxxhdpi/ic_capture.png
new file mode 100644
index 000000000..3bab00984
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/drawable-xxxhdpi/ic_capture.png
Binary files differ
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/drawable/transparent_button_background.xml b/java/com/android/dialer/callcomposer/cameraui/res/drawable/transparent_button_background.xml
new file mode 100644
index 000000000..fda52c99c
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/drawable/transparent_button_background.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:drawable="@color/background_item_grey_pressed"
+ android:state_pressed="true"/>
+ <item
+ android:drawable="@color/background_item_grey_pressed"
+ android:state_activated="true"/>
+ <item
+ android:drawable="@android:color/transparent"/>
+</selector> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml b/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml
new file mode 100644
index 000000000..75401b14b
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<com.android.dialer.callcomposer.cameraui.CameraMediaChooserView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/camera_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@android:color/black">
+
+ <FrameLayout
+ android:id="@+id/mediapicker_enabled"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <!-- Default to using the hardware rendered camera preview, we will fall back to
+ SoftwareCameraPreview in CameraMediaChooserView if needed -->
+ <com.android.dialer.callcomposer.camera.HardwareCameraPreview
+ android:id="@+id/camera_preview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
+
+ <com.android.dialer.callcomposer.camera.camerafocus.RenderOverlay
+ android:id="@+id/focus_visual"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <View
+ android:id="@+id/camera_shutter_visual"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@android:color/white"
+ android:visibility="gone" />
+
+ <!-- Need a background on this view in order for the ripple effect to have a place to draw -->
+ <FrameLayout
+ android:id="@+id/camera_button_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@android:color/transparent"
+ android:padding="16dp"
+ android:layout_gravity="bottom">
+
+ <ImageButton
+ android:id="@+id/camera_fullscreen"
+ android:layout_width="@dimen/camera_view_button_size"
+ android:layout_height="@dimen/camera_view_button_size"
+ android:layout_gravity="bottom|end"
+ android:layout_marginEnd="@dimen/camera_view_button_margin"
+ android:layout_marginBottom="@dimen/camera_view_button_margin"
+ android:src="@drawable/quantum_ic_fullscreen_white_48"
+ android:background="?android:selectableItemBackgroundBorderless"/>
+
+ <ImageButton
+ android:id="@+id/camera_exit_fullscreen"
+ android:layout_width="@dimen/camera_view_button_size"
+ android:layout_height="@dimen/camera_view_button_size"
+ android:layout_gravity="bottom|end"
+ android:layout_marginEnd="@dimen/camera_view_button_margin"
+ android:layout_marginBottom="@dimen/camera_view_button_margin"
+ android:src="@drawable/quantum_ic_fullscreen_exit_white_48"
+ android:visibility="gone"
+ android:background="?android:selectableItemBackgroundBorderless"/>
+
+ <ImageButton
+ android:id="@+id/camera_capture_button"
+ android:layout_width="@dimen/capture_button_size"
+ android:layout_height="@dimen/capture_button_size"
+ android:layout_gravity="bottom|center_horizontal"
+ android:layout_marginBottom="@dimen/capture_button_bottom_margin"
+ android:background="?android:selectableItemBackgroundBorderless"
+ android:src="@drawable/ic_capture"
+ android:scaleType="fitXY"
+ android:contentDescription="@string/camera_take_picture"/>
+
+ <ImageButton
+ android:id="@+id/swap_camera_button"
+ android:layout_width="@dimen/camera_view_button_size"
+ android:layout_height="@dimen/camera_view_button_size"
+ android:layout_gravity="start|bottom"
+ android:layout_marginStart="@dimen/camera_view_button_margin"
+ android:layout_marginBottom="@dimen/camera_view_button_margin"
+ android:src="@drawable/front_back_switch_button_animation"
+ android:background="@drawable/transparent_button_background"
+ android:contentDescription="@string/camera_switch_camera_rear"/>
+
+ <ImageButton
+ android:id="@+id/camera_cancel_button"
+ android:layout_width="@dimen/camera_view_button_size"
+ android:layout_height="@dimen/camera_view_button_size"
+ android:layout_gravity="start|bottom"
+ android:layout_marginStart="@dimen/camera_view_button_margin"
+ android:layout_marginBottom="@dimen/camera_view_button_margin"
+ android:visibility="gone"
+ android:background="@drawable/transparent_button_background"
+ android:src="@drawable/quantum_ic_undo_white_48"
+ android:contentDescription="@string/camera_cancel_recording" />
+ </FrameLayout>
+ </FrameLayout>
+
+ <ProgressBar
+ android:id="@+id/loading"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:visibility="gone"/>
+</com.android.dialer.callcomposer.cameraui.CameraMediaChooserView> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/values/colors.xml b/java/com/android/dialer/callcomposer/cameraui/res/values/colors.xml
new file mode 100644
index 000000000..d5a839aca
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/values/colors.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="background_item_grey_pressed">#E0E0E0</color>
+</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/values/dimens.xml b/java/com/android/dialer/callcomposer/cameraui/res/values/dimens.xml
new file mode 100644
index 000000000..09d4a58fd
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/values/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <dimen name="camera_view_button_margin">22dp</dimen>
+ <dimen name="camera_view_button_size">46dp</dimen>
+ <dimen name="capture_button_size">84dp</dimen>
+ <dimen name="capture_button_bottom_margin">4dp</dimen>
+</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/values/strings.xml b/java/com/android/dialer/callcomposer/cameraui/res/values/strings.xml
new file mode 100644
index 000000000..999fe8f96
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/cameraui/res/values/strings.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Content description of button to switch to full screen camera -->
+ <string name="camera_switch_full_screen">Switch to full screen camera</string>
+ <!-- Content description of button when after swapped to front -->
+ <string name="camera_switch_camera_facing">Button is now front camera</string>
+ <!-- Content description of button when after swapped to back -->
+ <string name="camera_switch_camera_rear">Button is now back camera</string>
+ <!-- Content description of button to cancel recording video -->
+ <string name="camera_cancel_recording">Stop recording video</string>
+ <!-- Accessibility announcement for when we are using the front facing camera -->
+ <string name="using_front_camera">Using front camera</string>
+ <!-- Accessibility announcement for when we are using the back camera -->
+ <string name="using_back_camera">Using back camera</string>
+ <!-- Content description of button to take a photo -->
+ <string name="camera_take_picture">Take photo</string>
+</resources> \ No newline at end of file