From 2d6bc36921c4a41b17bc1870c133ee42f1388b51 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 19 Jun 2017 17:28:33 -0700 Subject: Add "Simulator" for Enriched Calling An annoying part of development on enriched calling is that it was difficult to determine what sessions were in memory. We have a number of bugs related to incorrect sessions being shown, and knowing exactly what sessions are available in memory can help debug them. This CL adds a "Simulator" for enriched calling. This is more of a debug tool than a simulator since it doesn't yet support adding a new enriched calling session. To allow the simulator to view all of the sessions in memory, a new EnrichedCallManager API was introduced: getAllSessionsView. This API was designed in a way to prevent abuse, so it returns a list of string representations of the sessions. Just returning the full list of sessions would have allowed clients to bypass the getSession logic and examine sessions that shouldn't be available. Also in this change: * Integrate changes to form a base for future copybara imports. Test: TH PiperOrigin-RevId: 159445010 Change-Id: Ie8fc35d817a4e3b0eac37e0c34a6592060c43b23 --- Android.mk | 43 +++++--- AndroidManifest.xml | 1 + CONTRIBUTING | 27 ----- .../android/contacts/common/res/values/colors.xml | 1 + .../about/res/raw/third_party_license_metadata | 0 .../dialer/about/res/raw/third_party_licenses | 0 .../res/drawable-hdpi/ic_dialer_fork_add_call.png | Bin .../drawable-hdpi/ic_dialer_fork_current_call.png | Bin .../res/drawable-hdpi/ic_dialer_fork_tt_keypad.png | Bin .../dialer/binary/google/AndroidManifest.xml | 118 +++++++++++++++++++++ .../binary/google/GoogleStubDialerApplication.java | 37 +++++++ .../google/GoogleStubDialerRootComponent.java | 52 +++++++++ .../buildtype/bugfood/BuildTypeAccessorImpl.java | 30 ++++++ .../buildtype/dogfood/BuildTypeAccessorImpl.java | 30 ++++++ .../buildtype/fishfood/BuildTypeAccessorImpl.java | 30 ++++++ .../buildtype/test/BuildTypeAccessorImpl.java | 30 ++++++ .../dialer/callintent/call_initiation_type.proto | 1 + .../calllog/testing/FakeCallLogApplication.java | 53 --------- .../constants/googledialer/ConstantsImpl.java | 43 ++++++++ .../dialer/enrichedcall/EnrichedCallManager.java | 9 ++ .../enrichedcall/simulator/AndroidManifest.xml | 26 +++++ .../simulator/EnrichedCallSimulatorActivity.java | 110 +++++++++++++++++++ .../enrichedcall/simulator/SessionViewHolder.java | 37 +++++++ .../enrichedcall/simulator/SessionsAdapter.java | 51 +++++++++ .../layout/enriched_call_simulator_activity.xml | 38 +++++++ .../simulator/res/layout/session_view_holder.xml | 23 ++++ .../enrichedcall/simulator/res/values/strings.xml | 24 +++++ .../enrichedcall/stub/EnrichedCallManagerStub.java | 9 ++ .../res/layout/phone_disambig_item.xml | 0 .../dialer/logging/contact_lookup_result.proto | 1 + .../android/dialer/logging/contact_source.proto | 1 + .../android/dialer/logging/dialer_impression.proto | 23 ++++ .../android/dialer/logging/interaction_event.proto | 1 + .../dialer/logging/reporting_location.proto | 1 + java/com/android/dialer/logging/screen_event.proto | 1 + java/com/android/dialer/logging/ui_action.proto | 1 + java/com/android/dialer/searchfragment/README.md | 4 +- .../simulator/impl/SimulatorActionProvider.java | 8 ++ .../incallui/calllocation/impl/AndroidManifest.xml | 1 + .../android/incallui/maps/impl/AndroidManifest.xml | 1 + .../android/voicemail/impl/res/xml/vvm_config.xml | 1 + 41 files changed, 770 insertions(+), 97 deletions(-) delete mode 100644 CONTRIBUTING mode change 100644 => 100755 java/com/android/dialer/about/res/raw/third_party_license_metadata mode change 100644 => 100755 java/com/android/dialer/about/res/raw/third_party_licenses mode change 100644 => 100755 java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_add_call.png mode change 100644 => 100755 java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_current_call.png mode change 100644 => 100755 java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png create mode 100644 java/com/android/dialer/binary/google/AndroidManifest.xml create mode 100644 java/com/android/dialer/binary/google/GoogleStubDialerApplication.java create mode 100644 java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java create mode 100644 java/com/android/dialer/buildtype/bugfood/BuildTypeAccessorImpl.java create mode 100644 java/com/android/dialer/buildtype/dogfood/BuildTypeAccessorImpl.java create mode 100644 java/com/android/dialer/buildtype/fishfood/BuildTypeAccessorImpl.java create mode 100644 java/com/android/dialer/buildtype/test/BuildTypeAccessorImpl.java delete mode 100644 java/com/android/dialer/calllog/testing/FakeCallLogApplication.java create mode 100644 java/com/android/dialer/constants/googledialer/ConstantsImpl.java create mode 100644 java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml create mode 100644 java/com/android/dialer/enrichedcall/simulator/EnrichedCallSimulatorActivity.java create mode 100644 java/com/android/dialer/enrichedcall/simulator/SessionViewHolder.java create mode 100644 java/com/android/dialer/enrichedcall/simulator/SessionsAdapter.java create mode 100644 java/com/android/dialer/enrichedcall/simulator/res/layout/enriched_call_simulator_activity.xml create mode 100644 java/com/android/dialer/enrichedcall/simulator/res/layout/session_view_holder.xml create mode 100644 java/com/android/dialer/enrichedcall/simulator/res/values/strings.xml mode change 100644 => 100755 java/com/android/dialer/interactions/res/layout/phone_disambig_item.xml diff --git a/Android.mk b/Android.mk index dc34cc4a4..15bf8bcae 100644 --- a/Android.mk +++ b/Android.mk @@ -33,7 +33,6 @@ SRC_DIRS := \ # Exclude files incompatible with AOSP. EXCLUDE_FILES := \ - $(BASE_DIR)/dialer/calllog/testing/FakeCallLogApplication.java \ $(BASE_DIR)/incallui/calllocation/impl/AuthException.java \ $(BASE_DIR)/incallui/calllocation/impl/CallLocationImpl.java \ $(BASE_DIR)/incallui/calllocation/impl/CallLocationModule.java \ @@ -54,6 +53,16 @@ EXCLUDE_FILES := \ EXCLUDE_FILES += \ $(BASE_DIR)/contacts/common/format/testing/SpannedTestUtils.java +# Exclude build variants for now +EXCLUDE_FILES += \ + $(BASE_DIR)/dialer/buildtype/bugfood/BuildTypeAccessorImpl.java \ + $(BASE_DIR)/dialer/buildtype/dogfood/BuildTypeAccessorImpl.java \ + $(BASE_DIR)/dialer/buildtype/fishfood/BuildTypeAccessorImpl.java \ + $(BASE_DIR)/dialer/buildtype/test/BuildTypeAccessorImpl.java \ + $(BASE_DIR)/dialer/constants/googledialer/ConstantsImpl.java \ + $(BASE_DIR)/dialer/binary/google/GoogleStubDialerRootComponent.java \ + $(BASE_DIR)/dialer/binary/google/GoogleStubDialerApplication.java + # All Dialers resources. # find . -type d -name "res" | uniq | sort RES_DIRS := \ @@ -74,22 +83,23 @@ RES_DIRS := \ $(BASE_DIR)/dialer/contactactions/res \ $(BASE_DIR)/dialer/contactsfragment/res \ $(BASE_DIR)/dialer/dialpadview/res \ + $(BASE_DIR)/dialer/enrichedcall/simulator/res \ $(BASE_DIR)/dialer/interactions/res \ $(BASE_DIR)/dialer/main/impl/res \ $(BASE_DIR)/dialer/notification/res \ $(BASE_DIR)/dialer/oem/res \ $(BASE_DIR)/dialer/phonenumberutil/res \ $(BASE_DIR)/dialer/postcall/res \ + $(BASE_DIR)/dialer/searchfragment/common/res \ $(BASE_DIR)/dialer/searchfragment/list/res \ $(BASE_DIR)/dialer/searchfragment/nearbyplaces/res \ - $(BASE_DIR)/dialer/searchfragment/common/res \ + $(BASE_DIR)/dialershared/bubble/res \ $(BASE_DIR)/dialer/shortcuts/res \ $(BASE_DIR)/dialer/speeddial/res \ $(BASE_DIR)/dialer/theme/res \ $(BASE_DIR)/dialer/util/res \ $(BASE_DIR)/dialer/voicemailstatus/res \ $(BASE_DIR)/dialer/widget/res \ - $(BASE_DIR)/dialershared/bubble/res \ $(BASE_DIR)/incallui/answer/impl/affordance/res \ $(BASE_DIR)/incallui/answer/impl/answermethod/res \ $(BASE_DIR)/incallui/answer/impl/hint/res \ @@ -132,15 +142,17 @@ DIALER_MANIFEST_FILES += \ $(BASE_DIR)/dialer/contactactions/AndroidManifest.xml \ $(BASE_DIR)/dialer/contactsfragment/AndroidManifest.xml \ $(BASE_DIR)/dialer/dialpadview/AndroidManifest.xml \ + $(BASE_DIR)/dialer/enrichedcall/simulator/AndroidManifest.xml \ $(BASE_DIR)/dialer/interactions/AndroidManifest.xml \ $(BASE_DIR)/dialer/main/impl/AndroidManifest.xml \ $(BASE_DIR)/dialer/notification/AndroidManifest.xml \ $(BASE_DIR)/dialer/oem/AndroidManifest.xml \ $(BASE_DIR)/dialer/phonenumberutil/AndroidManifest.xml \ $(BASE_DIR)/dialer/postcall/AndroidManifest.xml \ + $(BASE_DIR)/dialer/searchfragment/common/AndroidManifest.xml \ $(BASE_DIR)/dialer/searchfragment/list/AndroidManifest.xml \ $(BASE_DIR)/dialer/searchfragment/nearbyplaces/AndroidManifest.xml \ - $(BASE_DIR)/dialer/searchfragment/common/AndroidManifest.xml \ + $(BASE_DIR)/dialershared/bubble/AndroidManifest.xml \ $(BASE_DIR)/dialer/shortcuts/AndroidManifest.xml \ $(BASE_DIR)/dialer/simulator/impl/AndroidManifest.xml \ $(BASE_DIR)/dialer/speeddial/AndroidManifest.xml \ @@ -148,7 +160,6 @@ DIALER_MANIFEST_FILES += \ $(BASE_DIR)/dialer/util/AndroidManifest.xml \ $(BASE_DIR)/dialer/voicemailstatus/AndroidManifest.xml \ $(BASE_DIR)/dialer/widget/AndroidManifest.xml \ - $(BASE_DIR)/dialershared/bubble/AndroidManifest.xml \ $(BASE_DIR)/incallui/AndroidManifest.xml \ $(BASE_DIR)/incallui/answer/impl/affordance/AndroidManifest.xml \ $(BASE_DIR)/incallui/answer/impl/AndroidManifest.xml \ @@ -166,8 +177,8 @@ DIALER_MANIFEST_FILES += \ $(BASE_DIR)/incallui/video/impl/AndroidManifest.xml \ $(BASE_DIR)/incallui/video/protocol/AndroidManifest.xml \ $(BASE_DIR)/incallui/wifi/AndroidManifest.xml \ - $(BASE_DIR)/voicemail/impl/AndroidManifest.xml \ $(BASE_DIR)/voicemail/AndroidManifest.xml \ + $(BASE_DIR)/voicemail/impl/AndroidManifest.xml \ # Merge all manifest files. @@ -206,22 +217,23 @@ LOCAL_AAPT_FLAGS := \ --extra-packages com.android.dialer.contactactions \ --extra-packages com.android.dialer.contactsfragment \ --extra-packages com.android.dialer.dialpadview \ + --extra-packages com.android.dialer.enrichedcall.simulator \ --extra-packages com.android.dialer.interactions \ --extra-packages com.android.dialer.main.impl \ --extra-packages com.android.dialer.notification \ --extra-packages com.android.dialer.oem \ --extra-packages com.android.dialer.phonenumberutil \ --extra-packages com.android.dialer.postcall \ + --extra-packages com.android.dialer.searchfragment.common \ --extra-packages com.android.dialer.searchfragment.list \ --extra-packages com.android.dialer.searchfragment.nearbyplaces \ - --extra-packages com.android.dialer.searchfragment.common \ + --extra-packages com.android.dialershared.bubble \ --extra-packages com.android.dialer.shortcuts \ --extra-packages com.android.dialer.speeddial \ --extra-packages com.android.dialer.theme \ --extra-packages com.android.dialer.util \ --extra-packages com.android.dialer.voicemailstatus \ --extra-packages com.android.dialer.widget \ - --extra-packages com.android.dialershared.bubble \ --extra-packages com.android.incallui \ --extra-packages com.android.incallui.answer.impl \ --extra-packages com.android.incallui.answer.impl.affordance \ @@ -249,7 +261,8 @@ LOCAL_AAPT_FLAGS := \ --extra-packages com.android.voicemail.impl.fetch \ --extra-packages com.android.voicemail.impl.settings \ --extra-packages com.android.voicemail.settings \ - --extra-packages me.leolin.shortcutbadger + --extra-packages me.leolin.shortcutbadger \ + LOCAL_STATIC_JAVA_LIBRARIES := \ android-common \ @@ -260,12 +273,12 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ dialer-disklrucache-target \ dialer-gifdecoder-target \ dialer-glide-target \ - dialer-guava-target \ dialer-grpc-all-target \ dialer-grpc-core-target \ dialer-grpc-okhttp-target \ dialer-grpc-protobuf-lite-target \ dialer-grpc-stub-target \ + dialer-guava-target \ dialer-javax-annotation-api-target \ dialer-javax-inject-target \ dialer-libshortcutbadger-target \ @@ -285,18 +298,18 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \ android-support-v7-recyclerview \ LOCAL_JAVA_LIBRARIES := \ - org.apache.http.legacy \ dialer-auto-value \ + org.apache.http.legacy \ # Libraries needed by the compiler (JACK) to generate code. PROCESSOR_LIBRARIES_TARGET := \ - dialer-dagger2-compiler \ + dialer-auto-value \ dialer-dagger2 \ + dialer-dagger2-compiler \ dialer-dagger2-producers \ dialer-guava \ dialer-javax-annotation-api \ dialer-javax-inject \ - dialer-auto-value \ # Resolve the jar paths. PROCESSOR_JARS := $(call java-lib-deps, $(PROCESSOR_LIBRARIES_TARGET)) @@ -352,16 +365,16 @@ PROCESSOR_JARS := include $(CLEAR_VARS) LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \ - dialer-dagger2-compiler:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-compiler/2.7/dagger-compiler-2.7$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-auto-value:../../../prebuilts/tools/common/m2/repository/com/google/auto/value/auto-value/1.3/auto-value-1.3$(COMMON_JAVA_PACKAGE_SUFFIX) \ + dialer-dagger2-compiler:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-compiler/2.7/dagger-compiler-2.7$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-dagger2:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger/2.7/dagger-2.7$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-dagger2-producers:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-producers/2.7/dagger-producers-2.7$(COMMON_JAVA_PACKAGE_SUFFIX) \ - dialer-guava:../../../prebuilts/tools/common/m2/repository/com/google/guava/guava/20.0/guava-20.0$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-grpc-all:../../../prebuilts/tools/common/m2/repository/io/grpc/grpc-all/1.0.3/grpc-all-1.0.3$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-grpc-core:../../../prebuilts/tools/common/m2/repository/io/grpc/grpc-core/1.0.3/grpc-core-1.0.3$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-grpc-okhttp:../../../prebuilts/tools/common/m2/repository/io/grpc/grpc-okhttp/1.0.3/grpc-okhttp-1.0.3$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-grpc-protobuf-lite:../../../prebuilts/tools/common/m2/repository/io/grpc/grpc-protobuf-lite/1.0.3/grpc-protobuf-lite-1.0.3$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-grpc-stub:../../../prebuilts/tools/common/m2/repository/io/grpc/grpc-stub/1.0.3/grpc-stub-1.0.3$(COMMON_JAVA_PACKAGE_SUFFIX) \ + dialer-guava:../../../prebuilts/tools/common/m2/repository/com/google/guava/guava/20.0/guava-20.0$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-javax-annotation-api:../../../prebuilts/tools/common/m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2$(COMMON_JAVA_PACKAGE_SUFFIX) \ dialer-javax-inject:../../../prebuilts/tools/common/m2/repository/javax/inject/javax.inject/1/javax.inject-1$(COMMON_JAVA_PACKAGE_SUFFIX) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8dc9f6bb9..f9abe4364 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -114,6 +114,7 @@ android:usesCleartextTraffic="false"> + diff --git a/CONTRIBUTING b/CONTRIBUTING deleted file mode 100644 index 2827b7d3f..000000000 --- a/CONTRIBUTING +++ /dev/null @@ -1,27 +0,0 @@ -Want to contribute? Great! First, read this page (including the small print at the end). - -### Before you contribute -Before we can use your code, you must sign the -[Google Individual Contributor License Agreement] -(https://cla.developers.google.com/about/google-individual) -(CLA), which you can do online. The CLA is necessary mainly because you own the -copyright to your changes, even after your contribution becomes part of our -codebase, so we need your permission to use and distribute your code. We also -need to be sure of various other things—for instance that you'll tell us if you -know that your code infringes on other people's patents. You don't have to sign -the CLA until after you've submitted your code for review and a member has -approved it, but you must do it before we can put your code into our codebase. -Before you start working on a larger contribution, you should get in touch with -us first through the issue tracker with your idea so that we can help out and -possibly guide you. Coordinating up front makes it much easier to avoid -frustration later on. - -### Code reviews -All submissions, including submissions by project members, require review. We -use Github pull requests for this purpose. - -### The small print -Contributions made by corporations are covered by a different agreement than -the one above, the -[Software Grant and Corporate Contributor License Agreement] -(https://cla.developers.google.com/about/google-corporate). diff --git a/java/com/android/contacts/common/res/values/colors.xml b/java/com/android/contacts/common/res/values/colors.xml index 434d193c7..20b28c9d9 100644 --- a/java/com/android/contacts/common/res/values/colors.xml +++ b/java/com/android/contacts/common/res/values/colors.xml @@ -60,6 +60,7 @@ #000 + #DB4437 #E91E63 diff --git a/java/com/android/dialer/about/res/raw/third_party_license_metadata b/java/com/android/dialer/about/res/raw/third_party_license_metadata old mode 100644 new mode 100755 diff --git a/java/com/android/dialer/about/res/raw/third_party_licenses b/java/com/android/dialer/about/res/raw/third_party_licenses old mode 100644 new mode 100755 diff --git a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_add_call.png b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_add_call.png old mode 100644 new mode 100755 diff --git a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_current_call.png b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_current_call.png old mode 100644 new mode 100755 diff --git a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png old mode 100644 new mode 100755 diff --git a/java/com/android/dialer/binary/google/AndroidManifest.xml b/java/com/android/dialer/binary/google/AndroidManifest.xml new file mode 100644 index 000000000..f393b8b11 --- /dev/null +++ b/java/com/android/dialer/binary/google/AndroidManifest.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com/android/dialer/binary/google/GoogleStubDialerApplication.java b/java/com/android/dialer/binary/google/GoogleStubDialerApplication.java new file mode 100644 index 000000000..e9289af73 --- /dev/null +++ b/java/com/android/dialer/binary/google/GoogleStubDialerApplication.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017 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.dialer.binary.google; + +import android.support.annotation.NonNull; +import com.android.dialer.binary.common.DialerApplication; +import com.android.dialer.inject.ContextModule; + +/** + * The application class for the Google Stub Dialer. This is a version of the Dialer app that + * depends on Google Play Services. + */ +public class GoogleStubDialerApplication extends DialerApplication { + + /** Returns a new instance of the root component for the Google Stub Dialer. */ + @Override + @NonNull + protected Object buildRootComponent() { + return DaggerGoogleStubDialerRootComponent.builder() + .contextModule(new ContextModule(this)) + .build(); + } +} diff --git a/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java new file mode 100644 index 000000000..2b4de974b --- /dev/null +++ b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2017 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.dialer.binary.google; + +import com.android.dialer.binary.basecomponent.BaseDialerRootComponent; +import com.android.dialer.calllog.CallLogModule; +import com.android.dialer.common.concurrent.DialerExecutorModule; +import com.android.dialer.configprovider.SharedPrefConfigProviderModule; +import com.android.dialer.enrichedcall.stub.StubEnrichedCallModule; +import com.android.dialer.inject.ContextModule; +import com.android.dialer.lightbringer.stub.StubLightbringerModule; +import com.android.dialer.simulator.impl.SimulatorModule; +import com.android.incallui.calllocation.impl.CallLocationModule; +import com.android.incallui.maps.impl.MapsModule; +import com.android.voicemail.impl.VoicemailModule; +import dagger.Component; +import javax.inject.Singleton; + +/** + * Root component for the Google Stub Dialer application. Unlike the AOSP variant, this component + * can pull in modules that depend on Google Play Services like the maps module. + */ +@Singleton +@Component( + modules = { + CallLocationModule.class, + CallLogModule.class, + ContextModule.class, + DialerExecutorModule.class, + SharedPrefConfigProviderModule.class, + SimulatorModule.class, + StubEnrichedCallModule.class, + MapsModule.class, + VoicemailModule.class, + StubLightbringerModule.class + } +) +public interface GoogleStubDialerRootComponent extends BaseDialerRootComponent {} diff --git a/java/com/android/dialer/buildtype/bugfood/BuildTypeAccessorImpl.java b/java/com/android/dialer/buildtype/bugfood/BuildTypeAccessorImpl.java new file mode 100644 index 000000000..45d72e05c --- /dev/null +++ b/java/com/android/dialer/buildtype/bugfood/BuildTypeAccessorImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 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.dialer.buildtype; + +import com.android.dialer.proguard.UsedByReflection; + +/** Gets the build type. */ +@UsedByReflection(value = "BuildType.java") +public class BuildTypeAccessorImpl implements BuildTypeAccessor { + + @Override + @BuildType.Type + public int getBuildType() { + return BuildType.BUGFOOD; + } +} diff --git a/java/com/android/dialer/buildtype/dogfood/BuildTypeAccessorImpl.java b/java/com/android/dialer/buildtype/dogfood/BuildTypeAccessorImpl.java new file mode 100644 index 000000000..e1f2cdc79 --- /dev/null +++ b/java/com/android/dialer/buildtype/dogfood/BuildTypeAccessorImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 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.dialer.buildtype; + +import com.android.dialer.proguard.UsedByReflection; + +/** Gets the build type. */ +@UsedByReflection(value = "BuildType.java") +public class BuildTypeAccessorImpl implements BuildTypeAccessor { + + @Override + @BuildType.Type + public int getBuildType() { + return BuildType.DOGFOOD; + } +} diff --git a/java/com/android/dialer/buildtype/fishfood/BuildTypeAccessorImpl.java b/java/com/android/dialer/buildtype/fishfood/BuildTypeAccessorImpl.java new file mode 100644 index 000000000..e5ad9015f --- /dev/null +++ b/java/com/android/dialer/buildtype/fishfood/BuildTypeAccessorImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 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.dialer.buildtype; + +import com.android.dialer.proguard.UsedByReflection; + +/** Gets the build type. */ +@UsedByReflection(value = "BuildType.java") +public class BuildTypeAccessorImpl implements BuildTypeAccessor { + + @Override + @BuildType.Type + public int getBuildType() { + return BuildType.FISHFOOD; + } +} diff --git a/java/com/android/dialer/buildtype/test/BuildTypeAccessorImpl.java b/java/com/android/dialer/buildtype/test/BuildTypeAccessorImpl.java new file mode 100644 index 000000000..80a1cb728 --- /dev/null +++ b/java/com/android/dialer/buildtype/test/BuildTypeAccessorImpl.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 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.dialer.buildtype; + +import com.android.dialer.proguard.UsedByReflection; + +/** Gets the build type. */ +@UsedByReflection(value = "BuildType.java") +public class BuildTypeAccessorImpl implements BuildTypeAccessor { + + @Override + @BuildType.Type + public int getBuildType() { + return BuildType.TEST; + } +} diff --git a/java/com/android/dialer/callintent/call_initiation_type.proto b/java/com/android/dialer/callintent/call_initiation_type.proto index 994399fd9..3caf0305b 100644 --- a/java/com/android/dialer/callintent/call_initiation_type.proto +++ b/java/com/android/dialer/callintent/call_initiation_type.proto @@ -7,6 +7,7 @@ option optimize_for = LITE_RUNTIME; package com.android.dialer.callintent; + // Different ways a call can be initiated. message CallInitiationType { enum Type { diff --git a/java/com/android/dialer/calllog/testing/FakeCallLogApplication.java b/java/com/android/dialer/calllog/testing/FakeCallLogApplication.java deleted file mode 100644 index 8aee7dd56..000000000 --- a/java/com/android/dialer/calllog/testing/FakeCallLogApplication.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2017 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.dialer.calllog.testing; - -import android.app.Application; -import com.android.dialer.calllog.CallLogComponent; -import com.android.dialer.calllog.CallLogModule; -import com.android.dialer.calllog.database.CallLogDatabaseComponent; -import com.android.dialer.common.concurrent.DialerExecutorComponent; -import com.android.dialer.common.concurrent.testing.TestDialerExecutorModule; -import com.android.dialer.inject.ContextModule; -import com.android.dialer.inject.HasRootComponent; -import dagger.Component; -import javax.inject.Singleton; - -/** - * Fake application for call log robolectric tests which uses all real bindings but doesn't require - * tests to depend on and use all of DialerApplication. - */ -public final class FakeCallLogApplication extends Application implements HasRootComponent { - private Object rootComponent; - - @Override - public final synchronized Object component() { - if (rootComponent == null) { - rootComponent = - DaggerFakeCallLogApplication_FakeComponent.builder() - .contextModule(new ContextModule(this)) - .build(); - } - return rootComponent; - } - - @Singleton - @Component(modules = {CallLogModule.class, ContextModule.class, TestDialerExecutorModule.class}) - interface FakeComponent - extends CallLogDatabaseComponent.HasComponent, - CallLogComponent.HasComponent, - DialerExecutorComponent.HasComponent {} -} diff --git a/java/com/android/dialer/constants/googledialer/ConstantsImpl.java b/java/com/android/dialer/constants/googledialer/ConstantsImpl.java new file mode 100644 index 000000000..28d8b2514 --- /dev/null +++ b/java/com/android/dialer/constants/googledialer/ConstantsImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2017 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.dialer.constants; + +import android.support.annotation.NonNull; +import com.android.dialer.proguard.UsedByReflection; + +/** Provider config values for Google Dialer. */ +@UsedByReflection(value = "Constants.java") +public class ConstantsImpl extends Constants { + + @Override + @NonNull + public String getFilteredNumberProviderAuthority() { + return "com.google.android.dialer.blocking.filterednumberprovider"; + } + + @Override + @NonNull + public String getFileProviderAuthority() { + return "com.google.android.dialer.files"; + } + + @NonNull + @Override + public String getAnnotatedCallLogProviderAuthority() { + return "com.google.android.dialer.annotatedcalllog"; + } +} diff --git a/java/com/android/dialer/enrichedcall/EnrichedCallManager.java b/java/com/android/dialer/enrichedcall/EnrichedCallManager.java index 0d3ed9e43..b97e6adaf 100644 --- a/java/com/android/dialer/enrichedcall/EnrichedCallManager.java +++ b/java/com/android/dialer/enrichedcall/EnrichedCallManager.java @@ -185,6 +185,15 @@ public interface EnrichedCallManager { @Nullable Session getSession(long sessionId); + /** + * Returns a list containing viewable string representations of all existing sessions. + * + *

