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

Unverified Commit a87b10c7 authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-13.0.0_r20' into staging/lineage-20.0_merge-android-13.0.0_r20

Android 13.0.0 release 20

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCY7SAXAAKCRDorT+BmrEO
# eE9JAJ9pSfv9pFMeEIbG04Bfw0gtuuBzdgCgj03K5AWRm+su4E2azQ65sa7HOTs=
# =QgIl
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Jan  3 21:22:04 2023 EET
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 1499 signatures in the past
#      14 months.  Encrypted 4 messages in the past 11 months.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Arc Wang
# Via Android Build Coastguard Worker
* tag 'android-13.0.0_r20':
  Remove Intent selector from 2-pane deep link Intent

Change-Id: Ib50885aaf1d7636dcc5371d3dbef4619d7161fd8
parents 1449a7ed 53da1703
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -397,6 +397,10 @@ public class SettingsActivity extends SettingsBaseActivity
     */
    public static Intent getTrampolineIntent(Intent intent, String highlightMenuKey) {
        final Intent detailIntent = new Intent(intent);
        // Guard against the arbitrary Intent injection.
        if (detailIntent.getSelector() != null) {
            detailIntent.setSelector(null);
        }
        // It's a deep link intent, SettingsHomepageActivity will set SplitPairRule and start it.
        final Intent trampolineIntent = new Intent(ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY)
                .setPackage(Utils.SETTINGS_PACKAGE_NAME)
+27 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings;

import static android.provider.Settings.EXTRA_SETTINGS_EMBEDDED_DEEP_LINK_INTENT_URI;

import static com.android.settings.SettingsActivity.EXTRA_SHOW_FRAGMENT;

import static com.google.common.truth.Truth.assertThat;
@@ -30,6 +32,7 @@ import static org.mockito.Mockito.when;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@@ -49,6 +52,7 @@ import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;

import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

@@ -114,6 +118,29 @@ public class SettingsActivityTest {
        assertThat(((ListenerFragment) fragments.get(1)).mOnActivityResultCalled).isTrue();
    }

    @Test
    public void getTrampolineIntent_intentSelector_shouldNotChangeIntentAction() {
        Intent targetIntent = new Intent().setClassName("android",
                "com.android.internal.app.PlatLogoActivity");
        Intent intent = new Intent(android.provider.Settings.ACTION_DISPLAY_SETTINGS);
        intent.setComponent(intent.resolveActivity(mContext.getPackageManager()));
        intent.setSelector(new
        Intent().setData(Uri.fromParts(targetIntent.toUri(Intent.URI_INTENT_SCHEME), /* ssp= */ "",
                /* fragment= */ null)));

        Intent resultIntent = SettingsActivity.getTrampolineIntent(intent, "menu_key");

        String intentUriString =
                resultIntent.getStringExtra(EXTRA_SETTINGS_EMBEDDED_DEEP_LINK_INTENT_URI);
        Intent parsedIntent = null;
        try {
            parsedIntent = Intent.parseUri(intentUriString, Intent.URI_INTENT_SCHEME);
        } catch (URISyntaxException e) {
            // Do nothng.
        }
        assertThat(parsedIntent.getAction()).isEqualTo(intent.getAction());
    }

    public static class ListenerFragment extends Fragment implements OnActivityResultListener {

        private boolean mOnActivityResultCalled;