Add PhoneStateListener.onOtaspChanged.
Bug: 3102320
Change-Id: I46e8d33a4ed80e5e074e92135653d57598d4c865
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 747af26..a7a0c68 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -103,6 +103,8 @@
private int mDataConnectionNetworkType;
+ private int mOtaspMode;
+
static final int PHONE_STATE_PERMISSION_MASK =
PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR |
PhoneStateListener.LISTEN_CALL_STATE |
@@ -225,6 +227,13 @@
remove(r.binder);
}
}
+ if ((events & PhoneStateListener.LISTEN_OTASP_CHANGED) != 0) {
+ try {
+ r.callback.onOtaspChanged(mOtaspMode);
+ } catch (RemoteException ex) {
+ remove(r.binder);
+ }
+ }
}
}
} else {
@@ -467,6 +476,25 @@
}
}
+ public void notifyOtaspChanged(int otaspMode) {
+ if (!checkNotifyPermission("notifyOtaspChanged()" )) {
+ return;
+ }
+ synchronized (mRecords) {
+ mOtaspMode = otaspMode;
+ for (Record r : mRecords) {
+ if ((r.events & PhoneStateListener.LISTEN_OTASP_CHANGED) != 0) {
+ try {
+ r.callback.onOtaspChanged(otaspMode);
+ } catch (RemoteException ex) {
+ mRemoveList.add(r.binder);
+ }
+ }
+ }
+ handleRemoveListLocked();
+ }
+ }
+
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)