public final class

ShellExecutorFactory

extends java.lang.Object

 java.lang.Object

↳androidx.test.services.shellexecutor.ShellExecutorFactory

Gradle dependencies

compile group: 'androidx.test', name: 'orchestrator', version: '1.5.0'

  • groupId: androidx.test
  • artifactId: orchestrator
  • version: 1.5.0

Artifact androidx.test:orchestrator:1.5.0 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.test:orchestrator com.android.support.test:orchestrator

Overview

Factory class for providing ShellExecutors.

Summary

Constructors
publicShellExecutorFactory(Context context, java.lang.String binderKey)

Methods
public ShellExecutorcreate()

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public ShellExecutorFactory(Context context, java.lang.String binderKey)

Methods

public ShellExecutor create()

Source

/*
 * Copyright (C) 2023 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 androidx.test.services.shellexecutor;

import android.content.Context;

/** Factory class for providing ShellExecutors. */
public final class ShellExecutorFactory {

  private final Context context;
  private final String binderKey;

  public ShellExecutorFactory(Context context, String binderKey) {
    this.context = context;
    this.binderKey = binderKey;
  }

  public ShellExecutor create() {
    // Binder keys for SpeakEasy are a string of hex digits. Binder keys for the FileObserver
    // protocol are the absolute path of the directory that the server is watching.
    if (binderKey.startsWith("/")) {
      return new ShellExecutorFileObserverImpl(binderKey);
    } else {
      return new ShellExecutorImpl(context, binderKey);
    }
  }
}