Java Code Examples for android.hardware.display.DisplayManager#getDisplays()

The following examples show how to use android.hardware.display.DisplayManager#getDisplays() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PdfMainPresenter.java    From Reader with Apache License 2.0 6 votes vote down vote up
@Override
public Presentation initPresentation() {
    DisplayManager displayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
    Display[] presentationDisplays = displayManager
            .getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
    if (presentationDisplays.length > 0) {
        Display presentationDisplay = presentationDisplays[0];
        mPresentation = new PdfPresentation(mContext, presentationDisplay);
        mPresentation.getWindow().setType(
                WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

        SystemPropertyUtils.setSystemProperty(mContext, "sys.eink.Appmode", "13");
        mPresentation.show();
        return mPresentation;
    }
    return null;
}
 
Example 2
Source File: OBSystemsManager.java    From GLEXP-Team-onebillion with Apache License 2.0 6 votes vote down vote up
public boolean isScreenOn(Context context)
{
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
    {
        DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
        boolean screenOn = false;
        for (Display display : dm.getDisplays())
        {
            if (display.getState() != Display.STATE_OFF)
            {
                screenOn = true;
            }
        }
        return screenOn;
    } else
    {
        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        //noinspection deprecation
        return pm.isScreenOn();
    }
}
 
Example 3
Source File: U.java    From SecondScreen with Apache License 2.0 6 votes vote down vote up
public static boolean castScreenActive(Context context) {
    DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
    Display[] displays = dm.getDisplays();

    for(Display display : displays) {
        try {
            if(Class.forName("android.view.Display")
                    .getMethod("getOwnerPackageName")
                    .invoke(display)
                    .equals("com.google.android.gms"))
                return true;
        } catch (Exception e) { /* Gracefully fail */ }
    }

    return false;
}
 
Example 4
Source File: HelperNotificationAndBadge.java    From iGap-Android with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Is the screen of the device on.
 *
 * @param context the context
 * @return true when (at least one) screen is on
 */
public boolean isScreenOn(Context context) {
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
        boolean screenOn = false;
        for (Display display : dm.getDisplays()) {
            if (display.getState() != Display.STATE_OFF) {
                screenOn = true;
            }
        }
        return screenOn;
    } else {
        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        return pm.isScreenOn();
    }
}
 
Example 5
Source File: Utils.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
public static boolean isScreenOn(Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
        for (Display display : dm.getDisplays()) {
            if (display.getState() != Display.STATE_OFF) {
                return true;
            }
        }
        return false;
    } else {
        PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        return powerManager.isScreenOn();
    }
}
 
Example 6
Source File: ScreenOnService.java    From SecondScreen with Apache License 2.0 5 votes vote down vote up
@Override
protected void onHandleIntent(Intent intent) {
    super.onHandleIntent(intent);

    // Turn the backlight back off after the device wakes up
    SharedPreferences prefCurrent = U.getPrefCurrent(this);
    SharedPreferences prefMain = U.getPrefMain(this);
    DisplayManager dm = (DisplayManager) getSystemService(DISPLAY_SERVICE);
    Display[] displays = dm.getDisplays();

    if(!prefCurrent.getBoolean("not_active", true)
        && prefCurrent.getBoolean("backlight_off", false)
        && (displays[displays.length - 1].getDisplayId() != Display.DEFAULT_DISPLAY
        || prefMain.getBoolean("force_backlight_off", false))) {

        // Turn auto-brightness off so it doesn't mess with things
        Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);

        // Attempt to set screen brightness to 0 first to avoid complications later
        Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 0);

        // Run superuser command to blank screen again after device was turned off
        for(File backlightOff : U.backlightOff) {
            if(backlightOff.exists()) {
                U.runCommand(this, "sleep 2 && echo 0 > " + backlightOff.getAbsolutePath());
                break;
            }
        }
    }
}
 
Example 7
Source File: DisplayConnectionService.java    From SecondScreen with Apache License 2.0 5 votes vote down vote up
@Override
public void onDisplayAdded(int displayId) {
    SharedPreferences prefCurrent = U.getPrefCurrent(DisplayConnectionService.this);
    DisplayManager dm = (DisplayManager) getSystemService(DISPLAY_SERVICE);
    Display[] displays = dm.getDisplays();

    try {
        if(displays[displays.length - 2].getDisplayId() == Display.DEFAULT_DISPLAY
                && prefCurrent.getBoolean("not_active", true)) {
            Intent hdmiIntent = new Intent(DisplayConnectionService.this, HdmiActivity.class);
            hdmiIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(hdmiIntent);
        }
    } catch (ArrayIndexOutOfBoundsException e) { /* Gracefully fail */ }
}
 
