diff options
author | Hall Liu <hallliu@google.com> | 2021-01-21 10:05:43 -0800 |
---|---|---|
committer | Hall Liu <hallliu@google.com> | 2021-01-28 12:28:25 -0800 |
commit | a749abceadc16039b6521c8128c004bde1a3bb08 (patch) | |
tree | bc02de0d2eccdadbb999568b4689ec135bb7a012 | |
parent | cd347c4bd01cc8db065e4c1979121631ee523f0b (diff) |
Add support for integrating call composer
* Minor bugfix in call log to handle USER_CURRENT
* add TelephonyLocalConnection that allows frameworks/opt/telephony to
call code (indirectly) in packages/services/Telephony
Bug: 177613111
Test: atest CallComposerTest
Merged-In: I602b51da6009c884364a026781ca3c160978fbd1
Change-Id: I61af7553b4b3d71fe87c86fca62941747d43ef55
-rw-r--r-- | core/java/android/provider/CallLog.java | 8 | ||||
-rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 4 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyLocalConnection.java | 47 |
3 files changed, 54 insertions, 5 deletions
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 33e33ee5fa02..9bfd75ef2170 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -249,11 +249,13 @@ public class CallLog { // Nasty casework for the shadow calllog begins... // First see if we're just inserting for one user. If so, insert into the shadow // based on whether that user is unlocked. - if (user != null) { - Uri baseUri = userManager.isUserUnlocked(user) ? CALL_COMPOSER_PICTURE_URI + UserHandle realUser = UserHandle.CURRENT.equals(user) + ? android.os.Process.myUserHandle() : user; + if (realUser != null) { + Uri baseUri = userManager.isUserUnlocked(realUser) ? CALL_COMPOSER_PICTURE_URI : SHADOW_CALL_COMPOSER_PICTURE_URI; Uri pictureInsertionUri = ContentProvider.maybeAddUserId(baseUri, - user.getIdentifier()); + realUser.getIdentifier()); Log.i(LOG_TAG, "Inserting call composer for single user at " + pictureInsertionUri); diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 5b03863efc7d..f7c96fd8890c 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -324,10 +324,10 @@ public class TelecomManager { */ public static final String EXTRA_INCOMING_PICTURE = "android.telecom.extra.INCOMING_PICTURE"; - // TODO(hallliu), This UUID is obtained from TelephonyManager#uploadCallComposerPicture. /** * A ParcelUuid used as a token to represent a picture that was uploaded prior to the call - * being placed. + * being placed. The value of this extra should be set using the {@link android.os.ParcelUuid} + * obtained from the callback in {@link TelephonyManager#uploadCallComposerPicture}. */ public static final String EXTRA_OUTGOING_PICTURE = "android.telecom.extra.OUTGOING_PICTURE"; diff --git a/telephony/java/android/telephony/TelephonyLocalConnection.java b/telephony/java/android/telephony/TelephonyLocalConnection.java new file mode 100644 index 000000000000..1cab267cc817 --- /dev/null +++ b/telephony/java/android/telephony/TelephonyLocalConnection.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 android.telephony; + +import java.util.UUID; + +/** + * Shim used for code in frameworks/opt/telephony to be able to call code in + * packages/services/Telephony. A singleton instance of this class is set when the phone process + * is brought up. + * @hide + */ +public class TelephonyLocalConnection { + public interface ConnectionImpl { + String getCallComposerServerUrlForHandle(int subscriptionId, UUID uuid); + } + private static ConnectionImpl sInstance; + + public static String getCallComposerServerUrlForHandle(int subscriptionId, UUID uuid) { + checkInstance(); + return sInstance.getCallComposerServerUrlForHandle(subscriptionId, uuid); + } + + private static void checkInstance() { + if (sInstance == null) { + throw new IllegalStateException("Connection impl is null!"); + } + } + + public static void setInstance(ConnectionImpl impl) { + sInstance = impl; + } +} |