Refactored area update info support
1. Refactored area update information support so it
is not limited to channel 50 and Brazil.
2. Added channel 60 for India.
Test: Manual
bug: 37746109
Change-Id: I470cc470f880aadd4f63815e21cdd4a71436a89d
(cherry picked from commit c3cab8ecb8
)
This commit is contained in:
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
package com.android.settings.deviceinfo;
|
package com.android.settings.deviceinfo;
|
||||||
|
|
||||||
|
import static android.content.Context.CARRIER_CONFIG_SERVICE;
|
||||||
|
import static android.content.Context.TELEPHONY_SERVICE;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -58,9 +62,6 @@ import com.android.settingslib.DeviceInfoUtils;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static android.content.Context.CARRIER_CONFIG_SERVICE;
|
|
||||||
import static android.content.Context.TELEPHONY_SERVICE;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the following information
|
* Display the following information
|
||||||
@@ -69,7 +70,7 @@ import static android.content.Context.TELEPHONY_SERVICE;
|
|||||||
* # Roaming
|
* # Roaming
|
||||||
* # Device Id (IMEI in GSM and MEID in CDMA)
|
* # Device Id (IMEI in GSM and MEID in CDMA)
|
||||||
* # Network type
|
* # Network type
|
||||||
* # Operator info (area info cell broadcast for Brazil)
|
* # Operator info (area update info cell broadcast)
|
||||||
* # Signal Strength
|
* # Signal Strength
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -87,18 +88,14 @@ public class SimStatus extends SettingsPreferenceFragment {
|
|||||||
private static final String KEY_IMEI = "imei";
|
private static final String KEY_IMEI = "imei";
|
||||||
private static final String KEY_IMEI_SV = "imei_sv";
|
private static final String KEY_IMEI_SV = "imei_sv";
|
||||||
private static final String KEY_ICCID = "iccid";
|
private static final String KEY_ICCID = "iccid";
|
||||||
private static final String COUNTRY_ABBREVIATION_BRAZIL = "br";
|
|
||||||
|
|
||||||
static final String CB_AREA_INFO_RECEIVED_ACTION =
|
static private final String CB_AREA_INFO_RECEIVED_ACTION =
|
||||||
"android.cellbroadcastreceiver.CB_AREA_INFO_RECEIVED";
|
"com.android.cellbroadcastreceiver.CB_AREA_INFO_RECEIVED";
|
||||||
|
|
||||||
static final String GET_LATEST_CB_AREA_INFO_ACTION =
|
static private final String GET_LATEST_CB_AREA_INFO_ACTION =
|
||||||
"android.cellbroadcastreceiver.GET_LATEST_CB_AREA_INFO";
|
"com.android.cellbroadcastreceiver.GET_LATEST_CB_AREA_INFO";
|
||||||
|
|
||||||
// Require the sender to have this permission to prevent third-party spoofing.
|
|
||||||
static final String CB_AREA_INFO_SENDER_PERMISSION =
|
|
||||||
"android.permission.RECEIVE_EMERGENCY_BROADCAST";
|
|
||||||
|
|
||||||
|
static private final String CELL_BROADCAST_RECEIVER_APP = "com.android.cellbroadcastreceiver";
|
||||||
|
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
private CarrierConfigManager mCarrierConfigManager;
|
private CarrierConfigManager mCarrierConfigManager;
|
||||||
@@ -118,7 +115,9 @@ public class SimStatus extends SettingsPreferenceFragment {
|
|||||||
private List<SubscriptionInfo> mSelectableSubInfos;
|
private List<SubscriptionInfo> mSelectableSubInfos;
|
||||||
|
|
||||||
private PhoneStateListener mPhoneStateListener;
|
private PhoneStateListener mPhoneStateListener;
|
||||||
private BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
|
|
||||||
|
// Once the cell broadcast configuration is moved into telephony framework,
|
||||||
|
private final BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
@@ -128,8 +127,7 @@ public class SimStatus extends SettingsPreferenceFragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CellBroadcastMessage cbMessage = (CellBroadcastMessage) extras.get("message");
|
CellBroadcastMessage cbMessage = (CellBroadcastMessage) extras.get("message");
|
||||||
if (cbMessage != null && cbMessage.getServiceCategory() == 50
|
if (cbMessage != null && mSir.getSubscriptionId() == cbMessage.getSubId()) {
|
||||||
&& mSir.getSubscriptionId() == cbMessage.getSubId()) {
|
|
||||||
String latestAreaInfo = cbMessage.getMessageBody();
|
String latestAreaInfo = cbMessage.getMessageBody();
|
||||||
updateAreaInfo(latestAreaInfo);
|
updateAreaInfo(latestAreaInfo);
|
||||||
}
|
}
|
||||||
@@ -216,11 +214,12 @@ public class SimStatus extends SettingsPreferenceFragment {
|
|||||||
if (mShowLatestAreaInfo) {
|
if (mShowLatestAreaInfo) {
|
||||||
getContext().registerReceiver(mAreaInfoReceiver,
|
getContext().registerReceiver(mAreaInfoReceiver,
|
||||||
new IntentFilter(CB_AREA_INFO_RECEIVED_ACTION),
|
new IntentFilter(CB_AREA_INFO_RECEIVED_ACTION),
|
||||||
CB_AREA_INFO_SENDER_PERMISSION, null);
|
Manifest.permission.RECEIVE_EMERGENCY_BROADCAST, null);
|
||||||
// Ask CellBroadcastReceiver to broadcast the latest area info received
|
// Ask CellBroadcastReceiver to broadcast the latest area info received
|
||||||
Intent getLatestIntent = new Intent(GET_LATEST_CB_AREA_INFO_ACTION);
|
Intent getLatestIntent = new Intent(GET_LATEST_CB_AREA_INFO_ACTION);
|
||||||
|
getLatestIntent.setPackage(CELL_BROADCAST_RECEIVER_APP);
|
||||||
getContext().sendBroadcastAsUser(getLatestIntent, UserHandle.ALL,
|
getContext().sendBroadcastAsUser(getLatestIntent, UserHandle.ALL,
|
||||||
CB_AREA_INFO_SENDER_PERMISSION);
|
Manifest.permission.RECEIVE_EMERGENCY_BROADCAST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,11 +380,8 @@ public class SimStatus extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
private void updatePreference() {
|
private void updatePreference() {
|
||||||
if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
|
if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
|
||||||
// only show area info when SIM country is Brazil
|
mShowLatestAreaInfo = Resources.getSystem().getBoolean(
|
||||||
if (COUNTRY_ABBREVIATION_BRAZIL.equals(mTelephonyManager.getSimCountryIso(
|
com.android.internal.R.bool.config_showAreaUpdateInfoSettings);
|
||||||
mSir.getSubscriptionId()))) {
|
|
||||||
mShowLatestAreaInfo = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(
|
PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(
|
||||||
mSir.getSubscriptionId());
|
mSir.getSubscriptionId());
|
||||||
|
Reference in New Issue
Block a user