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

Commit 84e0ec2e authored by George Chan's avatar George Chan
Browse files

Adding null check and optionalBackgroundInstallControl flag check. Dependency...

Adding null check and optionalBackgroundInstallControl flag check. Dependency service (Background Install Control) is disabled for wear devices as mentioned in: b/340928990

Change-Id: I9c263fd6e67bb3ad56b7099cd44b1f4408878e05
Flag: android.app.background_install_control_callback_api
Bug: 369382811
Test: atest
parent d5eaee40
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1580,10 +1580,20 @@ public class BinaryTransparencyService extends SystemService {
    }

    private void registerBicCallback() {
        if(!com.android.server.flags.Flags.optionalBackgroundInstallControl()) {
            Slog.d(TAG, "BICS is disabled for this device, skipping registration.");
            return;
        }
        IBackgroundInstallControlService iBics =
                IBackgroundInstallControlService.Stub.asInterface(
                        ServiceManager.getService(
                                Context.BACKGROUND_INSTALL_CONTROL_SERVICE));
        if(iBics == null) {
            Slog.e(TAG, "Failed to register BackgroundInstallControl callback, either "
                + "background install control service does not exist or disabled on this "
                + "build.");
            return;
        }
        try {
            iBics.registerBackgroundInstallCallback(
                    new BicCallbackHandler(mServiceImpl));