1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.googlecode.android_scripting.facade.telephony; 18 19 import android.app.Service; 20 import android.content.Context; 21 import com.android.cellbroadcastreceiver.tests.SendTestMessages; 22 import com.googlecode.android_scripting.facade.FacadeManager; 23 import com.googlecode.android_scripting.jsonrpc.RpcReceiver; 24 import com.googlecode.android_scripting.rpc.Rpc; 25 import com.googlecode.android_scripting.rpc.RpcParameter; 26 27 28 /** 29 * Exposes CellBroadcastReceiver test app functionality. 30 */ 31 public class CellBroadcastReceiverFacade extends RpcReceiver { 32 private final Context mContext; 33 private final Service mService; 34 CellBroadcastReceiverFacade(FacadeManager manager)35 public CellBroadcastReceiverFacade(FacadeManager manager) { 36 super(manager); 37 mService = manager.getService(); 38 mContext = mService; 39 } 40 41 @Rpc(description = "Trigger a cell broadcast alert on a particular channel.") cbrSendTestAlert( @pcParametername="messageId") Integer messageId, @RpcParameter(name="channelId") Integer channelId)42 public void cbrSendTestAlert( 43 @RpcParameter(name="messageId") Integer messageId, 44 @RpcParameter(name="channelId") Integer channelId) { 45 SendTestMessages.testSendMessage7bit(mContext, messageId, channelId); 46 } 47 shutdown()48 public void shutdown() { 49 50 } 51 } 52