summaryrefslogtreecommitdiffstats
path: root/core/java/android/service/carrier
diff options
context:
space:
mode:
authorJonathan Basseri <misterikkit@google.com>2015-02-25 13:01:52 -0800
committerJunda Liu <junda@google.com>2015-04-16 11:40:33 -0700
commit9a1c9b67c4b2426884deb60c1ff84130ab47333c (patch)
tree55d55270aaa3fc809b182b454a410b725b4e808b /core/java/android/service/carrier
parent3f2631f526d0a0ac0b57ac9f6d241bcc7aeb5f5b (diff)
downloadframeworks_base-9a1c9b67c4b2426884deb60c1ff84130ab47333c.zip
frameworks_base-9a1c9b67c4b2426884deb60c1ff84130ab47333c.tar.gz
frameworks_base-9a1c9b67c4b2426884deb60c1ff84130ab47333c.tar.bz2
Adding Carrier Config API.
UICC privileged carrier apps will extend CarrierConfigService to provide carrier-specific configuration. Apps/services will use CarrierConfigManager to read the current configuration. CarrierConfigManager also defines the set of configuration variables and their default values. Bug: b/19483786 Change-Id: I027211b43276afd6fe893ae50048c52f2aed5cf5
Diffstat (limited to 'core/java/android/service/carrier')
-rw-r--r--core/java/android/service/carrier/CarrierConfigService.java104
-rw-r--r--core/java/android/service/carrier/CarrierIdentifier.aidl19
-rw-r--r--core/java/android/service/carrier/CarrierIdentifier.java117
-rw-r--r--core/java/android/service/carrier/ICarrierConfigService.aidl32
4 files changed, 272 insertions, 0 deletions
diff --git a/core/java/android/service/carrier/CarrierConfigService.java b/core/java/android/service/carrier/CarrierConfigService.java
new file mode 100644
index 0000000..1880d16
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierConfigService.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2015 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.service.carrier;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.IBinder;
+
+/**
+ * A service that sets carrier configuration for telephony services.
+ * <p>
+ * To extend this class, you must declare the service in your manifest file to require the
+ * {@link android.Manifest.permission#BIND_CARRIER_CONFIG_SERVICE} permission and include an intent
+ * filter with the {@link #SERVICE_INTERFACE} action. For example:
+ * </p>
+ *
+ * <pre>{@code
+ * <service android:name=".MyCarrierConfigService"
+ * android:label="@string/service_name"
+ * android:permission="android.permission.BIND_CARRIER_CONFIG_SERVICE">
+ * <intent-filter>
+ * <action android:name="android.service.carrier.CarrierConfigService" />
+ * </intent-filter>
+ * </service>
+ * }</pre>
+ */
+public abstract class CarrierConfigService extends Service {
+
+ public static final String SERVICE_INTERFACE = "android.service.carrier.CarrierConfigService";
+
+ private final ICarrierConfigService.Stub mStubWrapper;
+
+ public CarrierConfigService() {
+ mStubWrapper = new ICarrierConfigServiceWrapper();
+ }
+
+ /**
+ * Override this method to set carrier configuration.
+ * <p>
+ * This method will be called by telephony services to get carrier-specific configuration
+ * values. The returned config will be saved by the system until,
+ * <ol>
+ * <li>The carrier app package is updated, or</li>
+ * <li>The carrier app requests a reload with
+ * {@link android.telephony.CarrierConfigManager#reloadCarrierConfigForSubId
+ * reloadCarrierConfigForSubId}.</li>
+ * </ol>
+ * This method can be called after a SIM card loads, which may be before or after boot.
+ * </p>
+ * <p>
+ * This method should not block for a long time. If expensive operations (e.g. network access)
+ * are required, this method can schedule the work and return null. Then, use
+ * {@link android.telephony.CarrierConfigManager#reloadCarrierConfigForSubId
+ * reloadCarrierConfigForSubId} to trigger a reload when the config is ready.
+ * </p>
+ * <p>
+ * Implementations should use the keys defined in {@link android.telephony.CarrierConfigManager
+ * CarrierConfigManager}. Any configuration values not set in the returned {@link Bundle} may be
+ * overridden by the system's default configuration service.
+ * </p>
+ *
+ * @param id contains details about the current carrier that can be used do decide what
+ * configuration values to return.
+ * @return a {@link Bundle} object containing the configuration or null if default values should
+ * be used.
+ */
+ public abstract Bundle onLoadConfig(CarrierIdentifier id);
+
+ /** @hide */
+ @Override
+ public final IBinder onBind(Intent intent) {
+ if (!SERVICE_INTERFACE.equals(intent.getAction())) {
+ return null;
+ }
+ return mStubWrapper;
+ }
+
+ /**
+ * A wrapper around ICarrierConfigService that forwards calls to implementations of
+ * {@link CarrierConfigService}.
+ *
+ * @hide
+ */
+ private class ICarrierConfigServiceWrapper extends ICarrierConfigService.Stub {
+
+ @Override
+ public Bundle getCarrierConfig(CarrierIdentifier id) {
+ return CarrierConfigService.this.onLoadConfig(id);
+ }
+ }
+}
diff --git a/core/java/android/service/carrier/CarrierIdentifier.aidl b/core/java/android/service/carrier/CarrierIdentifier.aidl
new file mode 100644
index 0000000..48b1398
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierIdentifier.aidl
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2015, 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.service.carrier;
+
+parcelable CarrierIdentifier;
diff --git a/core/java/android/service/carrier/CarrierIdentifier.java b/core/java/android/service/carrier/CarrierIdentifier.java
new file mode 100644
index 0000000..495fea6
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierIdentifier.java
@@ -0,0 +1,117 @@
+/**
+ * Copyright (c) 2015, 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.service.carrier;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Used to pass info to CarrierConfigService implementations so they can decide what values to
+ * return.
+ */
+public class CarrierIdentifier implements Parcelable {
+
+ /** Used to create a {@link CarrierIdentifier} from a {@link Parcel}. */
+ public static final Creator<CarrierIdentifier> CREATOR = new Creator<CarrierIdentifier>() {
+ @Override
+ public CarrierIdentifier createFromParcel(Parcel parcel) {
+ return new CarrierIdentifier(parcel);
+ }
+
+ @Override
+ public CarrierIdentifier[] newArray(int i) {
+ return new CarrierIdentifier[i];
+ }
+ };
+
+ private String mMcc;
+ private String mMnc;
+ private String mSpn;
+ private String mImsi;
+ private String mGid1;
+ private String mGid2;
+
+ public CarrierIdentifier(String mcc, String mnc, String spn, String imsi, String gid1,
+ String gid2) {
+ mMcc = mcc;
+ mMnc = mnc;
+ mSpn = spn;
+ mImsi = imsi;
+ mGid1 = gid1;
+ mGid2 = gid2;
+ }
+
+ /** @hide */
+ public CarrierIdentifier(Parcel parcel) {
+ readFromParcel(parcel);
+ }
+
+ /** Get the mobile country code. */
+ public String getMcc() {
+ return mMcc;
+ }
+
+ /** Get the mobile network code. */
+ public String getMnc() {
+ return mMnc;
+ }
+
+ /** Get the service provider name. */
+ public String getSpn() {
+ return mSpn;
+ }
+
+ /** Get the international mobile subscriber identity. */
+ public String getImsi() {
+ return mImsi;
+ }
+
+ /** Get the group identifier level 1. */
+ public String getGid1() {
+ return mGid1;
+ }
+
+ /** Get the group identifier level 2. */
+ public String getGid2() {
+ return mGid2;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeString(mMcc);
+ out.writeString(mMnc);
+ out.writeString(mSpn);
+ out.writeString(mImsi);
+ out.writeString(mGid1);
+ out.writeString(mGid2);
+ }
+
+ /** @hide */
+ public void readFromParcel(Parcel in) {
+ mMcc = in.readString();
+ mMnc = in.readString();
+ mSpn = in.readString();
+ mImsi = in.readString();
+ mGid1 = in.readString();
+ mGid2 = in.readString();
+ }
+}
diff --git a/core/java/android/service/carrier/ICarrierConfigService.aidl b/core/java/android/service/carrier/ICarrierConfigService.aidl
new file mode 100644
index 0000000..d8390b6
--- /dev/null
+++ b/core/java/android/service/carrier/ICarrierConfigService.aidl
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2015, 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.service.carrier;
+
+import android.os.Bundle;
+import android.service.carrier.CarrierIdentifier;
+
+/**
+ * Service used to get carrier config from carrier apps.
+ *
+ * @see android.service.carrier.CarrierConfigService
+ * @hide
+ */
+interface ICarrierConfigService {
+
+ /** @see android.service.carrier.CarrierConfigService#onLoadConfig */
+ Bundle getCarrierConfig(in CarrierIdentifier id);
+} \ No newline at end of file