Intended for debug display purposes only. + */ + @MainThread + @NonNull + List getAllSessionsForDisplay(); + @NonNull Filter createIncomingCallComposerFilter(); diff --git a/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml b/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml new file mode 100644 index 000000000..003ff19d5 --- /dev/null +++ b/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/com/android/dialer/enrichedcall/simulator/EnrichedCallSimulatorActivity.java b/java/com/android/dialer/enrichedcall/simulator/EnrichedCallSimulatorActivity.java new file mode 100644 index 000000000..bbc1ada6f --- /dev/null +++ b/java/com/android/dialer/enrichedcall/simulator/EnrichedCallSimulatorActivity.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2017 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.dialer.enrichedcall.simulator; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.Toolbar; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import com.android.dialer.common.Assert; +import com.android.dialer.common.LogUtil; +import com.android.dialer.enrichedcall.EnrichedCallComponent; +import com.android.dialer.enrichedcall.EnrichedCallManager; +import com.android.dialer.enrichedcall.EnrichedCallManager.StateChangedListener; + +/** + * Activity used to display Enriched call sessions that are currently in memory, and create new + * outgoing sessions with various bits of data. + * + *

This activity will dynamically refresh as new sessions are added or updated, but there's no + * update when sessions are deleted from memory. Use the refresh button to update the view. + */ +public class EnrichedCallSimulatorActivity extends AppCompatActivity + implements StateChangedListener, OnClickListener { + + public static Intent newIntent(@NonNull Context context) { + return new Intent(Assert.isNotNull(context), EnrichedCallSimulatorActivity.class); + } + + private Button refreshButton; + + private SessionsAdapter sessionsAdapter; + + @Override + protected void onCreate(@Nullable Bundle bundle) { + LogUtil.enterBlock("EnrichedCallSimulatorActivity.onCreate"); + super.onCreate(bundle); + setContentView(R.layout.enriched_call_simulator_activity); + Toolbar toolbar = findViewById(R.id.toolbar); + toolbar.setTitle(R.string.enriched_call_simulator_activity); + + refreshButton = findViewById(R.id.refresh); + refreshButton.setOnClickListener(this); + + RecyclerView recyclerView = findViewById(R.id.sessions_recycler_view); + recyclerView.setLayoutManager(new LinearLayoutManager(this)); + + sessionsAdapter = new SessionsAdapter(); + sessionsAdapter.setSessionStrings(getEnrichedCallManager().getAllSessionsForDisplay()); + recyclerView.setAdapter(sessionsAdapter); + } + + @Override + protected void onResume() { + LogUtil.enterBlock("EnrichedCallSimulatorActivity.onResume"); + super.onResume(); + getEnrichedCallManager().registerStateChangedListener(this); + } + + @Override + protected void onPause() { + LogUtil.enterBlock("EnrichedCallSimulatorActivity.onPause"); + super.onPause(); + getEnrichedCallManager().unregisterStateChangedListener(this); + } + + @Override + public void onEnrichedCallStateChanged() { + LogUtil.enterBlock("EnrichedCallSimulatorActivity.onEnrichedCallStateChanged"); + refreshSessions(); + } + + @Override + public void onClick(View v) { + if (v == refreshButton) { + LogUtil.i("EnrichedCallSimulatorActivity.onClick", "refreshing sessions"); + refreshSessions(); + } + } + + private void refreshSessions() { + sessionsAdapter.setSessionStrings(getEnrichedCallManager().getAllSessionsForDisplay()); + sessionsAdapter.notifyDataSetChanged(); + } + + private EnrichedCallManager getEnrichedCallManager() { + return EnrichedCallComponent.get(this).getEnrichedCallManager(); + } +} diff --git a/java/com/android/dialer/enrichedcall/simulator/SessionViewHolder.java b/java/com/android/dialer/enrichedcall/simulator/SessionViewHolder.java new file mode 100644 index 000000000..44431253d --- /dev/null +++ b/java/com/android/dialer/enrichedcall/simulator/SessionViewHolder.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017 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.dialer.enrichedcall.simulator; + +import android.support.annotation.NonNull; +import android.support.v7.widget.RecyclerView; +import android.view.View; +import android.widget.TextView; + +/** ViewHolder for an Enriched call session. */ +class SessionViewHolder extends RecyclerView.ViewHolder { + + private final TextView sessionStringView; + + SessionViewHolder(View view) { + super(view); + sessionStringView = view.findViewById(R.id.session_string); + } + + void updateSession(@NonNull String sessionString) { + sessionStringView.setText(sessionString); + } +} diff --git a/java/com/android/dialer/enrichedcall/simulator/SessionsAdapter.java b/java/com/android/dialer/enrichedcall/simulator/SessionsAdapter.java new file mode 100644 index 000000000..25edfc7dd --- /dev/null +++ b/java/com/android/dialer/enrichedcall/simulator/SessionsAdapter.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2017 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.dialer.enrichedcall.simulator; + +import android.support.annotation.NonNull; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.ViewGroup; +import com.android.dialer.common.Assert; +import java.util.List; + +/** Adapter for the RecyclerView in {@link EnrichedCallSimulatorActivity}. */ +class SessionsAdapter extends RecyclerView.Adapter { + + /** List of the string representation of all in-memory sessions */ + private List sessionStrings; + + void setSessionStrings(@NonNull List sessionStrings) { + this.sessionStrings = Assert.isNotNull(sessionStrings); + } + + @Override + public SessionViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { + LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); + return new SessionViewHolder(inflater.inflate(R.layout.session_view_holder, viewGroup, false)); + } + + @Override + public void onBindViewHolder(SessionViewHolder viewHolder, int i) { + viewHolder.updateSession(sessionStrings.get(i)); + } + + @Override + public int getItemCount() { + return sessionStrings.size(); + } +} diff --git a/java/com/android/dialer/enrichedcall/simulator/res/layout/enriched_call_simulator_activity.xml b/java/com/android/dialer/enrichedcall/simulator/res/layout/enriched_call_simulator_activity.xml new file mode 100644 index 000000000..be9aa7dea --- /dev/null +++ b/java/com/android/dialer/enrichedcall/simulator/res/layout/enriched_call_simulator_activity.xml @@ -0,0 +1,38 @@ + + + + + + + + +