From df3893d3ea8206a2d21c2a271a7f2ea2da681775 Mon Sep 17 00:00:00 2001 From: erfanian Date: Mon, 2 Oct 2017 14:28:41 -0700 Subject: Fix issue that the connection icon is placed a little left from center When status text is empty, VoWiFi icon is placed a bit left from center because the view of connection icon is containing margin between the tatus text. Fix to remove margin from the icon when the text is empty. Public-Origin-Change-Id: Ic302104d85fa9114bebb5688f3e8028d398d1921 Signed-off-by: Eric Erfanian Author: Kousuke Kitahara Bug: 66075997 Test: scuba tests PiperOrigin-RevId: 170753786 Change-Id: Ifde98a8c04ba3dc2233439957a74fc4f54b444fa --- .../incallui/contactgrid/ContactGridManager.java | 10 ++++++++++ .../res/layout/incall_contactgrid_top_row.xml | 21 ++++++++++++++++++++- .../incallui/contactgrid/res/values/dimens.xml | 22 ++++++++++++++++++++++ .../incallui/contactgrid/res/values/ids.xml | 1 + 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 java/com/android/incallui/contactgrid/res/values/dimens.xml (limited to 'java/com/android') diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java index 18bab6ab3..c0ab9609f 100644 --- a/java/com/android/incallui/contactgrid/ContactGridManager.java +++ b/java/com/android/incallui/contactgrid/ContactGridManager.java @@ -27,6 +27,7 @@ import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.widget.Chronometer; import android.widget.ImageView; +import android.widget.Space; import android.widget.TextView; import android.widget.ViewAnimator; import com.android.contacts.common.compat.PhoneNumberUtilsCompat; @@ -74,6 +75,7 @@ public class ContactGridManager { private final ViewAnimator bottomTextSwitcher; private final TextView bottomTextView; private final Chronometer bottomTimerView; + private final Space topRowSpace; private int avatarSize; private boolean hideAvatar; private boolean showAnonymousAvatar; @@ -104,6 +106,7 @@ public class ContactGridManager { bottomTextSwitcher = view.findViewById(R.id.contactgrid_bottom_text_switcher); bottomTextView = view.findViewById(R.id.contactgrid_bottom_text); bottomTimerView = view.findViewById(R.id.contactgrid_bottom_timer); + topRowSpace = view.findViewById(R.id.contactgrid_top_row_space); contactGridLayout = (View) contactNameTextView.getParent(); letterTile = new LetterTileDrawable(context.getResources()); @@ -229,9 +232,16 @@ public class ContactGridManager { if (info.icon == null) { connectionIconImageView.setVisibility(View.GONE); + topRowSpace.setVisibility(View.GONE); } else { connectionIconImageView.setVisibility(View.VISIBLE); connectionIconImageView.setImageDrawable(info.icon); + if (statusTextView.getVisibility() == View.VISIBLE + && !TextUtils.isEmpty(statusTextView.getText())) { + topRowSpace.setVisibility(View.VISIBLE); + } else { + topRowSpace.setVisibility(View.GONE); + } } } diff --git a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml index 59359c9c1..42066f286 100644 --- a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml +++ b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml @@ -1,4 +1,19 @@ + + + + + + + + 10dp + \ No newline at end of file diff --git a/java/com/android/incallui/contactgrid/res/values/ids.xml b/java/com/android/incallui/contactgrid/res/values/ids.xml index 821dc9d98..f3b111a16 100644 --- a/java/com/android/incallui/contactgrid/res/values/ids.xml +++ b/java/com/android/incallui/contactgrid/res/values/ids.xml @@ -28,4 +28,5 @@ + -- cgit v1.2.3 From a95459f9ccb54f6b694810cf7396ffdefde11d45 Mon Sep 17 00:00:00 2001 From: mdooley Date: Mon, 2 Oct 2017 16:12:34 -0700 Subject: Adjust the location update frequency for emergency calls Sometimes takes many seconds to get an accurate location during an emergency call. With this cl we use a high frequency update rate (5 seconds) until we get an accurate location, and then we decrease the update rate (30 seconds) to save power. Bug: 67317743 Test: manual PiperOrigin-RevId: 170770361 Change-Id: Ib6415145f6a62125f4b458e242ebe23409f9d406 --- .../incallui/calllocation/impl/LocationHelper.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'java/com/android') diff --git a/java/com/android/incallui/calllocation/impl/LocationHelper.java b/java/com/android/incallui/calllocation/impl/LocationHelper.java index 48baa020a..7fbd60d04 100644 --- a/java/com/android/incallui/calllocation/impl/LocationHelper.java +++ b/java/com/android/incallui/calllocation/impl/LocationHelper.java @@ -39,7 +39,8 @@ import java.util.List; /** Uses the Fused location service to get location and pass updates on to listeners. */ public class LocationHelper { - private static final int MIN_UPDATE_INTERVAL_MS = 20 * 1000; + private static final int FAST_MIN_UPDATE_INTERVAL_MS = 5 * 1000; + private static final int SLOW_MIN_UPDATE_INTERVAL_MS = 30 * 1000; private static final int LAST_UPDATE_THRESHOLD_MS = 60 * 1000; private static final int LOCATION_ACCURACY_THRESHOLD_METERS = 100; @@ -159,6 +160,7 @@ public class LocationHelper { private final FusedLocationProviderClient locationClient; private final ConnectivityManager connectivityManager; private final Handler mainThreadHandler = new Handler(); + private boolean gotGoodLocation; @MainThread LocationHelperInternal(Context context) { @@ -178,11 +180,12 @@ public class LocationHelper { private void requestUpdates() { LogUtil.enterBlock("LocationHelperInternal.requestUpdates"); + int interval = gotGoodLocation ? SLOW_MIN_UPDATE_INTERVAL_MS : FAST_MIN_UPDATE_INTERVAL_MS; LocationRequest locationRequest = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) - .setInterval(MIN_UPDATE_INTERVAL_MS) - .setFastestInterval(MIN_UPDATE_INTERVAL_MS); + .setInterval(interval) + .setFastestInterval(interval); locationClient .requestLocationUpdates(locationRequest, this) @@ -202,6 +205,7 @@ public class LocationHelper { LogUtil.i("LocationHelperInternal.getLocation", "onSuccess"); Assert.isMainThread(); LocationHelper.this.onLocationChanged(location, isConnected()); + maybeAdjustUpdateInterval(location); }) .addOnFailureListener( e -> LogUtil.e("LocationHelperInternal.getLocation", "onFailure", e)); @@ -215,10 +219,19 @@ public class LocationHelper { @Override public void run() { LocationHelper.this.onLocationChanged(location, isConnected()); + maybeAdjustUpdateInterval(location); } }); } + private void maybeAdjustUpdateInterval(Location location) { + if (!gotGoodLocation && checkLocation(location) == LOCATION_STATUS_OK) { + LogUtil.i("LocationHelperInternal.maybeAdjustUpdateInterval", "got good location"); + gotGoodLocation = true; + requestUpdates(); + } + } + /** @return Whether the phone is connected to data. */ private boolean isConnected() { if (connectivityManager == null) { -- cgit v1.2.3