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

Commit 5377c6be authored by Thomas Stuart's avatar Thomas Stuart Committed by Android (Google) Code Review
Browse files

Merge "Serial & Parallel transactions should not override the failure values" into main

parents 7dfbdf60 2c2e0c40
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ public class CallStreamingController extends CallsManagerListenerBase {

            if (mCallsManager.getCallStreamingController().isStreaming()) {
                future.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED,
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        "STREAMING_FAILED_ALREADY_STREAMING"));
            } else {
                future.complete(new VoipCallTransactionResult(
@@ -196,7 +196,8 @@ public class CallStreamingController extends CallsManagerListenerBase {
            if (roleManager == null || packageManager == null) {
                Log.w(this, "processTransaction: Can't find system service");
                future.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED, MESSAGE));
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        MESSAGE));
                return future;
            }

@@ -205,7 +206,8 @@ public class CallStreamingController extends CallsManagerListenerBase {
            if (holders.isEmpty()) {
                Log.w(this, "processTransaction: Can't find streaming app");
                future.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED, MESSAGE));
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        MESSAGE));
                return future;
            }
            Log.i(this, "processTransaction: servicePackage=%s", holders.get(0));
@@ -216,7 +218,8 @@ public class CallStreamingController extends CallsManagerListenerBase {
            if (infos.isEmpty()) {
                Log.w(this, "processTransaction: Can't find streaming service");
                future.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED, MESSAGE));
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        MESSAGE));
                return future;
            }

@@ -227,7 +230,8 @@ public class CallStreamingController extends CallsManagerListenerBase {
                Log.w(this, "Must require BIND_CALL_STREAMING_SERVICE: " +
                        serviceInfo.packageName);
                future.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED, MESSAGE));
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        MESSAGE));
                return future;
            }
            Intent intent = new Intent(CallStreamingService.SERVICE_INTERFACE);
@@ -239,7 +243,7 @@ public class CallStreamingController extends CallsManagerListenerBase {
                    | Context.BIND_SCHEDULE_LIKE_TOP_APP, mUserHandle)) {
                Log.w(this, "Can't bind to streaming service");
                future.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED,
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        "STREAMING_FAILED_SENDER_BINDING_ERROR"));
            }
            return future;
@@ -379,7 +383,8 @@ public class CallStreamingController extends CallsManagerListenerBase {
                        VoipCallTransactionResult.RESULT_SUCCEED, null));
            } catch (RemoteException e) {
                future.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED, "Exception when request "
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        "Exception when request "
                        + "setting state to streaming app."));
            }
            return future;
@@ -409,7 +414,7 @@ public class CallStreamingController extends CallsManagerListenerBase {
            } catch (RemoteException e) {
                resetController();
                mFuture.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED,
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        StreamingServiceTransaction.MESSAGE));
            }
        }
@@ -433,7 +438,7 @@ public class CallStreamingController extends CallsManagerListenerBase {
            resetController();
            if (!mFuture.isDone()) {
                mFuture.complete(new VoipCallTransactionResult(
                        VoipCallTransactionResult.RESULT_FAILED,
                        CallException.CODE_ERROR_UNKNOWN /* TODO:: define error b/335703584 */,
                        "STREAMING_FAILED_SENDER_BINDING_ERROR"));
            } else {
                mWrapper.onCallStreamingFailed(mCall, STREAMING_FAILED_SENDER_BINDING_ERROR);
+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.telecom.voip;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.telecom.CallEndpoint;
import android.telecom.CallException;
import android.util.Log;

import com.android.server.telecom.CallsManager;
@@ -49,8 +50,9 @@ public class EndpointChangeTransaction extends VoipCallTransaction {
                    future.complete(new VoipCallTransactionResult(
                            VoipCallTransactionResult.RESULT_SUCCEED, null));
                } else {
                    // TODO:: define errors in CallException class. b/335703584
                    future.complete(new VoipCallTransactionResult(
                            VoipCallTransactionResult.RESULT_FAILED, null));
                            CallException.CODE_ERROR_UNKNOWN, null));
                }
            }
        });
