From 2ca4318cc1ee57dda907ba2069bd61d162b1baef Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Thu, 31 Aug 2017 06:57:16 -0700 Subject: Update Dialer source to latest internal Google revision. Previously, Android's Dialer app was developed in an internal Google source control system and only exported to public during AOSP drops. The Dialer team is now switching to a public development model similar to the telephony team. This CL represents all internal Google changes that were committed to Dialer between the public O release and today's tip of tree on internal master. This CL squashes those changes into a single commit. In subsequent changes, changes will be exported on a per-commit basis. Test: make, flash install, run Merged-In: I45270eaa8ce732d71a1bd84b08c7fa0e99af3160 Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8 PiperOrigin-RevId: 167068436 --- .../binary/aosp/AospDialerRootComponent.java | 8 ++ .../dialer/binary/aosp/testing/AndroidManifest.xml | 24 +++++ .../dialer/binary/aosp/testing/TestActivity.java | 25 +++++ .../basecomponent/BaseDialerRootComponent.java | 12 +++ .../dialer/binary/common/DialerApplication.java | 19 ++-- .../dialer/binary/google/AndroidManifest.xml | 112 +++++++++++++++++++++ .../binary/google/GoogleStubDialerApplication.java | 37 +++++++ .../google/GoogleStubDialerRootComponent.java | 56 +++++++++++ 8 files changed, 281 insertions(+), 12 deletions(-) create mode 100644 java/com/android/dialer/binary/aosp/testing/AndroidManifest.xml create mode 100644 java/com/android/dialer/binary/aosp/testing/TestActivity.java 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 (limited to 'java/com/android/dialer/binary') diff --git a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java index 595401c70..50db7f751 100644 --- a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java +++ b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java @@ -18,10 +18,14 @@ package com.android.dialer.binary.aosp; 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.phonenumbergeoutil.impl.PhoneNumberGeoUtilModule; import com.android.dialer.simulator.impl.SimulatorModule; +import com.android.dialer.storage.StorageModule; import com.android.incallui.calllocation.stub.StubCallLocationModule; import com.android.incallui.maps.stub.StubMapsModule; import com.android.voicemail.impl.VoicemailModule; @@ -34,7 +38,11 @@ import javax.inject.Singleton; modules = { CallLogModule.class, ContextModule.class, + DialerExecutorModule.class, + PhoneNumberGeoUtilModule.class, + SharedPrefConfigProviderModule.class, SimulatorModule.class, + StorageModule.class, StubCallLocationModule.class, StubEnrichedCallModule.class, StubMapsModule.class, diff --git a/java/com/android/dialer/binary/aosp/testing/AndroidManifest.xml b/java/com/android/dialer/binary/aosp/testing/AndroidManifest.xml new file mode 100644 index 000000000..15870cb85 --- /dev/null +++ b/java/com/android/dialer/binary/aosp/testing/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/java/com/android/dialer/binary/aosp/testing/TestActivity.java b/java/com/android/dialer/binary/aosp/testing/TestActivity.java new file mode 100644 index 000000000..9cb26dab7 --- /dev/null +++ b/java/com/android/dialer/binary/aosp/testing/TestActivity.java @@ -0,0 +1,25 @@ +/* + * 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.aosp.testing; + +import android.app.Activity; + +/** + * An empty Activity to use in tests. This can be useful when UI needs to be tested outside an + * Activity, either as a background or to keep the test framework running. + */ +public class TestActivity extends Activity {} diff --git a/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java b/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java index 2deb7fdc4..30b1e8a15 100644 --- a/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java +++ b/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java @@ -17,9 +17,15 @@ package com.android.dialer.binary.basecomponent; import com.android.dialer.calllog.CallLogComponent; +import com.android.dialer.calllog.database.CallLogDatabaseComponent; +import com.android.dialer.common.concurrent.DialerExecutorComponent; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.lightbringer.LightbringerComponent; +import com.android.dialer.main.MainComponent; +import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtilComponent; import com.android.dialer.simulator.SimulatorComponent; +import com.android.dialer.storage.StorageComponent; import com.android.incallui.calllocation.CallLocationComponent; import com.android.incallui.maps.MapsComponent; import com.android.voicemail.VoicemailComponent; @@ -31,8 +37,14 @@ import com.android.voicemail.VoicemailComponent; public interface BaseDialerRootComponent extends CallLocationComponent.HasComponent, CallLogComponent.HasComponent, + CallLogDatabaseComponent.HasComponent, + ConfigProviderComponent.HasComponent, + DialerExecutorComponent.HasComponent, + MainComponent.HasComponent, EnrichedCallComponent.HasComponent, MapsComponent.HasComponent, + PhoneNumberGeoUtilComponent.HasComponent, SimulatorComponent.HasComponent, + StorageComponent.HasComponent, VoicemailComponent.HasComponent, LightbringerComponent.HasComponent {} diff --git a/java/com/android/dialer/binary/common/DialerApplication.java b/java/com/android/dialer/binary/common/DialerApplication.java index a4c2e7d6f..580e0a3a5 100644 --- a/java/com/android/dialer/binary/common/DialerApplication.java +++ b/java/com/android/dialer/binary/common/DialerApplication.java @@ -17,17 +17,17 @@ package com.android.dialer.binary.common; import android.app.Application; -import android.os.StrictMode; import android.os.Trace; import android.support.annotation.NonNull; +import android.support.v4.os.BuildCompat; import com.android.dialer.blocking.BlockedNumbersAutoMigrator; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; -import com.android.dialer.buildtype.BuildType; import com.android.dialer.calllog.CallLogComponent; import com.android.dialer.common.concurrent.DefaultDialerExecutorFactory; import com.android.dialer.inject.HasRootComponent; import com.android.dialer.notification.NotificationChannelManager; import com.android.dialer.persistentlog.PersistentLogger; +import com.android.dialer.strictmode.DialerStrictMode; /** A common application subclass for all Dialer build variants. */ public abstract class DialerApplication extends Application implements HasRootComponent { @@ -37,9 +37,8 @@ public abstract class DialerApplication extends Application implements HasRootCo @Override public void onCreate() { Trace.beginSection("DialerApplication.onCreate"); - if (BuildType.get() == BuildType.BUGFOOD) { - enableStrictMode(); - } + DialerStrictMode.onApplicationCreate(this); + super.onCreate(); new BlockedNumbersAutoMigrator( this.getApplicationContext(), @@ -49,16 +48,12 @@ public abstract class DialerApplication extends Application implements HasRootCo CallLogComponent.get(this).callLogFramework().registerContentObservers(getApplicationContext()); PersistentLogger.initialize(this); - NotificationChannelManager.getInstance().firstInitIfNeeded(this); + if (BuildCompat.isAtLeastO()) { + NotificationChannelManager.initChannels(this); + } Trace.endSection(); } - private void enableStrictMode() { - StrictMode.setThreadPolicy( - new StrictMode.ThreadPolicy.Builder().detectAll().penaltyDeath().build()); - StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build()); - } - /** * Returns a new instance of the root component for the application. Sub classes should define a * root component that extends all the sub components "HasComponent" intefaces. The component 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..12abe82ac --- /dev/null +++ b/java/com/android/dialer/binary/google/AndroidManifest.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..cf513777c --- /dev/null +++ b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java @@ -0,0 +1,56 @@ +/* + * 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.phonenumbergeoutil.impl.PhoneNumberGeoUtilModule; +import com.android.dialer.simulator.impl.SimulatorModule; +import com.android.dialer.storage.StorageModule; +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, + PhoneNumberGeoUtilModule.class, + SharedPrefConfigProviderModule.class, + SimulatorModule.class, + StorageModule.class, + StubEnrichedCallModule.class, + MapsModule.class, + VoicemailModule.class, + StubLightbringerModule.class + } +) +public interface GoogleStubDialerRootComponent extends BaseDialerRootComponent {} -- cgit v1.2.3