Merge "Catch ServiceSpecificExceptions properly when getting reg state/ transport type" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-07-13 06:31:27 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 8 deletions

View File

@@ -37,6 +37,7 @@ import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.IIntegerConsumer;
@@ -447,8 +448,9 @@ public class ImsMmTelManager implements RegistrationManager {
executor.execute(() -> stateCallback.accept(result));
}
});
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
} catch (ServiceSpecificException | RemoteException e) {
Log.w("ImsMmTelManager", "Error getting registration state: " + e);
executor.execute(() -> stateCallback.accept(REGISTRATION_STATE_NOT_REGISTERED));
}
}
@@ -488,8 +490,10 @@ public class ImsMmTelManager implements RegistrationManager {
executor.execute(() -> transportTypeCallback.accept(result));
}
});
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
} catch (ServiceSpecificException | RemoteException e) {
Log.w("ImsMmTelManager", "Error getting transport type: " + e);
executor.execute(() -> transportTypeCallback.accept(
AccessNetworkConstants.TRANSPORT_TYPE_INVALID));
}
}

View File

@@ -302,8 +302,10 @@ public class ImsRcsManager {
executor.execute(() -> stateCallback.accept(result));
}
});
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
} catch (ServiceSpecificException | RemoteException e) {
Log.w(TAG, "Get registration state error: " + e);
executor.execute(() -> stateCallback.accept(
RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED));
}
}
@@ -346,8 +348,10 @@ public class ImsRcsManager {
executor.execute(() -> transportTypeCallback.accept(result));
}
});
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
} catch (ServiceSpecificException | RemoteException e) {
Log.w(TAG, "Get registration transport type error: " + e);
executor.execute(() -> transportTypeCallback.accept(
AccessNetworkConstants.TRANSPORT_TYPE_INVALID));
}
}