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

Commit 3b180245 authored by Becca Hughes's avatar Becca Hughes
Browse files

Move DeviceConfig check to Service

Moves DC feature flag evalutation to
service since clients do not have
permisssion.

Test: gts
Bug: 275754582
Change-Id: Ic56cae1ad52d9df2daab6c82da0e57087a91408c
parent 71dac9db
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -460,9 +460,17 @@ public final class CredentialManager {
        return false;
    }

    /**
     * Returns whether the service is enabled.
     *
     * @hide
     */
    private boolean isServiceEnabled() {
        return DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_CREDENTIAL, DEVICE_CONFIG_ENABLE_CREDENTIAL_MANAGER, true);
        try {
            return mService.isServiceEnabled();
        } catch (RemoteException e) {
            return false;
        }
    }

    /**
+2 −0
Original line number Diff line number Diff line
@@ -58,5 +58,7 @@ interface ICredentialManager {
    List<CredentialProviderInfo> getCredentialProviderServices(in int userId, in int providerFilter);

    List<CredentialProviderInfo> getCredentialProviderServicesForTesting(in int providerFilter);

    boolean isServiceEnabled();
}
+13 −0
Original line number Diff line number Diff line
@@ -825,6 +825,19 @@ public final class CredentialManagerService
                    mContext, userId, providerFilter, getEnabledProviders());
        }

        @Override
        public boolean isServiceEnabled() {
            final long origId = Binder.clearCallingIdentity();
            try {
                return DeviceConfig.getBoolean(
                        DeviceConfig.NAMESPACE_CREDENTIAL,
                        CredentialManager.DEVICE_CONFIG_ENABLE_CREDENTIAL_MANAGER,
                        false);
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
        }

        @SuppressWarnings("GuardedBy") // ErrorProne requires service.mLock which is the same
        // this.mLock
        private Set<ComponentName> getEnabledProviders() {