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

Commit a8efa11c authored by Grace Jia's avatar Grace Jia Committed by Gerrit Code Review
Browse files

Merge "Add support for selected contacts device to device sharing."

parents bde4d599 5d5d8891
Loading
Loading
Loading
Loading
+40 −0
Original line number Original line Diff line number Diff line
@@ -2136,6 +2136,45 @@ public class SubscriptionController extends ISub.Stub {
        }
        }
    }
    }


    /**
     * Set contacts that allow device to device status sharing.
     * @param contacts contacts to set
     * @param subscriptionId
     * @return the number of records updated
     */
    @Override
    public int setDeviceToDeviceStatusSharingContacts(String contacts, int subscriptionId) {
        if (DBG) {
            logd("[setDeviceToDeviceStatusSharingContacts]- contacts:" + contacts
                    + " subId:" + subscriptionId);
        }

        enforceModifyPhoneState("setDeviceToDeviceStatusSharingContacts");

        // Now that all security checks passes, perform the operation as ourselves.
        final long identity = Binder.clearCallingIdentity();
        try {
            validateSubId(subscriptionId);
            ContentValues value = new ContentValues(1);
            value.put(SubscriptionManager.D2D_STATUS_SHARING_SELECTED_CONTACTS, contacts);
            if (DBG) {
                logd("[setDeviceToDeviceStatusSharingContacts]- contacts:" + contacts
                        + " set");
            }

            int result = updateDatabase(value, subscriptionId, true);

            // Refresh the Cache of Active Subscription Info List
            refreshCachedActiveSubscriptionInfoList();

            notifySubscriptionInfoChanged();

            return result;
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    public void syncGroupedSetting(int refSubId) {
    public void syncGroupedSetting(int refSubId) {
        logd("syncGroupedSetting");
        logd("syncGroupedSetting");
        try (Cursor cursor = mContext.getContentResolver().query(
        try (Cursor cursor = mContext.getContentResolver().query(
@@ -3154,6 +3193,7 @@ public class SubscriptionController extends ISub.Stub {
                        case SubscriptionManager.ALLOWED_NETWORK_TYPES:
                        case SubscriptionManager.ALLOWED_NETWORK_TYPES:
                        case SubscriptionManager.VOIMS_OPT_IN_STATUS:
                        case SubscriptionManager.VOIMS_OPT_IN_STATUS:
                        case SubscriptionManager.D2D_STATUS_SHARING:
                        case SubscriptionManager.D2D_STATUS_SHARING:
                        case SubscriptionManager.D2D_STATUS_SHARING_SELECTED_CONTACTS:
                            resultValue = cursor.getString(0);
                            resultValue = cursor.getString(0);
                            break;
                            break;
                        default:
                        default:
+2 −1
Original line number Original line Diff line number Diff line
@@ -116,7 +116,8 @@ public class FakeTelephonyProvider extends MockContentProvider {
                    + Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED + " INTEGER DEFAULT 0, "
                    + Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED + " INTEGER DEFAULT 0, "
                    + Telephony.SimInfo.COLUMN_RCS_CONFIG + " BLOB,"
                    + Telephony.SimInfo.COLUMN_RCS_CONFIG + " BLOB,"
                    + Telephony.SimInfo.COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS + " TEXT,"
                    + Telephony.SimInfo.COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS + " TEXT,"
                    + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING + " INTEGER DEFAULT 0"
                    + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING + " INTEGER DEFAULT 0,"
                    + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING_SELECTED_CONTACTS + "TEXT"
                    + ");";
                    + ");";
        }
        }