Add getAttributionSource() to mocked context.
TelephonyConnectionServiceTest use a mocked test that will be pass to TelphonyManager, so new context functions use in TelphonyManager that are not defined in the mocked context, need to be defined otherwise the test will fail.
Test: make, cts
Bug: 205326907
Change-Id: I9035b49cf431cc2526b46586e559b8f579ca9c6f
Merged-In: I9035b49cf431cc2526b46586e559b8f579ca9c6f
diff --git a/tests/src/com/android/TestContext.java b/tests/src/com/android/TestContext.java
index 5456469..7edbed9 100644
--- a/tests/src/com/android/TestContext.java
+++ b/tests/src/com/android/TestContext.java
@@ -19,6 +19,7 @@
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doAnswer;
+import android.content.AttributionSource;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -29,6 +30,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.PersistableBundle;
+import android.os.Process;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
@@ -96,6 +98,11 @@
}
@Override
+ public AttributionSource getAttributionSource() {
+ return new AttributionSource(Process.myUid(), getPackageName(), "");
+ }
+
+ @Override
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
return null;
}