Example 8
Source File: NotificationService.java    From SecondScreen with Apache License 2.0 5 votes vote down vote up
@Override
public void onDisplayRemoved(int displayId) {
    DisplayManager dm = (DisplayManager) getSystemService(DISPLAY_SERVICE);
    Display[] displays = dm.getDisplays();

    try {
        if(displays[displays.length - 1].getDisplayId() == Display.DEFAULT_DISPLAY) {
            Intent serviceIntent = new Intent(NotificationService.this, TempBacklightOnService.class);
            U.startService(NotificationService.this, serviceIntent);

            SharedPreferences prefMain = U.getPrefMain(NotificationService.this);
            ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
            boolean displayConnectionServiceRunning = false;

            for(ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
                if(DisplayConnectionService.class.getName().equals(service.service.getClassName()))
                    displayConnectionServiceRunning = true;
            }

            if(prefMain.getBoolean("inactive", true) && !displayConnectionServiceRunning) {
                Intent turnOffIntent = new Intent(NotificationService.this, TurnOffActivity.class);
                turnOffIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(turnOffIntent);
            }
        }
    } catch (ArrayIndexOutOfBoundsException e) { /* Gracefully fail */ }
}
 
Example 9
Source File: StarterService.java    From always-on-amoled with GNU General Public License v3.0 5 votes vote down vote up
boolean isScreenOn() {
    if (Utils.isAndroidNewerThanL()) {
        DisplayManager dm = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
        for (Display display : dm.getDisplays()) {
            if (display.getState() != Display.STATE_OFF) {
                return true;
            }
        }
        return false;
    } else {
        PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
        return powerManager.isScreenOn();
    }
}
 
Example 10
Source File: U.java    From SecondScreen with Apache License 2.0 5 votes vote down vote up
public static int getExternalDisplayID(Context context) {
    SharedPreferences prefCurrent = getPrefCurrent(context);
    int savedID = prefCurrent.getInt("external_display_id", -1);

    if(savedID != -1)
        return savedID;

    DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
    Display[] displays = dm.getDisplays();

    return displays[displays.length - 1].getDisplayId();
}
 
Example 11
Source File: Utils.java    From aosp_screen_stabilization with Apache License 2.0 5 votes vote down vote up
public static boolean isScreenOn(Context context)
{
	DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
	for (Display display : dm.getDisplays())
	{
		if (display.getState() != Display.STATE_OFF)
			return true;
	}
	return false;
}
 
Example 12
Source File: Utils.java    From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 5 votes vote down vote up
public static boolean isScreenOn(Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
        for (Display display : dm.getDisplays()) {
            if (display.getState() != Display.STATE_OFF) {
                return true;
            }
        }
        return false;
    } else {
        PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        return powerManager.isScreenOn();
    }
}
 
Example 13
Source File: ScreenUtils.java    From Reader with Apache License 2.0 5 votes vote down vote up
private static DisplayMetrics getEPDDisplayMetrics() {
    Context context = AppUtils.getAppContext();
    DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
    Display[] presentationDisplays = displayManager.getDisplays();
    Display display;
    if (presentationDisplays.length > 1) {
        display = presentationDisplays[1];
    } else {
        display = presentationDisplays[0];
    }
    DisplayMetrics metrics = new DisplayMetrics();
    display.getRealMetrics(metrics);
    LogUtils.d("widthPixels=" + metrics.widthPixels + " heightPixels=" + metrics.heightPixels);
    return metrics;
}
 
