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

Commit 412ad2cc authored by Zhu Youhua's avatar Zhu Youhua Committed by Gerrit - the friendly Code Review server
Browse files

Dialer: fix the runtime exception issue for smartsearch.

Device will throw runtime exception when accountName
or accountType is null.

Add a default value for the two columns.

Change-Id: I70a6dfad001c1cd4fc018fe1054108c3539f6276
CRs-Fixed: 1068330
parent 5051b2c2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1161,4 +1161,6 @@ e mode.</string>
    <string name="alert_call_over_wifi">Calls will be made over Wi-Fi.</string>
    <string name="alert_call_no_cellular_coverage">No cellular network available. Connect to available Wi-Fi to make calls.</string>
    <string name="alert_user_connect_to_wifi_for_call">Connect to Wi-Fi to make calls.</string>
    <string name="missing_account_type">(No type)</string>
    <string name="missing_account_name">(No name)</string>
</resources>
+18 −4
Original line number Diff line number Diff line
@@ -943,10 +943,24 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
                insert.bindLong(12, updatedContactCursor.getInt(PhoneQuery.PHONE_IS_PRIMARY));
                insert.bindLong(13, updatedContactCursor.getInt(PhoneQuery.PHONE_CARRIER_PRESENCE));
                insert.bindLong(14, currentMillis);
                insert.bindString(15, updatedContactCursor
                        .getString(PhoneQuery.PHONE_ACCOUNT_TYPE));
                insert.bindString(16, updatedContactCursor
                        .getString(PhoneQuery.PHONE_ACCOUNT_NAME));

                final String accountType = updatedContactCursor.getString(
                        PhoneQuery.PHONE_ACCOUNT_TYPE);
                if (accountType == null) {
                    insert.bindString(15, mContext.getResources().getString(
                            R.string.missing_account_type));
                } else {
                    insert.bindString(15, accountType);
                }

                final String accountName = updatedContactCursor.getString(
                        PhoneQuery.PHONE_ACCOUNT_NAME);
                if (accountName == null) {
                    insert.bindString(16, mContext.getResources().getString(
                            R.string.missing_account_name));
                } else {
                    insert.bindString(16, accountName);
                }
                insert.executeInsert();
                final String contactPhoneNumber =
                        updatedContactCursor.getString(PhoneQuery.PHONE_NUMBER);