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

Commit a470fef7 authored by Matías Hernández's avatar Matías Hernández
Browse files

Make areAutomaticZenRulesUserManaged() return false on WATCH and AUTOMOTIVE

Since these surfaces don't have the appropriate Settings UI to resolve ACTION_AUTOMATIC_ZEN_RULE_SETTINGS.

Bug: 370187423
Test: atest NotificationManagerZenTest
Flag: android.app.modes_ui
Change-Id: Ia25d29d76c48c1768889b211ba9e883d0ce9a9c7
parent f76196eb
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.Icon;
@@ -1333,10 +1334,14 @@ public class NotificationManager {
     */
    @FlaggedApi(Flags.FLAG_MODES_API)
    public boolean areAutomaticZenRulesUserManaged() {
        // modes ui is dependent on modes api
        return Flags.modesApi() && Flags.modesUi();
        if (Flags.modesApi() && Flags.modesUi()) {
            PackageManager pm = mContext.getPackageManager();
            return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH)
                    && !pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
        } else {
            return false;
        }
    }


    /**
     * Returns AutomaticZenRules owned by the caller.