diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 43f98c38715dd..56e0643b1e207 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -839,6 +839,8 @@ + + mimeType = new AtomicReference<>(intent.getType()); - - if (mimeType.get() == null && intent.getData() != null - && "content".equals(intent.getData().getScheme())) { - mInterface.getMimeTypeFilterAsync(intent.getData(), mUserId, - new RemoteCallback(result -> { - mimeType.set(result.getPairValue()); - })); - } + final String mimeType = intent.resolveType(mInternal.mContext); do { if (mStopOption) { @@ -627,7 +618,7 @@ final class ActivityManagerShellCommand extends ShellCommand { int userIdForQuery = mInternal.mUserController.handleIncomingUser( Binder.getCallingPid(), Binder.getCallingUid(), mUserId, false, ALLOW_NON_FULL, "ActivityManagerShellCommand", null); - List activities = mPm.queryIntentActivities(intent, mimeType.get(), + List activities = mPm.queryIntentActivities(intent, mimeType, 0, userIdForQuery).getList(); if (activities == null || activities.size() <= 0) { getErrPrintWriter().println("Error: Intent does not match any activities: " @@ -724,12 +715,12 @@ final class ActivityManagerShellCommand extends ShellCommand { } if (mWaitOption) { result = mInternal.startActivityAndWait(null, SHELL_PACKAGE_NAME, null, intent, - mimeType.get(), null, null, 0, mStartFlags, profilerInfo, + mimeType, null, null, 0, mStartFlags, profilerInfo, options != null ? options.toBundle() : null, mUserId); res = result.result; } else { res = mInternal.startActivityAsUserWithFeature(null, SHELL_PACKAGE_NAME, null, - intent, mimeType.get(), null, null, 0, mStartFlags, profilerInfo, + intent, mimeType, null, null, 0, mStartFlags, profilerInfo, options != null ? options.toBundle() : null, mUserId); } final long endTime = SystemClock.uptimeMillis();