diff options
| -rw-r--r-- | core/java/android/companion/utils/FeatureUtils.java | 52 | ||||
| -rw-r--r-- | services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java | 10 |
2 files changed, 0 insertions, 62 deletions
diff --git a/core/java/android/companion/utils/FeatureUtils.java b/core/java/android/companion/utils/FeatureUtils.java deleted file mode 100644 index a382e09ae7b2..000000000000 --- a/core/java/android/companion/utils/FeatureUtils.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2023 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.utils; - -import android.os.Binder; -import android.os.Build; -import android.provider.DeviceConfig; - -/** - * Util class for feature flags - * - * @hide - */ -public final class FeatureUtils { - - private static final String NAMESPACE_COMPANION = "companion"; - - private static final String PROPERTY_PERM_SYNC_ENABLED = "perm_sync_enabled"; - - public static boolean isPermSyncEnabled() { - // Permissions sync is always enabled in debuggable mode. - if (Build.isDebuggable()) { - return true; - } - - // Clear app identity to read the device config for feature flag. - final long identity = Binder.clearCallingIdentity(); - try { - return DeviceConfig.getBoolean(NAMESPACE_COMPANION, - PROPERTY_PERM_SYNC_ENABLED, false); - } finally { - Binder.restoreCallingIdentity(identity); - } - } - - private FeatureUtils() { - } -} diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java index 2c608930b391..8d41d4ee65a0 100644 --- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java @@ -75,7 +75,6 @@ import android.companion.IOnMessageReceivedListener; import android.companion.IOnTransportsChangedListener; import android.companion.ISystemDataTransferCallback; import android.companion.datatransfer.PermissionSyncRequest; -import android.companion.utils.FeatureUtils; import android.content.ComponentName; import android.content.Context; import android.content.SharedPreferences; @@ -825,11 +824,6 @@ public class CompanionDeviceManagerService extends SystemService { @Override public PendingIntent buildPermissionTransferUserConsentIntent(String packageName, int userId, int associationId) { - if (!FeatureUtils.isPermSyncEnabled()) { - throw new UnsupportedOperationException("Calling" - + " buildPermissionTransferUserConsentIntent, but this API is disabled by" - + " the system."); - } return mSystemDataTransferProcessor.buildPermissionTransferUserConsentIntent( packageName, userId, associationId); } @@ -837,10 +831,6 @@ public class CompanionDeviceManagerService extends SystemService { @Override public void startSystemDataTransfer(String packageName, int userId, int associationId, ISystemDataTransferCallback callback) { - if (!FeatureUtils.isPermSyncEnabled()) { - throw new UnsupportedOperationException("Calling startSystemDataTransfer, but this" - + " API is disabled by the system."); - } mSystemDataTransferProcessor.startSystemDataTransfer(packageName, userId, associationId, callback); } |