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

Commit 937f06f7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add support for selected contacts device to device sharing." into sc-dev

parents 65d99964 0fc9cd5d
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -2137,6 +2137,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) {
        logd("syncGroupedSetting");
        try (Cursor cursor = mContext.getContentResolver().query(
@@ -3155,6 +3194,7 @@ public class SubscriptionController extends ISub.Stub {
                        case SubscriptionManager.ALLOWED_NETWORK_TYPES:
                        case SubscriptionManager.VOIMS_OPT_IN_STATUS:
                        case SubscriptionManager.D2D_STATUS_SHARING:
                        case SubscriptionManager.D2D_STATUS_SHARING_SELECTED_CONTACTS:
                            resultValue = cursor.getString(0);
                            break;
                        default:
+2 −1
Original line number 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_RCS_CONFIG + " BLOB,"
                    + 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"
                    + ");";
        }