Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd8fadf0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add getAttributionSource function to mocked context" into tm-dev

parents 4b7f97e0 7974e19b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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