Merge "Make RcsMessageStore a top level API"

am: bac258f22e

Change-Id: If235ead8a75dc080e1e129d83bf7f24c3c996d8c
This commit is contained in:
Brad Ebinger
2019-07-12 14:53:26 -07:00
committed by android-build-merger
7 changed files with 29 additions and 64 deletions

View File

@@ -559,7 +559,7 @@ java_defaults {
"telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl",
"telephony/java/android/telephony/ims/aidl/IImsServiceControllerListener.aidl",
"telephony/java/android/telephony/ims/aidl/IImsSmsListener.aidl",
"telephony/java/android/telephony/ims/aidl/IRcs.aidl",
"telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl",
"telephony/java/android/telephony/mbms/IMbmsDownloadSessionCallback.aidl",
"telephony/java/android/telephony/mbms/IMbmsStreamingSessionCallback.aidl",
"telephony/java/android/telephony/mbms/IMbmsGroupCallSessionCallback.aidl",

View File

@@ -172,7 +172,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccCardManager;
import android.telephony.euicc.EuiccManager;
import android.telephony.ims.RcsManager;
import android.telephony.ims.RcsMessageManager;
import android.util.ArrayMap;
import android.util.Log;
import android.view.ContextThemeWrapper;
@@ -614,11 +614,11 @@ final class SystemServiceRegistry {
return new SubscriptionManager(ctx.getOuterContext());
}});
registerService(Context.TELEPHONY_RCS_SERVICE, RcsManager.class,
new CachedServiceFetcher<RcsManager>() {
registerService(Context.TELEPHONY_RCS_MESSAGE_SERVICE, RcsMessageManager.class,
new CachedServiceFetcher<RcsMessageManager>() {
@Override
public RcsManager createService(ContextImpl ctx) {
return new RcsManager(ctx.getOuterContext());
public RcsMessageManager createService(ContextImpl ctx) {
return new RcsMessageManager(ctx.getOuterContext());
}
});

View File

@@ -4665,10 +4665,10 @@ public abstract class Context {
/**
* Use with {@link #getSystemService(String)} to retrieve an
* {@link android.telephony.ims.RcsManager}.
* {@link android.telephony.ims.RcsMessageManager}.
* @hide
*/
public static final String TELEPHONY_RCS_SERVICE = "ircs";
public static final String TELEPHONY_RCS_MESSAGE_SERVICE = "ircsmessage";
/**
* Use with {@link #getSystemService(String)} to retrieve an

View File

@@ -19,10 +19,11 @@ package android.telephony.ims;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.ims.aidl.IRcs;
import android.telephony.ims.aidl.IRcsMessage;
/**
* A wrapper class around RPC calls that {@link RcsMessageStore} APIs to minimize boilerplate code.
* A wrapper class around RPC calls that {@link RcsMessageManager} APIs to minimize boilerplate
* code.
*
* @hide - not meant for public use
*/
@@ -34,13 +35,14 @@ class RcsControllerCall {
}
<R> R call(RcsServiceCall<R> serviceCall) throws RcsMessageStoreException {
IRcs iRcs = IRcs.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_RCS_SERVICE));
if (iRcs == null) {
IRcsMessage iRcsMessage = IRcsMessage.Stub.asInterface(ServiceManager.getService(
Context.TELEPHONY_RCS_MESSAGE_SERVICE));
if (iRcsMessage == null) {
throw new RcsMessageStoreException("Could not connect to RCS storage service");
}
try {
return serviceCall.methodOnIRcs(iRcs, mContext.getOpPackageName());
return serviceCall.methodOnIRcs(iRcsMessage, mContext.getOpPackageName());
} catch (RemoteException exception) {
throw new RcsMessageStoreException(exception.getMessage());
}
@@ -48,17 +50,17 @@ class RcsControllerCall {
void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall)
throws RcsMessageStoreException {
call((iRcs, callingPackage) -> {
serviceCall.methodOnIRcs(iRcs, callingPackage);
call((iRcsMessage, callingPackage) -> {
serviceCall.methodOnIRcs(iRcsMessage, callingPackage);
return null;
});
}
interface RcsServiceCall<R> {
R methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException;
R methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException;
}
interface RcsServiceCallWithNoReturn {
void methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException;
void methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException;
}
}

View File

@@ -1,43 +0,0 @@
/*
* 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.annotation.SystemService;
import android.content.Context;
/**
* The manager class for RCS related utilities.
*
* @hide
*/
@SystemService(Context.TELEPHONY_RCS_SERVICE)
public class RcsManager {
private final RcsMessageStore mRcsMessageStore;
/**
* @hide
*/
public RcsManager(Context context) {
mRcsMessageStore = new RcsMessageStore(context);
}
/**
* Returns an instance of {@link RcsMessageStore}
*/
public RcsMessageStore getRcsMessageStore() {
return mRcsMessageStore;
}
}

View File

@@ -18,6 +18,7 @@ package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemService;
import android.annotation.WorkerThread;
import android.content.Context;
import android.net.Uri;
@@ -25,15 +26,20 @@ import android.net.Uri;
import java.util.List;
/**
* RcsMessageStore is the application interface to RcsProvider and provides access methods to
* RcsMessageManager is the application interface to RcsProvider and provides access methods to
* RCS related database tables.
*
* @hide
*/
public class RcsMessageStore {
@SystemService(Context.TELEPHONY_RCS_MESSAGE_SERVICE)
public class RcsMessageManager {
RcsControllerCall mRcsControllerCall;
RcsMessageStore(Context context) {
/**
* Use {@link Context#getSystemService(String)} to get an instance of this service.
* @hide
*/
public RcsMessageManager(Context context) {
mRcsControllerCall = new RcsControllerCall(context);
}

View File

@@ -35,7 +35,7 @@ import android.telephony.ims.RcsThreadQueryResultParcelable;
* RPC definition between RCS storage APIs and phone process.
* {@hide}
*/
interface IRcs {
interface IRcsMessage {
/////////////////////////
// RcsMessageStore APIs
/////////////////////////