Example 14
Source File: U.java    From Taskbar with Apache License 2.0 4 votes vote down vote up
public static DisplayInfo getDisplayInfo(Context context, boolean fromTaskbar) {
    context = getDisplayContext(context);
    int displayID = getTaskbarDisplayID(context);

    DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
    Display currentDisplay = null;

    for(Display display : dm.getDisplays()) {
        if(display.getDisplayId() == displayID) {
            currentDisplay = display;
            break;
        }
    }

    if(currentDisplay == null)
        return new DisplayInfo(0, 0, 0, 0);

    DisplayMetrics metrics = new DisplayMetrics();
    currentDisplay.getMetrics(metrics);

    DisplayMetrics realMetrics = new DisplayMetrics();
    currentDisplay.getRealMetrics(realMetrics);

    DisplayInfo info = new DisplayInfo(metrics.widthPixels, metrics.heightPixels, metrics.densityDpi, 0);

    if(isChromeOs(context)) {
        SharedPreferences pref = getSharedPreferences(context);
        if(!pref.getBoolean(PREF_CHROME_OS_CONTEXT_MENU_FIX, true)) {
            info.width = realMetrics.widthPixels;
            info.height = realMetrics.heightPixels;
        }

        return info;
    }

    // Workaround for incorrect display size on devices with notches in landscape mode
    if(fromTaskbar && getDisplayOrientation(context) == Configuration.ORIENTATION_LANDSCAPE)
        return info;

    boolean sameWidth = metrics.widthPixels == realMetrics.widthPixels;
    boolean sameHeight = metrics.heightPixels == realMetrics.heightPixels;

    if(sameWidth && !sameHeight) {
        info.width = realMetrics.widthPixels;
        info.height = realMetrics.heightPixels - getNavbarHeight(context);
    }

    if(!sameWidth && sameHeight) {
        info.width = realMetrics.widthPixels - getNavbarHeight(context);
        info.height = realMetrics.heightPixels;
    }

    return info;
}
 
Example 15
Source File: U.java    From Taskbar with Apache License 2.0 4 votes vote down vote up
private static Display getExternalDisplay(Context context) {
    DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
    Display[] displays = dm.getDisplays();

    return displays[displays.length - 1];
}
 
Example 16
Source File: HdmiActivity.java    From SecondScreen with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
private void showMenu() {
    setContentView(R.layout.activity_hdmi);
    setTitle(getResources().getString(R.string.hdmi_connected));
    menu = true;

    TextView header = findViewById(R.id.hdmi_header);
    header.setText(getString(R.string.hdmi_connected));

    if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
        header.setTypeface(Typeface.DEFAULT);

    // Close notification drawer
    Intent closeDrawer = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    sendBroadcast(closeDrawer);

    DisplayManager dm = (DisplayManager) getApplicationContext().getSystemService(DISPLAY_SERVICE);
    DisplayMetrics metrics = new DisplayMetrics();

    Display[] displays = dm.getDisplays();
    displays[displays.length - 1].getRealMetrics(metrics);

    String extScreenRes = metrics.widthPixels + "x" + metrics.heightPixels;

    switch(extScreenRes) {
        case "3840x2160":
            extScreenRes = getResources().getStringArray(R.array.pref_resolution_list)[1];
            break;
        case "1920x1080":
            extScreenRes = getResources().getStringArray(R.array.pref_resolution_list)[2];
            break;
        case "1280x720":
            extScreenRes = getResources().getStringArray(R.array.pref_resolution_list)[3];
            break;
        case "854x480":
            extScreenRes = getResources().getStringArray(R.array.pref_resolution_list)[4];
            break;
    }

    TextView textView = findViewById(R.id.hdmiTextView);
    textView.setText(extScreenRes);

    // Get array of profiles
    final String[][] profileList = U.listProfiles(this);

    // If there are no saved profiles, then show a toast message and exit
    if(profileList == null) {
        U.showToast(this, R.string.no_profiles_found);
        finish();
    } else {
        // Create ArrayList and populate with list of profiles
        ArrayList<String> arrayList = new ArrayList<>(profileList[1].length);
        arrayList.addAll(Arrays.asList(profileList[1]));

        // Create the custom adapter to bind the array to the ListView
        final ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, arrayList);

        // Display the ListView
        final ListView listView = findViewById(R.id.listView3);
        listView.setAdapter(adapter);
        listView.setClickable(true);
        listView.setOnItemClickListener((arg0, arg1, position, arg3) -> {
            U.loadProfile(this, profileList[0][position]);
            finish();
        });
    }
}
 
