Merge "Specify the component for the ACTION_SHOW_ECM_EXIT_DIALOG Intent" into rvc-dev
diff --git a/src/com/android/phone/CallBarringEditPreference.java b/src/com/android/phone/CallBarringEditPreference.java
index 5d83de1..b8e3250 100644
--- a/src/com/android/phone/CallBarringEditPreference.java
+++ b/src/com/android/phone/CallBarringEditPreference.java
@@ -74,9 +74,9 @@
super(context, attrs);
// Get the summary settings, use CheckBoxPreference as the standard.
TypedArray typedArray = context.obtainStyledAttributes(attrs,
- R.styleable.CheckBoxPreference, 0, 0);
- mSummaryOn = typedArray.getString(R.styleable.CheckBoxPreference_summaryOn);
- mSummaryOff = typedArray.getString(R.styleable.CheckBoxPreference_summaryOff);
+ android.R.styleable.CheckBoxPreference, 0, 0);
+ mSummaryOn = typedArray.getString(android.R.styleable.CheckBoxPreference_summaryOn);
+ mSummaryOff = typedArray.getString(android.R.styleable.CheckBoxPreference_summaryOff);
mDisableText = context.getText(R.string.disable);
mEnableText = context.getText(R.string.enable);
typedArray.recycle();
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index 5d630af..42bfb24 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -1204,7 +1204,7 @@
return false;
}
- private static int getPrimaryColor(WallpaperColors colors) {
+ private int getPrimaryColor(WallpaperColors colors) {
if (colors != null) {
// Android accessibility scanner
// (https://support.google.com/accessibility/android/answer/7158390)
@@ -1212,15 +1212,22 @@
// 4.5 with background color. The color generated from wallpaper may not
// follow this rule. Calculate a proper color here.
Color primary = colors.getPrimaryColor();
- Color text = Color.valueOf(Color.WHITE);
+ Color text;
+ if (mSupportsDarkText) {
+ text = Color.valueOf(Color.BLACK);
+ } else {
+ text = Color.valueOf(Color.WHITE);
+ }
Color dial = Color.valueOf(DIALER_GREEN);
// If current primary color can't follow the contrast ratio rule, make it
- // deeper and try again.
+ // deeper/lighter and try again.
while (!checkContrastRatio(primary, text)) {
- primary = getDeeper(primary);
+ primary = getNextColor(primary, mSupportsDarkText);
}
- while (!checkContrastRatio(primary, dial)) {
- primary = getDeeper(primary);
+ if (!mSupportsDarkText) {
+ while (!checkContrastRatio(primary, dial)) {
+ primary = getNextColor(primary, mSupportsDarkText);
+ }
}
return primary.toArgb();
}
@@ -1230,17 +1237,21 @@
return Color.BLACK;
}
- private static Color getDeeper(Color color) {
- float r = color.red() - COLOR_DELTA;
- float g = color.green() - COLOR_DELTA;
- float b = color.blue() - COLOR_DELTA;
+ private Color getNextColor(Color color, boolean darkText) {
+ float sign = darkText ? 1.f : -1.f;
+ float r = color.red() + sign * COLOR_DELTA;
+ float g = color.green() + sign * COLOR_DELTA;
+ float b = color.blue() + sign * COLOR_DELTA;
if (r < 0f) r = 0f;
if (g < 0f) g = 0f;
if (b < 0f) b = 0f;
+ if (r > 1f) r = 1f;
+ if (g > 1f) g = 1f;
+ if (b > 1f) b = 1f;
return Color.valueOf(r, g, b);
}
- private static boolean checkContrastRatio(Color color1, Color color2) {
+ private boolean checkContrastRatio(Color color1, Color color2) {
float lum1 = color1.luminance();
float lum2 = color2.luminance();
double cr;
diff --git a/tests/src/com/android/TelephonyTestBase.java b/tests/src/com/android/TelephonyTestBase.java
index 86c5402..132d893 100644
--- a/tests/src/com/android/TelephonyTestBase.java
+++ b/tests/src/com/android/TelephonyTestBase.java
@@ -22,6 +22,8 @@
import android.os.Looper;
import android.util.Log;
+import com.android.internal.telephony.PhoneConfigurationManager;
+
import org.mockito.MockitoAnnotations;
import java.util.concurrent.CountDownLatch;
@@ -52,6 +54,8 @@
}
public void tearDown() throws Exception {
+ // Ensure there are no static references to handlers after test completes.
+ PhoneConfigurationManager.unregisterAllMultiSimConfigChangeRegistrants();
}
protected final void waitForHandlerAction(Handler h, long timeoutMillis) {