Merge "Fixed an issue where the emergency affordance would show" into nyc-mr1-dev

This commit is contained in:
Selim Cinek
2016-10-13 00:29:57 +00:00
committed by Android (Google) Code Review

View File

@@ -99,6 +99,7 @@ public class EmergencyAffordanceService extends SystemService {
}; };
private boolean mSimNeedsEmergencyAffordance; private boolean mSimNeedsEmergencyAffordance;
private boolean mNetworkNeedsEmergencyAffordance; private boolean mNetworkNeedsEmergencyAffordance;
private boolean mVoiceCapable;
private void requestCellScan() { private void requestCellScan() {
mHandler.obtainMessage(CELL_INFO_STATE_CHANGED).sendToTarget(); mHandler.obtainMessage(CELL_INFO_STATE_CHANGED).sendToTarget();
@@ -125,8 +126,8 @@ public class EmergencyAffordanceService extends SystemService {
private void updateEmergencyAffordanceNeeded() { private void updateEmergencyAffordanceNeeded() {
synchronized (mLock) { synchronized (mLock) {
mEmergencyAffordanceNeeded = mSimNeedsEmergencyAffordance || mEmergencyAffordanceNeeded = mVoiceCapable && (mSimNeedsEmergencyAffordance ||
mNetworkNeedsEmergencyAffordance; mNetworkNeedsEmergencyAffordance);
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.EMERGENCY_AFFORDANCE_NEEDED, Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,
mEmergencyAffordanceNeeded ? 1 : 0); mEmergencyAffordanceNeeded ? 1 : 0);
@@ -157,6 +158,11 @@ public class EmergencyAffordanceService extends SystemService {
public void onBootPhase(int phase) { public void onBootPhase(int phase) {
if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) { if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
mTelephonyManager = mContext.getSystemService(TelephonyManager.class); mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
mVoiceCapable = mTelephonyManager.isVoiceCapable();
if (!mVoiceCapable) {
updateEmergencyAffordanceNeeded();
return;
}
mSubscriptionManager = SubscriptionManager.from(mContext); mSubscriptionManager = SubscriptionManager.from(mContext);
HandlerThread thread = new HandlerThread(TAG); HandlerThread thread = new HandlerThread(TAG);
thread.start(); thread.start();