Example 17
Source File: BootService.java    From SecondScreen with Apache License 2.0 4 votes vote down vote up
@Override
protected void onHandleIntent(Intent intent) {
    super.onHandleIntent(intent);

    // Load preferences
    SharedPreferences prefCurrent = U.getPrefCurrent(this);
    SharedPreferences prefMain = U.getPrefMain(this);

    // Run superuser commands on boot
    final int safeModeDensityCommand = 0;
    final int safeModeSizeCommand = 1;
    final int rotationPreCommand = 2;
    final int rotationCommand = 3;
    final int rotationPostCommand = 4;
    final int vibrationCommand = 5;
    final int backlightCommand = 6;

    // Initialize su array
    String[] su = new String[backlightCommand + 1];
    Arrays.fill(su, "");

    if("auto-rotate".equals(prefCurrent.getString("rotation_lock_new", "do-nothing"))) {
        su[rotationCommand] = U.rotationCommand + Integer.toString(Intent.EXTRA_DOCK_STATE_DESK);
        if(Settings.Secure.getInt(getContentResolver(), "screensaver_enabled", 0) == 1
                && Settings.Secure.getInt(getContentResolver(), "screensaver_activate_on_dock", 0) == 1) {
            su[rotationPreCommand] = U.rotationPrePostCommands + "0";
            su[rotationPostCommand] = U.rotationPrePostCommands + "1";
        }
    }

    if(prefCurrent.getBoolean("vibration_off", false)) {
        // Set vibration command
        for(File vibrationOff : U.vibrationOff) {
            if(vibrationOff.exists()) {
                su[vibrationCommand] = "echo 0 > " + vibrationOff.getAbsolutePath();
                break;
            }
        }
    }

    DisplayManager dm = (DisplayManager) getSystemService(DISPLAY_SERVICE);
    Display[] displays = dm.getDisplays();

    if(prefCurrent.getBoolean("backlight_off", false)
            && (displays[displays.length - 1].getDisplayId() != Display.DEFAULT_DISPLAY
            || prefMain.getBoolean("force_backlight_off", false))) {
        // Turn auto-brightness off so it doesn't mess with things
        Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);

        // Attempt to set screen brightness to 0 first to avoid complications later
        Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 0);

        // Set backlight command
        for(File backlightOff : U.backlightOff) {
            if(backlightOff.exists()) {
                su[backlightCommand] = "sleep 2 && echo 0 > " + backlightOff.getAbsolutePath();
                break;
            }
        }
    }

    if(prefMain.getBoolean("safe_mode", false) && "activity-manager".equals(prefCurrent.getString("ui_refresh", "do-nothing"))) {
        su[safeModeSizeCommand] = U.safeModeSizeCommand("null");
        su[safeModeDensityCommand] = U.safeModeDensityCommand("null");

        SharedPreferences.Editor editor = prefCurrent.edit();
        editor.putString("ui_refresh", "activity-manager-safe-mode");
        editor.commit();
    }

    // Run superuser commands
    U.runCommands(this, su, false);

    // Send broadcast to start Taskbar
    if(prefCurrent.getBoolean("taskbar", false)) {
        Intent taskbarIntent = new Intent("com.farmerbb.taskbar.START");
        taskbarIntent.putExtra("secondscreen", true);
        taskbarIntent.setPackage(U.getTaskbarPackageName(this));

        sendBroadcast(taskbarIntent);
    }
}
 
Example 18
Source File: MiracastWidgetProvider.java    From miracast-widget with Apache License 2.0 4 votes vote down vote up
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
       final int length = appWidgetIds.length;

       for (int i = 0; i < length; i++) {
           int appWidgetId = appWidgetIds[i];

           Intent intent = new Intent(context, MainActivity.class);
           intent.putExtra(MainActivity.EXTRA_WIDGET_LAUNCH, true);
           PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
                                                   intent, PendingIntent.FLAG_UPDATE_CURRENT);

           final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.miracast_widget);
           views.setOnClickPendingIntent(R.id.widget_layout_parent, pendingIntent);
           final DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);

           Display[] displays = displayManager.getDisplays();
           boolean displaySet = false;
           int currentDisplay = -1;
           for(int j = 0; j < displays.length; j++){
           	Display display = displays[j];
           	if(display.getDisplayId() != Display.DEFAULT_DISPLAY){
                   views.setTextViewText(R.id.widget_text, display.getName());
                   views.setTextColor(R.id.widget_text, context.getResources().getColor(android.R.color.holo_blue_bright));
                   currentDisplay = display.getDisplayId();
                   displaySet = true;

                   // Track this
                   MiracastApplication application
                           = (MiracastApplication) context.getApplicationContext();
                   Tracker tracker = application.getDefaultTracker();
                   sendEventDisplayFound(tracker);
           	}
           }
           
           if(!displaySet){
               views.setTextViewText(R.id.widget_text, "Cast Screen");
               views.setTextColor(R.id.widget_text, context.getResources().getColor(android.R.color.white));
           }

           MiracastDisplayListener displayListener = new MiracastDisplayListener(currentDisplay, views, displayManager, appWidgetManager, appWidgetId, context);
           displayManager.registerDisplayListener(displayListener, null);

           // Tell the AppWidgetManager to perform an update on the current app widget
           appWidgetManager.updateAppWidget(appWidgetId, views);
       }
   }
 
