Merge "Ensure sim color is shown on multi-sim devices when only one sim installed." into lmp-mr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e8def4b..039cc31 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -277,6 +277,7 @@
android:theme="@style/Theme.CircularRevealAnimation"
android:exported="false"
android:configChanges="keyboardHidden|orientation"
+ android:launchMode="singleInstance"
android:noHistory="true"
android:excludeFromRecents="true"
android:screenOrientation="nosensor" />
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 92d1f4a..82df4ec 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -104,6 +104,7 @@
<style name="DialtactsActivityTheme" parent="DialtactsTheme">
<item name="android:actionBarStyle">@style/DialtactsActionBarWithoutTitleStyle</item>
<item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb</item>
+ <item name="android:fastScrollTrackDrawable">@null</item>
</style>
<style name="CallDetailActivityTheme" parent="DialtactsThemeWithoutActionBarOverlay">
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index ce6475e..f1112f1 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -924,9 +924,10 @@
PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity());
boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(
getTelecomManager().getUserSelectedOutgoingPhoneAccount());
- boolean multiSim = subscriptionAccountHandles.size() > 1;
+ boolean needsAccountDisambiguation = subscriptionAccountHandles.size() > 1
+ && !hasUserSelectedDefault;
- if ((multiSim && !hasUserSelectedDefault) || isVoicemailAvailable()) {
+ if (needsAccountDisambiguation || isVoicemailAvailable()) {
// On a multi-SIM phone, if the user has not selected a default
// subscription, initiate a call to voicemail so they can select an account
// from the "Call with" dialog.
@@ -1519,13 +1520,21 @@
/**
* Check if voicemail is enabled/accessible.
*
- * @return true if voicemail is enabled and accessibly. Note that this can be false
+ * @return true if voicemail is enabled and accessible. Note that this can be false
* "temporarily" after the app boot.
- * @see TelephonyManager#getVoiceMailNumber()
+ * @see TelecomManager#hasVoiceMailNumber(PhoneAccountHandle)
*/
private boolean isVoicemailAvailable() {
try {
- return getTelephonyManager().getVoiceMailNumber() != null;
+ PhoneAccountHandle defaultUserSelectedAccount =
+ getTelecomManager().getUserSelectedOutgoingPhoneAccount();
+ if (defaultUserSelectedAccount == null) {
+ // In a single-SIM phone, there is no default outgoing phone account selected by
+ // the user, so just call TelephonyManager#getVoicemailNumber directly.
+ return getTelephonyManager().getVoiceMailNumber() != null;
+ } else {
+ return getTelecomManager().hasVoiceMailNumber(defaultUserSelectedAccount);
+ }
} catch (SecurityException se) {
// Possibly no READ_PHONE_STATE privilege.
Log.w(TAG, "SecurityException is thrown. Maybe privilege isn't sufficient.");
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index 408d5b1..af82e40 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -90,6 +90,7 @@
private ShortcutCardsAdapter mMergedAdapter;
private CallLogAdapter mCallLogAdapter;
private CallLogQueryHandler mCallLogQueryHandler;
+ private OverlappingPaneLayout mOverlappingPaneLayout;
private boolean mIsPanelOpen = true;
@@ -302,6 +303,7 @@
mRemoveViewContent = parentView.findViewById(R.id.remove_view_content);
setupPaneLayout((OverlappingPaneLayout) parentView);
+ mOverlappingPaneLayout = (OverlappingPaneLayout) parentView;
return parentView;
}
@@ -322,6 +324,11 @@
mCallLogAdapter.changeCursor(cursor);
mMergedAdapter.notifyDataSetChanged();
+
+ // Refresh the overlapping pane to ensure that any changes in the shortcut card height
+ // are appropriately reflected in the overlap position.
+ mOverlappingPaneLayout.refresh();
+
// Return true; took ownership of cursor
return true;
}
diff --git a/src/com/android/dialer/widget/OverlappingPaneLayout.java b/src/com/android/dialer/widget/OverlappingPaneLayout.java
index 8f911c2..167b849 100644
--- a/src/com/android/dialer/widget/OverlappingPaneLayout.java
+++ b/src/com/android/dialer/widget/OverlappingPaneLayout.java
@@ -717,6 +717,22 @@
return wantTouchEvents;
}
+ /**
+ * Refreshes the {@link OverlappingPaneLayout} be attempting to re-open or re-close the pane.
+ * This ensures that the overlapping pane is repositioned based on any changes to the view
+ * which is being overlapped.
+ * <p>
+ * The {@link #openPane()} and {@link #closePane()} methods do not perform any animation if the
+ * pane has already been positioned appropriately.
+ */
+ public void refresh() {
+ if (isOpen()) {
+ openPane();
+ } else {
+ closePane();
+ }
+ }
+
private boolean closePane(View pane, int initialVelocity) {
if (mFirstLayout || smoothSlideTo(0.f, initialVelocity)) {
mPreservedOpenState = false;