1 /**
2  * Copyright (C) 2017 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.android.internal.telephony;
18 
19 import android.hardware.radio.deprecated.V1_0.IOemHookIndication;
20 import android.os.AsyncResult;
21 
22 import java.util.ArrayList;
23 
24 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_OEM_HOOK_RAW;
25 
26 /**
27  * Class containing oem hook indication callbacks
28  */
29 public class OemHookIndication extends IOemHookIndication.Stub {
30     RIL mRil;
31 
OemHookIndication(RIL ril)32     public OemHookIndication(RIL ril) {
33         mRil = ril;
34     }
35 
36     /**
37      * @param indicationType RadioIndicationType
38      * @param data Data sent by oem
39      */
oemHookRaw(int indicationType, ArrayList<Byte> data)40     public void oemHookRaw(int indicationType, ArrayList<Byte> data) {
41         mRil.processIndication(indicationType);
42 
43         byte[] response = RIL.arrayListToPrimitiveArray(data);
44         if (RIL.RILJ_LOGD) {
45             mRil.unsljLogvRet(RIL_UNSOL_OEM_HOOK_RAW,
46                     com.android.internal.telephony.uicc.IccUtils.bytesToHexString(response));
47         }
48 
49         if (mRil.mUnsolOemHookRawRegistrant != null) {
50             mRil.mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, response, null));
51         }
52     }
53 }
54