Example 19
Source File: PowerUtils.java    From AcDisplay with GNU General Public License v2.0 4 votes vote down vote up
@SuppressLint("NewApi")
public static boolean isScreenOn(@NonNull Context context) {
    display_api:
    if (Device.hasKitKatWatchApi()) {
        DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
        Display[] displays = dm.getDisplays(null);
        Display display = null;
        if (displays == null || displays.length == 0) {
            break display_api;
        } else if (displays.length > 1) {
            Timber.tag(TAG).i("The number of logical displays is " + displays.length);
        }

        for (Display d : displays) {
            final boolean virtual = Operator.bitAnd(d.getFlags(), Display.FLAG_PRESENTATION);
            if (d.isValid() && !virtual) {
                display = d;

                final int type;
                try {
                    Method method = Display.class.getDeclaredMethod("getType");
                    method.setAccessible(true);
                    type = (int) method.invoke(d);
                } catch (Exception e) {
                    continue;
                }

                if (type == 1 /* built-in display */) {
                    break;
                }
            }
        }

        if (display == null) {
            return false;
        }

        Timber.tag(TAG).i("Display state=" + display.getState());
        return display.getState() == Display.STATE_ON;
    }
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    return isInteractive(pm);
}
 
Example 20
Source File: NotificationService.java    From an2linuxclient with GNU General Public License v3.0 4 votes vote down vote up
private boolean filter(StatusBarNotification sbn) {
    String packageName = sbn.getPackageName();
    if (!globalEnabled() || !appEnabled(packageName)) {
        return false;
    }
    boolean usingCustomSettings = isUsingCustomSettings(packageName);
    SharedPreferences sp;
    if (usingCustomSettings) {
        sp = getSharedPreferences(getString(R.string.notification_settings_custom), MODE_PRIVATE);
    } else {
        sp = getSharedPreferences(getString(R.string.notification_settings_global), MODE_PRIVATE);
    }

    boolean isAn2linuxTestNotification = packageName.startsWith("kiwi.root.an2linuxclient");
    if (dontSendIfScreenIsOn(sp, packageName, usingCustomSettings) && !isAn2linuxTestNotification) {
        boolean screenIsOn = false;

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
            DisplayManager dm = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
            for (Display display : dm.getDisplays()) {
                if (display.getState() == Display.STATE_ON) {
                    // private as in samsung always-on feature, not sure if this is how it works
                    // https://stackoverflow.com/questions/2474367/how-can-i-tell-if-the-screen-is-on-in-android#comment71534994_17348755
                    boolean displayIsPrivate = (display.getFlags() & Display.FLAG_PRIVATE) == Display.FLAG_PRIVATE;
                    if (!displayIsPrivate) {
                        screenIsOn = true;
                        break;
                    }
                }
            }
        } else {
            PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
            if (powerManager.isScreenOn()){
                screenIsOn = true;
            }
        }

        if (screenIsOn) {
            return false;
        }
    }

    int flags = sbn.getNotification().flags;
    if (isOngoing(flags) && blockOngoing(sp, packageName, usingCustomSettings)){
        return false;
    }
    if (isForeground(flags) && blockForeground(sp, packageName, usingCustomSettings)){
        return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH){
        if (isGroupSummary(flags) && blockGroupSummary(sp, packageName, usingCustomSettings)){
            return false;
        }
        if (isLocalOnly(flags) && blockLocalOnly(sp, packageName, usingCustomSettings)){
            return false;
        }
    }
    return priorityAllowed(sp, packageName, usingCustomSettings, sbn.getNotification().priority);
}