Merge "Create new RcsParticipantQueryResultParcelable"
This commit is contained in:
@@ -169,8 +169,9 @@ public class RcsGroupThread extends RcsThread {
|
||||
RcsParticipantQueryParams queryParameters =
|
||||
new RcsParticipantQueryParams.Builder().setThread(this).build();
|
||||
|
||||
RcsParticipantQueryResult queryResult = RcsControllerCall.call(
|
||||
iRcs -> iRcs.getParticipants(queryParameters));
|
||||
RcsParticipantQueryResult queryResult = new RcsParticipantQueryResult(
|
||||
RcsControllerCall.call(
|
||||
iRcs -> iRcs.getParticipants(queryParameters)));
|
||||
|
||||
List<RcsParticipant> participantList = queryResult.getParticipants();
|
||||
Set<RcsParticipant> participantSet = new LinkedHashSet<>(participantList);
|
||||
|
||||
@@ -72,7 +72,8 @@ public class RcsMessageStore {
|
||||
public RcsParticipantQueryResult getRcsParticipants(
|
||||
@Nullable RcsParticipantQueryParams queryParameters)
|
||||
throws RcsMessageStoreException {
|
||||
return RcsControllerCall.call(iRcs -> iRcs.getParticipants(queryParameters));
|
||||
return new RcsParticipantQueryResult(
|
||||
RcsControllerCall.call(iRcs -> iRcs.getParticipants(queryParameters)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +89,8 @@ public class RcsMessageStore {
|
||||
public RcsParticipantQueryResult getRcsParticipants(
|
||||
@NonNull RcsQueryContinuationToken continuationToken)
|
||||
throws RcsMessageStoreException {
|
||||
return RcsControllerCall.call(iRcs -> iRcs.getParticipantsWithToken(continuationToken));
|
||||
return new RcsParticipantQueryResult(
|
||||
RcsControllerCall.call(iRcs -> iRcs.getParticipantsWithToken(continuationToken)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,11 +18,9 @@ package android.telephony.ims;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The result of a {@link RcsMessageStore#getRcsParticipants(RcsParticipantQueryParams)}
|
||||
@@ -31,23 +29,12 @@ import java.util.List;
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class RcsParticipantQueryResult implements Parcelable {
|
||||
// A token for the caller to continue their query for the next batch of results
|
||||
private RcsQueryContinuationToken mContinuationToken;
|
||||
// The list of participant IDs returned with this query
|
||||
private List<Integer> mParticipants;
|
||||
public final class RcsParticipantQueryResult {
|
||||
private final RcsParticipantQueryResultParcelable mRcsParticipantQueryResultParcelable;
|
||||
|
||||
/**
|
||||
* Internal constructor for {@link com.android.internal.telephony.ims.RcsMessageStoreController}
|
||||
* to create query results
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public RcsParticipantQueryResult(
|
||||
RcsQueryContinuationToken continuationToken,
|
||||
List<Integer> participants) {
|
||||
mContinuationToken = continuationToken;
|
||||
mParticipants = participants;
|
||||
RcsParticipantQueryResult(
|
||||
RcsParticipantQueryResultParcelable rcsParticipantQueryResultParcelable) {
|
||||
mRcsParticipantQueryResultParcelable = rcsParticipantQueryResultParcelable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +44,7 @@ public final class RcsParticipantQueryResult implements Parcelable {
|
||||
*/
|
||||
@Nullable
|
||||
public RcsQueryContinuationToken getContinuationToken() {
|
||||
return mContinuationToken;
|
||||
return mRcsParticipantQueryResultParcelable.mContinuationToken;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,39 +54,8 @@ public final class RcsParticipantQueryResult implements Parcelable {
|
||||
*/
|
||||
@NonNull
|
||||
public List<RcsParticipant> getParticipants() {
|
||||
List<RcsParticipant> participantList = new ArrayList<>();
|
||||
for (Integer participantId : mParticipants) {
|
||||
participantList.add(new RcsParticipant(participantId));
|
||||
}
|
||||
|
||||
return participantList;
|
||||
}
|
||||
|
||||
private RcsParticipantQueryResult(Parcel in) {
|
||||
mContinuationToken = in.readParcelable(
|
||||
RcsQueryContinuationToken.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Creator<RcsParticipantQueryResult> CREATOR =
|
||||
new Creator<RcsParticipantQueryResult>() {
|
||||
@Override
|
||||
public RcsParticipantQueryResult createFromParcel(Parcel in) {
|
||||
return new RcsParticipantQueryResult(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RcsParticipantQueryResult[] newArray(int size) {
|
||||
return new RcsParticipantQueryResult[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(mContinuationToken, flags);
|
||||
return mRcsParticipantQueryResultParcelable.mParticipantIds.stream()
|
||||
.map(RcsParticipant::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
|
||||
package android.telephony.ims;
|
||||
|
||||
parcelable RcsParticipantQueryResult;
|
||||
parcelable RcsParticipantQueryResultParcelable;
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.telephony.ims;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public final class RcsParticipantQueryResultParcelable implements Parcelable {
|
||||
final RcsQueryContinuationToken mContinuationToken;
|
||||
final List<Integer> mParticipantIds;
|
||||
|
||||
public RcsParticipantQueryResultParcelable(
|
||||
RcsQueryContinuationToken continuationToken,
|
||||
List<Integer> participantIds) {
|
||||
mContinuationToken = continuationToken;
|
||||
mParticipantIds = participantIds;
|
||||
}
|
||||
|
||||
private RcsParticipantQueryResultParcelable(Parcel in) {
|
||||
mContinuationToken = in.readParcelable(RcsQueryContinuationToken.class.getClassLoader());
|
||||
mParticipantIds = new ArrayList<>();
|
||||
in.readList(mParticipantIds, Integer.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<RcsParticipantQueryResultParcelable> CREATOR =
|
||||
new Parcelable.Creator<RcsParticipantQueryResultParcelable>() {
|
||||
@Override
|
||||
public RcsParticipantQueryResultParcelable createFromParcel(Parcel in) {
|
||||
return new RcsParticipantQueryResultParcelable(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RcsParticipantQueryResultParcelable[] newArray(int size) {
|
||||
return new RcsParticipantQueryResultParcelable[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(mContinuationToken, flags);
|
||||
dest.writeList(mParticipantIds);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import android.telephony.ims.RcsMessageQueryParams;
|
||||
import android.telephony.ims.RcsMessageQueryResult;
|
||||
import android.telephony.ims.RcsOutgoingMessageCreationParams;
|
||||
import android.telephony.ims.RcsParticipantQueryParams;
|
||||
import android.telephony.ims.RcsParticipantQueryResult;
|
||||
import android.telephony.ims.RcsParticipantQueryResultParcelable;
|
||||
import android.telephony.ims.RcsQueryContinuationToken;
|
||||
import android.telephony.ims.RcsThreadQueryParams;
|
||||
import android.telephony.ims.RcsThreadQueryResultParcelable;
|
||||
@@ -44,9 +44,9 @@ interface IRcs {
|
||||
RcsThreadQueryResultParcelable getRcsThreadsWithToken(
|
||||
in RcsQueryContinuationToken continuationToken);
|
||||
|
||||
RcsParticipantQueryResult getParticipants(in RcsParticipantQueryParams queryParams);
|
||||
RcsParticipantQueryResultParcelable getParticipants(in RcsParticipantQueryParams queryParams);
|
||||
|
||||
RcsParticipantQueryResult getParticipantsWithToken(
|
||||
RcsParticipantQueryResultParcelable getParticipantsWithToken(
|
||||
in RcsQueryContinuationToken continuationToken);
|
||||
|
||||
RcsMessageQueryResult getMessages(in RcsMessageQueryParams queryParams);
|
||||
|
||||
Reference in New Issue
Block a user