Update Intent#resolveTypeIfNeeded() for intent filter matching
With the change ag/15315839, explicit intents also have to match the declared intent filters. The existing implementation of resolveTypeIfNeeded() assumes all explicit intents will always be delivered and will skip resolving types for content:// uris. Update the implementation to only skip resolution if the intent is bound to the same app it was created, or the caller is either root or the system. Bug: 196573010 Test: atest CtsContentTestCases:PackageManagerTest Change-Id: Ic3b51c68fd971422242db42af35e13f691d65c07
This commit is contained in:
@@ -30,6 +30,7 @@ import android.annotation.SdkConstant.SdkConstantType;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.app.ActivityThread;
|
||||
import android.app.AppGlobals;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
@@ -8281,7 +8282,10 @@ public class Intent implements Parcelable, Cloneable {
|
||||
* needed.
|
||||
*/
|
||||
public @Nullable String resolveTypeIfNeeded(@NonNull ContentResolver resolver) {
|
||||
if (mComponent != null) {
|
||||
// Match logic in PackageManagerService#applyEnforceIntentFilterMatching(...)
|
||||
if (mComponent != null && (Process.myUid() == Process.ROOT_UID
|
||||
|| Process.myUid() == Process.SYSTEM_UID
|
||||
|| mComponent.getPackageName().equals(ActivityThread.currentPackageName()))) {
|
||||
return mType;
|
||||
}
|
||||
return resolveType(resolver);
|
||||
|
||||
Reference in New Issue
Block a user