ChooserActivity populates intentFilter mimeType with intent.getType() prior to intent.getDataString(). This fixes the issue in screenshot sharing that no or much less than usual direct share recommendations surface.

Test: atest
Test: test on phone
Bug: 229607293
Change-Id: I8d610e4c7033b25eea8a98885339207a723716b6
This commit is contained in:
Song Hu
2022-05-07 15:12:55 -07:00
parent 470f8434b1
commit fbdcff39cd

View File

@@ -1861,10 +1861,10 @@ public class ChooserActivity extends ResolverActivity implements
try {
final Intent intent = getTargetIntent();
String dataString = intent.getDataString();
if (!TextUtils.isEmpty(dataString)) {
return new IntentFilter(intent.getAction(), dataString);
}
if (intent.getType() == null) {
if (!TextUtils.isEmpty(dataString)) {
return new IntentFilter(intent.getAction(), dataString);
}
Log.e(TAG, "Failed to get target intent filter: intent data and type are null");
return null;
}