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 --- .../dialer/callcomposer/AndroidManifest.xml | 2 +- .../dialer/callcomposer/CallComposerActivity.java | 73 ++++++---------------- .../callcomposer/CameraComposerFragment.java | 13 +++- .../dialer/callcomposer/GalleryCursorLoader.java | 4 +- .../callcomposer/MessageComposerFragment.java | 36 +---------- .../dialer/callcomposer/camera/CameraManager.java | 19 ++---- .../callcomposer/camera/ImagePersistTask.java | 38 +++++------ .../callcomposer/proto/call_composer_contact.proto | 18 ------ .../res/layout/call_composer_activity.xml | 12 ++-- .../res/layout/fragment_message_composer.xml | 2 +- .../dialer/callcomposer/res/values-ca/strings.xml | 4 +- .../dialer/callcomposer/res/values/styles.xml | 2 +- 12 files changed, 64 insertions(+), 159 deletions(-) delete mode 100644 java/com/android/dialer/callcomposer/proto/call_composer_contact.proto (limited to 'java/com/android/dialer/callcomposer') diff --git a/java/com/android/dialer/callcomposer/AndroidManifest.xml b/java/com/android/dialer/callcomposer/AndroidManifest.xml index 369db6f4a..cce71105f 100644 --- a/java/com/android/dialer/callcomposer/AndroidManifest.xml +++ b/java/com/android/dialer/callcomposer/AndroidManifest.xml @@ -17,7 +17,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.callcomposer"> - + { File outputFile = DialerUtils.createShareableFile(mContext); try (OutputStream outputStream = new FileOutputStream(outputFile)) { - if (mHeightPercent != 1.0f) { - writeClippedBitmap(outputStream); - } else { - Bitmap bitmap = BitmapFactory.decodeByteArray(mBytes, 0, mBytes.length); - bitmap = BitmapResizer.resizeForEnrichedCalling(bitmap); - bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream); - } + writeClippedBitmap(outputStream); } return FileProvider.getUriForFile( @@ -105,10 +97,12 @@ public class ImagePersistTask extends FallibleAsyncTask { } catch (final IOException e) { // Couldn't get exif tags, not the end of the world } + Bitmap bitmap = BitmapFactory.decodeByteArray(mBytes, 0, mBytes.length); final int clippedWidth; final int clippedHeight; - if (ExifInterface.getOrientationParams(orientation).invertDimensions) { + boolean invert = ExifInterface.getOrientationParams(orientation).invertDimensions; + if (invert) { Assert.checkState(mWidth == bitmap.getHeight()); Assert.checkState(mHeight == bitmap.getWidth()); clippedWidth = (int) (mHeight * mHeightPercent); @@ -119,24 +113,22 @@ public class ImagePersistTask extends FallibleAsyncTask { clippedWidth = mWidth; clippedHeight = (int) (mHeight * mHeightPercent); } - final int offsetTop = (bitmap.getHeight() - clippedHeight) / 2; - final int offsetLeft = (bitmap.getWidth() - clippedWidth) / 2; + + int offsetTop = (bitmap.getHeight() - clippedHeight) / 2; + int offsetLeft = (bitmap.getWidth() - clippedWidth) / 2; mWidth = clippedWidth; mHeight = clippedHeight; + + Matrix matrix = new Matrix(); + matrix.postRotate(invert ? 90 : 0); + Bitmap clippedBitmap = - Bitmap.createBitmap(clippedWidth, clippedHeight, Bitmap.Config.ARGB_8888); - clippedBitmap.setDensity(bitmap.getDensity()); - final Canvas clippedBitmapCanvas = new Canvas(clippedBitmap); - final Matrix matrix = new Matrix(); - matrix.postTranslate(-offsetLeft, -offsetTop); - clippedBitmapCanvas.drawBitmap(bitmap, matrix, null /* paint */); - clippedBitmapCanvas.save(); + Bitmap.createBitmap( + bitmap, offsetLeft, offsetTop, clippedWidth, clippedHeight, matrix, true); clippedBitmap = BitmapResizer.resizeForEnrichedCalling(clippedBitmap); - // EXIF data can take a big chunk of the file size and is often cleared by the - // carrier, only store orientation since that's critical - final ExifTag orientationTag = exifInterface.getTag(ExifInterface.TAG_ORIENTATION); + // EXIF data can take a big chunk of the file size and we've already manually rotated our image, + // so remove all of the exif data. exifInterface.clearExif(); - exifInterface.setTag(orientationTag); exifInterface.writeExif(clippedBitmap, outputStream); clippedBitmap.recycle(); diff --git a/java/com/android/dialer/callcomposer/proto/call_composer_contact.proto b/java/com/android/dialer/callcomposer/proto/call_composer_contact.proto deleted file mode 100644 index 99766aac5..000000000 --- a/java/com/android/dialer/callcomposer/proto/call_composer_contact.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto2"; - -option java_package = "com.android.dialer.callcomposer"; -option java_multiple_files = true; -option optimize_for = LITE_RUNTIME; - -package com.android.dialer.callcomposer; - -message CallComposerContact { - optional fixed64 photo_id = 1; - optional string photo_uri = 2; - optional string contact_uri = 3; - optional string name_or_number = 4; - optional string number = 6; - optional string display_number = 7; - optional string number_label = 8; - optional int32 contact_type = 9; -} diff --git a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml index c3f1102d1..14703a44c 100644 --- a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml +++ b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml @@ -15,11 +15,11 @@ ~ limitations under the License --> + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/background" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/call_composer_background_color"> "Fes una foto" "No s\'ha pogut carregar la imatge de la càmera" "Permet" - "Per fer una foto, dóna accés a la càmera" - "Per compartir una imatge, dóna accés al contingut multimèdia" + "Per fer una foto, dona accés a la càmera" + "Per compartir una imatge, dona accés al contingut multimèdia" diff --git a/java/com/android/dialer/callcomposer/res/values/styles.xml b/java/com/android/dialer/callcomposer/res/values/styles.xml index 29ac4ddaa..16e7fb622 100644 --- a/java/com/android/dialer/callcomposer/res/values/styles.xml +++ b/java/com/android/dialer/callcomposer/res/values/styles.xml @@ -15,7 +15,7 @@ ~ limitations under the License --> -