Merge "Create new RcsThreadQueryResultParcelable"
This commit is contained in:
@@ -41,7 +41,8 @@ public class RcsMessageStore {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public RcsThreadQueryResult getRcsThreads(@Nullable RcsThreadQueryParams queryParameters)
|
public RcsThreadQueryResult getRcsThreads(@Nullable RcsThreadQueryParams queryParameters)
|
||||||
throws RcsMessageStoreException {
|
throws RcsMessageStoreException {
|
||||||
return RcsControllerCall.call(iRcs -> iRcs.getRcsThreads(queryParameters));
|
return new RcsThreadQueryResult(
|
||||||
|
RcsControllerCall.call(iRcs -> iRcs.getRcsThreads(queryParameters)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +56,8 @@ public class RcsMessageStore {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public RcsThreadQueryResult getRcsThreads(@NonNull RcsQueryContinuationToken continuationToken)
|
public RcsThreadQueryResult getRcsThreads(@NonNull RcsQueryContinuationToken continuationToken)
|
||||||
throws RcsMessageStoreException {
|
throws RcsMessageStoreException {
|
||||||
return RcsControllerCall.call(iRcs -> iRcs.getRcsThreadsWithToken(continuationToken));
|
return new RcsThreadQueryResult(
|
||||||
|
RcsControllerCall.call(iRcs -> iRcs.getRcsThreadsWithToken(continuationToken)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,7 +154,6 @@ public class RcsMessageStore {
|
|||||||
*
|
*
|
||||||
* @param persistableEvent The {@link RcsEvent} to persist into storage.
|
* @param persistableEvent The {@link RcsEvent} to persist into storage.
|
||||||
* @throws RcsMessageStoreException if the query could not be completed on the storage
|
* @throws RcsMessageStoreException if the query could not be completed on the storage
|
||||||
*
|
|
||||||
* @see RcsGroupThreadNameChangedEvent
|
* @see RcsGroupThreadNameChangedEvent
|
||||||
* @see RcsGroupThreadIconChangedEvent
|
* @see RcsGroupThreadIconChangedEvent
|
||||||
* @see RcsGroupThreadParticipantJoinedEvent
|
* @see RcsGroupThreadParticipantJoinedEvent
|
||||||
|
|||||||
@@ -20,13 +20,10 @@ import static android.provider.Telephony.RcsColumns.RcsUnifiedThreadColumns.THRE
|
|||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
|
|
||||||
import com.android.ims.RcsTypeIdPair;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The result of a {@link RcsMessageStore#getRcsThreads(RcsThreadQueryParams)}
|
* The result of a {@link RcsMessageStore#getRcsThreads(RcsThreadQueryParams)}
|
||||||
@@ -35,23 +32,11 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class RcsThreadQueryResult implements Parcelable {
|
public final class RcsThreadQueryResult {
|
||||||
// A token for the caller to continue their query for the next batch of results
|
private final RcsThreadQueryResultParcelable mRcsThreadQueryResultParcelable;
|
||||||
private RcsQueryContinuationToken mContinuationToken;
|
|
||||||
// The list of thread IDs returned with this query
|
|
||||||
private List<RcsTypeIdPair> mRcsThreadIds;
|
|
||||||
|
|
||||||
/**
|
RcsThreadQueryResult(RcsThreadQueryResultParcelable rcsThreadQueryResultParcelable) {
|
||||||
* Internal constructor for {@link com.android.internal.telephony.ims.RcsMessageStoreController}
|
mRcsThreadQueryResultParcelable = rcsThreadQueryResultParcelable;
|
||||||
* to create query results
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public RcsThreadQueryResult(
|
|
||||||
RcsQueryContinuationToken continuationToken,
|
|
||||||
List<RcsTypeIdPair> rcsThreadIds) {
|
|
||||||
mContinuationToken = continuationToken;
|
|
||||||
mRcsThreadIds = rcsThreadIds;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +46,7 @@ public final class RcsThreadQueryResult implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public RcsQueryContinuationToken getContinuationToken() {
|
public RcsQueryContinuationToken getContinuationToken() {
|
||||||
return mContinuationToken;
|
return mRcsThreadQueryResultParcelable.mContinuationToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,47 +56,10 @@ public final class RcsThreadQueryResult implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<RcsThread> getThreads() {
|
public List<RcsThread> getThreads() {
|
||||||
List<RcsThread> rcsThreads = new ArrayList<>();
|
return mRcsThreadQueryResultParcelable.mRcsThreadIds.stream()
|
||||||
|
.map(typeIdPair -> typeIdPair.getType() == THREAD_TYPE_1_TO_1
|
||||||
for (RcsTypeIdPair typeIdPair : mRcsThreadIds) {
|
? new Rcs1To1Thread(typeIdPair.getId())
|
||||||
if (typeIdPair.getType() == THREAD_TYPE_1_TO_1) {
|
: new RcsGroupThread(typeIdPair.getId()))
|
||||||
rcsThreads.add(new Rcs1To1Thread(typeIdPair.getId()));
|
.collect(Collectors.toList());
|
||||||
} else {
|
|
||||||
rcsThreads.add(new RcsGroupThread(typeIdPair.getId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rcsThreads;
|
|
||||||
}
|
|
||||||
|
|
||||||
private RcsThreadQueryResult(Parcel in) {
|
|
||||||
mContinuationToken = in.readParcelable(
|
|
||||||
RcsQueryContinuationToken.class.getClassLoader());
|
|
||||||
mRcsThreadIds = new ArrayList<>();
|
|
||||||
in.readList(mRcsThreadIds, Integer.class.getClassLoader());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final @android.annotation.NonNull Creator<RcsThreadQueryResult> CREATOR =
|
|
||||||
new Creator<RcsThreadQueryResult>() {
|
|
||||||
@Override
|
|
||||||
public RcsThreadQueryResult createFromParcel(Parcel in) {
|
|
||||||
return new RcsThreadQueryResult(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RcsThreadQueryResult[] newArray(int size) {
|
|
||||||
return new RcsThreadQueryResult[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeParcelable(mContinuationToken, flags);
|
|
||||||
dest.writeList(mRcsThreadIds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,4 @@
|
|||||||
|
|
||||||
package android.telephony.ims;
|
package android.telephony.ims;
|
||||||
|
|
||||||
parcelable RcsThreadQueryResult;
|
parcelable RcsThreadQueryResultParcelable;
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.android.ims.RcsTypeIdPair;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final class RcsThreadQueryResultParcelable implements Parcelable {
|
||||||
|
final RcsQueryContinuationToken mContinuationToken;
|
||||||
|
final List<RcsTypeIdPair> mRcsThreadIds;
|
||||||
|
|
||||||
|
public RcsThreadQueryResultParcelable(
|
||||||
|
RcsQueryContinuationToken continuationToken,
|
||||||
|
List<RcsTypeIdPair> rcsThreadIds) {
|
||||||
|
mContinuationToken = continuationToken;
|
||||||
|
mRcsThreadIds = rcsThreadIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RcsThreadQueryResultParcelable(Parcel in) {
|
||||||
|
mContinuationToken = in.readParcelable(RcsQueryContinuationToken.class.getClassLoader());
|
||||||
|
mRcsThreadIds = new ArrayList<>();
|
||||||
|
in.readList(mRcsThreadIds, RcsTypeIdPair.class.getClassLoader());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<RcsThreadQueryResultParcelable> CREATOR =
|
||||||
|
new Parcelable.Creator<RcsThreadQueryResultParcelable>() {
|
||||||
|
@Override
|
||||||
|
public RcsThreadQueryResultParcelable createFromParcel(Parcel in) {
|
||||||
|
return new RcsThreadQueryResultParcelable(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RcsThreadQueryResultParcelable[] newArray(int size) {
|
||||||
|
return new RcsThreadQueryResultParcelable[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeParcelable(mContinuationToken, flags);
|
||||||
|
dest.writeList(mRcsThreadIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ import android.telephony.ims.RcsParticipantQueryParams;
|
|||||||
import android.telephony.ims.RcsParticipantQueryResult;
|
import android.telephony.ims.RcsParticipantQueryResult;
|
||||||
import android.telephony.ims.RcsQueryContinuationToken;
|
import android.telephony.ims.RcsQueryContinuationToken;
|
||||||
import android.telephony.ims.RcsThreadQueryParams;
|
import android.telephony.ims.RcsThreadQueryParams;
|
||||||
import android.telephony.ims.RcsThreadQueryResult;
|
import android.telephony.ims.RcsThreadQueryResultParcelable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RPC definition between RCS storage APIs and phone process.
|
* RPC definition between RCS storage APIs and phone process.
|
||||||
@@ -39,9 +39,9 @@ interface IRcs {
|
|||||||
/////////////////////////
|
/////////////////////////
|
||||||
// RcsMessageStore APIs
|
// RcsMessageStore APIs
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
RcsThreadQueryResult getRcsThreads(in RcsThreadQueryParams queryParams);
|
RcsThreadQueryResultParcelable getRcsThreads(in RcsThreadQueryParams queryParams);
|
||||||
|
|
||||||
RcsThreadQueryResult getRcsThreadsWithToken(
|
RcsThreadQueryResultParcelable getRcsThreadsWithToken(
|
||||||
in RcsQueryContinuationToken continuationToken);
|
in RcsQueryContinuationToken continuationToken);
|
||||||
|
|
||||||
RcsParticipantQueryResult getParticipants(in RcsParticipantQueryParams queryParams);
|
RcsParticipantQueryResult getParticipants(in RcsParticipantQueryParams queryParams);
|
||||||
|
|||||||
Reference in New Issue
Block a user