Add ADB transport skeleton

This adds the AIDL definition for ADB transports. For instance USB is
one type of ADB transport and the only one supported now.

Bug: 63820489
Test: make
Change-Id: Id422a814567021ab4b1097c2792a95c42bfccf74
This commit is contained in:
Kenny Root
2018-01-19 09:01:46 -05:00
parent dc14eb700a
commit 61fd360f50
4 changed files with 50 additions and 2 deletions

View File

@@ -151,6 +151,7 @@ java_defaults {
"core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl",
"core/java/android/database/IContentObserver.aidl",
"core/java/android/debug/IAdbManager.aidl",
"core/java/android/debug/IAdbTransport.aidl",
":libcamera_client_aidl",
":libcamera_client_framework_aidl",
"core/java/android/hardware/IConsumerIrService.aidl",

View File

@@ -23,4 +23,17 @@ package android.debug;
* @hide Only should be called from the system server.
*/
public abstract class AdbManagerInternal {
/**
* Registers a ADB transport mechanism.
*
* @param transport ADB transport interface to register
*/
public abstract void registerTransport(IAdbTransport transport);
/**
* Unregisters a previously registered ADB transport mechanism.
*
* @param transport previously-added ADB transport interface to be removed
*/
public abstract void unregisterTransport(IAdbTransport transport);
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018 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 android.debug;
/** @hide */
interface IAdbTransport {
}

View File

@@ -18,7 +18,10 @@ package com.android.server.adb;
import android.content.Context;
import android.debug.AdbManagerInternal;
import android.debug.IAdbManager;
import android.debug.IAdbTransport;
import android.os.Binder;
import android.os.IBinder;
import android.util.ArrayMap;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.IndentingPrintWriter;
@@ -51,11 +54,21 @@ public class AdbService extends IAdbManager.Stub {
}
private class AdbManagerInternalImpl extends AdbManagerInternal {
@Override
public void registerTransport(IAdbTransport transport) {
mTransports.put(transport.asBinder(), transport);
}
@Override
public void unregisterTransport(IAdbTransport transport) {
mTransports.remove(transport.asBinder());
}
}
private static final String TAG = "AdbService";
private final Context mContext;
private final ArrayMap<IBinder, IAdbTransport> mTransports = new ArrayMap<>();
private AdbService(Context context) {
mContext = context;
@@ -73,8 +86,8 @@ public class AdbService extends IAdbManager.Stub {
if (args == null || args.length == 0 || "-a".equals(args[0])) {
pw.println("ADB Manager State:");
pw.increaseIndent();
pw.println("None");
// TODO: flesh out with status.
pw.print("Number of registered transports: ");
pw.println(mTransports.size());
} else {
pw.println("Dump current ADB state");
pw.println(" No commands available");