From fc37b02f5d3381a7882770941e461b13b679b6ef Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Tue, 21 Mar 2017 10:11:17 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/150756069 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/150392808 (3/16/2017) to cl/150756069 (3/21/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: I0888b5db52efb28eb8194600e0c7804592f975f3 --- .../dialer/callcomposer/CallComposerActivity.java | 64 ++++------------------ .../callcomposer/CameraComposerFragment.java | 5 +- .../callcomposer/GalleryComposerFragment.java | 4 +- .../dialer/callcomposer/camera/CameraManager.java | 6 +- .../callcomposer/nano/CallComposerContact.java | 32 +++++------ 5 files changed, 37 insertions(+), 74 deletions(-) (limited to 'java/com/android/dialer/callcomposer') diff --git a/java/com/android/dialer/callcomposer/CallComposerActivity.java b/java/com/android/dialer/callcomposer/CallComposerActivity.java index f73563ff8..9fb6c38f4 100644 --- a/java/com/android/dialer/callcomposer/CallComposerActivity.java +++ b/java/com/android/dialer/callcomposer/CallComposerActivity.java @@ -49,7 +49,6 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toolbar; import com.android.contacts.common.ContactPhotoManager; -import com.android.contacts.common.util.UriUtils; import com.android.dialer.callcomposer.CallComposerFragment.CallComposerListener; import com.android.dialer.callcomposer.nano.CallComposerContact; import com.android.dialer.callcomposer.util.CopyAndResizeImageTask; @@ -59,7 +58,6 @@ import com.android.dialer.callintent.nano.CallInitiationType; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.UiUtil; -import com.android.dialer.compat.CompatUtils; import com.android.dialer.constants.Constants; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.enrichedcall.EnrichedCallManager; @@ -305,7 +303,7 @@ public class CallComposerActivity extends AppCompatActivity @Override public void onCopyFailed(Throwable throwable) { - // TODO(b/33753902) + // TODO(b/34279096) - gracefully handle message failure LogUtil.e("CallComposerActivity.onCopyFailed", "copy Failed", throwable); } }) @@ -473,21 +471,16 @@ public class CallComposerActivity extends AppCompatActivity return getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; } - /** - * Populates the contact info fields based on the current contact information. Copied from {@link - * com.android.contacts.common.dialog.CallSubjectDialog}. - */ + /** Populates the contact info fields based on the current contact information. */ private void updateContactInfo() { - if (contact.contactUri != null) { - setPhoto( - contact.photoId, - Uri.parse(contact.photoUri), - Uri.parse(contact.contactUri), - contact.nameOrNumber, - contact.isBusiness); - } else { - contactPhoto.setVisibility(View.GONE); - } + ContactPhotoManager.getInstance(this) + .loadDialerThumbnail( + contactPhoto, + contact.contactUri == null ? null : Uri.parse(contact.contactUri), + contact.photoId, + contact.nameOrNumber, + contact.contactType); + nameView.setText(contact.nameOrNumber); getActionBar().setTitle(contact.nameOrNumber); if (!TextUtils.isEmpty(contact.numberLabel) && !TextUtils.isEmpty(contact.displayNumber)) { @@ -505,43 +498,6 @@ public class CallComposerActivity extends AppCompatActivity } } - /** - * Sets the photo on the quick contact galleryIcon. Copied from {@link - * com.android.contacts.common.dialog.CallSubjectDialog}. - */ - private void setPhoto( - long photoId, Uri photoUri, Uri contactUri, String displayName, boolean isBusiness) { - contactPhoto.assignContactUri(contactUri); - if (CompatUtils.isLollipopCompatible()) { - contactPhoto.setOverlay(null); - } - - int contactType; - if (isBusiness) { - contactType = ContactPhotoManager.TYPE_BUSINESS; - } else { - contactType = ContactPhotoManager.TYPE_DEFAULT; - } - - String lookupKey = null; - if (contactUri != null) { - lookupKey = UriUtils.getLookupKeyFromUri(contactUri); - } - - ContactPhotoManager.DefaultImageRequest request = - new ContactPhotoManager.DefaultImageRequest( - displayName, lookupKey, contactType, true /* isCircular */); - - if (photoId == 0 && photoUri != null) { - contactPhoto.setImageDrawable( - getDrawable(R.drawable.product_logo_avatar_anonymous_color_120)); - } else { - ContactPhotoManager.getInstance(this) - .loadThumbnail( - contactPhoto, photoId, false /* darkTheme */, true /* isCircular */, request); - } - } - /** Animates compose UI into view */ private void runEntranceAnimation() { if (!shouldAnimateEntrance) { diff --git a/java/com/android/dialer/callcomposer/CameraComposerFragment.java b/java/com/android/dialer/callcomposer/CameraComposerFragment.java index 583fb5446..ebd032199 100644 --- a/java/com/android/dialer/callcomposer/CameraComposerFragment.java +++ b/java/com/android/dialer/callcomposer/CameraComposerFragment.java @@ -366,7 +366,10 @@ public class CameraComposerFragment extends CallComposerFragment @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - outState.putInt(CAMERA_DIRECTION_KEY, CameraManager.get().getCameraInfo().facing); + + CameraInfo cameraInfo = CameraManager.get().getCameraInfo(); + int facing = cameraInfo == null ? CameraInfo.CAMERA_FACING_BACK : cameraInfo.facing; + outState.putInt(CAMERA_DIRECTION_KEY, facing); outState.putParcelable(CAMERA_URI_KEY, cameraUri); } diff --git a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java index b53d6a9d6..1d684a2d3 100644 --- a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java +++ b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java @@ -277,14 +277,14 @@ public class GalleryComposerFragment extends CallComposerFragment @Override public void onCopyFailed(Throwable throwable) { - // TODO(b/33753902) + // TODO(b/34279096) - gracefully handle message failure LogUtil.e( "GalleryComposerFragment.onFailure", "Data preparation failed", throwable); } }) .execute(); } else { - // TODO(b/33753902) + // TODO(b/34279096) - gracefully handle message failure } } } diff --git a/java/com/android/dialer/callcomposer/camera/CameraManager.java b/java/com/android/dialer/callcomposer/camera/CameraManager.java index 87cd16a99..4cc08ba32 100644 --- a/java/com/android/dialer/callcomposer/camera/CameraManager.java +++ b/java/com/android/dialer/callcomposer/camera/CameraManager.java @@ -23,6 +23,7 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Looper; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.text.TextUtils; import android.view.MotionEvent; @@ -305,6 +306,7 @@ public class CameraManager implements FocusOverlayManager.Listener { } } + @Nullable @VisibleForTesting public CameraInfo getCameraInfo() { if (mCameraIndex == NO_CAMERA_SELECTED) { @@ -516,7 +518,7 @@ public class CameraManager implements FocusOverlayManager.Listener { final WindowManager windowManager = (WindowManager) mCameraPreview.getContext().getSystemService(Context.WINDOW_SERVICE); - int degrees = 0; + int degrees; switch (windowManager.getDefaultDisplay().getRotation()) { case Surface.ROTATION_0: degrees = 0; @@ -530,6 +532,8 @@ public class CameraManager implements FocusOverlayManager.Listener { case Surface.ROTATION_270: degrees = 270; break; + default: + throw Assert.createAssertionFailException(""); } // The display orientation of the camera (this controls the preview image). diff --git a/java/com/android/dialer/callcomposer/nano/CallComposerContact.java b/java/com/android/dialer/callcomposer/nano/CallComposerContact.java index acb71a0aa..dcda571e2 100644 --- a/java/com/android/dialer/callcomposer/nano/CallComposerContact.java +++ b/java/com/android/dialer/callcomposer/nano/CallComposerContact.java @@ -48,9 +48,6 @@ public final class CallComposerContact // optional string name_or_number = 4; public java.lang.String nameOrNumber; - // optional bool is_business = 5; - public boolean isBusiness; - // optional string number = 6; public java.lang.String number; @@ -60,6 +57,9 @@ public final class CallComposerContact // optional string number_label = 8; public java.lang.String numberLabel; + // optional int32 contact_type = 9; + public int contactType; + // @@protoc_insertion_point(class_scope:com.android.dialer.callcomposer.CallComposerContact) public CallComposerContact() { @@ -71,10 +71,10 @@ public final class CallComposerContact photoUri = ""; contactUri = ""; nameOrNumber = ""; - isBusiness = false; number = ""; displayNumber = ""; numberLabel = ""; + contactType = 0; unknownFieldData = null; cachedSize = -1; return this; @@ -95,9 +95,6 @@ public final class CallComposerContact if (this.nameOrNumber != null && !this.nameOrNumber.equals("")) { output.writeString(4, this.nameOrNumber); } - if (this.isBusiness != false) { - output.writeBool(5, this.isBusiness); - } if (this.number != null && !this.number.equals("")) { output.writeString(6, this.number); } @@ -107,6 +104,9 @@ public final class CallComposerContact if (this.numberLabel != null && !this.numberLabel.equals("")) { output.writeString(8, this.numberLabel); } + if (this.contactType != 0) { + output.writeInt32(9, this.contactType); + } super.writeTo(output); } @@ -130,10 +130,6 @@ public final class CallComposerContact com.google.protobuf.nano.CodedOutputByteBufferNano.computeStringSize( 4, this.nameOrNumber); } - if (this.isBusiness != false) { - size += - com.google.protobuf.nano.CodedOutputByteBufferNano.computeBoolSize(5, this.isBusiness); - } if (this.number != null && !this.number.equals("")) { size += com.google.protobuf.nano.CodedOutputByteBufferNano.computeStringSize(6, this.number); } @@ -146,6 +142,10 @@ public final class CallComposerContact size += com.google.protobuf.nano.CodedOutputByteBufferNano.computeStringSize(8, this.numberLabel); } + if (this.contactType != 0) { + size += + com.google.protobuf.nano.CodedOutputByteBufferNano.computeInt32Size(9, this.contactType); + } return size; } @@ -184,11 +184,6 @@ public final class CallComposerContact this.nameOrNumber = input.readString(); break; } - case 40: - { - this.isBusiness = input.readBool(); - break; - } case 50: { this.number = input.readString(); @@ -204,6 +199,11 @@ public final class CallComposerContact this.numberLabel = input.readString(); break; } + case 72: + { + this.contactType = input.readInt32(); + break; + } } } } -- cgit v1.2.3