Merge tag 'android-8.1.0_r20' of https://android.googlesource.com/platform/packages/services/Telecomm into HEAD
Android 8.1.0 release 20
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..3b3808a
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=review.blissroms.com
+port=29418
+project=platform_packages_services_Telecomm.git
+defaultbranch=o8.1
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4f1cb8b..2e7ca22 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -67,7 +67,7 @@
android:protectionLevel="signature|system"/>
<application android:label="@string/telecommAppLabel"
- android:icon="@mipmap/ic_launcher_phone"
+ android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:supportsRtl="true"
android:process="system"
diff --git a/res/mipmap-anydpi/ic_launcher.xml b/res/mipmap-anydpi/ic_launcher.xml
new file mode 100644
index 0000000..d8649ba
--- /dev/null
+++ b/res/mipmap-anydpi/ic_launcher.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2018 The LineageOS 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.
+-->
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@mipmap/ic_background"/>
+ <foreground android:drawable="@mipmap/ic_foreground"/>
+</adaptive-icon>
+
diff --git a/res/mipmap-hdpi/ic_background.png b/res/mipmap-hdpi/ic_background.png
new file mode 100644
index 0000000..d0f68ba
--- /dev/null
+++ b/res/mipmap-hdpi/ic_background.png
Binary files differ
diff --git a/res/mipmap-hdpi/ic_foreground.png b/res/mipmap-hdpi/ic_foreground.png
new file mode 100644
index 0000000..65f15fc
--- /dev/null
+++ b/res/mipmap-hdpi/ic_foreground.png
Binary files differ
diff --git a/res/mipmap-hdpi/ic_launcher_phone.png b/res/mipmap-hdpi/ic_launcher_phone.png
deleted file mode 100644
index 47d7894..0000000
--- a/res/mipmap-hdpi/ic_launcher_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-mdpi/ic_background.png b/res/mipmap-mdpi/ic_background.png
new file mode 100644
index 0000000..55f05fe
--- /dev/null
+++ b/res/mipmap-mdpi/ic_background.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_foreground.png b/res/mipmap-mdpi/ic_foreground.png
new file mode 100644
index 0000000..049a633
--- /dev/null
+++ b/res/mipmap-mdpi/ic_foreground.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_phone.png b/res/mipmap-mdpi/ic_launcher_phone.png
deleted file mode 100644
index 3b333cf..0000000
--- a/res/mipmap-mdpi/ic_launcher_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_background.png b/res/mipmap-xhdpi/ic_background.png
new file mode 100644
index 0000000..6076ed3
--- /dev/null
+++ b/res/mipmap-xhdpi/ic_background.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_foreground.png b/res/mipmap-xhdpi/ic_foreground.png
new file mode 100644
index 0000000..4dc42ff
--- /dev/null
+++ b/res/mipmap-xhdpi/ic_foreground.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_phone.png b/res/mipmap-xhdpi/ic_launcher_phone.png
deleted file mode 100644
index 020c2fa..0000000
--- a/res/mipmap-xhdpi/ic_launcher_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_background.png b/res/mipmap-xxhdpi/ic_background.png
new file mode 100644
index 0000000..83d4bb9
--- /dev/null
+++ b/res/mipmap-xxhdpi/ic_background.png
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_foreground.png b/res/mipmap-xxhdpi/ic_foreground.png
new file mode 100644
index 0000000..0bb6676
--- /dev/null
+++ b/res/mipmap-xxhdpi/ic_foreground.png
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_launcher_phone.png b/res/mipmap-xxhdpi/ic_launcher_phone.png
deleted file mode 100644
index 1594e4e..0000000
--- a/res/mipmap-xxhdpi/ic_launcher_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xxxhdpi/ic_background.png b/res/mipmap-xxxhdpi/ic_background.png
new file mode 100644
index 0000000..fba7110
--- /dev/null
+++ b/res/mipmap-xxxhdpi/ic_background.png
Binary files differ
diff --git a/res/mipmap-xxxhdpi/ic_foreground.png b/res/mipmap-xxxhdpi/ic_foreground.png
new file mode 100644
index 0000000..1de54c0
--- /dev/null
+++ b/res/mipmap-xxxhdpi/ic_foreground.png
Binary files differ
diff --git a/res/mipmap-xxxhdpi/ic_launcher_phone.png b/res/mipmap-xxxhdpi/ic_launcher_phone.png
deleted file mode 100644
index 8c92ac1..0000000
--- a/res/mipmap-xxxhdpi/ic_launcher_phone.png
+++ /dev/null
Binary files differ
diff --git a/src/com/android/server/telecom/CallAudioModeStateMachine.java b/src/com/android/server/telecom/CallAudioModeStateMachine.java
index b5c7e7a..cb667f4 100644
--- a/src/com/android/server/telecom/CallAudioModeStateMachine.java
+++ b/src/com/android/server/telecom/CallAudioModeStateMachine.java
@@ -18,9 +18,15 @@
import android.media.AudioManager;
import android.os.Message;
+import android.os.SystemProperties;
import android.telecom.Log;
import android.telecom.Logging.Runnable;
import android.telecom.Logging.Session;
+import android.telecom.PhoneAccount;
+import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.util.SparseArray;
import com.android.internal.util.IState;
@@ -286,8 +292,26 @@
@Override
public void enter() {
Log.i(LOG_TAG, "Audio focus entering SIM CALL state");
+ boolean setMsimAudioParams = SystemProperties
+ .getBoolean("ro.multisim.set_audio_params", false);
+ Call call = mCallAudioManager.getForegroundCall();
+
mAudioManager.requestAudioFocusForCall(AudioManager.STREAM_VOICE_CALL,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
+
+ if (call != null && call.getTargetPhoneAccount() != null && setMsimAudioParams) {
+ PhoneAccountHandle handle = call.getTargetPhoneAccount();
+ PhoneAccount account = mTelecomManager.getPhoneAccount(handle);
+ int subId = TelephonyManager.getDefault().getSubIdForPhoneAccount(account);
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ Log.d(LOG_TAG, "setAudioParameters phoneId=" + phoneId);
+ if (phoneId == 0) {
+ mAudioManager.setParameters("phone_type=cp1");
+ } else if (phoneId == 1) {
+ mAudioManager.setParameters("phone_type=cp2");
+ }
+ }
+
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
mMostRecentMode = AudioManager.MODE_IN_CALL;
mCallAudioManager.setCallAudioRouteFocusState(CallAudioRouteStateMachine.ACTIVE_FOCUS);
@@ -463,14 +487,16 @@
private final BaseState mOtherFocusState = new OtherFocusState();
private final AudioManager mAudioManager;
+ private final TelecomManager mTelecomManager;
private CallAudioManager mCallAudioManager;
private int mMostRecentMode;
private boolean mIsInitialized = false;
- public CallAudioModeStateMachine(AudioManager audioManager) {
+ public CallAudioModeStateMachine(AudioManager audioManager, TelecomManager telecomManager) {
super(CallAudioModeStateMachine.class.getSimpleName());
mAudioManager = audioManager;
+ mTelecomManager = telecomManager;
mMostRecentMode = AudioManager.MODE_NORMAL;
addState(mUnfocusedState);
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 3e8e3d0..e31de42 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -361,7 +361,8 @@
mCallAudioManager = new CallAudioManager(callAudioRouteStateMachine,
this,new CallAudioModeStateMachine((AudioManager)
- mContext.getSystemService(Context.AUDIO_SERVICE)),
+ mContext.getSystemService(Context.AUDIO_SERVICE),
+ (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE)),
playerFactory, mRinger, new RingbackPlayer(playerFactory), mDtmfLocalTonePlayer);
mHeadsetMediaButton = headsetMediaButtonFactory.create(context, this, mLock);
diff --git a/tests/src/com/android/server/telecom/tests/CallAudioModeStateMachineTest.java b/tests/src/com/android/server/telecom/tests/CallAudioModeStateMachineTest.java
index af1d3a2..b32cbbf 100644
--- a/tests/src/com/android/server/telecom/tests/CallAudioModeStateMachineTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallAudioModeStateMachineTest.java
@@ -17,6 +17,7 @@
package com.android.server.telecom.tests;
import android.media.AudioManager;
+import android.telecom.TelecomManager;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.SmallTest;
@@ -89,6 +90,7 @@
@Mock private AudioManager mAudioManager;
@Mock private CallAudioManager mCallAudioManager;
+ @Mock private TelecomManager mTelecomManager;
@Override
public void setUp() throws Exception {
@@ -104,7 +106,7 @@
@SmallTest
public void testNoFocusWhenRingerSilenced() throws Throwable {
- CallAudioModeStateMachine sm = new CallAudioModeStateMachine(mAudioManager);
+ CallAudioModeStateMachine sm = new CallAudioModeStateMachine(mAudioManager, mTelecomManager);
sm.setCallAudioManager(mCallAudioManager);
sm.sendMessage(CallAudioModeStateMachine.ABANDON_FOCUS_FOR_TESTING);
waitForStateMachineActionCompletion(sm, CallAudioModeStateMachine.RUN_RUNNABLE);
@@ -543,7 +545,7 @@
@Override
protected void runParametrizedTestCase(TestParameters _params) {
ModeTestParameters params = (ModeTestParameters) _params;
- CallAudioModeStateMachine sm = new CallAudioModeStateMachine(mAudioManager);
+ CallAudioModeStateMachine sm = new CallAudioModeStateMachine(mAudioManager, mTelecomManager);
sm.setCallAudioManager(mCallAudioManager);
sm.sendMessage(params.initialAudioState);
waitForStateMachineActionCompletion(sm, CallAudioModeStateMachine.RUN_RUNNABLE);