Merge "Add a flag for voip app actions and tag relevant API." into main
diff --git a/res/xml/activity_blocked_numbers.xml b/res/xml/activity_blocked_numbers.xml
index e77184d..b6298e9 100644
--- a/res/xml/activity_blocked_numbers.xml
+++ b/res/xml/activity_blocked_numbers.xml
@@ -41,8 +41,8 @@
android:layout_height="wrap_content"
android:text="@string/non_primary_user"
android:paddingTop="@dimen/blocked_numbers_large_padding"
- android:paddingLeft="@dimen/blocked_numbers_large_padding"
- android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:paddingStart="@dimen/blocked_numbers_large_padding"
+ android:paddingEnd="@dimen/blocked_numbers_large_padding"
style="@style/BlockedNumbersTextPrimary2"
android:visibility="gone" />
@@ -62,8 +62,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/blocked_numbers_large_padding"
- android:paddingLeft="@dimen/blocked_numbers_large_padding"
- android:paddingRight="@dimen/blocked_numbers_large_padding">
+ android:paddingStart="@dimen/blocked_numbers_large_padding"
+ android:paddingEnd="@dimen/blocked_numbers_large_padding">
<TextView
android:layout_width="wrap_content"
diff --git a/res/xml/blocking_suppressed_butterbar.xml b/res/xml/blocking_suppressed_butterbar.xml
index 8b941b9..2947340 100644
--- a/res/xml/blocking_suppressed_butterbar.xml
+++ b/res/xml/blocking_suppressed_butterbar.xml
@@ -25,19 +25,19 @@
android:id="@+id/icon"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
android:paddingTop="@dimen/blocked_numbers_large_padding"
- android:paddingRight="@dimen/blocked_numbers_large_padding"
- android:paddingLeft="@dimen/blocked_numbers_large_padding"
+ android:paddingEnd="@dimen/blocked_numbers_large_padding"
+ android:paddingStart="@dimen/blocked_numbers_large_padding"
android:src="@drawable/ic_status_blocked_orange_40dp"/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/icon"
+ android:layout_toEndOf="@id/icon"
android:paddingTop="@dimen/blocked_numbers_large_padding"
- android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:paddingEnd="@dimen/blocked_numbers_large_padding"
android:text="@string/blocked_numbers_butter_bar_title"
style="@style/BlockedNumbersTextPrimary2" />
@@ -45,11 +45,11 @@
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/icon"
+ android:layout_toEndOf="@id/icon"
android:layout_below="@id/title"
android:paddingTop="@dimen/blocked_numbers_large_padding"
android:paddingBottom="@dimen/blocked_numbers_large_padding"
- android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:paddingEnd="@dimen/blocked_numbers_large_padding"
android:text="@string/blocked_numbers_butter_bar_body"
style="@style/BlockedNumbersTextSecondary" />
@@ -57,9 +57,9 @@
android:id="@+id/reenable_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@id/icon"
+ android:layout_toEndOf="@id/icon"
android:layout_below="@id/description"
- android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:paddingEnd="@dimen/blocked_numbers_large_padding"
android:text="@string/blocked_numbers_butter_bar_button"
style="@style/BlockedNumbersButton"
android:background="?android:attr/selectableItemBackgroundBorderless" />
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index de1ecec..0c403b4 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -67,6 +67,7 @@
import com.android.internal.util.Preconditions;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -2492,12 +2493,11 @@
*/
private void handleConnectionServiceDeath() {
if (!mPendingResponses.isEmpty()) {
- CreateConnectionResponse[] responses = mPendingResponses.values().toArray(
- new CreateConnectionResponse[mPendingResponses.values().size()]);
+ Collection<CreateConnectionResponse> responses = mPendingResponses.values();
mPendingResponses.clear();
- for (int i = 0; i < responses.length; i++) {
- responses[i].handleCreateConnectionFailure(
- new DisconnectCause(DisconnectCause.ERROR, "CS_DEATH"));
+ for (CreateConnectionResponse response : responses) {
+ response.handleCreateConnectionFailure(new DisconnectCause(DisconnectCause.ERROR,
+ "CS_DEATH"));
}
}
mCallIdMapper.clear();
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index 08257d4..a01c35b 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -89,6 +89,7 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@@ -1968,6 +1969,11 @@
pw.increaseIndent();
Analytics.dump(pw);
pw.decreaseIndent();
+
+ pw.println("Flag Configurations: ");
+ pw.increaseIndent();
+ reflectAndPrintFlagConfigs(pw);
+ pw.decreaseIndent();
}
if (isTimeLineView) {
Log.dumpEventsTimeline(pw);
@@ -1977,6 +1983,28 @@
}
/**
+ * Print all feature flag configurations that Telecom is using for debugging purposes.
+ */
+ private void reflectAndPrintFlagConfigs(IndentingPrintWriter pw) {
+
+ try {
+ // Look away, a forbidden technique (reflection) is being used to allow us to get
+ // all flag configs without having to add them manually to this method.
+ Method[] methods = FeatureFlags.class.getMethods();
+ if (methods.length == 0) {
+ pw.println("NONE");
+ return;
+ }
+ for (Method m : methods) {
+ pw.println(m.getName() + "-> " + m.invoke(mFeatureFlags));
+ }
+ } catch (Exception e) {
+ pw.println("[ERROR]");
+ }
+
+ }
+
+ /**
* @see android.telecom.TelecomManager#createManageBlockedNumbersIntent
*/
@Override
diff --git a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
index 4e42c0c..6d50e35 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
@@ -77,6 +77,7 @@
import org.mockito.ArgumentMatcher;
import org.mockito.Mock;
+import java.lang.reflect.Method;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Executor;
@@ -87,6 +88,7 @@
import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
@@ -1706,6 +1708,28 @@
verify(mContext, never()).sendBroadcastAsUser(any(Intent.class), any(UserHandle.class));
}
+ /**
+ * FeatureFlags is autogenerated code, so there could be a situation where something changes
+ * outside of Telecom control that breaks reflection. This test attempts to ensure that changes
+ * to auto-generated FeatureFlags code that breaks reflection are caught early.
+ */
+ @SmallTest
+ @Test
+ public void testFlagConfigReflectionWorks() {
+ try {
+ Method[] methods = FeatureFlags.class.getMethods();
+ for (Method m : methods) {
+ // test getting the name and invoking the flag code
+ String name = m.getName();
+ Object val = m.invoke(mFeatureFlags);
+ assertNotNull(name);
+ assertNotNull(val);
+ }
+ } catch (Exception e) {
+ fail("Reflection failed for FeatureFlags with error: " + e);
+ }
+ }
+
@SmallTest
@Test
public void testIsVoicemailNumber() throws Exception {