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

Commit 74848ae4 authored by Jason Monk's avatar Jason Monk
Browse files

Don't use user-tagged Uris in slice callbacks

Test: uiservicestests
Bug: 68751119
Change-Id: I440400b20bb6d89d5e066efab420a6afee0ad123
parent 45354354
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ public abstract class SliceProvider extends ContentProvider {
    @Override
    public Bundle call(String method, String arg, Bundle extras) {
        if (method.equals(METHOD_SLICE)) {
            Uri uri = extras.getParcelable(EXTRA_BIND_URI);
            Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI));
            List<SliceSpec> supportedSpecs = extras.getParcelableArrayList(EXTRA_SUPPORTED_SPECS);

            String callingPackage = getCallingPackage();
@@ -327,19 +327,19 @@ public abstract class SliceProvider extends ContentProvider {
            }
            return b;
        } else if (method.equals(METHOD_PIN)) {
            Uri uri = extras.getParcelable(EXTRA_BIND_URI);
            Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI));
            if (Binder.getCallingUid() != Process.SYSTEM_UID) {
                throw new SecurityException("Only the system can pin/unpin slices");
            }
            handlePinSlice(uri);
        } else if (method.equals(METHOD_UNPIN)) {
            Uri uri = extras.getParcelable(EXTRA_BIND_URI);
            Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI));
            if (Binder.getCallingUid() != Process.SYSTEM_UID) {
                throw new SecurityException("Only the system can pin/unpin slices");
            }
            handleUnpinSlice(uri);
        } else if (method.equals(METHOD_GET_DESCENDANTS)) {
            Uri uri = extras.getParcelable(EXTRA_BIND_URI);
            Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI));
            Bundle b = new Bundle();
            b.putParcelableArrayList(EXTRA_SLICE_DESCENDANTS,
                    new ArrayList<>(handleGetDescendants(uri)));
+2 −2
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public class SliceManagerService extends ISliceManager.Stub {
    }

    @VisibleForTesting
    PinnedSliceState createPinnedSlice(Uri uri) {
    protected PinnedSliceState createPinnedSlice(Uri uri) {
        return new PinnedSliceState(this, uri);
    }

@@ -352,7 +352,7 @@ public class SliceManagerService extends ISliceManager.Stub {
    // Based on getDefaultHome in ShortcutService.
    // TODO: Unify if possible
    @VisibleForTesting
    String getDefaultHome(int userId) {
    protected String getDefaultHome(int userId) {
        final long token = Binder.clearCallingIdentity();
        try {
            final List<ResolveInfo> allHomeCandidates = new ArrayList<>();