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

Commit 78ee160c authored by Chris Antol's avatar Chris Antol
Browse files

Only check INTERACT_ACROSS_USERS_FULL when user handle is not current

Bug: 326057017
Change-Id: I83ab4461f28e7f40c676099213c840a1a7dc932a
Test: atest; open app info pages from both primary and secondary profile -> verify they open as expected
Flag: EXEMPT bug fix
parent d72678d3
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -136,14 +136,14 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
                mPackageName = intent.getData().getSchemeSpecificPart();
            }
        }
        if (!hasInteractAcrossUsersPermission()) {
        if (intent != null && intent.hasExtra(Intent.EXTRA_USER_HANDLE)) {
            mUserId = ((UserHandle) intent.getParcelableExtra(Intent.EXTRA_USER_HANDLE))
                    .getIdentifier();
            if (mUserId != UserHandle.myUserId() && !hasInteractAcrossUsersFullPermission()) {
                Log.w(TAG, "Intent not valid.");
                finish();
                return "";
            }
        if (intent != null && intent.hasExtra(Intent.EXTRA_USER_HANDLE)) {
            mUserId = ((UserHandle) intent.getParcelableExtra(
                    Intent.EXTRA_USER_HANDLE)).getIdentifier();
        } else {
            mUserId = UserHandle.myUserId();
        }
@@ -171,7 +171,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
    }

    @VisibleForTesting
    protected boolean hasInteractAcrossUsersPermission() {
    protected boolean hasInteractAcrossUsersFullPermission() {
        Activity activity = getActivity();
        if (!(activity instanceof SettingsActivity)) {
            return false;
+2 −2
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ public class AppInfoWithHeaderTest {
        }

        @Override
        protected boolean hasInteractAcrossUsersPermission() {
        protected boolean hasInteractAcrossUsersFullPermission() {
            return true;
        }

@@ -267,7 +267,7 @@ public class AppInfoWithHeaderTest {

    private static final class TestFragmentWithoutPermission extends TestFragment {
        @Override
        protected boolean hasInteractAcrossUsersPermission() {
        protected boolean hasInteractAcrossUsersFullPermission() {
            return false;
        }
    }