diff options
-rw-r--r-- | Android.mk | 11 | ||||
-rw-r--r-- | api/current.txt | 34 | ||||
-rw-r--r-- | api/system-current.txt | 36 | ||||
-rw-r--r-- | core/java/android/app/SystemServiceRegistry.java | 8 | ||||
-rw-r--r-- | core/java/android/content/Context.java | 13 | ||||
-rw-r--r-- | core/java/android/service/carrier/CarrierConfigService.java | 104 | ||||
-rw-r--r-- | core/java/android/service/carrier/CarrierIdentifier.aidl | 19 | ||||
-rw-r--r-- | core/java/android/service/carrier/CarrierIdentifier.java | 117 | ||||
-rw-r--r-- | core/java/android/service/carrier/ICarrierConfigService.aidl | 32 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 9 | ||||
-rw-r--r-- | core/res/res/values/strings.xml | 102 | ||||
-rw-r--r-- | telephony/java/android/telephony/CarrierConfigManager.java | 183 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl | 31 |
13 files changed, 695 insertions, 4 deletions
@@ -209,6 +209,7 @@ LOCAL_SRC_FILES += \ core/java/android/os/IUserManager.aidl \ core/java/android/os/IVibratorService.aidl \ core/java/android/security/IKeystoreService.aidl \ + core/java/android/service/carrier/ICarrierConfigService.aidl \ core/java/android/service/carrier/ICarrierMessagingCallback.aidl \ core/java/android/service/carrier/ICarrierMessagingService.aidl \ core/java/android/service/gatekeeper/IGateKeeperService.aidl \ @@ -390,15 +391,16 @@ LOCAL_SRC_FILES += \ telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl \ telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl \ telephony/java/com/android/ims/ImsConfigListener.aidl \ + telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl \ + telephony/java/com/android/internal/telephony/IMms.aidl \ + telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl \ telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \ telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \ + telephony/java/com/android/internal/telephony/ISms.aidl \ + telephony/java/com/android/internal/telephony/ISub.aidl \ telephony/java/com/android/internal/telephony/ITelephony.aidl \ telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \ - telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl \ - telephony/java/com/android/internal/telephony/ISms.aidl \ telephony/java/com/android/internal/telephony/IWapPushManager.aidl \ - telephony/java/com/android/internal/telephony/ISub.aidl \ - telephony/java/com/android/internal/telephony/IMms.aidl \ wifi/java/android/net/wifi/IWifiManager.aidl \ wifi/java/android/net/wifi/passpoint/IWifiPasspointManager.aidl \ wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \ @@ -549,6 +551,7 @@ aidl_files := \ frameworks/base/core/java/android/view/textservice/SpellCheckerInfo.aidl \ frameworks/base/core/java/android/view/textservice/SentenceSuggestionsInfo.aidl \ frameworks/base/core/java/android/view/textservice/SuggestionsInfo.aidl \ + frameworks/base/core/java/android/service/carrier/CarrierIdentifier.aidl \ frameworks/base/core/java/android/service/carrier/MessagePdu.aidl \ frameworks/base/core/java/android/service/notification/StatusBarNotification.aidl \ frameworks/base/core/java/android/service/chooser/ChooserTarget.aidl \ diff --git a/api/current.txt b/api/current.txt index d73b9f9..75db758 100644 --- a/api/current.txt +++ b/api/current.txt @@ -20,6 +20,7 @@ package android { field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS"; field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE"; field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET"; + field public static final java.lang.String BIND_CARRIER_CONFIG_SERVICE = "android.permission.BIND_CARRIER_CONFIG_SERVICE"; field public static final java.lang.String BIND_CARRIER_MESSAGING_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_SERVICE"; field public static final java.lang.String BIND_CHOOSER_TARGET_SERVICE = "android.permission.BIND_CHOOSER_TARGET_SERVICE"; field public static final java.lang.String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN"; @@ -7740,6 +7741,7 @@ package android.content { field public static final java.lang.String BLUETOOTH_SERVICE = "bluetooth"; field public static final java.lang.String CAMERA_SERVICE = "camera"; field public static final java.lang.String CAPTIONING_SERVICE = "captioning"; + field public static final java.lang.String CARRIER_CONFIG_SERVICE = "carrier_config"; field public static final java.lang.String CLIPBOARD_SERVICE = "clipboard"; field public static final java.lang.String CONNECTIVITY_SERVICE = "connectivity"; field public static final java.lang.String CONSUMER_IR_SERVICE = "consumer_ir"; @@ -28498,6 +28500,26 @@ package android.security { package android.service.carrier { + public abstract class CarrierConfigService extends android.app.Service { + ctor public CarrierConfigService(); + method public final android.os.IBinder onBind(android.content.Intent); + method public abstract android.os.Bundle onLoadConfig(android.service.carrier.CarrierIdentifier); + field public static final java.lang.String SERVICE_INTERFACE = "android.service.carrier.CarrierConfigService"; + } + + public class CarrierIdentifier implements android.os.Parcelable { + ctor public CarrierIdentifier(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public int describeContents(); + method public java.lang.String getGid1(); + method public java.lang.String getGid2(); + method public java.lang.String getImsi(); + method public java.lang.String getMcc(); + method public java.lang.String getMnc(); + method public java.lang.String getSpn(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR; + } + public abstract class CarrierMessagingService extends android.app.Service { ctor public CarrierMessagingService(); method public android.os.IBinder onBind(android.content.Intent); @@ -30463,6 +30485,18 @@ package android.telecom { package android.telephony { + public class CarrierConfigManager { + method public android.os.Bundle getConfig(); + method public android.os.Bundle getConfigForSubId(int); + method public void reloadCarrierConfigForSubId(int); + field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED"; + field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available"; + field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned"; + field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported"; + field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma"; + field public static final java.lang.String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat"; + } + public final class CellIdentityCdma implements android.os.Parcelable { method public int describeContents(); method public int getBasestationId(); diff --git a/api/system-current.txt b/api/system-current.txt index f98e15f..1deca48 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -28,6 +28,7 @@ package android { field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS"; field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE"; field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET"; + field public static final java.lang.String BIND_CARRIER_CONFIG_SERVICE = "android.permission.BIND_CARRIER_CONFIG_SERVICE"; field public static final java.lang.String BIND_CARRIER_MESSAGING_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_SERVICE"; field public static final java.lang.String BIND_CHOOSER_TARGET_SERVICE = "android.permission.BIND_CHOOSER_TARGET_SERVICE"; field public static final java.lang.String BIND_CONDITION_PROVIDER_SERVICE = "android.permission.BIND_CONDITION_PROVIDER_SERVICE"; @@ -7956,6 +7957,7 @@ package android.content { field public static final java.lang.String BLUETOOTH_SERVICE = "bluetooth"; field public static final java.lang.String CAMERA_SERVICE = "camera"; field public static final java.lang.String CAPTIONING_SERVICE = "captioning"; + field public static final java.lang.String CARRIER_CONFIG_SERVICE = "carrier_config"; field public static final java.lang.String CLIPBOARD_SERVICE = "clipboard"; field public static final java.lang.String CONNECTIVITY_SERVICE = "connectivity"; field public static final java.lang.String CONSUMER_IR_SERVICE = "consumer_ir"; @@ -30501,6 +30503,26 @@ package android.security { package android.service.carrier { + public abstract class CarrierConfigService extends android.app.Service { + ctor public CarrierConfigService(); + method public final android.os.IBinder onBind(android.content.Intent); + method public abstract android.os.Bundle onLoadConfig(android.service.carrier.CarrierIdentifier); + field public static final java.lang.String SERVICE_INTERFACE = "android.service.carrier.CarrierConfigService"; + } + + public class CarrierIdentifier implements android.os.Parcelable { + ctor public CarrierIdentifier(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String); + method public int describeContents(); + method public java.lang.String getGid1(); + method public java.lang.String getGid2(); + method public java.lang.String getImsi(); + method public java.lang.String getMcc(); + method public java.lang.String getMnc(); + method public java.lang.String getSpn(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR; + } + public abstract class CarrierMessagingService extends android.app.Service { ctor public CarrierMessagingService(); method public android.os.IBinder onBind(android.content.Intent); @@ -32583,6 +32605,20 @@ package android.telecom { package android.telephony { + public class CarrierConfigManager { + method public android.os.Bundle getConfig(); + method public android.os.Bundle getConfigForSubId(int); + method public static android.os.Bundle getDefaultConfig(); + method public void reloadCarrierConfigForSubId(int); + method public void updateConfigForPhoneId(int, java.lang.String); + field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED"; + field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available"; + field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned"; + field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported"; + field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma"; + field public static final java.lang.String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat"; + } + public final class CellIdentityCdma implements android.os.Parcelable { method public int describeContents(); method public int getBasestationId(); diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 4ede5b1..e446700 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -105,6 +105,7 @@ import android.hardware.fingerprint.IFingerprintService; import android.service.persistentdata.IPersistentDataBlockService; import android.service.persistentdata.PersistentDataBlockManager; import android.telecom.TelecomManager; +import android.telephony.CarrierConfigManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; @@ -420,6 +421,13 @@ final class SystemServiceRegistry { return new SubscriptionManager(ctx.getOuterContext()); }}); + registerService(Context.CARRIER_CONFIG_SERVICE, CarrierConfigManager.class, + new CachedServiceFetcher<CarrierConfigManager>() { + @Override + public CarrierConfigManager createService(ContextImpl ctx) { + return new CarrierConfigManager(); + }}); + registerService(Context.TELECOM_SERVICE, TelecomManager.class, new CachedServiceFetcher<TelecomManager>() { @Override diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 0cbf960..370f61c 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -2193,6 +2193,7 @@ public abstract class Context { MEDIA_ROUTER_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, + CARRIER_CONFIG_SERVICE, TELECOM_SERVICE, CLIPBOARD_SERVICE, INPUT_METHOD_SERVICE, @@ -2338,6 +2339,8 @@ public abstract class Context { * @see android.telephony.TelephonyManager * @see #TELEPHONY_SUBSCRIPTION_SERVICE * @see android.telephony.SubscriptionManager + * @see #CARRIER_CONFIG_SERVICE + * @see android.telephony.CarrierConfigManager * @see #INPUT_METHOD_SERVICE * @see android.view.inputmethod.InputMethodManager * @see #UI_MODE_SERVICE @@ -2755,6 +2758,16 @@ public abstract class Context { /** * Use with {@link #getSystemService} to retrieve a + * {@link android.telephony.CarrierConfigManager} for reading carrier configuration values. + * + * @see #getSystemService + * @see android.telephony.CarrierConfigManager + */ + public static final String CARRIER_CONFIG_SERVICE = "carrier_config"; + + /** + * Use with {@link #getSystemService} to retrieve a + * {@link android.text.ClipboardManager} for accessing and modifying * {@link android.content.ClipboardManager} for accessing and modifying * the contents of the global clipboard. * 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 diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 13877fb..5465212 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2408,6 +2408,15 @@ android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="signature" /> + <!-- The system process that pulls carrier configuration from carrier apps will + have this permission. Carrier apps that provide + {@link android.service.carrier.CarrierConfigService} should require this + permission for clients binding to their service. --> + <permission android:name="android.permission.BIND_CARRIER_CONFIG_SERVICE" + android:label="@string/permlab_bindCarrierConfigService" + android:description="@string/permdesc_bindCarrierConfigService" + android:protectionLevel="signature|system" /> + <!-- The system process is explicitly the only one allowed to launch the confirmation UI for full backup/restore --> <uses-permission android:name="android.permission.CONFIRM_FULL_BACKUP"/> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 3d1fd7c..59366cc 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1323,6 +1323,108 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_use_sip">Allows the app to make and receive SIP calls.</string> + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_register_sim_subscription">register new telecom SIM connections</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_register_sim_subscription">Allows the app to register new telecom SIM connections.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_register_call_provider">register new telecom connections</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_register_call_provider">Allows the app to register new telecom connections.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_connection_manager">manage telecom connections</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_connection_manager">Allows the app to manage telecom connections.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_bind_incall_service">interact with in-call screen</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_bind_incall_service">Allows the app to control when and how the user sees the in-call screen.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_bind_connection_service">interact with telephony services</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_bind_connection_service">Allows the app to interact with telephony services to make/receive calls.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_control_incall_experience">provide an in-call user experience</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_control_incall_experience">Allows the app to provide an in-call user experience.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_readNetworkUsageHistory">read historical network usage</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_readNetworkUsageHistory">Allows the app to read historical network usage for specific networks and apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_manageNetworkPolicy">manage network policy</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_manageNetworkPolicy">Allows the app to manage network policies and define app-specific rules.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_modifyNetworkAccounting">modify network usage accounting</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_modifyNetworkAccounting">Allows the app to modify how network usage is accounted against apps. Not for use by normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_accessNotifications">access notifications</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_accessNotifications">Allows the app to retrieve, examine, and clear notifications, including those posted by other apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_bindNotificationListenerService">bind to a notification listener service</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_bindNotificationListenerService">Allows the holder to bind to the top-level interface of a notification listener service. Should never be needed for normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_bindConditionProviderService">bind to a condition provider service</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_bindConditionProviderService">Allows the holder to bind to the top-level interface of a condition provider service. Should never be needed for normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_bindDreamService">bind to a dream service</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_bindDreamService">Allows the holder to bind to the top-level interface of a dream service. Should never be needed for normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_invokeCarrierSetup">invoke the carrier-provided configuration app</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_invokeCarrierSetup">Allows the holder to invoke the carrier-provided configuration app. Should never be needed for normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_accessNetworkConditions">listen for observations on network conditions</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_accessNetworkConditions">Allows an application to listen for observations on network conditions. Should never be needed for normal apps.</string> + + <string name="permlab_setInputCalibration">change input device calibration</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_setInputCalibration">Allows the app to modify the calibration parameters of the touch screen. Should never be needed for normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_accessDrmCertificates">access DRM certificates</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_accessDrmCertificates">Allows an application to provision and use DRM certficates. Should never be needed for normal apps.</string> + + <string name="permlab_handoverStatus">Receive Android Beam transfer status</string> + <string name="permdesc_handoverStatus">Allows this application to receive information about current Android Beam transfers</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_removeDrmCertificates">remove DRM certificates</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_removeDrmCertificates">Allows an application to remove DRM certficates. Should never be needed for normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_bindCarrierMessagingService">bind to a carrier messaging service</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_bindCarrierMessagingService">Allows the holder to bind to the top-level interface of a carrier messaging service. Should never be needed for normal apps.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_bindCarrierConfigService">bind to a carrier config service</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_bindCarrierConfigService">Allows the holder to bind to a carrier config service. Should never be needed for normal apps.</string> + <!-- Policy administration --> <!-- Title of policy access to limiting the user's password choices --> diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java new file mode 100644 index 0000000..cdf77b4 --- /dev/null +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -0,0 +1,183 @@ +/* + * 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.telephony; + +import com.android.internal.telephony.ICarrierConfigLoader; + +import android.annotation.SystemApi; +import android.content.Context; +import android.os.Bundle; +import android.os.RemoteException; +import android.os.ServiceManager; + +/** + * Provides access to telephony configuration values that are carrier-specific. + * <p> + * Users should obtain an instance of this class by calling + * {@code mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);} + * </p> + * + * @see Context#getSystemService + * @see Context#CARRIER_CONFIG_SERVICE + */ +public class CarrierConfigManager { + /** + * @hide + */ + public CarrierConfigManager() { + } + + /** + * This intent is broadcast by the system when carrier config changes. + */ + public static final String + ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED"; + + /** + * Flag specifying whether VoLTE should be available for carrier, independent of carrier + * provisioning. If false: hard disabled. If true: then depends on carrier provisioning, + * availability, etc. + */ + public static final String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available"; + + /** + * Flag specifying whether VoLTE availability is based on provisioning. + */ + public static final String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned"; + + /** + * Flag specifying whether VoLTE TTY is supported. + */ + public static final String BOOL_CARRIER_VOLTE_TTY_SUPPORTED + = "bool_carrier_volte_tty_supported"; + + /** + * Show APN Settings for some CDMA carriers. + */ + public static final String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma"; + + /** + * If Voice Radio Technology is RIL_RADIO_TECHNOLOGY_LTE:14 or RIL_RADIO_TECHNOLOGY_UNKNOWN:0 + * this is the value that should be used instead. A configuration value of + * RIL_RADIO_TECHNOLOGY_UNKNOWN:0 means there is no replacement value and that the default + * assumption for phone type (GSM) should be used. + */ + public static final String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat"; + + private final static String TAG = "CarrierConfigManager"; + + /** The default value for every variable. */ + private final static Bundle sDefaults; + + static { + sDefaults = new Bundle(); + sDefaults.putBoolean(BOOL_CARRIER_VOLTE_AVAILABLE, false); + sDefaults.putBoolean(BOOL_CARRIER_VOLTE_PROVISIONED, false); + sDefaults.putBoolean(BOOL_CARRIER_VOLTE_TTY_SUPPORTED, true); + sDefaults.putBoolean(BOOL_SHOW_APN_SETTING_CDMA, false); + + sDefaults.putInt(INT_VOLTE_REPLACEMENT_RAT, 0); + } + + /** + * Gets the configuration values for a particular subscription, which is associated with a + * specific SIM card. If an invalid subId is used, the returned config will contain default + * values. + * + * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}. + * @return A {@link Bundle} containing the config for the given subId, or default values for an + * invalid subId. + */ + public Bundle getConfigForSubId(int subId) { + try { + return getICarrierConfigLoader().getConfigForSubId(subId); + } catch (RemoteException ex) { + Rlog.e(TAG, "Error getting config for subId " + Integer.toString(subId) + ": " + + ex.toString()); + } catch (NullPointerException ex) { + Rlog.e(TAG, "Error getting config for subId " + Integer.toString(subId) + ": " + + ex.toString()); + } + return null; + } + + /** + * Gets the configuration values for the default subscription. + * + * @see #getConfigForSubId + */ + public Bundle getConfig() { + return getConfigForSubId(SubscriptionManager.getDefaultSubId()); + } + + /** + * Calling this method triggers telephony services to fetch the current carrier configuration. + * <p> + * Normally this does not need to be called because the platform reloads config on its own. Call + * this method if your app wants to update config at an arbitrary moment. + * </p> + * <p> + * This method returns before the reload has completed, and + * {@link android.service.carrier.CarrierConfigService#onLoadConfig} will be called from an + * arbitrary thread. + * </p> + */ + public void reloadCarrierConfigForSubId(int subId) { + try { + getICarrierConfigLoader().reloadCarrierConfigForSubId(subId); + } catch (RemoteException ex) { + Rlog.e(TAG, "Error reloading config for subId=" + subId + ": " + ex.toString()); + } catch (NullPointerException ex) { + Rlog.e(TAG, "Error reloading config for subId=" + subId + ": " + ex.toString()); + } + } + + /** + * Request the carrier config loader to update the cofig for phoneId. + * + * Depending on simState, the config may be cleared or loaded from config app. + * This is only used by SubscriptionInfoUpdater. + * + * @hide + */ + @SystemApi + public void updateConfigForPhoneId(int phoneId, String simState) { + try { + getICarrierConfigLoader().updateConfigForPhoneId(phoneId, simState); + } catch (RemoteException ex) { + Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex.toString()); + } catch (NullPointerException ex) { + Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex.toString()); + } + } + + /** + * Returns a bundle with the default value for every supported configuration variable. + * + * @hide + */ + @SystemApi + public static Bundle getDefaultConfig() { + return sDefaults; + } + + /** @hide */ + private ICarrierConfigLoader getICarrierConfigLoader() { + return ICarrierConfigLoader.Stub + .asInterface(ServiceManager.getService(Context.CARRIER_CONFIG_SERVICE)); + } +} diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl new file mode 100644 index 0000000..b5cdd9a --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl @@ -0,0 +1,31 @@ +/* + * 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 com.android.internal.telephony; + +import android.os.Bundle; + +/** + * Interface used to interact with the CarrierConfigLoader + */ +interface ICarrierConfigLoader { + + Bundle getConfigForSubId(int subId); + + void reloadCarrierConfigForSubId(int subId); + + void updateConfigForPhoneId(int phoneId, String simState); +} |