Merge "Stop sending the new outgoing call broadcast in a blocking manner." into main
diff --git a/flags/telecom_ringer_flag_declarations.aconfig b/flags/telecom_ringer_flag_declarations.aconfig
index bc0dcc8..54748d0 100644
--- a/flags/telecom_ringer_flag_declarations.aconfig
+++ b/flags/telecom_ringer_flag_declarations.aconfig
@@ -2,7 +2,7 @@
flag {
name: "use_device_provided_serialized_ringer_vibration"
- namespace: "android_platform_telecom"
+ namespace: "telecom"
description: "Gates whether to use a serialized, device-specific ring vibration."
bug: "282113261"
}
\ No newline at end of file
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index 72aecac..85a4239 100644
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -664,19 +664,16 @@
}
int maxCallId = -1;
int numFound;
- Cursor countCursor = resolver.query(providerUri,
+ try (Cursor countCursor = resolver.query(providerUri,
new String[]{Calls._ID},
null,
null,
- Calls._ID + " DESC");
- try {
+ Calls._ID + " DESC")) {
numFound = countCursor.getCount();
if (numFound > 0) {
countCursor.moveToFirst();
maxCallId = countCursor.getInt(0);
}
- } finally {
- countCursor.close();
}
return new Pair<>(numFound, maxCallId);
} catch (Exception e) {
diff --git a/src/com/android/server/telecom/ParcelableCallUtils.java b/src/com/android/server/telecom/ParcelableCallUtils.java
index 673b99a..c77e605 100644
--- a/src/com/android/server/telecom/ParcelableCallUtils.java
+++ b/src/com/android/server/telecom/ParcelableCallUtils.java
@@ -158,6 +158,10 @@
properties |= android.telecom.Call.Details.PROPERTY_VOIP_AUDIO_MODE;
}
+ if (call.isTransactionalCall()) {
+ properties |= android.telecom.Call.Details.PROPERTY_IS_TRANSACTIONAL;
+ }
+
// If this is a single-SIM device, the "default SIM" will always be the only SIM.
boolean isDefaultSmsAccount = phoneAccountRegistrar != null &&
phoneAccountRegistrar.isUserSelectedSmsPhoneAccount(call.getTargetPhoneAccount());
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index 1cf2399..4570957 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -40,6 +40,7 @@
import android.os.VibrationAttributes;
import android.os.VibrationEffect;
import android.os.Vibrator;
+import android.os.vibrator.persistence.ParsedVibration;
import android.os.vibrator.persistence.VibrationXmlParser;
import android.telecom.Log;
import android.telecom.TelecomManager;
@@ -779,14 +780,20 @@
}
@Nullable
- private static VibrationEffect loadSerializedDefaultRingVibration(Resources resources) {
-
+ private static VibrationEffect loadSerializedDefaultRingVibration(
+ Resources resources, Vibrator vibrator) {
try {
InputStream vibrationInputStream =
resources.openRawResource(
com.android.internal.R.raw.default_ringtone_vibration_effect);
- return VibrationXmlParser.parse(
- new InputStreamReader(vibrationInputStream, StandardCharsets.UTF_8));
+ ParsedVibration parsedVibration = VibrationXmlParser
+ .parseDocument(
+ new InputStreamReader(vibrationInputStream, StandardCharsets.UTF_8));
+ if (parsedVibration == null) {
+ Log.w(TAG, "Got null parsed default ring vibration effect.");
+ return null;
+ }
+ return parsedVibration.resolve(vibrator);
} catch (IOException | Resources.NotFoundException e) {
Log.e(TAG, e, "Error parsing default ring vibration effect.");
return null;
@@ -806,8 +813,8 @@
}
if (featureFlags.useDeviceProvidedSerializedRingerVibration()) {
- VibrationEffect parsedEffect = loadSerializedDefaultRingVibration(resources);
- if (parsedEffect != null && vibrator.areVibrationFeaturesSupported(parsedEffect)) {
+ VibrationEffect parsedEffect = loadSerializedDefaultRingVibration(resources, vibrator);
+ if (parsedEffect != null) {
Log.i(TAG, "Using parsed default ring vibration.");
// Make the parsed effect repeating to make it vibrate continuously during ring.
// If the effect is already repeating, this API call is a no-op.
diff --git a/tests/src/com/android/server/telecom/tests/RingerTest.java b/tests/src/com/android/server/telecom/tests/RingerTest.java
index 4a4a893..f232525 100644
--- a/tests/src/com/android/server/telecom/tests/RingerTest.java
+++ b/tests/src/com/android/server/telecom/tests/RingerTest.java
@@ -57,6 +57,7 @@
import android.os.VibrationEffect;
import android.os.vibrator.persistence.VibrationXmlParser;
import android.os.Vibrator;
+import android.os.VibratorInfo;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.telecom.PhoneAccountHandle;
@@ -109,6 +110,7 @@
@Mock SystemSettingsUtil mockSystemSettingsUtil;
@Mock RingtoneFactory mockRingtoneFactory;
@Mock Vibrator mockVibrator;
+ @Mock VibratorInfo mockVibratorInfo;
@Mock InCallController mockInCallController;
@Mock NotificationManager mockNotificationManager;
@Mock Ringer.AccessibilityManagerAdapter mockAccessibilityManagerAdapter;
@@ -139,6 +141,7 @@
when(mockPlayerFactory.createPlayer(anyInt())).thenReturn(mockTonePlayer);
mockAudioManager = mContext.getSystemService(AudioManager.class);
when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL);
+ when(mockVibrator.getInfo()).thenReturn(mockVibratorInfo);
when(mockSystemSettingsUtil.isHapticPlaybackSupported(any(Context.class)))
.thenAnswer((invocation) -> mIsHapticPlaybackSupported);
mockNotificationManager =mContext.getSystemService(NotificationManager.class);
@@ -187,7 +190,7 @@
</vibration>
""",
/* useSimpleVibration= */ true);
- when(mockVibrator.areVibrationFeaturesSupported(any())).thenReturn(true);
+ when(mockVibratorInfo.areVibrationFeaturesSupported(any())).thenReturn(true);
createRingerUnderTest();
@@ -212,7 +215,7 @@
</vibration>
""",
/* useSimpleVibration= */ false);
- when(mockVibrator.areVibrationFeaturesSupported(any())).thenReturn(true);
+ when(mockVibratorInfo.areVibrationFeaturesSupported(any())).thenReturn(true);
createRingerUnderTest();
@@ -236,7 +239,7 @@
</vibration>
""",
/* useSimpleVibration= */ false);
- when(mockVibrator.areVibrationFeaturesSupported(any())).thenReturn(true);
+ when(mockVibratorInfo.areVibrationFeaturesSupported(any())).thenReturn(true);
createRingerUnderTest();
@@ -256,7 +259,7 @@
</vibration>
""",
/* useSimpleVibration= */ false);
- when(mockVibrator.areVibrationFeaturesSupported(any())).thenReturn(true);
+ when(mockVibratorInfo.areVibrationFeaturesSupported(any())).thenReturn(true);
createRingerUnderTest();
@@ -285,7 +288,7 @@
</vibration>
""",
/* useSimpleVibration= */ false);
- when(mockVibrator.areVibrationFeaturesSupported(
+ when(mockVibratorInfo.areVibrationFeaturesSupported(
eq(VibrationEffect.createPredefined(EFFECT_CLICK)))).thenReturn(false);
createRingerUnderTest();
@@ -300,7 +303,7 @@
mockVibrationResourceValues(
/* defaultVibrationContent= */ "bad serialization",
/* useSimpleVibration= */ false);
- when(mockVibrator.areVibrationFeaturesSupported(any())).thenReturn(true);
+ when(mockVibratorInfo.areVibrationFeaturesSupported(any())).thenReturn(true);
createRingerUnderTest();
@@ -313,7 +316,7 @@
when(mFeatureFlags.useDeviceProvidedSerializedRingerVibration()).thenReturn(true);
mockVibrationResourceValues(
/* defaultVibrationContent= */ "", /* useSimpleVibration= */ false);
- when(mockVibrator.areVibrationFeaturesSupported(any())).thenReturn(true);
+ when(mockVibratorInfo.areVibrationFeaturesSupported(any())).thenReturn(true);
createRingerUnderTest();