use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.
the class TelephonyRegistry method notifyServiceStateForPhoneId.
public void notifyServiceStateForPhoneId(int phoneId, int subId, ServiceState state) {
if (!checkNotifyPermission("notifyServiceState()")) {
return;
}
synchronized (mRecords) {
if (VDBG) {
log("notifyServiceStateForSubscriber: subId=" + subId + " phoneId=" + phoneId + " state=" + state);
}
if (validatePhoneId(phoneId)) {
mServiceState[phoneId] = state;
logServiceStateChanged("notifyServiceStateForSubscriber", subId, phoneId, state);
if (VDBG)
toStringLogSSC("notifyServiceStateForSubscriber");
for (Record r : mRecords) {
if (VDBG) {
log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId + " phoneId=" + phoneId + " state=" + state);
}
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_SERVICE_STATE) && idMatch(r.subId, subId, phoneId)) {
try {
if (DBG) {
log("notifyServiceStateForSubscriber: callback.onSSC r=" + r + " subId=" + subId + " phoneId=" + phoneId + " state=" + state);
}
r.callback.onServiceStateChanged(new ServiceState(state));
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
}
}
} else {
log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId);
}
handleRemoveListLocked();
}
broadcastServiceStateChanged(state, phoneId, subId);
}
use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.
the class KeyguardUpdateMonitor method isEmergencyOnly.
public boolean isEmergencyOnly() {
boolean isEmerg = false;
ServiceState state;
for (int slotId = 0; slotId < TelephonyManager.getDefault().getPhoneCount(); slotId++) {
state = null;
int[] subId = mSubscriptionManager.getSubId(slotId);
if (subId != null && subId.length > 0) {
state = mServiceStates.get(subId[0]);
}
if (state != null) {
if (state.getVoiceRegState() == ServiceState.STATE_IN_SERVICE)
return false;
else if (state.isEmergencyOnly()) {
isEmerg = true;
}
}
}
return isEmerg;
}
use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.
the class KeyguardUpdateMonitor method isOOS.
public boolean isOOS() {
boolean ret = true;
int phoneCount = TelephonyManager.getDefault().getPhoneCount();
for (int phoneId = 0; phoneId < phoneCount; phoneId++) {
ServiceState state = mServiceStates.get(phoneId);
if (state != null) {
if (state.isEmergencyOnly())
ret = false;
if ((state.getVoiceRegState() != ServiceState.STATE_OUT_OF_SERVICE) && (state.getVoiceRegState() != ServiceState.STATE_POWER_OFF))
ret = false;
if (DEBUG) {
Log.d(TAG, "phoneId: " + phoneId + ", is emergency: " + state.isEmergencyOnly() + ", voice state: " + state.getVoiceRegState());
}
} else {
if (DEBUG)
Log.d(TAG, "phoneId: " + phoneId + ", state is NULL");
}
}
if (DEBUG)
Log.d(TAG, "is Emergency supported: " + !ret);
return ret;
}
use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.
the class ComprehensiveCountryDetector method addPhoneStateListener.
protected synchronized void addPhoneStateListener() {
if (mPhoneStateListener == null) {
mPhoneStateListener = new PhoneStateListener() {
@Override
public void onServiceStateChanged(ServiceState serviceState) {
mCountServiceStateChanges++;
mTotalCountServiceStateChanges++;
if (!isNetworkCountryCodeAvailable()) {
return;
}
if (DEBUG)
Slog.d(TAG, "onServiceStateChanged: " + serviceState.getState());
detectCountry(true, true);
}
};
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
}
}
use of android.telephony.ServiceState in project android_frameworks_base by ResurrectionRemix.
the class KeyguardUpdateMonitor method isEmergencyOnly.
public boolean isEmergencyOnly() {
boolean isEmerg = false;
ServiceState state;
for (int slotId = 0; slotId < TelephonyManager.getDefault().getPhoneCount(); slotId++) {
state = null;
int[] subId = mSubscriptionManager.getSubId(slotId);
if (subId != null && subId.length > 0) {
state = mServiceStates.get(subId[0]);
}
if (state != null) {
if (state.getVoiceRegState() == ServiceState.STATE_IN_SERVICE)
return false;
else if (state.isEmergencyOnly()) {
isEmerg = true;
}
}
}
return isEmerg;
}
Aggregations