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

Commit 20bdf9d2 authored by Paul Soulos's avatar Paul Soulos
Browse files

Fixes crash in clicking entries without intent uri

Bug: 16559592
Change-Id: I47f8ad2b93c0e2435cac7d0c806d47d0f1b4d06c
parent 8bd49e40
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -290,20 +290,21 @@ public class QuickContactActivity extends ContactsActivity {
            // so the exact usage type is not necessary in all cases
            String usageType = DataUsageFeedback.USAGE_TYPE_CALL;

            final String scheme = intent.getData().getScheme();
            if ((scheme != null && scheme.equals(CallUtil.SCHEME_SMSTO)) ||
            final Uri intentUri = intent.getData();
            if ((intentUri != null && intentUri.getScheme() != null &&
                    intentUri.getScheme().equals(CallUtil.SCHEME_SMSTO)) ||
                    (intent.getType() != null && intent.getType().equals(MIMETYPE_SMS))) {
                usageType = DataUsageFeedback.USAGE_TYPE_SHORT_TEXT;
            }

            // Data IDs start at 1 so anything less is invalid
            if (dataId > 0) {
                final Uri uri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
                final Uri dataUsageUri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
                        .appendPath(String.valueOf(dataId))
                        .appendQueryParameter(DataUsageFeedback.USAGE_TYPE, usageType)
                        .build();
                final boolean successful = getContentResolver().update(
                        uri, new ContentValues(), null, null) > 0;
                        dataUsageUri, new ContentValues(), null, null) > 0;
                if (!successful) {
                    Log.w(TAG, "DataUsageFeedback increment failed");
                }