Add getAttributionSource function to mocked context
Bug: 221772127 Test: make, atest Change-Id: I6671f27e5c600762b106fb79b1c79f7b47bc1a50
This commit is contained in:
parent
7f9d05c6d2
commit
7974e19b7d
@ -17,6 +17,7 @@
|
||||
package android.test;
|
||||
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.AttributionSource;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@ -26,6 +27,7 @@ import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Process;
|
||||
import android.test.mock.MockAccountManager;
|
||||
|
||||
import java.io.File;
|
||||
@ -63,6 +65,15 @@ public class IsolatedContext extends ContextWrapper {
|
||||
return intents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttributionSource getAttributionSource() {
|
||||
AttributionSource attributionSource = super.getAttributionSource();
|
||||
if (attributionSource == null) {
|
||||
return new AttributionSource.Builder(Process.myUid()).build();
|
||||
}
|
||||
return attributionSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContentResolver getContentResolver() {
|
||||
// We need to return the real resolver so that MailEngine.makeRight can get to the
|
||||
|
Loading…
x
Reference in New Issue
Block a user