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

Commit fbf401e3 authored by Antoan Angelov's avatar Antoan Angelov Committed by Android (Google) Code Review
Browse files

Merge "Open app details for the correct user depending on the profile." into rvc-dev

parents 76562e16 ebf3c057
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1536,10 +1536,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
@@ -1305,7 +1305,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();
    }