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

Commit a6b7c40c authored by Sanjana Sunil's avatar Sanjana Sunil
Browse files

Rename API to getProcessTokenBinder()

Bug: 264412166
Bug: 265440701
Test: atest SdkSandboxLifecycleHostTest
Change-Id: Ie49423731f14b458e934f842cc514bbfda960f1c
parent ec3c5f10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ package android.content {

  public abstract class Context {
    method @NonNull public android.content.Context createContextForSdkInSandbox(@NonNull android.content.pm.ApplicationInfo, int) throws android.content.pm.PackageManager.NameNotFoundException;
    method @NonNull public android.os.IBinder getIApplicationThreadBinder();
    method @NonNull public android.os.IBinder getProcessToken();
    method @NonNull public android.os.UserHandle getUser();
    field public static final String PAC_PROXY_SERVICE = "pac_proxy";
    field public static final String TEST_NETWORK_SERVICE = "test_network";
+1 −1
Original line number Diff line number Diff line
@@ -2028,7 +2028,7 @@ class ContextImpl extends Context {
    /** @hide */
    @NonNull
    @Override
    public IBinder getIApplicationThreadBinder() {
    public IBinder getProcessToken() {
        return getIApplicationThread().asBinder();
    }

+2 −4
Original line number Diff line number Diff line
@@ -7517,14 +7517,12 @@ public abstract class Context {
    }

    /**
     * Get the binder object associated with the IApplicationThread of this Context.
     *
     * This can be used by a mainline module to uniquely identify a specific app process.
     * Used by a mainline module to uniquely identify a specific app process.
     * @hide
     */
    @NonNull
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public IBinder getIApplicationThreadBinder() {
    public IBinder getProcessToken() {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

+2 −2
Original line number Diff line number Diff line
@@ -1286,8 +1286,8 @@ public class ContextWrapper extends Context {
     * @hide
     */
    @Override
    public IBinder getIApplicationThreadBinder() {
        return mBase.getIApplicationThreadBinder();
    public IBinder getProcessToken() {
        return mBase.getProcessToken();
    }

    /**
+8 −7
Original line number Diff line number Diff line
@@ -75,8 +75,9 @@ public interface ActivityManagerLocal {
     * @param conn Receives information as the service is started and stopped.
     *        This must be a valid ServiceConnection object; it must not be null.
     * @param clientAppUid Uid of the app for which the sdk sandbox process needs to be spawned.
     * @param clientApplicationThread ApplicationThread object of the app for which the sdk sandboox
     *                                is spawned.
     * @param clientAppProcessToken process token used to uniquely identify the client app
     *        process binding to the SDK sandbox. This is obtained using
     *        {@link Context#getProcessToken()}.
     * @param clientAppPackage Package of the app for which the sdk sandbox process needs to
     *        be spawned. This package must belong to the clientAppUid.
     * @param processName Unique identifier for the service instance. Each unique name here will
@@ -92,7 +93,7 @@ public interface ActivityManagerLocal {
     */
    @SuppressLint("RethrowRemoteException")
    boolean bindSdkSandboxService(@NonNull Intent service, @NonNull ServiceConnection conn,
            int clientAppUid, @NonNull IBinder clientApplicationThread,
            int clientAppUid, @NonNull IBinder clientAppProcessToken,
            @NonNull String clientAppPackage, @NonNull String processName,
            @Context.BindServiceFlags int flags)
            throws RemoteException;
@@ -112,9 +113,9 @@ public interface ActivityManagerLocal {
    /**
     * Kill an app process associated with an SDK sandbox.
     *
     * @param clientApplicationThreadBinder binder value of the
     *        {@link android.app.IApplicationThread} of a client app process associated with a
     *        sandbox. This is obtained using {@link Context#getIApplicationThreadBinder()}.
     * @param clientAppProcessToken process token used to uniquely identify the client app
     *        process associated with an SDK sandbox. This is obtained using
     *        {@link Context#getProcessToken()}.
     */
    void killSdkSandboxClientAppProcess(@NonNull IBinder clientApplicationThreadBinder);
    void killSdkSandboxClientAppProcess(@NonNull IBinder clientAppProcessToken);
}