Merge "Add the user mobile data state into PhoneStateListener so that applications can listen to the change of the user mobile data state."
This commit is contained in:
@@ -40455,6 +40455,7 @@ package android.telephony {
|
|||||||
method public void onServiceStateChanged(android.telephony.ServiceState);
|
method public void onServiceStateChanged(android.telephony.ServiceState);
|
||||||
method public deprecated void onSignalStrengthChanged(int);
|
method public deprecated void onSignalStrengthChanged(int);
|
||||||
method public void onSignalStrengthsChanged(android.telephony.SignalStrength);
|
method public void onSignalStrengthsChanged(android.telephony.SignalStrength);
|
||||||
|
method public void onUserMobileDataStateChanged(boolean);
|
||||||
field public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8
|
field public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8
|
||||||
field public static final int LISTEN_CALL_STATE = 32; // 0x20
|
field public static final int LISTEN_CALL_STATE = 32; // 0x20
|
||||||
field public static final int LISTEN_CELL_INFO = 1024; // 0x400
|
field public static final int LISTEN_CELL_INFO = 1024; // 0x400
|
||||||
@@ -40466,6 +40467,7 @@ package android.telephony {
|
|||||||
field public static final int LISTEN_SERVICE_STATE = 1; // 0x1
|
field public static final int LISTEN_SERVICE_STATE = 1; // 0x1
|
||||||
field public static final deprecated int LISTEN_SIGNAL_STRENGTH = 2; // 0x2
|
field public static final deprecated int LISTEN_SIGNAL_STRENGTH = 2; // 0x2
|
||||||
field public static final int LISTEN_SIGNAL_STRENGTHS = 256; // 0x100
|
field public static final int LISTEN_SIGNAL_STRENGTHS = 256; // 0x100
|
||||||
|
field public static final int LISTEN_USER_MOBILE_DATA_STATE = 524288; // 0x80000
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class RadioAccessSpecifier implements android.os.Parcelable {
|
public final class RadioAccessSpecifier implements android.os.Parcelable {
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
|
|
||||||
private int[] mDataActivationState;
|
private int[] mDataActivationState;
|
||||||
|
|
||||||
|
private boolean[] mUserMobileDataState;
|
||||||
|
|
||||||
private SignalStrength[] mSignalStrength;
|
private SignalStrength[] mSignalStrength;
|
||||||
|
|
||||||
private boolean[] mMessageWaiting;
|
private boolean[] mMessageWaiting;
|
||||||
@@ -304,6 +306,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
mServiceState = new ServiceState[numPhones];
|
mServiceState = new ServiceState[numPhones];
|
||||||
mVoiceActivationState = new int[numPhones];
|
mVoiceActivationState = new int[numPhones];
|
||||||
mDataActivationState = new int[numPhones];
|
mDataActivationState = new int[numPhones];
|
||||||
|
mUserMobileDataState = new boolean[numPhones];
|
||||||
mSignalStrength = new SignalStrength[numPhones];
|
mSignalStrength = new SignalStrength[numPhones];
|
||||||
mMessageWaiting = new boolean[numPhones];
|
mMessageWaiting = new boolean[numPhones];
|
||||||
mCallForwarding = new boolean[numPhones];
|
mCallForwarding = new boolean[numPhones];
|
||||||
@@ -320,6 +323,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
mCallIncomingNumber[i] = "";
|
mCallIncomingNumber[i] = "";
|
||||||
mServiceState[i] = new ServiceState();
|
mServiceState[i] = new ServiceState();
|
||||||
mSignalStrength[i] = new SignalStrength();
|
mSignalStrength[i] = new SignalStrength();
|
||||||
|
mUserMobileDataState[i] = false;
|
||||||
mMessageWaiting[i] = false;
|
mMessageWaiting[i] = false;
|
||||||
mCallForwarding[i] = false;
|
mCallForwarding[i] = false;
|
||||||
mCellLocation[i] = new Bundle();
|
mCellLocation[i] = new Bundle();
|
||||||
@@ -656,6 +660,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
remove(r.binder);
|
remove(r.binder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((events & PhoneStateListener.LISTEN_USER_MOBILE_DATA_STATE) != 0) {
|
||||||
|
try {
|
||||||
|
r.callback.onUserMobileDataStateChanged(mUserMobileDataState[phoneId]);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
remove(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1012,6 +1023,33 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void notifyUserMobileDataStateChangedForPhoneId(int phoneId, int subId, boolean state) {
|
||||||
|
if (!checkNotifyPermission("notifyUserMobileDataStateChanged()")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (VDBG) {
|
||||||
|
log("notifyUserMobileDataStateChangedForSubscriberPhoneID: subId=" + phoneId
|
||||||
|
+ " state=" + state);
|
||||||
|
}
|
||||||
|
synchronized (mRecords) {
|
||||||
|
if (validatePhoneId(phoneId)) {
|
||||||
|
mMessageWaiting[phoneId] = state;
|
||||||
|
for (Record r : mRecords) {
|
||||||
|
if (r.matchPhoneStateListenerEvent(
|
||||||
|
PhoneStateListener.LISTEN_USER_MOBILE_DATA_STATE) &&
|
||||||
|
idMatch(r.subId, subId, phoneId)) {
|
||||||
|
try {
|
||||||
|
r.callback.onUserMobileDataStateChanged(state);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
mRemoveList.add(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleRemoveListLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void notifyCallForwardingChanged(boolean cfi) {
|
public void notifyCallForwardingChanged(boolean cfi) {
|
||||||
notifyCallForwardingChangedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cfi);
|
notifyCallForwardingChangedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cfi);
|
||||||
}
|
}
|
||||||
@@ -1374,6 +1412,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
pw.println("mServiceState=" + mServiceState[i]);
|
pw.println("mServiceState=" + mServiceState[i]);
|
||||||
pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
|
pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
|
||||||
pw.println("mDataActivationState= " + mDataActivationState[i]);
|
pw.println("mDataActivationState= " + mDataActivationState[i]);
|
||||||
|
pw.println("mUserMobileDataState= " + mUserMobileDataState[i]);
|
||||||
pw.println("mSignalStrength=" + mSignalStrength[i]);
|
pw.println("mSignalStrength=" + mSignalStrength[i]);
|
||||||
pw.println("mMessageWaiting=" + mMessageWaiting[i]);
|
pw.println("mMessageWaiting=" + mMessageWaiting[i]);
|
||||||
pw.println("mCallForwarding=" + mCallForwarding[i]);
|
pw.println("mCallForwarding=" + mCallForwarding[i]);
|
||||||
@@ -1755,6 +1794,18 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((events & PhoneStateListener.LISTEN_USER_MOBILE_DATA_STATE) != 0) {
|
||||||
|
try {
|
||||||
|
if (VDBG) {
|
||||||
|
log("checkPossibleMissNotify: onUserMobileDataStateChanged phoneId="
|
||||||
|
+ phoneId + " umds=" + mUserMobileDataState[phoneId]);
|
||||||
|
}
|
||||||
|
r.callback.onUserMobileDataStateChanged(mUserMobileDataState[phoneId]);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
mRemoveList.add(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((events & PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR) != 0) {
|
if ((events & PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR) != 0) {
|
||||||
try {
|
try {
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
|
|||||||
@@ -244,6 +244,13 @@ public class PhoneStateListener {
|
|||||||
*/
|
*/
|
||||||
public static final int LISTEN_DATA_ACTIVATION_STATE = 0x00040000;
|
public static final int LISTEN_DATA_ACTIVATION_STATE = 0x00040000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen for changes to the user mobile data state
|
||||||
|
*
|
||||||
|
* @see #onUserMobileDataStateChanged
|
||||||
|
*/
|
||||||
|
public static final int LISTEN_USER_MOBILE_DATA_STATE = 0x00080000;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Subscription used to listen to the phone state changes
|
* Subscription used to listen to the phone state changes
|
||||||
* @hide
|
* @hide
|
||||||
@@ -349,6 +356,9 @@ public class PhoneStateListener {
|
|||||||
case LISTEN_DATA_ACTIVATION_STATE:
|
case LISTEN_DATA_ACTIVATION_STATE:
|
||||||
PhoneStateListener.this.onDataActivationStateChanged((int)msg.obj);
|
PhoneStateListener.this.onDataActivationStateChanged((int)msg.obj);
|
||||||
break;
|
break;
|
||||||
|
case LISTEN_USER_MOBILE_DATA_STATE:
|
||||||
|
PhoneStateListener.this.onUserMobileDataStateChanged((boolean)msg.obj);
|
||||||
|
break;
|
||||||
case LISTEN_CARRIER_NETWORK_CHANGE:
|
case LISTEN_CARRIER_NETWORK_CHANGE:
|
||||||
PhoneStateListener.this.onCarrierNetworkChange((boolean)msg.obj);
|
PhoneStateListener.this.onCarrierNetworkChange((boolean)msg.obj);
|
||||||
break;
|
break;
|
||||||
@@ -542,6 +552,14 @@ public class PhoneStateListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback invoked when the user mobile data state has changed
|
||||||
|
* @param enabled indicates whether the current user mobile data state is enabled or disabled.
|
||||||
|
*/
|
||||||
|
public void onUserMobileDataStateChanged(boolean enabled) {
|
||||||
|
// default implementation empty
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback invoked when telephony has received notice from a carrier
|
* Callback invoked when telephony has received notice from a carrier
|
||||||
* app that a network action that could result in connectivity loss
|
* app that a network action that could result in connectivity loss
|
||||||
@@ -654,6 +672,10 @@ public class PhoneStateListener {
|
|||||||
send(LISTEN_DATA_ACTIVATION_STATE, 0, 0, activationState);
|
send(LISTEN_DATA_ACTIVATION_STATE, 0, 0, activationState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onUserMobileDataStateChanged(boolean enabled) {
|
||||||
|
send(LISTEN_USER_MOBILE_DATA_STATE, 0, 0, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
public void onCarrierNetworkChange(boolean active) {
|
public void onCarrierNetworkChange(boolean active) {
|
||||||
send(LISTEN_CARRIER_NETWORK_CHANGE, 0, 0, active);
|
send(LISTEN_CARRIER_NETWORK_CHANGE, 0, 0, active);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,5 +46,6 @@ oneway interface IPhoneStateListener {
|
|||||||
void onVoiceActivationStateChanged(int activationState);
|
void onVoiceActivationStateChanged(int activationState);
|
||||||
void onDataActivationStateChanged(int activationState);
|
void onDataActivationStateChanged(int activationState);
|
||||||
void onCarrierNetworkChange(in boolean active);
|
void onCarrierNetworkChange(in boolean active);
|
||||||
|
void onUserMobileDataStateChanged(in boolean enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,4 +69,5 @@ interface ITelephonyRegistry {
|
|||||||
int activationState, int activationType);
|
int activationState, int activationType);
|
||||||
void notifySubscriptionInfoChanged();
|
void notifySubscriptionInfoChanged();
|
||||||
void notifyCarrierNetworkChange(in boolean active);
|
void notifyCarrierNetworkChange(in boolean active);
|
||||||
|
void notifyUserMobileDataStateChangedForPhoneId(in int phoneId, in int subId, in boolean state);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user