Add flag to control blocking Smart Replies for apps targeting an Android version below P.

Bug: 73802997

Test: atest SmartReplyConstantsTest

Change-Id: Id340cba09da7931ff6a4689802b3a5f594852a72
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
index c5067a6..7b0b8004 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
@@ -33,13 +33,16 @@
     private static final String TAG = "SmartReplyConstants";
 
     private static final String KEY_ENABLED = "enabled";
+    private static final String KEY_REQUIRES_TARGETING_P = "requires_targeting_p";
     private static final String KEY_MAX_SQUEEZE_REMEASURE_ATTEMPTS =
             "max_squeeze_remeasure_attempts";
 
     private final boolean mDefaultEnabled;
+    private final boolean mDefaultRequiresP;
     private final int mDefaultMaxSqueezeRemeasureAttempts;
 
     private boolean mEnabled;
+    private boolean mRequiresTargetingP;
     private int mMaxSqueezeRemeasureAttempts;
 
     private final Context mContext;
@@ -52,6 +55,8 @@
         final Resources resources = mContext.getResources();
         mDefaultEnabled = resources.getBoolean(
                 R.bool.config_smart_replies_in_notifications_enabled);
+        mDefaultRequiresP = resources.getBoolean(
+                R.bool.config_smart_replies_in_notifications_requires_targeting_p);
         mDefaultMaxSqueezeRemeasureAttempts = resources.getInteger(
                 R.integer.config_smart_replies_in_notifications_max_squeeze_remeasure_attempts);
 
@@ -75,6 +80,7 @@
                 Log.e(TAG, "Bad smart reply constants", e);
             }
             mEnabled = mParser.getBoolean(KEY_ENABLED, mDefaultEnabled);
+            mRequiresTargetingP = mParser.getBoolean(KEY_REQUIRES_TARGETING_P, mDefaultRequiresP);
             mMaxSqueezeRemeasureAttempts = mParser.getInt(
                     KEY_MAX_SQUEEZE_REMEASURE_ATTEMPTS, mDefaultMaxSqueezeRemeasureAttempts);
         }
@@ -86,6 +92,14 @@
     }
 
     /**
+     * Returns whether smart replies in notifications should be disabled when the app targets a
+     * version of Android older than P.
+     */
+    public boolean requiresTargetingP() {
+        return mRequiresTargetingP;
+    }
+
+    /**
      * Returns the maximum number of times {@link SmartReplyView#onMeasure(int, int)} will try to
      * find a better (narrower) line-break for a double-line smart reply button.
      */