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

Commit 36c330df authored by George Chan's avatar George Chan Committed by Android (Google) Code Review
Browse files

Merge "Updated UsbDataProtectionHook to account for feature disablement...

Merge "Updated UsbDataProtectionHook to account for feature disablement without immediate reboot as well as adding fallback default for canSetUsbDataSignal." into main
parents f1fa4315 0608497d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.UserHandle;
import android.security.Flags;
import android.util.Slog;

import com.android.server.LocalServices;
@@ -83,6 +84,7 @@ public class UsbDataAdvancedProtectionHook extends AdvancedProtectionHook {
    private NotificationManager mNotificationManager;
    private NotificationChannel mNotificationChannel;

    private boolean mCanSetUsbDataSignal = false;
    private AdvancedProtectionFeature mFeature
        = new AdvancedProtectionFeature(FEATURE_ID_DISALLOW_USB);

@@ -96,6 +98,7 @@ public class UsbDataAdvancedProtectionHook extends AdvancedProtectionHook {
        mUsbManagerInternal = Objects.requireNonNull(
            LocalServices.getService(IUsbManagerInternal.class));
        onAdvancedProtectionChanged(enabled);
        mCanSetUsbDataSignal = canSetUsbDataSignal();
    }

    @Override
@@ -105,7 +108,7 @@ public class UsbDataAdvancedProtectionHook extends AdvancedProtectionHook {

    @Override
    public boolean isAvailable() {
        return canSetUsbDataSignal();
        return Flags.aapmFeatureUsbDataProtection() && mCanSetUsbDataSignal;
    }

    @Override