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

Commit 0bee1c2d authored by Sooraj Sasindran's avatar Sooraj Sasindran Committed by James Lin
Browse files

Use utils HandlerExecutor

Use telephpny.utils.HandlerExecutor

Bug: 140908357
Test: Build
Change-Id: I1d21e06c4965433e9928e736976ec7e56aebfe53
Merged-In: I1d21e06c4965433e9928e736976ec7e56aebfe53
parent 4cc64777
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -31,8 +31,10 @@ import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.Rlog;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.util.HandlerExecutor;


import java.util.concurrent.Executor;

+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.feature.ImsFeature;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.util.HandlerExecutor;

import java.util.concurrent.Executor;

+0 −46
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.ims;

import android.annotation.NonNull;

import android.os.Handler;
import com.android.internal.util.Preconditions;

import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;

/**
 * An adapter {@link Executor} that posts all executed tasks onto the given
 * {@link Handler}.
 *
 * @hide
 */
public class HandlerExecutor implements Executor {
    private final Handler mHandler;

    public HandlerExecutor(@NonNull Handler handler) {
        mHandler = Preconditions.checkNotNull(handler);
    }

    @Override
    public void execute(Runnable command) {
        if (!mHandler.post(command)) {
            throw new RejectedExecutionException(mHandler + " is shutting down");
        }
    }
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import com.android.ims.internal.IImsMultiEndpoint;
import com.android.ims.internal.IImsUt;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.util.HandlerExecutor;

import java.io.FileDescriptor;
import java.io.PrintWriter;