summaryrefslogtreecommitdiff
path: root/android/telephony/ims/internal/stub/ImsConfigImplBase.java
blob: 33aec5dfb8af7e983a2c283d74200f894ba69185 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * Copyright (C) 2017 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.internal.stub;

import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.telephony.ims.internal.aidl.IImsConfig;
import android.telephony.ims.internal.aidl.IImsConfigCallback;

import com.android.ims.ImsConfig;

/**
 * Controls the modification of IMS specific configurations. For more information on the supported
 * IMS configuration constants, see {@link ImsConfig}.
 *
 * @hide
 */

public class ImsConfigImplBase {

    //TODO: Implement the Binder logic to call base APIs. Need to finish other ImsService Config
    // work first.
    private final IImsConfig mBinder = new IImsConfig.Stub() {

        @Override
        public void addImsConfigCallback(IImsConfigCallback c) throws RemoteException {
            ImsConfigImplBase.this.addImsConfigCallback(c);
        }

        @Override
        public void removeImsConfigCallback(IImsConfigCallback c) throws RemoteException {
            ImsConfigImplBase.this.removeImsConfigCallback(c);
        }

        @Override
        public int getConfigInt(int item) throws RemoteException {
            return Integer.MIN_VALUE;
        }

        @Override
        public String getConfigString(int item) throws RemoteException {
            return null;
        }

        @Override
        public int setConfigInt(int item, int value) throws RemoteException {
            return Integer.MIN_VALUE;
        }

        @Override
        public int setConfigString(int item, String value) throws RemoteException {
            return Integer.MIN_VALUE;
        }
    };

    public class Callback extends IImsConfigCallback.Stub {

        @Override
        public final void onIntConfigChanged(int item, int value) throws RemoteException {
            onConfigChanged(item, value);
        }

        @Override
        public final void onStringConfigChanged(int item, String value) throws RemoteException {
            onConfigChanged(item, value);
        }

        /**
         * Called when the IMS configuration has changed.
         * @param item the IMS configuration key constant, as defined in ImsConfig.
         * @param value the new integer value of the IMS configuration constant.
         */
        public void onConfigChanged(int item, int value) {
            // Base Implementation
        }

        /**
         * Called when the IMS configuration has changed.
         * @param item the IMS configuration key constant, as defined in ImsConfig.
         * @param value the new String value of the IMS configuration constant.
         */
        public void onConfigChanged(int item, String value) {
            // Base Implementation
        }
    }

    private final RemoteCallbackList<IImsConfigCallback> mCallbacks = new RemoteCallbackList<>();

    /**
     * Adds a {@link Callback} to the list of callbacks notified when a value in the configuration
     * changes.
     * @param c callback to add.
     */
    private void addImsConfigCallback(IImsConfigCallback c) {
        mCallbacks.register(c);
    }
    /**
     * Removes a {@link Callback} to the list of callbacks notified when a value in the
     * configuration changes.
     *
     * @param c callback to remove.
     */
    private void removeImsConfigCallback(IImsConfigCallback c) {
        mCallbacks.unregister(c);
    }

    public final IImsConfig getBinder() {
        return mBinder;
    }

    /**
     * Sets the value for IMS service/capabilities parameters by the operator device
     * management entity. It sets the config item value in the provisioned storage
     * from which the master value is derived.
     *
     * @param item as defined in com.android.ims.ImsConfig#ConfigConstants.
     * @param value in Integer format.
     * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants.
     */
    public int setConfig(int item, int value) {
        // Base Implementation - To be overridden.
        return ImsConfig.OperationStatusConstants.FAILED;
    }

    /**
     * Sets the value for IMS service/capabilities parameters by the operator device
     * management entity. It sets the config item value in the provisioned storage
     * from which the master value is derived.
     *
     * @param item as defined in com.android.ims.ImsConfig#ConfigConstants.
     * @param value in String format.
     * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants.
     */
    public int setConfig(int item, String value) {
        return ImsConfig.OperationStatusConstants.FAILED;
    }

    /**
     * Gets the value for ims service/capabilities parameters from the provisioned
     * value storage.
     *
     * @param item as defined in com.android.ims.ImsConfig#ConfigConstants.
     * @return value in Integer format.
     */
    public int getConfigInt(int item) {
        return ImsConfig.OperationStatusConstants.FAILED;
    }

    /**
     * Gets the value for ims service/capabilities parameters from the provisioned
     * value storage.
     *
     * @param item as defined in com.android.ims.ImsConfig#ConfigConstants.
     * @return value in String format.
     */
    public String getConfigString(int item) {
        return null;
    }
}