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

Commit 008cb740 authored by Grace Jia's avatar Grace Jia Committed by Automerger Merge Worker
Browse files

Merge "Add support for selected contacts device to device sharing." am: a8efa11c am: 2620d275

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1694285

Change-Id: Ic578dd179b47b0467db6be4343bf469f3506f6e2
parents 310aec61 2620d275
Loading
Loading
Loading
Loading
+40 −0
Original line number 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) {
        logd("syncGroupedSetting");
        try (Cursor cursor = mContext.getContentResolver().query(
@@ -3154,6 +3193,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"
                    + ");";
        }