+5 −9
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.telecom.voip;

import android.telecom.CallException;

import com.android.server.telecom.LoggedHandlerExecutor;
import com.android.server.telecom.TelecomSystem;

@@ -48,14 +50,8 @@ public class ParallelTransaction extends VoipCallTransaction {
                        if (result.getResult() != VoipCallTransactionResult.RESULT_SUCCEED) {
                            CompletableFuture.completedFuture(null).thenApplyAsync(
                                    (x) -> {
                                        VoipCallTransactionResult mainResult =
                                                new VoipCallTransactionResult(
                                                        VoipCallTransactionResult.RESULT_FAILED,
                                                        String.format(
                                                                "sub transaction %s failed",
                                                                transactionName));
                                        finish(mainResult);
                                        mCompleteListener.onTransactionCompleted(mainResult,
                                        finish(result);
                                        mCompleteListener.onTransactionCompleted(result,
                                                mTransactionName);
                                        return null;
                                    }, new LoggedHandlerExecutor(mHandler,
@@ -74,7 +70,7 @@ public class ParallelTransaction extends VoipCallTransaction {
                                (x) -> {
                                    VoipCallTransactionResult mainResult =
                                            new VoipCallTransactionResult(
                                            VoipCallTransactionResult.RESULT_FAILED,
                                                    CallException.CODE_OPERATION_TIMED_OUT,
                                            String.format("sub transaction %s timed out",
                                                    transactionName));
                                    finish(mainResult);
+3 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.telecom.voip;

import static com.android.server.telecom.voip.VideoStateTranslation.TransactionalVideoStateToVideoProfileState;

import android.telecom.CallException;
import android.telecom.VideoProfile;
import android.util.Log;

@@ -48,12 +49,12 @@ public class RequestVideoStateTransaction extends VoipCallTransaction {
        if (isRequestingVideoTransmission(mVideoProfileState) &&
                !mCall.isVideoCallingSupportedByPhoneAccount()) {
            future.complete(new VoipCallTransactionResult(
                    VoipCallTransactionResult.RESULT_FAILED,
                    CallException.CODE_ERROR_UNKNOWN /*TODO:: define error code. b/335703584 */,
                    "Video calling is not supported by the target account"));
        } else if (isRequestingVideoTransmission(mVideoProfileState) &&
                !mCall.isTransactionalCallSupportsVideoCalling()) {
            future.complete(new VoipCallTransactionResult(
                    VoipCallTransactionResult.RESULT_FAILED,
                    CallException.CODE_ERROR_UNKNOWN /*TODO:: define error code. b/335703584 */,
                    "Video calling is not supported according to the callAttributes"));
        } else {
            mCall.setVideoState(mVideoProfileState);
+5 −9
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.telecom.voip;

import android.telecom.CallException;

import com.android.server.telecom.LoggedHandlerExecutor;
import com.android.server.telecom.TelecomSystem;

@@ -53,14 +55,8 @@ public class SerialTransaction extends VoipCallTransaction {
                            handleTransactionFailure();
                            CompletableFuture.completedFuture(null).thenApplyAsync(
                                    (x) -> {
                                        VoipCallTransactionResult mainResult =
                                                new VoipCallTransactionResult(
                                                        VoipCallTransactionResult.RESULT_FAILED,
                                                        String.format(
                                                                "sub transaction %s failed",
                                                                transactionName));
                                        finish(mainResult);
                                        mCompleteListener.onTransactionCompleted(mainResult,
                                        finish(result);
                                        mCompleteListener.onTransactionCompleted(result,
                                                mTransactionName);
                                        return null;
                                    }, new LoggedHandlerExecutor(mHandler,
@@ -86,7 +82,7 @@ public class SerialTransaction extends VoipCallTransaction {
                                (x) -> {
                                    VoipCallTransactionResult mainResult =
                                            new VoipCallTransactionResult(
                                            VoipCallTransactionResult.RESULT_FAILED,
                                                    CallException.CODE_OPERATION_TIMED_OUT,
                                            String.format("sub transaction %s timed out",
                                                    transactionName));
                                    finish(mainResult);
Loading