summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/speakeasy
diff options
context:
space:
mode:
authorerfanian <erfanian@google.com>2018-01-10 15:08:47 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-10 15:26:00 -0800
commit7b94d1e8ca0ad2f89a640192e02c5a59ad37f4f2 (patch)
treef10cf944a9d908f707ce62686f8a741ca1bdbb51 /java/com/android/incallui/speakeasy
parenta544dfcb17c4d1a2db5295d1e27ef47b6d0da82c (diff)
Add the boilerplate dagger logic for SpeakEasy.
Test: NONE PiperOrigin-RevId: 181524242 Change-Id: If5d3632421722b4da7b64f78d904b58723408b7c
Diffstat (limited to 'java/com/android/incallui/speakeasy')
-rw-r--r--java/com/android/incallui/speakeasy/SpeakEasy.java24
-rw-r--r--java/com/android/incallui/speakeasy/SpeakEasyComponent.java39
-rw-r--r--java/com/android/incallui/speakeasy/SpeakEasyStub.java31
-rw-r--r--java/com/android/incallui/speakeasy/StubSpeakEasyModule.java28
4 files changed, 122 insertions, 0 deletions
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);
+}