• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.dialer.spam;
18 
19 import android.content.Context;
20 import android.content.Intent;
21 
22 /** Allows the container application to interact with spam settings. */
23 public interface SpamSettings {
24 
25   /** @return if spam module is enabled */
isSpamEnabled()26   boolean isSpamEnabled();
27 
28   /** @return if spam after call notification is enabled */
isSpamNotificationEnabled()29   boolean isSpamNotificationEnabled();
30 
31   /** @return if spam blocking is enabled */
isSpamBlockingEnabled()32   boolean isSpamBlockingEnabled();
33 
34   /** @return if spam blocking user setting is controlled by carrier */
isSpamBlockingControlledByCarrier()35   boolean isSpamBlockingControlledByCarrier();
36 
37   /** @return if spam blocking module is enabled by flag */
isSpamBlockingEnabledByFlag()38   boolean isSpamBlockingEnabledByFlag();
39 
40   /** @return if spam blocking setting is enabled by user */
isSpamBlockingEnabledByUser()41   boolean isSpamBlockingEnabledByUser();
42 
43   /** @return if dialog is used by default for spam after call notification */
isDialogEnabledForSpamNotification()44   boolean isDialogEnabledForSpamNotification();
45 
46   /** @return if report spam is checked by default in block/report dialog */
isDialogReportSpamCheckedByDefault()47   boolean isDialogReportSpamCheckedByDefault();
48 
49   /** @return percentage of after call notifications for spam numbers to show to the user */
percentOfSpamNotificationsToShow()50   int percentOfSpamNotificationsToShow();
51 
52   /** @return percentage of after call notifications for nonspam numbers to show to the user */
percentOfNonSpamNotificationsToShow()53   int percentOfNonSpamNotificationsToShow();
54 
55   /**
56    * Modifies spam blocking setting.
57    *
58    * @param enabled Whether to enable or disable the setting.
59    * @param listener The callback to be invoked after setting change is done.
60    */
modifySpamBlockingSetting(boolean enabled, ModifySettingListener listener)61   void modifySpamBlockingSetting(boolean enabled, ModifySettingListener listener);
62 
63   /** @return an intent to start spam blocking setting */
getSpamBlockingSettingIntent(Context context)64   Intent getSpamBlockingSettingIntent(Context context);
65 
66   /** Callback to be invoked when setting change completes. */
67   interface ModifySettingListener {
68 
69     /** Called when setting change completes. */
onComplete(boolean success)70     void onComplete(boolean success);
71   }
72 }
73