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

Commit 1677a338 authored by Pu Shi's avatar Pu Shi Committed by Android (Google) Code Review
Browse files

Merge "Added skeleton classes for Universal Clipboard" into main

parents 9fde1984 fd26efd1
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@ import android.bluetooth.BluetoothFrameworkInitializer;
import android.companion.CompanionDeviceManager;
import android.companion.ICompanionDeviceManager;
import android.companion.datatransfer.continuity.ITaskContinuityManager;
import android.companion.datatransfer.continuity.IUniversalClipboardManager;
import android.companion.datatransfer.continuity.TaskContinuityManager;
import android.companion.datatransfer.continuity.UniversalClipboardManager;
import android.companion.virtual.IVirtualDeviceManager;
import android.companion.virtual.VirtualDeviceManager;
import android.compat.Compatibility;
@@ -1517,6 +1519,21 @@ public final class SystemServiceRegistry {
                    });
        }

        if (android.companion.Flags.enableUniversalClipboard()) {
            registerService(Context.UNIVERSAL_CLIPBOARD_SERVICE, UniversalClipboardManager.class,
                    new CachedServiceFetcher<UniversalClipboardManager>() {
                        @Override
                        public UniversalClipboardManager createService(ContextImpl ctx)
                                throws ServiceNotFoundException {
                            IBinder iBinder = ServiceManager.getServiceOrThrow(
                                    Context.UNIVERSAL_CLIPBOARD_SERVICE);
                            IUniversalClipboardManager service =
                                    IUniversalClipboardManager.Stub.asInterface(iBinder);
                            return new UniversalClipboardManager(ctx, service);
                        }
                    });
        }

        registerService(Context.CROSS_PROFILE_APPS_SERVICE, CrossProfileApps.class,
                new CachedServiceFetcher<CrossProfileApps>() {
                    @Override
+25 −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.companion.datatransfer.continuity;

/**
 * Interface for communication with the Universal Clipboard service.
 * {@hide}
 */
interface IUniversalClipboardManager {

}
 No newline at end of file
+36 −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.companion.datatransfer.continuity;

import android.annotation.SystemService;
import android.content.Context;

/**
 *  Public interface for managing Universal Clipboard feature on the device.
 *
 * @hide
 */
@SystemService(Context.UNIVERSAL_CLIPBOARD_SERVICE)
public class UniversalClipboardManager {
    private final Context mContext;
    private final IUniversalClipboardManager mService;

    public UniversalClipboardManager(Context context, IUniversalClipboardManager service) {
        mContext = context;
        mService = service;
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -7009,6 +7009,16 @@ public abstract class Context {
     */
    public static final String TASK_CONTINUITY_SERVICE = "task_continuity";

    /**
     * Use with {@link #getSystemService(String)} to retrieve a
     * {@link android.companion.datatransfer.continuity.UniversalClipboardManager}.
     *
     * @see #getSystemService(String)
     * @see UniversalClipboardManager
     * @hide
     */
    public static final String UNIVERSAL_CLIPBOARD_SERVICE = "universal_clipboard";

    /**
     * Use with {@link #getSystemService(String)} to retrieve a
     * {@link android.app.ondeviceintelligence.OnDeviceIntelligenceManager}.
+48 −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 com.android.server.companion.datatransfer.continuity;

import android.companion.datatransfer.continuity.IUniversalClipboardManager;
import android.content.Context;

import com.android.server.SystemService;


/**
 * Service for Universal Clipboard
 *
 * @hide
 *
 */
public final class UniversalClipboardService extends SystemService {

    private UniversalClipboardServiceImpl mUniversalClipboardService;

    public UniversalClipboardService(Context context) {
        super(context);
    }

    @Override
    public void onStart() {
        mUniversalClipboardService = new UniversalClipboardServiceImpl();
        publishBinderService(Context.UNIVERSAL_CLIPBOARD_SERVICE, mUniversalClipboardService);
    }

    private final class UniversalClipboardServiceImpl extends IUniversalClipboardManager.Stub {

    }
}
Loading