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

Commit 63a14538 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge changes from topic "may15" into sc-dev

* changes:
  Apply "attributionTags" to all component types.
  Apply AttributionSource during Intent delivery.
parents 6fb4729e 5014fbd6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11882,7 +11882,6 @@ package android.content.pm {
    field public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11; // 0xb
    field public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12; // 0xc
    field public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; // 0x1
    field public String[] attributionTags;
    field public int colorMode;
    field public int configChanges;
    field public int documentLaunchMode;
@@ -12074,6 +12073,7 @@ package android.content.pm {
    method public final int getLogoResource();
    method public boolean isEnabled();
    field public android.content.pm.ApplicationInfo applicationInfo;
    field public String[] attributionTags;
    field public int descriptionRes;
    field public boolean directBootAware;
    field public boolean enabled;
+26 −7
Original line number Diff line number Diff line
@@ -3509,7 +3509,8 @@ public final class ActivityThread extends ClientTransactionHandler
                    cl, component.getClassName(), r.intent);
            StrictMode.incrementExpectedActivityCount(activity.getClass());
            r.intent.setExtrasClassLoader(cl);
            r.intent.prepareToEnterProcess(isProtectedComponent(r.activityInfo));
            r.intent.prepareToEnterProcess(isProtectedComponent(r.activityInfo),
                    appContext.getAttributionSource());
            if (r.state != null) {
                r.state.setClassLoader(cl);
            }
@@ -3801,7 +3802,8 @@ public final class ActivityThread extends ClientTransactionHandler
        for (int i=0; i<N; i++) {
            ReferrerIntent intent = intents.get(i);
            intent.setExtrasClassLoader(r.activity.getClassLoader());
            intent.prepareToEnterProcess(isProtectedComponent(r.activityInfo));
            intent.prepareToEnterProcess(isProtectedComponent(r.activityInfo),
                    r.activity.getAttributionSource());
            r.activity.mFragments.noteStateNotSaved();
            mInstrumentation.callActivityOnNewIntent(r.activity, intent);
        }
@@ -4241,10 +4243,15 @@ public final class ActivityThread extends ClientTransactionHandler
            if (data.info.splitName != null) {
                context = (ContextImpl) context.createContextForSplit(data.info.splitName);
            }
            if (data.info.attributionTags != null && data.info.attributionTags.length > 0) {
                final String attributionTag = data.info.attributionTags[0];
                context = (ContextImpl) context.createAttributionContext(attributionTag);
            }
            java.lang.ClassLoader cl = context.getClassLoader();
            data.intent.setExtrasClassLoader(cl);
            data.intent.prepareToEnterProcess(
                    isProtectedComponent(data.info) || isProtectedBroadcast(data.intent));
                    isProtectedComponent(data.info) || isProtectedBroadcast(data.intent),
                    context.getAttributionSource());
            data.setExtrasClassLoader(cl);
            receiver = packageInfo.getAppFactory()
                    .instantiateReceiver(cl, data.info.name, data.intent);
