Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 588ec9f3 authored by Rambo Wang's avatar Rambo Wang
Browse files

Clear binder identity in callback of IMS IPC interfaces

The binder identity does get cleared when goes from client process
into phone process. When it comes back from phone to client, the
binder identity should also be cleared.

Bug: 193923945
Test: atest android.telephony.cts.TelephonyManagerTest
Test: atest ImsServiceTest RcsFeatureControllerTest ImsMmTelManagerTest
Merged-In: I34225e32111879e155c9f7865f0045430d171467
Change-Id: I34225e32111879e155c9f7865f0045430d171467
(cherry picked from commit c18002c4)
parent 4438cf67
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -13965,7 +13965,12 @@ public class TelephonyManager {
        IBooleanConsumer aidlConsumer = callback == null ? null : new IBooleanConsumer.Stub() {
            @Override
            public void accept(boolean result) {
                final long identity = Binder.clearCallingIdentity();
                try {
                    executor.execute(() -> callback.accept(result));
                } finally {
                    Binder.restoreCallingIdentity(identity);
                }
            }
        };
+24 −4
Original line number Diff line number Diff line
@@ -445,7 +445,12 @@ public class ImsMmTelManager implements RegistrationManager {
            iTelephony.getImsMmTelRegistrationState(mSubId, new IIntegerConsumer.Stub() {
                @Override
                public void accept(int result) {
                    final long identity = Binder.clearCallingIdentity();
                    try {
                        executor.execute(() -> stateCallback.accept(result));
                    } finally {
                        Binder.restoreCallingIdentity(identity);
                    }
                }
            });
        } catch (ServiceSpecificException | RemoteException e) {
@@ -487,7 +492,12 @@ public class ImsMmTelManager implements RegistrationManager {
                    new IIntegerConsumer.Stub() {
                        @Override
                        public void accept(int result) {
                            final long identity = Binder.clearCallingIdentity();
                            try {
                                executor.execute(() -> transportTypeCallback.accept(result));
                            } finally {
                                Binder.restoreCallingIdentity(identity);
                            }
                        }
                    });
        } catch (ServiceSpecificException | RemoteException e) {
@@ -807,7 +817,12 @@ public class ImsMmTelManager implements RegistrationManager {
            iTelephony.isMmTelCapabilitySupported(mSubId, new IIntegerConsumer.Stub() {
                @Override
                public void accept(int result) {
                    final long identity = Binder.clearCallingIdentity();
                    try {
                        executor.execute(() -> callback.accept(result == 1));
                    } finally {
                        Binder.restoreCallingIdentity(identity);
                    }
                }
            }, capability, transportType);
        } catch (ServiceSpecificException sse) {
@@ -1452,7 +1467,12 @@ public class ImsMmTelManager implements RegistrationManager {
            iTelephony.getImsMmTelFeatureState(mSubId, new IIntegerConsumer.Stub() {
                @Override
                public void accept(int result) {
                    final long identity = Binder.clearCallingIdentity();
                    try {
                        executor.execute(() -> callback.accept(result));
                    } finally {
                        Binder.restoreCallingIdentity(identity);
                    }
                }
            });
        } catch (ServiceSpecificException sse) {
+12 −2
Original line number Diff line number Diff line
@@ -299,7 +299,12 @@ public class ImsRcsManager {
            imsRcsController.getImsRcsRegistrationState(mSubId, new IIntegerConsumer.Stub() {
                @Override
                public void accept(int result) {
                    final long identity = Binder.clearCallingIdentity();
                    try {
                        executor.execute(() -> stateCallback.accept(result));
                    } finally {
                        Binder.restoreCallingIdentity(identity);
                    }
                }
            });
        } catch (ServiceSpecificException | RemoteException e) {
@@ -345,7 +350,12 @@ public class ImsRcsManager {
                    new IIntegerConsumer.Stub() {
                        @Override
                        public void accept(int result) {
                            final long identity = Binder.clearCallingIdentity();
                            try {
                                executor.execute(() -> transportTypeCallback.accept(result));
                            } finally {
                                Binder.restoreCallingIdentity(identity);
                            }
                        }
                    });
        } catch (ServiceSpecificException | RemoteException e) {