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

Commit d24e7bc1 authored by Sarup Dalwani's avatar Sarup Dalwani
Browse files

Adding package name in case of the restricting the overlay activities.

Bug: 307231174
Test: Manually tested the flow.
Test: atest UsbManagerTests
Change-Id: I37431d5fbef9eadfbb2538dbbebbecdea495e2f9
parent 3b95fbb8
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -978,8 +978,14 @@ public class UsbProfileGroupSettingsManager {

        shouldRestrictOverlayActivities = filteredAppProcessInfos.stream().anyMatch(pkg -> {
            try {
                return mPackageManager.getProperty(PROPERTY_RESTRICT_USB_OVERLAY_ACTIVITIES, pkg)
                        .getBoolean();
                boolean restrictUsbOverlayActivitiesForPackage = mPackageManager
                        .getProperty(PROPERTY_RESTRICT_USB_OVERLAY_ACTIVITIES, pkg).getBoolean();

                if (restrictUsbOverlayActivitiesForPackage) {
                    Slog.d(TAG, "restricting usb overlay activities as package " + pkg
                            + " is in foreground");
                }
                return restrictUsbOverlayActivitiesForPackage;
            } catch (NameNotFoundException e) {
                if (DEBUG) {
                    Slog.d(TAG, "property PROPERTY_RESTRICT_USB_OVERLAY_ACTIVITIES "
@@ -989,8 +995,8 @@ public class UsbProfileGroupSettingsManager {
            }
        });

        if (shouldRestrictOverlayActivities) {
            Slog.d(TAG, "restricting starting of usb overlay activities");
        if (!shouldRestrictOverlayActivities) {
            Slog.d(TAG, "starting of usb overlay activities");
        }
        return shouldRestrictOverlayActivities;
    }