@@ -4435,6 +4442,10 @@ public final class ActivityThread extends ClientTransactionHandler
            if (data.info.splitName != null) {
                context = (ContextImpl) context.createContextForSplit(data.info.splitName);
            }
            if (data.info.attributionTags != null && data.info.attributionTags.length > 0) {
                final String attributionTag = data.info.attributionTags[0];
                context = (ContextImpl) context.createAttributionContext(attributionTag);
            }
            // Service resources must be initialized with the same loaders as the application
            // context.
            context.getResources().addLoaders(
@@ -4469,7 +4480,8 @@ public final class ActivityThread extends ClientTransactionHandler
        if (s != null) {
            try {
                data.intent.setExtrasClassLoader(s.getClassLoader());
                data.intent.prepareToEnterProcess(isProtectedComponent(createData.info));
                data.intent.prepareToEnterProcess(isProtectedComponent(createData.info),
                        s.getAttributionSource());
                try {
                    if (!data.rebind) {
                        IBinder binder = s.onBind(data.intent);
@@ -4499,7 +4511,8 @@ public final class ActivityThread extends ClientTransactionHandler
        if (s != null) {
            try {
                data.intent.setExtrasClassLoader(s.getClassLoader());
                data.intent.prepareToEnterProcess(isProtectedComponent(createData.info));
                data.intent.prepareToEnterProcess(isProtectedComponent(createData.info),
                        s.getAttributionSource());
                boolean doRebind = s.onUnbind(data.intent);
                try {
                    if (doRebind) {
@@ -4588,7 +4601,8 @@ public final class ActivityThread extends ClientTransactionHandler
            try {
                if (data.args != null) {
                    data.args.setExtrasClassLoader(s.getClassLoader());
                    data.args.prepareToEnterProcess(isProtectedComponent(createData.info));
                    data.args.prepareToEnterProcess(isProtectedComponent(createData.info),
                            s.getAttributionSource());
                }
                int res;
                if (!data.taskRemoved) {
@@ -5241,7 +5255,8 @@ public final class ActivityThread extends ClientTransactionHandler
            try {
                if (ri.mData != null) {
                    ri.mData.setExtrasClassLoader(r.activity.getClassLoader());
                    ri.mData.prepareToEnterProcess(isProtectedComponent(r.activityInfo));
                    ri.mData.prepareToEnterProcess(isProtectedComponent(r.activityInfo),
                            r.activity.getAttributionSource());
                }
                if (DEBUG_RESULTS) Slog.v(TAG,
                        "Delivering result to activity " + r + " : " + ri);
@@ -7342,6 +7357,10 @@ public final class ActivityThread extends ClientTransactionHandler
                    throw new RuntimeException(e);
                }
            }
            if (info.attributionTags != null && info.attributionTags.length > 0) {
                final String attributionTag = info.attributionTags[0];
                c = c.createAttributionContext(attributionTag);
            }

            try {
                final java.lang.ClassLoader cl = c.getClassLoader();
+11 −2
Original line number Diff line number Diff line
@@ -1774,7 +1774,8 @@ class ContextImpl extends Context {
                intent.setExtrasClassLoader(getClassLoader());
                // TODO: determine at registration time if caller is
                // protecting themselves with signature permission
                intent.prepareToEnterProcess(ActivityThread.isProtectedBroadcast(intent));
                intent.prepareToEnterProcess(ActivityThread.isProtectedBroadcast(intent),
                        getAttributionSource());
            }
            return intent;
        } catch (RemoteException e) {
@@ -3035,8 +3036,16 @@ class ContextImpl extends Context {
            }
        }

        final String attributionTag;
        if (activityInfo.attributionTags != null && activityInfo.attributionTags.length > 0) {
            attributionTag = activityInfo.attributionTags[0];
        } else {
            attributionTag = null;
        }

        ContextImpl context = new ContextImpl(null, mainThread, packageInfo, ContextParams.EMPTY,
                null, null, activityInfo.splitName, activityToken, null, 0, classLoader, null);
                attributionTag, null, activityInfo.splitName, activityToken, null, 0, classLoader,
                null);
        context.mContextType = CONTEXT_TYPE_ACTIVITY;
        context.mIsConfigurationBasedContext = true;

+2 −1
Original line number Diff line number Diff line
@@ -1651,7 +1651,8 @@ public final class LoadedApk {
                        intent.setExtrasClassLoader(cl);
                        // TODO: determine at registration time if caller is
                        // protecting themselves with signature permission
                        intent.prepareToEnterProcess(ActivityThread.isProtectedBroadcast(intent));
                        intent.prepareToEnterProcess(ActivityThread.isProtectedBroadcast(intent),
                                mContext.getAttributionSource());
                        setExtrasClassLoader(cl);
                        receiver.setPendingResult(this);
                        receiver.onReceive(mContext, intent);
+5 −0
Original line number Diff line number Diff line
@@ -1190,6 +1190,11 @@ public final class BluetoothDevice implements Parcelable {
        return devices;
    }

    /** {@hide} */
    public void prepareToEnterProcess(AttributionSource attributionSource) {
        setAttributionSource(attributionSource);
    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (o instanceof BluetoothDevice) {
Loading