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

Commit ebf3c057 authored by arangelov's avatar arangelov
Browse files

Open app details for the correct user depending on the profile.

Fixes: 149732838
Test: manual
Change-Id: I477a3af794f98aa91ad6c3164338339be0858cb3
parent d514712c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1525,10 +1525,12 @@ public class ChooserActivity extends ResolverActivity implements
                labels.add(innerInfo.getResolveInfo().loadLabel(getPackageManager()));
            }
            f = new ResolverTargetActionsDialogFragment(mti.getDisplayLabel(), name,
                    mti.getTargets(), labels);
                    mti.getTargets(), labels,
                    mChooserMultiProfilePagerAdapter.getCurrentUserHandle());
        } else {
            f = new ResolverTargetActionsDialogFragment(
                    ti.getResolveInfo().loadLabel(getPackageManager()), name, pinned);
                    ti.getResolveInfo().loadLabel(getPackageManager()), name, pinned,
                    mChooserMultiProfilePagerAdapter.getCurrentUserHandle());
        }

        f.show(getFragmentManager(), TARGET_DETAILS_FRAGMENT_TAG);
+1 −1
Original line number Diff line number Diff line
@@ -1303,7 +1303,7 @@ public class ResolverActivity extends Activity implements
        Intent in = new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
                .setData(Uri.fromParts("package", ri.activityInfo.packageName, null))
                .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
        startActivity(in);
        startActivityAsUser(in, mMultiProfilePagerAdapter.getCurrentUserHandle());
    }

    @VisibleForTesting
+8 −3
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;

import com.android.internal.R;
@@ -43,6 +44,7 @@ public class ResolverTargetActionsDialogFragment extends DialogFragment
    private static final String NAME_KEY = "componentName";
    private static final String TITLE_KEY = "title";
    private static final String PINNED_KEY = "pinned";
    private static final String USER_ID_KEY = "userId";

    // Sync with R.array.resolver_target_actions_* resources
    private static final int TOGGLE_PIN_INDEX = 0;
@@ -56,19 +58,21 @@ public class ResolverTargetActionsDialogFragment extends DialogFragment
    }

    public ResolverTargetActionsDialogFragment(CharSequence title, ComponentName name,
            boolean pinned) {
            boolean pinned, UserHandle userHandle) {
        Bundle args = new Bundle();
        args.putCharSequence(TITLE_KEY, title);
        args.putParcelable(NAME_KEY, name);
        args.putBoolean(PINNED_KEY, pinned);
        args.putParcelable(USER_ID_KEY, userHandle);
        setArguments(args);
    }

    public ResolverTargetActionsDialogFragment(CharSequence title, ComponentName name,
            List<DisplayResolveInfo> targets, List<CharSequence> labels) {
            List<DisplayResolveInfo> targets, List<CharSequence> labels, UserHandle userHandle) {
        Bundle args = new Bundle();
        args.putCharSequence(TITLE_KEY, title);
        args.putParcelable(NAME_KEY, name);
        args.putParcelable(USER_ID_KEY, userHandle);
        mTargetInfos = targets;
        mLabels = labels;
        setArguments(args);
@@ -122,7 +126,8 @@ public class ResolverTargetActionsDialogFragment extends DialogFragment
            Intent in = new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
                    .setData(Uri.fromParts("package", name.getPackageName(), null))
                    .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
            startActivity(in);
            UserHandle userHandle = args.getParcelable(USER_ID_KEY);
            getActivity().startActivityAsUser(in, userHandle);
        }
        dismiss();
    }