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 29 public RingerAttributes.Builder setEndEarly(boolean endEarly) { 30 mEndEarly = endEarly; 31 return this; 32 } 33 34 public RingerAttributes.Builder setLetDialerHandleRinging(boolean letDialerHandleRinging) { 35 mLetDialerHandleRinging = letDialerHandleRinging; 36 return this; 37 } 38 39 public RingerAttributes.Builder setAcquireAudioFocus(boolean acquireAudioFocus) { 40 mAcquireAudioFocus = acquireAudioFocus; 41 return this; 42 } 43 44 public RingerAttributes.Builder setRingerAudible(boolean ringerAudible) { 45 mRingerAudible = ringerAudible; 46 return this; 47 } 48 49 public RingerAttributes.Builder setInaudibleReason(String inaudibleReason) { 50 mInaudibleReason = inaudibleReason; 51 return this; 52 } 53 54 public RingerAttributes.Builder setShouldRingForContact(boolean shouldRingForContact) { 55 mShouldRingForContact = shouldRingForContact; 56 return this; 57 } 58 59 public RingerAttributes.Builder setSilentRingingRequested(boolean silentRingingRequested) { 60 mSilentRingingRequested = silentRingingRequested; 61 return this; 62 } 63 64 public RingerAttributes build() { 65 return new RingerAttributes(mEndEarly, mLetDialerHandleRinging, mAcquireAudioFocus, 66 mRingerAudible, mInaudibleReason, mShouldRingForContact, 67 mSilentRingingRequested); 68 } 69 } 70 71 private boolean mEndEarly; 72 private boolean mLetDialerHandleRinging; 73 private boolean mAcquireAudioFocus; 74 private boolean mRingerAudible; 75 private String mInaudibleReason; 76 private boolean mShouldRingForContact; 77 private boolean mSilentRingingRequested; 78 79 private RingerAttributes(boolean endEarly, boolean letDialerHandleRinging, 80 boolean acquireAudioFocus, boolean ringerAudible, String inaudibleReason, 81 boolean shouldRingForContact, boolean silentRingingRequested) { 82 mEndEarly = endEarly; 83 mLetDialerHandleRinging = letDialerHandleRinging; 84 mAcquireAudioFocus = acquireAudioFocus; 85 mRingerAudible = ringerAudible; 86 mInaudibleReason = inaudibleReason; 87 mShouldRingForContact = shouldRingForContact; 88 mSilentRingingRequested = silentRingingRequested; 89 } 90 91 public boolean isEndEarly() { 92 return mEndEarly; 93 } 94 95 public boolean letDialerHandleRinging() { 96 return mLetDialerHandleRinging; 97 } 98 99 public boolean shouldAcquireAudioFocus() { 100 return mAcquireAudioFocus; 101 } 102 103 public boolean isRingerAudible() { 104 return mRingerAudible; 105 } 106 107 public String getInaudibleReason() { 108 return mInaudibleReason; 109 } 110 111 public boolean shouldRingForContact() { 112 return mShouldRingForContact; 113 } 114 115 public boolean isSilentRingingRequested() { 116 return mSilentRingingRequested; 117 } 118 } 119