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

Commit a00b444f authored by Kedar Chitnis's avatar Kedar Chitnis Committed by Automerger Merge Worker
Browse files

Merge "dumpstate: Add dumpstate device AIDL HAL" am: 745a344a am: e8222cb9...

Merge "dumpstate: Add dumpstate device AIDL HAL" am: 745a344a am: e8222cb9 am: 40ae0040 am: 3d3108cd

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1895055

Change-Id: I06a0a1762b1e4b7303f1f54cc4aae7912cd226f3
parents cefc38f1 3d3108cd
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -222,9 +222,8 @@
            <regex-instance>.*</regex-instance>
        </interface>
    </hal>
    <hal format="hidl" optional="true">
    <hal format="aidl" optional="true">
        <name>android.hardware.dumpstate</name>
        <version>1.1</version>
        <interface>
            <name>IDumpstateDevice</name>
            <instance>default</instance>
+43 −0
Original line number Diff line number Diff line
// Copyright (C) 2021 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 {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "hardware_interfaces_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["hardware_interfaces_license"],
}

aidl_interface {
    name: "android.hardware.dumpstate",
    vendor_available: true,
    srcs: ["android/hardware/dumpstate/*.aidl"],
    stability: "vintf",
    backend: {
        cpp: {
            enabled: false,
        },
        java: {
            enabled: false,
        },
        ndk: {
            separate_platform_variant: false,
            vndk: {
                enabled: true,
            },
        },
    },
}
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.dumpstate;
@VintfStability
interface IDumpstateDevice {
  void dumpstateBoard(in ParcelFileDescriptor[] fd, in android.hardware.dumpstate.IDumpstateDevice.DumpstateMode mode, in long timeoutMillis);
  boolean getVerboseLoggingEnabled();
  void setVerboseLoggingEnabled(in boolean enable);
  const int ERROR_UNSUPPORTED_MODE = 1;
  const int ERROR_DEVICE_LOGGING_NOT_ENABLED = 2;
  @Backing(type="int") @VintfStability
  enum DumpstateMode {
    FULL = 0,
    INTERACTIVE = 1,
    REMOTE = 2,
    WEAR = 3,
    CONNECTIVITY = 4,
    WIFI = 5,
    DEFAULT = 6,
    PROTO = 7,
  }
}
+137 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.hardware.dumpstate;

import android.os.ParcelFileDescriptor;

@VintfStability
interface IDumpstateDevice {
    /**
     * Constants that define the type of bug report being taken to restrict content appropriately.
     */
    @VintfStability
    @Backing(type="int")
    enum DumpstateMode {
        /**
         * Takes a bug report without user interference.
         */
        FULL = 0,
        /**
         * Interactive bug report, i.e. triggered by the user.
         */
        INTERACTIVE = 1,
        /**
         * Remote bug report triggered by DevicePolicyManager, for example.
         */
        REMOTE = 2,
        /**
         * Bug report triggered on a wear device.
         */
        WEAR = 3,
        /**
         * Bug report limited to only connectivity info (cellular, wifi, and networking). Sometimes
         * called "telephony" in legacy contexts.
         *
         * All reported information MUST directly relate to connectivity debugging or customer
         * support and MUST NOT contain unrelated private information. This information MUST NOT
         * identify user-installed packages (UIDs are OK, package names are not), and MUST NOT
         * contain logs of user application traffic.
         */
        CONNECTIVITY = 4,
        /**
         * Bug report limited to only wifi info.
         */
        WIFI = 5,
        /**
         * Default mode, This mode MUST be supported if the
         * dumpstate HAL is implemented.
         */
        DEFAULT = 6,
        /**
         * Takes a report in protobuf.
         *
         * The content, if implemented, must be a binary protobuf message written to the first file
         * descriptor of the native handle. The protobuf schema shall be defined by the vendor.
         */
        PROTO = 7,
    }

    /**
     * Returned for cases where the device doesn't support the given DumpstateMode (e.g. a phone
     * trying to use DumpstateMode::WEAR).
     */
    const int ERROR_UNSUPPORTED_MODE = 1;
    /**
     * Returned when device logging is not enabled.
     */
    const int ERROR_DEVICE_LOGGING_NOT_ENABLED = 2;

    /**
     * Dump device-specific state into the given file descriptors.
     *
     * One file descriptor must be passed to this method but two may be passed:
     * the first descriptor must be used to dump device-specific state in text
     * format, the second descriptor is optional and may be used to dump
     * device-specific state in binary format.
     *
     * DumpstateMode can be used to limit the information that is output.
     * For an example of when this is relevant, consider a bug report being generated with
     * DumpstateMode::CONNECTIVITY - there is no reason to include camera or USB logs in this type
     * of report.
     *
     * When verbose logging is disabled, getVerboseLoggingEnabled returns false, and this
     * API is called, it may still output essential information but must not include
     * information that identifies the user.
     *
     * @param fd array of file descriptors, with one or two valid file descriptors. The first FD is
     *         for text output, the second (if present) is for binary output.
     * @param mode A mode value to restrict dumped content.
     * @param timeoutMillis An approximate "budget" for how much time this call has been allotted.
     *     If execution runs longer than this, the IDumpstateDevice service may be killed and only
     *     partial information will be included in the report.
     * @return If error, return service specific error with code
     *           ERROR_UNSUPPORTED_MODE or ERROR_DEVICE_LOGGING_NOT_ENABLED
     */
    void dumpstateBoard(in ParcelFileDescriptor[] fd, in DumpstateMode mode, in long timeoutMillis);

    /**
     * Queries the current state of verbose device logging. Primarily for UI and informative
     * purposes.
     *
     * Even if verbose logging has been disabled, dumpstateBoard may still be called by the
     * dumpstate routine, and essential information that does not identify the user may be included.
     *
     * @return Whether or not verbose vendor logging is currently enabled.
     */
    boolean getVerboseLoggingEnabled();

    /**
     * Turns verbose device vendor logging on or off.
     *
     * The setting should be persistent across reboots. Underlying implementations may need to start
     * vendor logging daemons, set system properties, or change logging masks, for example. Given
     * that many vendor logs contain significant amounts of private information and may come with
     * memory/storage/battery impacts, calling this method on a user build should only be done after
     * user consent has been obtained, e.g. from a toggle in developer settings.
     *
     * Even if verbose logging has been disabled, dumpstateBoard may still be called by the
     * dumpstate routine, and essential information that does not identify the user may be included.
     *
     * @param enable Whether to enable or disable verbose vendor logging.
     */
    void setVerboseLoggingEnabled(in boolean enable);
}
+46 −0
Original line number Diff line number Diff line
// Copyright (C) 2021 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 {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "hardware_interfaces_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["hardware_interfaces_license"],
}

cc_binary {
    name: "android.hardware.dumpstate-service.example",
    relative_install_path: "hw",
    init_rc: ["dumpstate-default.rc"],
    vintf_fragments: ["dumpstate-default.xml"],
    vendor: true,
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "libcutils",
        "libdumpstateutil",
        "liblog",
        "libutils",
        "android.hardware.dumpstate-V1-ndk",
    ],
    srcs: [
        "main.cpp",
        "Dumpstate.cpp",
    ],
    cflags: [
        "-DLOG_TAG=\"android.hardware.dumpstate-service.example\"",
    ],
}
Loading