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

Commit e47c0ec0 authored by Jay Sullivan's avatar Jay Sullivan Committed by Android (Google) Code Review
Browse files

Merge "[Safety Labels] Filter out auto, wear and tv" into udc-dev

parents 42774433 8fb015cd
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.content.Context;
import android.content.IIntentReceiver;
import android.content.Intent;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.PowerExemptionManager;
@@ -337,7 +338,7 @@ public final class BroadcastHelper {
                broadcastAllowlist, null /* filterExtrasForReceiver */, null);
        // Send to PermissionController for all new users, even if it may not be running for some
        // users
        if (isPrivacySafetyLabelChangeNotificationsEnabled()) {
        if (isPrivacySafetyLabelChangeNotificationsEnabled(mContext)) {
            sendPackageBroadcast(Intent.ACTION_PACKAGE_ADDED,
                    packageName, extras, 0,
                    mContext.getPackageManager().getPermissionControllerPackageName(),
@@ -389,9 +390,13 @@ public final class BroadcastHelper {
    }

    /** Returns whether the Safety Label Change notification, a privacy feature, is enabled. */
    public static boolean isPrivacySafetyLabelChangeNotificationsEnabled() {
    public static boolean isPrivacySafetyLabelChangeNotificationsEnabled(Context context) {
        PackageManager packageManager = context.getPackageManager();
        return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
                SAFETY_LABEL_CHANGE_NOTIFICATIONS_ENABLED, false);
                SAFETY_LABEL_CHANGE_NOTIFICATIONS_ENABLED, false)
            && !packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)
            && !packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
            && !packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH);
    }

    @NonNull
+1 −1
Original line number Diff line number Diff line
@@ -2954,7 +2954,7 @@ final class InstallPackageHelper {
                }
                // Send to PermissionController for all update users, even if it may not be running
                // for some users
                if (BroadcastHelper.isPrivacySafetyLabelChangeNotificationsEnabled()) {
                if (BroadcastHelper.isPrivacySafetyLabelChangeNotificationsEnabled(mContext)) {
                    mPm.sendPackageBroadcast(Intent.ACTION_PACKAGE_ADDED, packageName,
                            extras, 0 /*flags*/,
                            mPm.mRequiredPermissionControllerPackage, null /*finishedReceiver*/,