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

Commit d438cfd6 authored by Rafael Higuera Silva's avatar Rafael Higuera Silva
Browse files

Fix exception crashing euiccService process

Test: make and manual testing
Bug: 325065647
Change-Id: I3ed3827de2e3152b2efe74a35ed3b6244f370b76
parent d09ff815
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -856,10 +856,22 @@ public abstract class EuiccService extends Service {
                int slotId, IGetAvailableMemoryInBytesCallback callback) {
            mExecutor.execute(
                    () -> {
                        long availableMemoryInBytes =
                        long availableMemoryInBytes = EuiccManager.EUICC_MEMORY_FIELD_UNAVAILABLE;
                        String unsupportedOperationMessage = "";
                        try {
                            availableMemoryInBytes =
                                    EuiccService.this.onGetAvailableMemoryInBytes(slotId);
                        } catch (UnsupportedOperationException e) {
                            unsupportedOperationMessage = e.getMessage();
                        }

                        try {
                            if (!unsupportedOperationMessage.isEmpty()) {
                                callback.onUnsupportedOperationException(
                                        unsupportedOperationMessage);
                            } else {
                                callback.onSuccess(availableMemoryInBytes);
                            }
                        } catch (RemoteException e) {
                            // Can't communicate with the phone process; ignore.
                        }
+1 −0
Original line number Diff line number Diff line
@@ -19,4 +19,5 @@ package android.service.euicc;
/** @hide */
oneway interface IGetAvailableMemoryInBytesCallback {
    void onSuccess(long availableMemoryInBytes);
    void onUnsupportedOperationException(String message);
}