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

Commit ae83ac24 authored by Matt Gilbride's avatar Matt Gilbride
Browse files

Add `DynamicInstrumentationManagerService`

Adds a new service with a single operation
`getExecutableMethodFileOffsets`. The operation allows the caller to
fetch information about the native executable of a given method. The
operation's access control is limited to the UprobeStats module.

Given a method in the form of fully qualified class name, method
name, and fully qualified parameter list, the operation returns
information from the ODEX file associated with that method. If the
method isn't precompiled, the operation returns null.
However, ART can be enhanced to support returning information about
JIT compiled methods in the future.

Bug: 372925025
Test: DynamicInstrumentationManagerServiceTests, ExecutableMethodFileOffsetsTest
Flag: com.android.art.flags.executable_method_file_offsets
Change-Id: I1f2dc3780d1bd2a682c1fd3ec41e5c8d73e96fc2
parent 793c88f2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -399,6 +399,7 @@ java_defaults {
        "com.android.sysprop.foldlockbehavior",
        "com.android.sysprop.view",
        "framework-internal-utils",
        "dynamic_instrumentation_manager_aidl-java",
        // If MimeMap ever becomes its own APEX, then this dependency would need to be removed
        // in favor of an API stubs dependency in java_library "framework" below.
        "mimemap",
+1 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ package android {
    field public static final String DISABLE_SYSTEM_SOUND_EFFECTS = "android.permission.DISABLE_SYSTEM_SOUND_EFFECTS";
    field public static final String DISPATCH_PROVISIONING_MESSAGE = "android.permission.DISPATCH_PROVISIONING_MESSAGE";
    field public static final String DOMAIN_VERIFICATION_AGENT = "android.permission.DOMAIN_VERIFICATION_AGENT";
    field @FlaggedApi("com.android.art.flags.executable_method_file_offsets") public static final String DYNAMIC_INSTRUMENTATION = "android.permission.DYNAMIC_INSTRUMENTATION";
    field @FlaggedApi("com.android.window.flags.untrusted_embedding_any_app_permission") public static final String EMBED_ANY_APP_IN_UNTRUSTED_MODE = "android.permission.EMBED_ANY_APP_IN_UNTRUSTED_MODE";
    field @FlaggedApi("android.content.pm.emergency_install_permission") public static final String EMERGENCY_INSTALL_PACKAGES = "android.permission.EMERGENCY_INSTALL_PACKAGES";
    field public static final String ENTER_CAR_MODE_PRIORITIZED = "android.permission.ENTER_CAR_MODE_PRIORITIZED";
+12 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ filegroup {
    exclude_srcs: [
        "android/os/*MessageQueue/**/*.java",
        "android/ranging/**/*.java",
        ":dynamic_instrumentation_manager_aidl_sources",
    ],
    visibility: ["//frameworks/base"],
}
@@ -119,6 +120,17 @@ filegroup {
    srcs: ["android/tracing/TraceReportParams.aidl"],
}

filegroup {
    name: "dynamic_instrumentation_manager_aidl_sources",
    srcs: ["android/os/instrumentation/*.aidl"],
}

aidl_interface {
    name: "dynamic_instrumentation_manager_aidl",
    srcs: [":dynamic_instrumentation_manager_aidl_sources"],
    unstable: true,
}

filegroup {
    name: "framework-internal-display-sources",
    srcs: ["com/android/internal/display/BrightnessSynchronizer.java"],
+6 −0
Original line number Diff line number Diff line
@@ -6801,6 +6801,12 @@ public abstract class Context {
    @FlaggedApi(android.media.tv.flags.Flags.FLAG_MEDIA_QUALITY_FW)
    public static final String MEDIA_QUALITY_SERVICE = "media_quality";

    /**
     * Service to perform operations needed for dynamic instrumentation.
     * @hide
     */
    public static final String DYNAMIC_INSTRUMENTATION_SERVICE = "dynamic_instrumentation";

    /**
     * Determine whether the given permission is allowed for a particular
     * process and user ID running in the system.
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.os.instrumentation;

/**
 * Represents the location of the code for a compiled method within a process'
 * memory.
 * {@hide}
 */
@JavaDerive(toString=true)
parcelable ExecutableMethodFileOffsets {
  /**
   * The OS path of the containing file (could be virtual).
   */
  @utf8InCpp String containerPath;
  /**
   * The offset of the containing file within the process' memory.
   */
  long containerOffset;
  /**
   * The offset of the method within the containing file.
   */
  long methodOffset;
}
Loading