Loading services/core/java/com/android/server/TelephonyRegistry.java +4 −20 Original line number Diff line number Diff line Loading @@ -79,7 +79,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.stream.Collectors; /** * Since phone process can be restarted, this class provides a centralized place Loading Loading @@ -849,10 +848,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } if ((events & PhoneStateListener .LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) != 0 && TelephonyPermissions.checkReadPhoneStateOnAnyActiveSub( r.context, r.callerPid, r.callerUid, r.callingPackage, "listen_active_data_subid_change")) { .LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) != 0) { try { r.callback.onActiveDataSubIdChanged(mActiveDataSubId); } catch (RemoteException ex) { Loading Loading @@ -1829,23 +1825,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { log("notifyActiveDataSubIdChanged: activeDataSubId=" + activeDataSubId); } // Create a copy to prevent the IPC call while checking carrier privilege under the lock. List<Record> copiedRecords; synchronized (mRecords) { copiedRecords = new ArrayList<>(mRecords); } mActiveDataSubId = activeDataSubId; // Filter the record that does not listen to this change or does not have the permission. copiedRecords = copiedRecords.stream().filter(r -> r.matchPhoneStateListenerEvent( PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) && TelephonyPermissions.checkReadPhoneStateOnAnyActiveSub( mContext, r.callerPid, r.callerUid, r.callingPackage, "notifyActiveDataSubIdChanged")).collect(Collectors.toCollection(ArrayList::new)); synchronized (mRecords) { for (Record r : copiedRecords) { if (mRecords.contains(r)) { for (Record r : mRecords) { if (r.matchPhoneStateListenerEvent( PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE)) { try { r.callback.onActiveDataSubIdChanged(activeDataSubId); } catch (RemoteException ex) { Loading telephony/java/android/telephony/PhoneStateListener.java +2 −7 Original line number Diff line number Diff line Loading @@ -33,13 +33,13 @@ import android.telephony.ims.ImsReasonInfo; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.IPhoneStateListener; import dalvik.system.VMRuntime; import java.lang.ref.WeakReference; import java.util.List; import java.util.Map; import java.util.concurrent.Executor; import dalvik.system.VMRuntime; /** * A listener class for monitoring changes in specific telephony states * on the device, including service state, signal strength, message Loading Loading @@ -301,11 +301,6 @@ public class PhoneStateListener { * it could be the current active opportunistic subscription in use, or the * subscription user selected as default data subscription in DSDS mode. * * Requires Permission: No permission is required to listen, but notification requires * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} or the calling * app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}) * on any active subscription. * * @see #onActiveDataSubscriptionIdChanged */ public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE = 0x00400000; Loading Loading
services/core/java/com/android/server/TelephonyRegistry.java +4 −20 Original line number Diff line number Diff line Loading @@ -79,7 +79,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.stream.Collectors; /** * Since phone process can be restarted, this class provides a centralized place Loading Loading @@ -849,10 +848,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } if ((events & PhoneStateListener .LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) != 0 && TelephonyPermissions.checkReadPhoneStateOnAnyActiveSub( r.context, r.callerPid, r.callerUid, r.callingPackage, "listen_active_data_subid_change")) { .LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) != 0) { try { r.callback.onActiveDataSubIdChanged(mActiveDataSubId); } catch (RemoteException ex) { Loading Loading @@ -1829,23 +1825,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { log("notifyActiveDataSubIdChanged: activeDataSubId=" + activeDataSubId); } // Create a copy to prevent the IPC call while checking carrier privilege under the lock. List<Record> copiedRecords; synchronized (mRecords) { copiedRecords = new ArrayList<>(mRecords); } mActiveDataSubId = activeDataSubId; // Filter the record that does not listen to this change or does not have the permission. copiedRecords = copiedRecords.stream().filter(r -> r.matchPhoneStateListenerEvent( PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) && TelephonyPermissions.checkReadPhoneStateOnAnyActiveSub( mContext, r.callerPid, r.callerUid, r.callingPackage, "notifyActiveDataSubIdChanged")).collect(Collectors.toCollection(ArrayList::new)); synchronized (mRecords) { for (Record r : copiedRecords) { if (mRecords.contains(r)) { for (Record r : mRecords) { if (r.matchPhoneStateListenerEvent( PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE)) { try { r.callback.onActiveDataSubIdChanged(activeDataSubId); } catch (RemoteException ex) { Loading
telephony/java/android/telephony/PhoneStateListener.java +2 −7 Original line number Diff line number Diff line Loading @@ -33,13 +33,13 @@ import android.telephony.ims.ImsReasonInfo; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.IPhoneStateListener; import dalvik.system.VMRuntime; import java.lang.ref.WeakReference; import java.util.List; import java.util.Map; import java.util.concurrent.Executor; import dalvik.system.VMRuntime; /** * A listener class for monitoring changes in specific telephony states * on the device, including service state, signal strength, message Loading Loading @@ -301,11 +301,6 @@ public class PhoneStateListener { * it could be the current active opportunistic subscription in use, or the * subscription user selected as default data subscription in DSDS mode. * * Requires Permission: No permission is required to listen, but notification requires * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} or the calling * app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}) * on any active subscription. * * @see #onActiveDataSubscriptionIdChanged */ public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE = 0x00400000; Loading