1 /*
2  * Copyright (C) 2020 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.server.telecom;
18 
19 public class RingerAttributes {
20     public static class Builder {
21         private boolean mEndEarly;
22         private boolean mLetDialerHandleRinging;
23         private boolean mAcquireAudioFocus;
24         private boolean mRingerAudible;
25         private String mInaudibleReason;
26         private boolean mShouldRingForContact;
27         private boolean mSilentRingingRequested;
28         private boolean mWorkProfileQuietMode;
29 
setEndEarly(boolean endEarly)30         public RingerAttributes.Builder setEndEarly(boolean endEarly) {
31             mEndEarly = endEarly;
32             return this;
33         }
34 
setLetDialerHandleRinging(boolean letDialerHandleRinging)35         public RingerAttributes.Builder setLetDialerHandleRinging(boolean letDialerHandleRinging) {
36             mLetDialerHandleRinging = letDialerHandleRinging;
37             return this;
38         }
39 
setAcquireAudioFocus(boolean acquireAudioFocus)40         public RingerAttributes.Builder setAcquireAudioFocus(boolean acquireAudioFocus) {
41             mAcquireAudioFocus = acquireAudioFocus;
42             return this;
43         }
44 
setRingerAudible(boolean ringerAudible)45         public RingerAttributes.Builder setRingerAudible(boolean ringerAudible) {
46             mRingerAudible = ringerAudible;
47             return this;
48         }
49 
setInaudibleReason(String inaudibleReason)50         public RingerAttributes.Builder setInaudibleReason(String inaudibleReason) {
51             mInaudibleReason = inaudibleReason;
52             return this;
53         }
54 
setShouldRingForContact(boolean shouldRingForContact)55         public RingerAttributes.Builder setShouldRingForContact(boolean shouldRingForContact) {
56             mShouldRingForContact = shouldRingForContact;
57             return this;
58         }
59 
setSilentRingingRequested(boolean silentRingingRequested)60         public RingerAttributes.Builder setSilentRingingRequested(boolean silentRingingRequested) {
61             mSilentRingingRequested = silentRingingRequested;
62             return this;
63         }
64 
setWorkProfileQuietMode(boolean workProfileQuietMode)65         public RingerAttributes.Builder setWorkProfileQuietMode(boolean workProfileQuietMode) {
66             mWorkProfileQuietMode = workProfileQuietMode;
67             return this;
68         }
69 
build()70         public RingerAttributes build() {
71             return new RingerAttributes(mEndEarly, mLetDialerHandleRinging, mAcquireAudioFocus,
72                     mRingerAudible, mInaudibleReason, mShouldRingForContact,
73                     mSilentRingingRequested, mWorkProfileQuietMode);
74         }
75     }
76 
77     private boolean mEndEarly;
78     private boolean mLetDialerHandleRinging;
79     private boolean mAcquireAudioFocus;
80     private boolean mRingerAudible;
81     private String mInaudibleReason;
82     private boolean mShouldRingForContact;
83     private boolean mSilentRingingRequested;
84     private boolean mWorkProfileQuietMode;
85 
RingerAttributes(boolean endEarly, boolean letDialerHandleRinging, boolean acquireAudioFocus, boolean ringerAudible, String inaudibleReason, boolean shouldRingForContact, boolean silentRingingRequested, boolean workProfileQuietMode)86     private RingerAttributes(boolean endEarly, boolean letDialerHandleRinging,
87             boolean acquireAudioFocus, boolean ringerAudible, String inaudibleReason,
88             boolean shouldRingForContact, boolean silentRingingRequested,
89             boolean workProfileQuietMode) {
90         mEndEarly = endEarly;
91         mLetDialerHandleRinging = letDialerHandleRinging;
92         mAcquireAudioFocus = acquireAudioFocus;
93         mRingerAudible = ringerAudible;
94         mInaudibleReason = inaudibleReason;
95         mShouldRingForContact = shouldRingForContact;
96         mSilentRingingRequested = silentRingingRequested;
97         mWorkProfileQuietMode = workProfileQuietMode;
98     }
99 
isEndEarly()100     public boolean isEndEarly() {
101         return mEndEarly;
102     }
103 
letDialerHandleRinging()104     public boolean letDialerHandleRinging() {
105         return mLetDialerHandleRinging;
106     }
107 
shouldAcquireAudioFocus()108     public boolean shouldAcquireAudioFocus() {
109         return mAcquireAudioFocus;
110     }
111 
isRingerAudible()112     public boolean isRingerAudible() {
113         return mRingerAudible;
114     }
115 
getInaudibleReason()116     public String getInaudibleReason() {
117         return mInaudibleReason;
118     }
119 
shouldRingForContact()120     public boolean shouldRingForContact() {
121         return mShouldRingForContact;
122     }
123 
isSilentRingingRequested()124     public boolean isSilentRingingRequested() {
125         return mSilentRingingRequested;
126     }
127 
isWorkProfileInQuietMode()128     public boolean isWorkProfileInQuietMode() {
129         return mWorkProfileQuietMode;
130     }
131 }
132