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

Commit aab4db2c authored by Guojing Yuan's avatar Guojing Yuan Committed by Android (Google) Code Review
Browse files

Merge "[CDM][Refactoring 4/N] Move device presence logic out of CDMS" into main

parents 60b866ea 55f1144b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1086,7 +1086,7 @@ public final class CompanionDeviceManager {
        }
        Objects.requireNonNull(deviceAddress, "address cannot be null");
        try {
            mService.registerDevicePresenceListenerService(deviceAddress,
            mService.legacyStartObservingDevicePresence(deviceAddress,
                    mContext.getOpPackageName(), mContext.getUserId());
        } catch (RemoteException e) {
            ExceptionUtils.propagateIfInstanceOf(e.getCause(), DeviceNotAssociatedException.class);
@@ -1128,7 +1128,7 @@ public final class CompanionDeviceManager {
        }
        Objects.requireNonNull(deviceAddress, "address cannot be null");
        try {
            mService.unregisterDevicePresenceListenerService(deviceAddress,
            mService.legacyStopObservingDevicePresence(deviceAddress,
                    mContext.getPackageName(), mContext.getUserId());
        } catch (RemoteException e) {
            ExceptionUtils.propagateIfInstanceOf(e.getCause(), DeviceNotAssociatedException.class);
@@ -1328,7 +1328,7 @@ public final class CompanionDeviceManager {
    @RequiresPermission(android.Manifest.permission.REQUEST_COMPANION_SELF_MANAGED)
    public void notifyDeviceAppeared(int associationId) {
        try {
            mService.notifyDeviceAppeared(associationId);
            mService.notifySelfManagedDeviceAppeared(associationId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -1350,7 +1350,7 @@ public final class CompanionDeviceManager {
    @RequiresPermission(android.Manifest.permission.REQUEST_COMPANION_SELF_MANAGED)
    public void notifyDeviceDisappeared(int associationId) {
        try {
            mService.notifyDeviceDisappeared(associationId);
            mService.notifySelfManagedDeviceDisappeared(associationId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+12 −12
Original line number Diff line number Diff line
@@ -59,12 +59,16 @@ interface ICompanionDeviceManager {
        int userId);

    @EnforcePermission("REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE")
    void registerDevicePresenceListenerService(in String deviceAddress, in String callingPackage,
        int userId);
    void legacyStartObservingDevicePresence(in String deviceAddress, in String callingPackage, int userId);

    @EnforcePermission("REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE")
    void unregisterDevicePresenceListenerService(in String deviceAddress, in String callingPackage,
        int userId);
    void legacyStopObservingDevicePresence(in String deviceAddress, in String callingPackage, int userId);

    @EnforcePermission("REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE")
    void startObservingDevicePresence(in ObservingDevicePresenceRequest request, in String packageName, int userId);

    @EnforcePermission("REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE")
    void stopObservingDevicePresence(in ObservingDevicePresenceRequest request, in String packageName, int userId);

    boolean canPairWithoutPrompt(in String packageName, in String deviceMacAddress, int userId);

@@ -93,9 +97,11 @@ interface ICompanionDeviceManager {
    @EnforcePermission("USE_COMPANION_TRANSPORTS")
    void removeOnMessageReceivedListener(int messageType, IOnMessageReceivedListener listener);

    void notifyDeviceAppeared(int associationId);
    @EnforcePermission("REQUEST_COMPANION_SELF_MANAGED")
    void notifySelfManagedDeviceAppeared(int associationId);

    void notifyDeviceDisappeared(int associationId);
    @EnforcePermission("REQUEST_COMPANION_SELF_MANAGED")
    void notifySelfManagedDeviceDisappeared(int associationId);

    PendingIntent buildPermissionTransferUserConsentIntent(String callingPackage, int userId,
        int associationId);
@@ -135,10 +141,4 @@ interface ICompanionDeviceManager {
    byte[] getBackupPayload(int userId);

    void applyRestoredPayload(in byte[] payload, int userId);

    @EnforcePermission("REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE")
    void startObservingDevicePresence(in ObservingDevicePresenceRequest request, in String packageName, int userId);

    @EnforcePermission("REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE")
    void stopObservingDevicePresence(in ObservingDevicePresenceRequest request, in String packageName, int userId);
}
Loading