diff options
Diffstat (limited to 'java')
7 files changed, 138 insertions, 10 deletions
diff --git a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java index c344fad62..1be675925 100644 --- a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java +++ b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java @@ -34,6 +34,7 @@ import com.android.dialer.storage.StorageModule; import com.android.dialer.strictmode.impl.SystemStrictModeModule; import com.android.incallui.calllocation.stub.StubCallLocationModule; import com.android.incallui.maps.stub.StubMapsModule; +import com.android.incallui.speakeasy.StubSpeakEasyModule; import com.android.voicemail.impl.VoicemailModule; import dagger.Component; import javax.inject.Singleton; @@ -51,15 +52,16 @@ import javax.inject.Singleton; SharedPrefConfigProviderModule.class, SimulatorModule.class, StorageModule.class, - SystemStrictModeModule.class, StubCallLocationModule.class, StubDuoModule.class, StubEnrichedCallModule.class, + StubFeedbackModule.class, StubMapsModule.class, - VoicemailModule.class, StubSimSuggestionModule.class, - StubFeedbackModule.class, StubSpamModule.class, + StubSpeakEasyModule.class, + SystemStrictModeModule.class, + VoicemailModule.class, } ) public interface AospDialerRootComponent extends BaseDialerRootComponent {} diff --git a/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java b/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java index 20152af03..37e04ac82 100644 --- a/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java +++ b/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java @@ -35,6 +35,7 @@ import com.android.dialer.storage.StorageComponent; import com.android.dialer.strictmode.StrictModeComponent; import com.android.incallui.calllocation.CallLocationComponent; import com.android.incallui.maps.MapsComponent; +import com.android.incallui.speakeasy.SpeakEasyComponent; import com.android.voicemail.VoicemailComponent; /** @@ -58,7 +59,8 @@ public interface BaseDialerRootComponent PreCallComponent.HasComponent, SimSuggestionComponent.HasComponent, SimulatorComponent.HasComponent, + SpamComponent.HasComponent, + SpeakEasyComponent.HasComponent, StorageComponent.HasComponent, StrictModeComponent.HasComponent, - VoicemailComponent.HasComponent, - SpamComponent.HasComponent {} + VoicemailComponent.HasComponent {} diff --git a/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java index b54e06229..d9d0d26f1 100644 --- a/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java +++ b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java @@ -34,6 +34,7 @@ import com.android.dialer.storage.StorageModule; import com.android.dialer.strictmode.impl.SystemStrictModeModule; import com.android.incallui.calllocation.impl.CallLocationModule; import com.android.incallui.maps.impl.MapsModule; +import com.android.incallui.speakeasy.StubSpeakEasyModule; import com.android.voicemail.impl.VoicemailModule; import dagger.Component; import javax.inject.Singleton; @@ -49,20 +50,21 @@ import javax.inject.Singleton; CallLogModule.class, ContextModule.class, DialerExecutorModule.class, + MapsModule.class, PhoneLookupModule.class, // TODO(zachh): Module which uses APDL? PhoneNumberGeoUtilModule.class, PreCallModule.class, - StubSimSuggestionModule.class, SharedPrefConfigProviderModule.class, SimulatorModule.class, StorageModule.class, - SystemStrictModeModule.class, - StubEnrichedCallModule.class, - MapsModule.class, - VoicemailModule.class, StubDuoModule.class, + StubEnrichedCallModule.class, StubFeedbackModule.class, + StubSimSuggestionModule.class, StubSpamModule.class, + StubSpeakEasyModule.class, + SystemStrictModeModule.class, + VoicemailModule.class, } ) public interface GoogleStubDialerRootComponent extends BaseDialerRootComponent {} diff --git a/java/com/android/incallui/speakeasy/SpeakEasy.java b/java/com/android/incallui/speakeasy/SpeakEasy.java new file mode 100644 index 000000000..393072c39 --- /dev/null +++ b/java/com/android/incallui/speakeasy/SpeakEasy.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.incallui.speakeasy; + +/** This interface provides a wrapper between callers and the Whisper client. */ +public interface SpeakEasy { + + /** Signals to the user interface that the feature is abailable for use. */ + boolean isEnabled(); +} diff --git a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java new file mode 100644 index 000000000..13f5e97fe --- /dev/null +++ b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.incallui.speakeasy; + +import android.content.Context; +import com.android.dialer.inject.HasRootComponent; +import dagger.Subcomponent; + +/** Dagger component to get SpeakEasy. */ +@Subcomponent +public abstract class SpeakEasyComponent { + + public abstract SpeakEasy speakEasy(); + + public static SpeakEasyComponent get(Context context) { + return ((SpeakEasyComponent.HasComponent) + ((HasRootComponent) context.getApplicationContext()).component()) + .speakEasyComponent(); + } + + /** Used to refer to the root application component. */ + public interface HasComponent { + SpeakEasyComponent speakEasyComponent(); + } +} diff --git a/java/com/android/incallui/speakeasy/SpeakEasyStub.java b/java/com/android/incallui/speakeasy/SpeakEasyStub.java new file mode 100644 index 000000000..5e8a84ab8 --- /dev/null +++ b/java/com/android/incallui/speakeasy/SpeakEasyStub.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.incallui.speakeasy; + +import javax.inject.Inject; + +/** Default implementation of SpeakEasy. */ +public class SpeakEasyStub implements SpeakEasy { + + @Inject + public SpeakEasyStub() {} + + @Override + public boolean isEnabled() { + return false; + } +} diff --git a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java new file mode 100644 index 000000000..9a6f47677 --- /dev/null +++ b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.incallui.speakeasy; + +import dagger.Binds; +import dagger.Module; + +/** Module which binds {@link SpeakEasyStub}. */ +@Module +public abstract class StubSpeakEasyModule { + + @Binds + abstract SpeakEasy bindsSpeakEasy(SpeakEasyStub stub); +} |