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

Commit e2c0b5fe authored by Katsiaryna Naliuka's avatar Katsiaryna Naliuka
Browse files

Handle the case of null intent type when obtaining target intent filter.

Currently the method swallows the exception but that pollutes the logs.
This change preserves the behavior while getting rid of distracting
errors in the logs.

Test: atest IntentTest; atest ChooserActivityTest

Change-Id: I2b02dc4ae0343fa1fd58a112455e426d8a6d3f34
parent 753216eb
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1795,6 +1795,10 @@ public class ChooserActivity extends ResolverActivity implements
            if (!TextUtils.isEmpty(dataString)) {
                return new IntentFilter(intent.getAction(), dataString);
            }
            if (intent.getType() == null) {
                Log.e(TAG, "Failed to get target intent filter: intent data and type are null");
                return null;
            }
            IntentFilter intentFilter = new IntentFilter(intent.getAction(), intent.getType());
            List<Uri> contentUris = new ArrayList<>();
            if (Intent.ACTION_SEND.equals(intent.getAction())) {
@@ -1815,7 +1819,7 @@ public class ChooserActivity extends ResolverActivity implements
            }
            return intentFilter;
        } catch (Exception e) {
            Log.e(TAG, "failed to get target intent filter", e);
            Log.e(TAG, "Failed to get target intent filter", e);
            return null;
        }
    }