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

Commit c9e2c6d3 authored by Hunter Knepshield's avatar Hunter Knepshield
Browse files

Make IDumpstateDevice 1.1

Add dumpstateBoard_1_1 to accept a mode parameter (e.g. for limiting
vendor logs to the right bug reports).

Add setDeviceLoggingEnabled for the user to toggle vendor logging on and
off.

Bug: 143183758
Bug: 143184495
Test: atest VtsHalDumpstateV1_1TargetTest
Change-Id: I5420e5e4ce88619c7e40cf967382f98babc3c3d5
parent 9ae79098
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@
    </hal>
    <hal format="hidl" optional="true">
        <name>android.hardware.dumpstate</name>
        <version>1.0</version>
        <version>1.1</version>
        <interface>
            <name>IDumpstateDevice</name>
            <instance>default</instance>
+2 −0
Original line number Diff line number Diff line
@@ -633,6 +633,8 @@ f18695dd36ee205640b8326a17453858a7b4596653aaa6ef0016b0aef1bd4dac android.hardwar
4d85e814f94949dae4dc6cb82bbd7d6bb24ffafda6ddb2eac928d2a4fc2e21ce android.hardware.cas@1.2::types
66931c2506fbb5af61f20138cb05e0a09e7bf67d6964c231d27c648933bb33ec android.hardware.drm@1.3::ICryptoFactory
994d08ab27d613022c258a9ec48cece7adf2a305e92df5d76ef923e2c6665f64 android.hardware.drm@1.3::IDrmFactory
881aa8720fb1d69aa9843bfab69d810ab7654a61d2f5ab5e2626cbf240f24eaf android.hardware.dumpstate@1.1::types
13b33f623521ded51a6c0f7ea5b77e97066d0aa1e38a83c2873f08ad67294f89 android.hardware.dumpstate@1.1::IDumpstateDevice
3dacec7801968e1e4479724dc0180442d9e915466bff051f80996266b1a51c2c android.hardware.gnss@2.1::IGnss
ba62e1e8993bfb9f27fa04816fa0f2241ae2d01edfa3d0c04182e2e5de80045c android.hardware.gnss@2.1::IGnssCallback
ccdf3c0fb2c02a6d4dc57afb276c3497ae8172b80b00ebc0bf8a0238dd38b01d android.hardware.gnss@2.1::IGnssConfiguration
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ TEST_P(DumpstateHidlTest, TestOk) {
    ASSERT_EQ(1, read(fds[0], &buff, 1)) << "dumped nothing";

    native_handle_close(handle);
    native_handle_delete(handle);
}

// Positive test: make sure dumpstateBoard() doesn't crash with two FDs.
@@ -96,6 +97,7 @@ TEST_P(DumpstateHidlTest, TestHandleWithTwoFds) {
    ASSERT_TRUE(status.isOk()) << "Status should be ok: " << status.description();

    native_handle_close(handle);
    native_handle_delete(handle);
}

INSTANTIATE_TEST_SUITE_P(
+18 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
    name: "android.hardware.dumpstate@1.1",
    root: "android.hardware",
    vndk: {
        enabled: true,
    },
    srcs: [
        "types.hal",
        "IDumpstateDevice.hal",
    ],
    interfaces: [
        "android.hardware.dumpstate@1.0",
        "android.hidl.base@1.0",
    ],
    gen_java: true,
}
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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@1.1;

import @1.0::IDumpstateDevice;

interface IDumpstateDevice extends @1.0::IDumpstateDevice {
    /**
     * Extension of dumpstateBoard which also accepts a mode parameter to limit dumped data.
     *
     * 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.
     *
     * The 1.0 version of #dumpstateBoard(handle) should just delegate to this new method and pass
     * DumpstateMode::DEFAULT and a timeout of 30,000ms (30 seconds).
     *
     * @param h A native handle 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.
     */
    dumpstateBoard_1_1(handle h, DumpstateMode mode, uint64_t timeoutMillis);

    /**
     * Turns 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.
     *
     * @param enable Whether to enable or disable device vendor logging.
     * @return success Whether or not the change took effect.
     */
    setDeviceLoggingEnabled(bool enable) generates (bool success);
};
Loading