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

Commit f69c0558 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "native-process-framework-poc" into main

* changes:
  Support native processes in the AMS
  Implement the functionality for managing the native process
parents 5515871b cb4e53d7
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -265,7 +265,12 @@ filegroup {
        "android/util/AndroidException.java",
        "android/view/DisplayAdjustments.java",
        "android/view/ViewDebug.java",
    ] + select(release_flag("RELEASE_NATIVE_FRAMEWORK_PROTOTYPE"), {
        true: [
            "android/app/INativeApplicationThread.aidl",
        ],
        default: [],
    }),
    visibility: ["//frameworks/base/test-mock"],
}

@@ -843,3 +848,20 @@ aidl_interface {
        },
    },
}

aidl_interface {
    name: "native_application_thread_aidl",
    srcs: [
        "android/app/INativeApplicationThread.aidl",
    ],
    unstable: true,
    backend: {
        java: {
            // java code is generated through framework-core-sources.
            enabled: false,
        },
        rust: {
            enabled: true,
        },
    },
}
+1 −0
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ interface IActivityManager {
    oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map,
            boolean abortBroadcast, int flags);
    void attachApplication(in IApplicationThread app, long startSeq);
    void attachNativeApplication(in IBinder nativeThread, long startSeq);
    void finishAttachApplication(long startSeq, long timestampApplicationOnCreateNs);
    List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
    @UnsupportedAppUsage
+24 −0
Original line number Diff line number Diff line
@@ -92,4 +92,28 @@ interface IActivityManagerStructured {
    void unregisterProcessObserver(in IProcessObserver observer);
    @UnsupportedAppUsage
    List<RunningAppProcessInfo> getRunningAppProcesses();

    /** Callback from a service to AMS to indicate it has completed a scheduled operation */
    @UnsupportedAppUsage
    oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res);
    /** Type for IActivityManager.serviceDoneExecuting: anonymous operation */
    const int SERVICE_DONE_EXECUTING_ANON = 0;
    /** Type for IActivityManager.serviceDoneExecuting: done with an onStart call */
    const int SERVICE_DONE_EXECUTING_START = 1;
    /** Type for IActivityManager.serviceDoneExecuting: done stopping (destroying) service */
    const int SERVICE_DONE_EXECUTING_STOP = 2;
    /** Type for IActivityManager.serviceDoneExecuting: done with an onRebind call */
    const int SERVICE_DONE_EXECUTING_REBIND = 3;
    /** Type for IActivityManager.serviceDoneExecuting: done with an onUnbind call */
    const int SERVICE_DONE_EXECUTING_UNBIND = 4;

    /** A service reporting that it has completed a binding, and returning the IBinder */
    void publishService(in IBinder token, in IBinder bindToken, in IBinder service);

    /** A service reporting that it has completed an unbind operation */
    void unbindFinished(in IBinder token, in IBinder bindToken);

    void attachNativeApplication(in IBinder nativeThread, long startSeq);

    void finishAttachApplication(long startSeq, long timestampApplicationOnCreateNs);
}
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.app;

import java.util.List;
import java.util.Map;

/**
 * System private API for communicating with the application.  This is given to
 * the activity manager by an application  when it starts up, for the activity
 * manager to tell the application about things it needs to do.
 *
 * {@hide}
 */
oneway interface INativeApplicationThread {
    @UnsupportedAppUsage
    void scheduleCreateService(IBinder serviceToken,
            in List<String> libraryPaths, in String permittedLibsDir,
            in String libraryName, in String baseSymbolName, int processState);

    @UnsupportedAppUsage
    void scheduleDestroyService(IBinder serviceToken);

    @UnsupportedAppUsage
    void scheduleBindService(IBinder serviceToken, IBinder bindToken,
            int intentHash,
            in @nullable @utf8InCpp String action,
            in @nullable @utf8InCpp String data,
            boolean rebind, int processState, long bindSeq);

    @UnsupportedAppUsage
    void scheduleUnbindService(IBinder serviceToken, IBinder bindToken, int intentHash);

    @UnsupportedAppUsage
    void scheduleTrimMemory(int level);

    @UnsupportedAppUsage
    void bindApplication();
}
+7 −0
Original line number Diff line number Diff line
@@ -333,6 +333,13 @@ flag {
     is_fixed_read_only: true
}

flag {
    name: "native_framework_prototype"
    namespace: "system_performance"
    description: "Enable support for the native framework prototype"
    bug: "406925781"
}

flag {
    name: "network_time_uses_shared_memory"
    namespace: "system_performance"
Loading